org.texi 763 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806
  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:
  1895. a tool-tip window then shows the full contents of the field.
  1896. Alternatively, @kbd{C-h .} (@code{display-local-help}) reveals them,
  1897. too. For convenience, any change near the shrunk part of a column
  1898. expands it.
  1899. @vindex org-startup-shrink-all-tables
  1900. Setting the option @code{org-startup-shrink-all-tables} shrinks all columns
  1901. containing a width cookie in a file the moment it is visited. You can
  1902. also set this option on a per-file basis with:
  1903. @example
  1904. #+STARTUP: shrink
  1905. @end example
  1906. If you would like to overrule the automatic alignment of number-rich
  1907. columns to the right and of string-rich columns to the left, you can
  1908. use @samp{<r>}, @samp{<c>} or @samp{<l>} in a similar fashion. You may also combine
  1909. alignment and field width like this: @samp{<r10>}.
  1910. Lines which only contain these formatting cookies are removed
  1911. automatically upon exporting the document.
  1912. @node Column Groups
  1913. @section Column Groups
  1914. @cindex grouping columns in tables
  1915. When Org exports tables, it does so by default without vertical lines
  1916. because that is visually more satisfying in general. Occasionally
  1917. however, vertical lines can be useful to structure a table into groups
  1918. of columns, much like horizontal lines can do for groups of rows. In
  1919. order to specify column groups, you can use a special row where the
  1920. first field contains only @samp{/}. The further fields can either contain
  1921. @samp{<} to indicate that this column should start a group, @samp{>} to indicate
  1922. the end of a column, or @samp{<>} (no space between @samp{<} and @samp{>}) to make
  1923. a column a group of its own. Upon export, boundaries between column
  1924. groups are marked with vertical lines. Here is an example:
  1925. @example
  1926. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1927. |---+-----+-----+-----+---------+------------|
  1928. | / | < | | > | < | > |
  1929. | 1 | 1 | 1 | 1 | 1 | 1 |
  1930. | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1931. | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1932. |---+-----+-----+-----+---------+------------|
  1933. #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
  1934. @end example
  1935. It is also sufficient to just insert the column group starters after
  1936. every vertical line you would like to have:
  1937. @example
  1938. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1939. |---+-----+-----+-----+---------+------------|
  1940. | / | < | | | < | |
  1941. @end example
  1942. @node Orgtbl Mode
  1943. @section The Orgtbl Minor Mode
  1944. @cindex Orgtbl mode
  1945. @cindex minor mode for tables
  1946. @findex orgtbl-mode
  1947. If you like the intuitive way the Org table editor works, you might
  1948. also want to use it in other modes like Text mode or Mail mode. The
  1949. minor mode Orgtbl mode makes this possible. You can always toggle the
  1950. mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1951. example in Message mode, use
  1952. @lisp
  1953. (add-hook 'message-mode-hook 'turn-on-orgtbl)
  1954. @end lisp
  1955. Furthermore, with some special setup, it is possible to maintain
  1956. tables in arbitrary syntax with Orgtbl mode. For example, it is
  1957. possible to construct @LaTeX{} tables with the underlying ease and power
  1958. of Orgtbl mode, including spreadsheet capabilities. For details, see
  1959. @ref{Tables in Arbitrary Syntax}.
  1960. @node The spreadsheet
  1961. @section The spreadsheet
  1962. @cindex calculations, in tables
  1963. @cindex spreadsheet capabilities
  1964. @cindex Calc package
  1965. The table editor makes use of the Emacs Calc package to implement
  1966. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms
  1967. to derive fields from other fields. While fully featured, Org's
  1968. implementation is not identical to other spreadsheets. For example,
  1969. Org knows the concept of a @emph{column formula} that will be applied to
  1970. all non-header fields in a column without having to copy the formula
  1971. to each relevant field. There is also a formula debugger, and
  1972. a formula editor with features for highlighting fields in the table
  1973. corresponding to the references at the point in the formula, moving
  1974. these references by arrow keys.
  1975. @menu
  1976. * References:: How to refer to another field or range.
  1977. * Formula syntax for Calc:: Using Calc to compute stuff.
  1978. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp.
  1979. * Durations and time values:: How to compute durations and time values.
  1980. * Field and range formulas:: Formula for specific (ranges of) fields.
  1981. * Column formulas:: Formulas valid for an entire column.
  1982. * Lookup functions:: Lookup functions for searching tables.
  1983. * Editing and debugging formulas:: Fixing formulas.
  1984. * Updating the table:: Recomputing all dependent fields.
  1985. * Advanced features:: Field and column names, automatic recalculation...
  1986. @end menu
  1987. @node References
  1988. @subsection References
  1989. @cindex references
  1990. To compute fields in the table from other fields, formulas must
  1991. reference other fields or ranges. In Org, fields can be referenced by
  1992. name, by absolute coordinates, and by relative coordinates. To find
  1993. out what the coordinates of a field are, press @kbd{C-c ?} in
  1994. that field, or press @kbd{C-c @}} to toggle the display of a grid.
  1995. @anchor{Field references}
  1996. @subsubheading Field references
  1997. @cindex field references
  1998. @cindex references, to fields
  1999. Formulas can reference the value of another field in two ways. Like
  2000. in any other spreadsheet, you may reference fields with
  2001. a letter/number combination like @samp{B3}, meaning the second field in the
  2002. third row. However, Org prefers to use another, more general
  2003. representation that looks like this:@footnote{Org understands references typed by the user as @samp{B4}, but it
  2004. does not use this syntax when offering a formula for editing. You can
  2005. customize this behavior using the variable
  2006. @code{org-table-use-standard-references}.}
  2007. @example
  2008. @@ROW$COLUMN
  2009. @end example
  2010. Column specifications can be absolute like @samp{$1}, @samp{$2}, @dots{}, @samp{$N}, or
  2011. relative to the current column, i.e., the column of the field which is
  2012. being computed, like @samp{$+1} or @samp{$-2}. @samp{$<} and @samp{$>} are immutable
  2013. references to the first and last column, respectively, and you can use
  2014. @samp{$>>>} to indicate the third column from the right.
  2015. The row specification only counts data lines and ignores horizontal
  2016. separator lines, or ``hlines''. Like with columns, you can use absolute
  2017. row numbers @samp{@@1}, @samp{@@2}, @dots{}, @samp{@@N}, and row numbers relative to the
  2018. current row like @samp{@@+3} or @samp{@@-1}. @samp{@@<} and @samp{@@>} are immutable
  2019. references the first and last row in the table, respectively. You may
  2020. also specify the row relative to one of the hlines: @samp{@@I} refers to the
  2021. first hline, @samp{@@II} to the second, etc. @samp{@@-I} refers to the first such
  2022. line above the current line, @samp{@@+I} to the first such line below the
  2023. current line. You can also write @samp{@@III+2} which is the second data
  2024. line after the third hline in the table.
  2025. @samp{@@0} and @samp{$0} refer to the current row and column, respectively, i.e.,
  2026. to the row/column for the field being computed. Also, if you omit
  2027. either the column or the row part of the reference, the current
  2028. row/column is implied.
  2029. Org's references with @emph{unsigned} numbers are fixed references in the
  2030. sense that if you use the same reference in the formula for two
  2031. different fields, the same field is referenced each time. Org's
  2032. references with @emph{signed} numbers are floating references because the
  2033. same reference operator can reference different fields depending on
  2034. the field being calculated by the formula.
  2035. Here are a few examples:
  2036. @multitable @columnfractions 0.2 0.8
  2037. @item @samp{@@2$3}
  2038. @tab 2nd row, 3rd column (same as @samp{C2})
  2039. @item @samp{$5}
  2040. @tab column 5 in the current row (same as @samp{E&})
  2041. @item @samp{@@2}
  2042. @tab current column, row 2
  2043. @item @samp{@@-1$-3}
  2044. @tab field one row up, three columns to the left
  2045. @item @samp{@@-I$2}
  2046. @tab field just under hline above current row, column 2
  2047. @item @samp{@@>$5}
  2048. @tab field in the last row, in column 5
  2049. @end multitable
  2050. @anchor{Range references}
  2051. @subsubheading Range references
  2052. @cindex range references
  2053. @cindex references, to ranges
  2054. You may reference a rectangular range of fields by specifying two
  2055. field references connected by two dots @samp{..}. If both fields are in
  2056. the current row, you may simply use @samp{$2..$7}, but if at least one
  2057. field is in a different row, you need to use the general @samp{@@ROW$COLUMN}
  2058. format at least for the first field, i.e., the reference must start
  2059. with @samp{@@} in order to be interpreted correctly. Examples:
  2060. @multitable @columnfractions 0.2 0.8
  2061. @item @samp{$1..$3}
  2062. @tab first three fields in the current row
  2063. @item @samp{$P..$Q}
  2064. @tab range, using column names (see @ref{Advanced features})
  2065. @item @samp{$<<<..$>>}
  2066. @tab start in third column, continue to the last but one
  2067. @item @samp{@@2$1..@@4$3}
  2068. @tab six fields between these two fields (same as @samp{A2..C4})
  2069. @item @samp{@@-1$-2..@@-1}
  2070. @tab 3 fields in the row above, starting from 2 columns on the left
  2071. @item @samp{@@I..II}
  2072. @tab between first and second hline, short for @samp{@@I..@@II}
  2073. @end multitable
  2074. @noindent
  2075. Range references return a vector of values that can be fed into Calc
  2076. vector functions. Empty fields in ranges are normally suppressed, so
  2077. that the vector contains only the non-empty fields. For other options
  2078. with the mode switches @samp{E}, @samp{N} and examples, see @ref{Formula syntax for Calc}.
  2079. @anchor{Field coordinates in formulas}
  2080. @subsubheading Field coordinates in formulas
  2081. @cindex field coordinates
  2082. @cindex coordinates, of field
  2083. @cindex row, of field coordinates
  2084. @cindex column, of field coordinates
  2085. @vindex org-table-current-column
  2086. @vindex org-table-current-dline
  2087. One of the very first actions during evaluation of Calc formulas and
  2088. Lisp formulas is to substitute @samp{@@#} and @samp{$#} in the formula with the
  2089. row or column number of the field where the current result will go to.
  2090. The traditional Lisp formula equivalents are @code{org-table-current-dline}
  2091. and @code{org-table-current-column}. Examples:
  2092. @table @asis
  2093. @item @samp{if(@@# % 2, $#, string(""))}
  2094. Insert column number on odd rows, set field to empty on even
  2095. rows.
  2096. @item @samp{$2 = '(identity remote(FOO, @@@@#$1))}
  2097. Copy text or values of each row of column 1 of the table named
  2098. @var{FOO} into column 2 of the current table.
  2099. @item @samp{@@3 = 2 * remote(FOO, @@@@1$$#)}
  2100. Insert the doubled value of each column of row 1 of the table
  2101. named @var{FOO} into row 3 of the current table.
  2102. @end table
  2103. @noindent
  2104. For the second and third examples, table @var{FOO} must have at
  2105. least as many rows or columns as the current table. Note that this is
  2106. inefficient@footnote{The computation time scales as O(N^2) because table
  2107. @var{FOO} is parsed for each field to be copied.} for large number of rows.
  2108. @anchor{Named references}
  2109. @subsubheading Named references
  2110. @cindex named references
  2111. @cindex references, named
  2112. @cindex name, of column or field
  2113. @cindex constants, in calculations
  2114. @cindex @samp{CONSTANTS}, keyword
  2115. @vindex org-table-formula-constants
  2116. @samp{$name} is interpreted as the name of a column, parameter or constant.
  2117. Constants are defined globally through the variable
  2118. @code{org-table-formula-constants}, and locally---for the file---through
  2119. a line like this example:
  2120. @example
  2121. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  2122. @end example
  2123. @noindent
  2124. @vindex constants-unit-system
  2125. @pindex constants.el
  2126. Also, properties (see @ref{Properties and Columns}) can be used as
  2127. constants in table formulas: for a property @samp{Xyz} use the name
  2128. @samp{$PROP_Xyz}, and the property will be searched in the current outline
  2129. entry and in the hierarchy above it. If you have the @samp{constants.el}
  2130. package, it will also be used to resolve constants, including natural
  2131. constants like @samp{$h} for Planck's constant, and units like @samp{$km} for
  2132. kilometers@footnote{The file @samp{constants.el} can supply the values of constants in
  2133. two different unit systems, @samp{SI} and @samp{cgs}. Which one is used depends
  2134. on the value of the variable @code{constants-unit-system}. You can use the
  2135. @samp{STARTUP} options @samp{constSI} and @samp{constcgs} to set this value for the
  2136. current buffer.}. Column names and parameters can be specified in
  2137. special table lines. These are described below, see @ref{Advanced features}. All names must start with a letter, and further consist
  2138. of letters and numbers.
  2139. @anchor{Remote references}
  2140. @subsubheading Remote references
  2141. @cindex remote references
  2142. @cindex references, remote
  2143. @cindex references, to a different table
  2144. @cindex name, of column or field
  2145. @cindex @samp{NAME}, keyword
  2146. You may also reference constants, fields and ranges from a different
  2147. table, either in the current file or even in a different file. The
  2148. syntax is
  2149. @example
  2150. remote(NAME,REF)
  2151. @end example
  2152. @noindent
  2153. where @var{NAME} can be the name of a table in the current file
  2154. as set by a @samp{#+NAME:} line before the table. It can also be the ID of
  2155. an entry, even in a different file, and the reference then refers to
  2156. the first table in that entry. @var{REF} is an absolute field or
  2157. range reference as described above for example @samp{@@3$3} or @samp{$somename},
  2158. valid in the referenced table.
  2159. @cindex table indirection
  2160. When @var{NAME} has the format @samp{@@ROW$COLUMN}, it is substituted
  2161. with the name or ID found in this field of the current table. For
  2162. example @samp{remote($1, @@@@>$2)} @result{} @samp{remote(year_2013, @@@@>$1)}. The format
  2163. @samp{B3} is not supported because it can not be distinguished from a plain
  2164. table name or ID.
  2165. @node Formula syntax for Calc
  2166. @subsection Formula syntax for Calc
  2167. @cindex formula syntax, Calc
  2168. @cindex syntax, of formulas
  2169. A formula can be any algebraic expression understood by the Emacs Calc
  2170. package. Note that Calc has the non-standard convention that @samp{/} has
  2171. lower precedence than @samp{*}, so that @samp{a/b*c} is interpreted as
  2172. @samp{(a/(b*c))}. Before evaluation by @code{calc-eval} (see @ref{Calling Calc from Your Programs,Calling Calc from
  2173. Your Lisp Programs,,calc,}), variable substitution takes place according to
  2174. the rules described above.
  2175. @cindex vectors, in table calculations
  2176. The range vectors can be directly fed into the Calc vector functions
  2177. like @code{vmean} and @code{vsum}.
  2178. @cindex format specifier, in spreadsheet
  2179. @cindex mode, for Calc
  2180. @vindex org-calc-default-modes
  2181. A formula can contain an optional mode string after a semicolon. This
  2182. string consists of flags to influence Calc and other modes during
  2183. execution. By default, Org uses the standard Calc modes (precision
  2184. 12, angular units degrees, fraction and symbolic modes off). The
  2185. display format, however, has been changed to @code{(float 8)} to keep
  2186. tables compact. The default settings can be configured using the
  2187. variable @code{org-calc-default-modes}.
  2188. @table @asis
  2189. @item @samp{p20}
  2190. Set the internal Calc calculation precision to 20 digits.
  2191. @item @samp{n3}, @samp{s3}, @samp{e2}, @samp{f4}
  2192. Normal, scientific, engineering or fixed format of the result of
  2193. Calc passed back to Org. Calc formatting is unlimited in
  2194. precision as long as the Calc calculation precision is greater.
  2195. @item @samp{D}, @samp{R}
  2196. Degree and radian angle modes of Calc.
  2197. @item @samp{F}, @samp{S}
  2198. Fraction and symbolic modes of Calc.
  2199. @item @samp{T}, @samp{t}, @samp{U}
  2200. Duration computations in Calc or Lisp, @ref{Durations and time values}.
  2201. @item @samp{E}
  2202. If and how to consider empty fields. Without @samp{E} empty fields in
  2203. range references are suppressed so that the Calc vector or Lisp
  2204. list contains only the non-empty fields. With @samp{E} the empty
  2205. fields are kept. For empty fields in ranges or empty field
  2206. references the value @samp{nan} (not a number) is used in Calc
  2207. formulas and the empty string is used for Lisp formulas. Add @samp{N}
  2208. to use 0 instead for both formula types. For the value of
  2209. a field the mode @samp{N} has higher precedence than @samp{E}.
  2210. @item @samp{N}
  2211. Interpret all fields as numbers, use 0 for non-numbers. See the
  2212. next section to see how this is essential for computations with
  2213. Lisp formulas. In Calc formulas it is used only occasionally
  2214. because there number strings are already interpreted as numbers
  2215. without @samp{N}.
  2216. @item @samp{L}
  2217. Literal, for Lisp formulas only. See the next section.
  2218. @end table
  2219. @noindent
  2220. Unless you use large integer numbers or high-precision calculation and
  2221. display for floating point numbers you may alternatively provide
  2222. a @code{printf} format specifier to reformat the Calc result after it has
  2223. been passed back to Org instead of letting Calc already do the
  2224. formatting@footnote{The printf reformatting is limited in precision because the
  2225. value passed to it is converted into an ``integer'' or ``double''. The
  2226. ``integer'' is limited in size by truncating the signed value to 32
  2227. bits. The ``double'' is limited in precision to 64 bits overall which
  2228. leaves approximately 16 significant decimal digits.}. A few examples:
  2229. @multitable {aaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  2230. @item @samp{$1+$2}
  2231. @tab Sum of first and second field
  2232. @item @samp{$1+$2;%.2f}
  2233. @tab Same, format result to two decimals
  2234. @item @samp{exp($2)+exp($1)}
  2235. @tab Math functions can be used
  2236. @item @samp{$0;%.1f}
  2237. @tab Reformat current cell to 1 decimal
  2238. @item @samp{($3-32)*5/9}
  2239. @tab Degrees F @arrow{} C conversion
  2240. @item @samp{$c/$1/$cm}
  2241. @tab Hz @arrow{} cm conversion, using @samp{constants.el}
  2242. @item @samp{tan($1);Dp3s1}
  2243. @tab Compute in degrees, precision 3, display SCI 1
  2244. @item @samp{sin($1);Dp3%.1e}
  2245. @tab Same, but use @code{printf} specifier for display
  2246. @item @samp{vmean($2..$7)}
  2247. @tab Compute column range mean, using vector function
  2248. @item @samp{vmean($2..$7);EN}
  2249. @tab Same, but treat empty fields as 0
  2250. @item @samp{taylor($3,x=7,2)}
  2251. @tab Taylor series of $3, at x=7, second degree
  2252. @end multitable
  2253. Calc also contains a complete set of logical operations (see @ref{Logical Operations,Logical
  2254. Operations,,calc,}). For example
  2255. @table @asis
  2256. @item @samp{if($1 < 20, teen, string(""))}
  2257. @samp{"teen"} if age @samp{$1} is less than 20, else the Org table result
  2258. field is set to empty with the empty string.
  2259. @item @samp{if("$1" =} ``nan'' || ``$2'' @samp{= "nan", string(""), $1 + $2); E f-1}
  2260. Sum of the first two columns. When at least one of the input
  2261. fields is empty the Org table result field is set to empty. @samp{E}
  2262. is required to not convert empty fields to 0. @samp{f-1} is an
  2263. optional Calc format string similar to @samp{%.1f} but leaves empty
  2264. results empty.
  2265. @item @samp{if(typeof(vmean($1..$7)) =} 12, string(``''), vmean($1..$7); E=
  2266. Mean value of a range unless there is any empty field. Every
  2267. field in the range that is empty is replaced by @samp{nan} which lets
  2268. @samp{vmean} result in @samp{nan}. Then @samp{typeof =} 12= detects the @samp{nan}
  2269. from @code{vmean} and the Org table result field is set to empty. Use
  2270. this when the sample set is expected to never have missing
  2271. values.
  2272. @item @samp{if("$1..$7" =} ``[]'', string(``''), vmean($1..$7))=
  2273. Mean value of a range with empty fields skipped. Every field in
  2274. the range that is empty is skipped. When all fields in the range
  2275. are empty the mean value is not defined and the Org table result
  2276. field is set to empty. Use this when the sample set can have
  2277. a variable size.
  2278. @item @samp{vmean($1..$7); EN}
  2279. To complete the example before: Mean value of a range with empty
  2280. fields counting as samples with value 0. Use this only when
  2281. incomplete sample sets should be padded with 0 to the full size.
  2282. @end table
  2283. You can add your own Calc functions defined in Emacs Lisp with
  2284. @code{defmath} and use them in formula syntax for Calc.
  2285. @node Formula syntax for Lisp
  2286. @subsection Emacs Lisp forms as formulas
  2287. @cindex Lisp forms, as table formulas
  2288. It is also possible to write a formula in Emacs Lisp. This can be
  2289. useful for string manipulation and control structures, if Calc's
  2290. functionality is not enough.
  2291. If a formula starts with a single-quote followed by an opening
  2292. parenthesis, then it is evaluated as a Lisp form. The evaluation
  2293. should return either a string or a number. Just as with Calc
  2294. formulas, you can specify modes and a @code{printf} format after
  2295. a semicolon.
  2296. With Emacs Lisp forms, you need to be conscious about the way field
  2297. references are interpolated into the form. By default, a reference is
  2298. interpolated as a Lisp string (in double-quotes) containing the field.
  2299. If you provide the @samp{N} mode switch, all referenced elements are
  2300. numbers---non-number fields will be zero---and interpolated as Lisp
  2301. numbers, without quotes. If you provide the @samp{L} flag, all fields are
  2302. interpolated literally, without quotes. I.e., if you want a reference
  2303. to be interpreted as a string by the Lisp form, enclose the reference
  2304. operator itself in double-quotes, like @samp{"$3"}. Ranges are inserted as
  2305. space-separated fields, so you can embed them in list or vector
  2306. syntax.
  2307. Here are a few examples---note how the @samp{N} mode is used when we do
  2308. computations in Lisp:
  2309. @table @asis
  2310. @item @samp{'(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))}
  2311. Swap the first two characters of the content of column 1.
  2312. @item @samp{'(+ $1 $2);N}
  2313. Add columns 1 and 2, equivalent to Calc's @samp{$1+$2}.
  2314. @item @samp{'(apply '+ '($1..$4));N}
  2315. Compute the sum of columns 1 to 4, like Calc's @samp{vsum($1..$4)}.
  2316. @end table
  2317. @node Durations and time values
  2318. @subsection Durations and time values
  2319. @cindex Duration, computing
  2320. @cindex Time, computing
  2321. @vindex org-table-duration-custom-format
  2322. If you want to compute time values use the @samp{T}, @samp{t}, or @samp{U} flag,
  2323. either in Calc formulas or Elisp formulas:
  2324. @example
  2325. | Task 1 | Task 2 | Total |
  2326. |---------+----------+----------|
  2327. | 2:12 | 1:47 | 03:59:00 |
  2328. | 2:12 | 1:47 | 03:59 |
  2329. | 3:02:20 | -2:07:00 | 0.92 |
  2330. #+TBLFM: @@2$3=$1+$2;T::@@3$3=$1+$2;U::@@4$3=$1+$2;t
  2331. @end example
  2332. Input duration values must be of the form @samp{HH:MM[:SS]}, where seconds
  2333. are optional. With the @samp{T} flag, computed durations are displayed as
  2334. @samp{HH:MM:SS} (see the first formula above). With the @samp{U} flag, seconds
  2335. are omitted so that the result is only @samp{HH:MM} (see second formula
  2336. above). Zero-padding of the hours field depends upon the value of the
  2337. variable @code{org-table-duration-hour-zero-padding}.
  2338. With the @samp{t} flag, computed durations are displayed according to the
  2339. value of the option @code{org-table-duration-custom-format}, which defaults
  2340. to @code{hours} and displays the result as a fraction of hours (see the
  2341. third formula in the example above).
  2342. Negative duration values can be manipulated as well, and integers are
  2343. considered as seconds in addition and subtraction.
  2344. @node Field and range formulas
  2345. @subsection Field and range formulas
  2346. @cindex field formula
  2347. @cindex range formula
  2348. @cindex formula, for individual table field
  2349. @cindex formula, for range of fields
  2350. To assign a formula to a particular field, type it directly into the
  2351. field, preceded by @samp{:=}, for example @samp{vsum(@@II..III)}. When you press
  2352. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with the cursor
  2353. still in the field, the formula is stored as the formula for this
  2354. field, evaluated, and the current field is replaced with the result.
  2355. @cindex @samp{TBLFM}, keyword
  2356. Formulas are stored in a special @samp{TBLFM} keyword located directly
  2357. below the table. If you type the equation in the fourth field of the
  2358. third data line in the table, the formula looks like @samp{@@3$4=$1+$2}.
  2359. When inserting/deleting/swapping column and rows with the appropriate
  2360. commands, @emph{absolute references} (but not relative ones) in stored
  2361. formulas are modified in order to still reference the same field. To
  2362. avoid this from happening, in particular in range references, anchor
  2363. ranges at the table borders (using @samp{@@<}, @samp{@@>}, @samp{$<}, @samp{$>}), or at
  2364. hlines using the @samp{@@I} notation. Automatic adaptation of field
  2365. references does of course not happen if you edit the table structure
  2366. with normal editing commands---then you must fix the equations
  2367. yourself.
  2368. Instead of typing an equation into the field, you may also use the
  2369. following command
  2370. @table @asis
  2371. @item @kbd{C-u C-c =} (@code{org-table-eval-formula})
  2372. @kindex C-u C-c =
  2373. @findex org-table-eval-formula
  2374. Install a new formula for the current field. The command prompts
  2375. for a formula with default taken from the @samp{TBLFM} keyword,
  2376. applies it to the current field, and stores it.
  2377. @end table
  2378. The left-hand side of a formula can also be a special expression in
  2379. order to assign the formula to a number of different fields. There is
  2380. no keyboard shortcut to enter such range formulas. To add them, use
  2381. the formula editor (see @ref{Editing and debugging formulas}) or edit the
  2382. @samp{TBLFM} keyword directly.
  2383. @table @asis
  2384. @item @samp{$2=}
  2385. Column formula, valid for the entire column. This is so common
  2386. that Org treats these formulas in a special way, see @ref{Column formulas}.
  2387. @item @code{@@3=}
  2388. Row formula, applies to all fields in the specified row. @samp{@@>=}
  2389. means the last row.
  2390. @item @samp{@@1$2..@@4$3=}
  2391. Range formula, applies to all fields in the given rectangular
  2392. range. This can also be used to assign a formula to some but not
  2393. all fields in a row.
  2394. @item @samp{$NAME=}
  2395. Named field, see @ref{Advanced features}.
  2396. @end table
  2397. @node Column formulas
  2398. @subsection Column formulas
  2399. @cindex column formula
  2400. @cindex formula, for table column
  2401. When you assign a formula to a simple column reference like @samp{$3=}, the
  2402. same formula is used in all fields of that column, with the following
  2403. very convenient exceptions: (i) If the table contains horizontal
  2404. separator hlines with rows above and below, everything before the
  2405. first such hline is considered part of the table @emph{header} and is not
  2406. modified by column formulas. Therefore a header is mandatory when you
  2407. use column formulas and want to add hlines to group rows, like for
  2408. example to separate a total row at the bottom from the summand rows
  2409. above. (ii) Fields that already get a value from a field/range
  2410. formula are left alone by column formulas. These conditions make
  2411. column formulas very easy to use.
  2412. To assign a formula to a column, type it directly into any field in
  2413. the column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  2414. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with the cursor
  2415. still in the field, the formula is stored as the formula for the
  2416. current column, evaluated and the current field replaced with the
  2417. result. If the field contains only @samp{=}, the previously stored formula
  2418. for this column is used. For each column, Org only remembers the most
  2419. recently used formula. In the @samp{TBLFM} keyword, column formulas look
  2420. like @samp{$4=$1+$2}. The left-hand side of a column formula can not be
  2421. the name of column, it must be the numeric column reference or @samp{$>}.
  2422. Instead of typing an equation into the field, you may also use the
  2423. following command:
  2424. @table @asis
  2425. @item @kbd{C-c =} (@code{org-table-eval-formula})
  2426. @kindex C-c =
  2427. @findex org-table-eval-formula
  2428. Install a new formula for the current column and replace current
  2429. field with the result of the formula. The command prompts for
  2430. a formula, with default taken from the @samp{TBLFM} keyword, applies
  2431. it to the current field and stores it. With a numeric prefix
  2432. argument, e.g., @kbd{C-5 C-c =}, the command applies it to
  2433. that many consecutive fields in the current column.
  2434. @end table
  2435. @node Lookup functions
  2436. @subsection Lookup functions
  2437. @cindex lookup functions in tables
  2438. @cindex table lookup functions
  2439. Org has three predefined Emacs Lisp functions for lookups in tables.
  2440. @table @asis
  2441. @item @code{(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)}
  2442. @findex org-lookup-first
  2443. Searches for the first element @var{S} in list
  2444. @var{S-LIST} for which
  2445. @lisp
  2446. (PREDICATE VAL S)
  2447. @end lisp
  2448. is non-@code{nil}; returns the value from the corresponding position
  2449. in list @var{R-LIST}. The default @var{PREDICATE} is
  2450. @code{equal}. Note that the parameters @var{VAL} and
  2451. @var{S} are passed to @var{PREDICATE} in the same order
  2452. as the corresponding parameters are in the call to
  2453. @code{org-lookup-first}, where @var{VAL} precedes
  2454. @var{S-LIST}. If @var{R-LIST} is @code{nil}, the matching
  2455. element @var{S} of @var{S-LIST} is returned.
  2456. @item @code{(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)}
  2457. @findex org-lookup-last
  2458. Similar to @code{org-lookup-first} above, but searches for the @emph{last}
  2459. element for which @var{PREDICATE} is non-@code{nil}.
  2460. @item @code{(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)}
  2461. @findex org-lookup-all
  2462. Similar to @code{org-lookup-first}, but searches for @emph{all} elements
  2463. for which @var{PREDICATE} is non-@code{nil}, and returns @emph{all}
  2464. corresponding values. This function can not be used by itself in
  2465. a formula, because it returns a list of values. However,
  2466. powerful lookups can be built when this function is combined with
  2467. other Emacs Lisp functions.
  2468. @end table
  2469. If the ranges used in these functions contain empty fields, the @samp{E}
  2470. mode for the formula should usually be specified: otherwise empty
  2471. fields are not included in @var{S-LIST} and/or @var{R-LIST}
  2472. which can, for example, result in an incorrect mapping from an element
  2473. of @var{S-LIST} to the corresponding element of
  2474. @var{R-LIST}.
  2475. These three functions can be used to implement associative arrays,
  2476. count matching cells, rank results, group data, etc. For practical
  2477. examples see @uref{https://orgmode.org/worg/org-tutorials/org-lookups.html, this tutorial on Worg}.
  2478. @node Editing and debugging formulas
  2479. @subsection Editing and debugging formulas
  2480. @cindex formula editing
  2481. @cindex editing, of table formulas
  2482. @vindex org-table-use-standard-references
  2483. You can edit individual formulas in the minibuffer or directly in the
  2484. field. Org can also prepare a special buffer with all active formulas
  2485. of a table. When offering a formula for editing, Org converts
  2486. references to the standard format (like @samp{B3} or @samp{D&}) if possible. If
  2487. you prefer to only work with the internal format (like @samp{@@3$2} or
  2488. @samp{$4}), configure the variable @code{org-table-use-standard-references}.
  2489. @table @asis
  2490. @item @kbd{C-c =} or @kbd{C-u C-c =} (@code{org-table-eval-formula})
  2491. @kindex C-c =
  2492. @kindex C-u C-c =
  2493. @findex org-table-eval-formula
  2494. Edit the formula associated with the current column/field in the
  2495. minibuffer. See @ref{Column formulas}, and @ref{Field and range formulas}.
  2496. @item @kbd{C-u C-u C-c =} (@code{org-table-eval-formula})
  2497. @kindex C-u C-u C-c =
  2498. @findex org-table-eval-formula
  2499. Re-insert the active formula (either a field formula, or a column
  2500. formula) into the current field, so that you can edit it directly
  2501. in the field. The advantage over editing in the minibuffer is
  2502. that you can use the command @kbd{C-c ?}.
  2503. @item @kbd{C-c ?} (@code{org-table-field-info})
  2504. @kindex C-c ?
  2505. @findex org-table-field-info
  2506. While editing a formula in a table field, highlight the field(s)
  2507. referenced by the reference at the cursor position in the
  2508. formula.
  2509. @item @kbd{C-c @}} (@code{org-table-toggle-coordinate-overlays})
  2510. @kindex C-c @}
  2511. @findex org-table-toggle-coordinate-overlays
  2512. Toggle the display of row and column numbers for a table, using
  2513. overlays. These are updated each time the table is aligned; you
  2514. can force it with @kbd{C-c C-c}.
  2515. @item @kbd{C-c @{} (@code{org-table-toggle-formula-debugger})
  2516. @kindex C-c @{
  2517. @findex org-table-toggle-formula-debugger
  2518. Toggle the formula debugger on and off. See below.
  2519. @item @kbd{C-c '} (@code{org-table-edit-formulas})
  2520. @kindex C-c '
  2521. @findex org-table-edit-formulas
  2522. Edit all formulas for the current table in a special buffer,
  2523. where the formulas are displayed one per line. If the current
  2524. field has an active formula, the cursor in the formula editor
  2525. marks it. While inside the special buffer, Org automatically
  2526. highlights any field or range reference at the cursor position.
  2527. You may edit, remove and add formulas, and use the following
  2528. commands:
  2529. @table @asis
  2530. @item @kbd{C-c C-c} or @kbd{C-x C-s} (@code{org-table-fedit-finish})
  2531. @kindex C-x C-s
  2532. @kindex C-c C-c
  2533. @findex org-table-fedit-finish
  2534. Exit the formula editor and store the modified formulas. With
  2535. @kbd{C-u} prefix, also apply the new formulas to the
  2536. entire table.
  2537. @item @kbd{C-c C-q} (@code{org-table-fedit-abort})
  2538. @kindex C-c C-q
  2539. @findex org-table-fedit-abort
  2540. Exit the formula editor without installing changes.
  2541. @item @kbd{C-c C-r} (@code{org-table-fedit-toggle-ref-type})
  2542. @kindex C-c C-r
  2543. @findex org-table-fedit-toggle-ref-type
  2544. Toggle all references in the formula editor between standard
  2545. (like @samp{B3}) and internal (like @samp{@@3$2}).
  2546. @item @kbd{@key{TAB}} (@code{org-table-fedit-lisp-indent})
  2547. @kindex TAB
  2548. @findex org-table-fedit-lisp-indent
  2549. Pretty-print or indent Lisp formula at point. When in a line
  2550. containing a Lisp formula, format the formula according to
  2551. Emacs Lisp rules. Another @kbd{@key{TAB}} collapses the formula
  2552. back again. In the open formula, @kbd{@key{TAB}} re-indents
  2553. just like in Emacs Lisp mode.
  2554. @item @kbd{M-@key{TAB}} (@code{lisp-complete-symbol})
  2555. @kindex M-TAB
  2556. @findex lisp-complete-symbol
  2557. Complete Lisp symbols, just like in Emacs Lisp mode.
  2558. @item @kbd{S-@key{UP}}, @kbd{S-@key{DOWN}}, @kbd{S-@key{LEFT}}, @kbd{S-@key{RIGHT}}
  2559. @kindex S-UP
  2560. @kindex S-DOWN
  2561. @kindex S-LEFT
  2562. @kindex S-RIGHT
  2563. @findex org-table-fedit-ref-up
  2564. @findex org-table-fedit-ref-down
  2565. @findex org-table-fedit-ref-left
  2566. @findex org-table-fedit-ref-right
  2567. Shift the reference at point. For example, if the reference
  2568. is @samp{B3} and you press @kbd{S-@key{RIGHT}}, it becomes @samp{C3}.
  2569. This also works for relative references and for hline
  2570. references.
  2571. @item @kbd{M-S-@key{UP}} (@code{org-table-fedit-line-up})
  2572. @kindex M-S-UP
  2573. @findex org-table-fedit-line-up
  2574. Move the test line for column formulas up in the Org buffer.
  2575. @item @kbd{M-S-@key{DOWN}} (@code{org-table-fedit-line-down})
  2576. @kindex M-S-DOWN
  2577. @findex org-table-fedit-line-down
  2578. Move the test line for column formulas down in the Org buffer.
  2579. @item @kbd{M-@key{UP}} (@code{org-table-fedit-scroll-up})
  2580. @kindex M-UP
  2581. @findex org-table-fedit-scroll-up
  2582. Scroll up the window displaying the table.
  2583. @item @kbd{M-@key{DOWN}} (@code{org-table-fedit-scroll-down})
  2584. @kindex M-DOWN
  2585. @findex org-table-fedit-scroll-down
  2586. Scroll down the window displaying the table.
  2587. @item @kbd{C-c @}}
  2588. @kindex C-c @}
  2589. @findex org-table-toggle-coordinate-overlays
  2590. Turn the coordinate grid in the table on and off.
  2591. @end table
  2592. @end table
  2593. Making a table field blank does not remove the formula associated with
  2594. the field, because that is stored in a different line---the @samp{TBLFM}
  2595. keyword line. During the next recalculation, the field will be filled
  2596. again. To remove a formula from a field, you have to give an empty
  2597. reply when prompted for the formula, or to edit the @samp{TBLFM} keyword.
  2598. @kindex C-c C-c
  2599. You may edit the @samp{TBLFM} keyword directly and re-apply the changed
  2600. equations with @kbd{C-c C-c} in that line or with the normal
  2601. recalculation commands in the table.
  2602. @anchor{Using multiple @samp{TBLFM} lines}
  2603. @subsubheading Using multiple @samp{TBLFM} lines
  2604. @cindex multiple formula lines
  2605. @cindex @samp{TBLFM} keywords, multiple
  2606. @cindex @samp{TBLFM}, switching
  2607. @kindex C-c C-c
  2608. You may apply the formula temporarily. This is useful when you switch
  2609. the formula. Place multiple @samp{TBLFM} keywords right after the table,
  2610. and then press @kbd{C-c C-c} on the formula to apply. Here is an
  2611. example:
  2612. @example
  2613. | x | y |
  2614. |---+---|
  2615. | 1 | |
  2616. | 2 | |
  2617. #+TBLFM: $2=$1*1
  2618. #+TBLFM: $2=$1*2
  2619. @end example
  2620. @noindent
  2621. Pressing @kbd{C-c C-c} in the line of @samp{#+TBLFM: $2=$1*2} yields:
  2622. @example
  2623. | x | y |
  2624. |---+---|
  2625. | 1 | 2 |
  2626. | 2 | 4 |
  2627. #+TBLFM: $2=$1*1
  2628. #+TBLFM: $2=$1*2
  2629. @end example
  2630. @noindent
  2631. Note: If you recalculate this table, with @kbd{C-u C-c *}, for
  2632. example, you get the following result of applying only the first
  2633. @samp{TBLFM} keyword.
  2634. @example
  2635. | x | y |
  2636. |---+---|
  2637. | 1 | 1 |
  2638. | 2 | 2 |
  2639. #+TBLFM: $2=$1*1
  2640. #+TBLFM: $2=$1*2
  2641. @end example
  2642. @anchor{Debugging formulas}
  2643. @subsubheading Debugging formulas
  2644. @cindex formula debugging
  2645. @cindex debugging, of table formulas
  2646. When the evaluation of a formula leads to an error, the field content
  2647. becomes the string @samp{#ERROR}. If you would like to see what is going
  2648. on during variable substitution and calculation in order to find
  2649. a bug, turn on formula debugging in the Tbl menu and repeat the
  2650. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in
  2651. a field. Detailed information are displayed.
  2652. @node Updating the table
  2653. @subsection Updating the table
  2654. @cindex recomputing table fields
  2655. @cindex updating, table
  2656. Recalculation of a table is normally not automatic, but needs to be
  2657. triggered by a command. To make recalculation at least
  2658. semi-automatic, see @ref{Advanced features}.
  2659. In order to recalculate a line of a table or the entire table, use the
  2660. following commands:
  2661. @table @asis
  2662. @item @kbd{C-c *} (@code{org-table-recalculate})
  2663. @kindex C-c *
  2664. @findex org-table-recalculate
  2665. Recalculate the current row by first applying the stored column
  2666. formulas from left to right, and all field/range formulas in the
  2667. current row.
  2668. @item @kbd{C-u C-c *} or @kbd{C-u C-c C-c}
  2669. @kindex C-u C-c *
  2670. @kindex C-u C-c C-c
  2671. Recompute the entire table, line by line. Any lines before the
  2672. first hline are left alone, assuming that these are part of the
  2673. table header.
  2674. @item @kbd{C-u C-u C-c *} or @kbd{C-u C-u C-c C-c} (@code{org-table-iterate})
  2675. @kindex C-u C-u C-c *
  2676. @kindex C-u C-u C-c C-c
  2677. @findex org-table-iterate
  2678. Iterate the table by recomputing it until no further changes
  2679. occur. This may be necessary if some computed fields use the
  2680. value of other fields that are computed @emph{later} in the
  2681. calculation sequence.
  2682. @item @kbd{M-x org-table-recalculate-buffer-tables}
  2683. @findex org-table-recalculate-buffer-tables
  2684. Recompute all tables in the current buffer.
  2685. @item @kbd{M-x org-table-iterate-buffer-tables}
  2686. @findex org-table-iterate-buffer-tables
  2687. Iterate all tables in the current buffer, in order to converge
  2688. table-to-table dependencies.
  2689. @end table
  2690. @node Advanced features
  2691. @subsection Advanced features
  2692. If you want the recalculation of fields to happen automatically, or if
  2693. you want to be able to assign @emph{names}@footnote{Such names must start with an alphabetic character and use
  2694. only alphanumeric/underscore characters.} to fields and columns,
  2695. you need to reserve the first column of the table for special marking
  2696. characters.
  2697. @table @asis
  2698. @item @kbd{C-#} (@code{org-table-rotate-recalc-marks})
  2699. @kindex C-#
  2700. @findex org-table-rotate-recalc-marks
  2701. Rotate the calculation mark in first column through the states
  2702. @samp{#}, @samp{*}, @samp{!}, @samp{$}. When there is an active region, change all
  2703. marks in the region.
  2704. @end table
  2705. Here is an example of a table that collects exam results of students
  2706. and makes use of these features:
  2707. @example
  2708. |---+---------+--------+--------+--------+-------+------|
  2709. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  2710. |---+---------+--------+--------+--------+-------+------|
  2711. | ! | | P1 | P2 | P3 | Tot | |
  2712. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  2713. | ^ | | m1 | m2 | m3 | mt | |
  2714. |---+---------+--------+--------+--------+-------+------|
  2715. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  2716. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  2717. |---+---------+--------+--------+--------+-------+------|
  2718. | | Average | | | | 25.0 | |
  2719. | ^ | | | | | at | |
  2720. | $ | max=50 | | | | | |
  2721. |---+---------+--------+--------+--------+-------+------|
  2722. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  2723. @end example
  2724. @noindent
  2725. @strong{Important}: please note that for these special tables, recalculating
  2726. the table with @kbd{C-u C-c *} only affects rows that are marked
  2727. @samp{#} or @samp{*}, and fields that have a formula assigned to the field
  2728. itself. The column formulas are not applied in rows with empty first
  2729. field.
  2730. @cindex marking characters, tables
  2731. The marking characters have the following meaning:
  2732. @table @asis
  2733. @item @samp{!}
  2734. The fields in this line define names for the columns, so that you
  2735. may refer to a column as @samp{$Tot} instead of @samp{$6}.
  2736. @item @samp{^}
  2737. This row defines names for the fields @emph{above} the row. With such
  2738. a definition, any formula in the table may use @samp{$m1} to refer to
  2739. the value @samp{10}. Also, if you assign a formula to a names field,
  2740. it is stored as @samp{$name = ...}.
  2741. @item @samp{_}
  2742. Similar to @samp{^}, but defines names for the fields in the row
  2743. @emph{below}.
  2744. @item @samp{$}
  2745. Fields in this row can define @emph{parameters} for formulas. For
  2746. example, if a field in a @samp{$} row contains @samp{max=50}, then formulas
  2747. in this table can refer to the value 50 using @samp{$max}. Parameters
  2748. work exactly like constants, only that they can be defined on
  2749. a per-table basis.
  2750. @item @samp{#}
  2751. Fields in this row are automatically recalculated when pressing
  2752. @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{S-@key{TAB}} in this row.
  2753. Also, this row is selected for a global recalculation with
  2754. @kbd{C-u C-c *}. Unmarked lines are left alone by this
  2755. command.
  2756. @item @samp{*}
  2757. Selects this line for global recalculation with @kbd{C-u C-c *}, but not for automatic recalculation. Use this when
  2758. automatic recalculation slows down editing too much.
  2759. @item @samp{/}
  2760. Do not export this line. Useful for lines that contain the
  2761. narrowing @samp{<N>} markers or column group markers.
  2762. @end table
  2763. Finally, just to whet your appetite for what can be done with the
  2764. fantastic Calc package, here is a table that computes the Taylor
  2765. series of degree n at location x for a couple of functions.
  2766. @example
  2767. |---+-------------+---+-----+--------------------------------------|
  2768. | | Func | n | x | Result |
  2769. |---+-------------+---+-----+--------------------------------------|
  2770. | # | exp(x) | 1 | x | 1 + x |
  2771. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  2772. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  2773. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  2774. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  2775. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  2776. |---+-------------+---+-----+--------------------------------------|
  2777. #+TBLFM: $5=taylor($2,$4,$3);n3
  2778. @end example
  2779. @node Org Plot
  2780. @section Org Plot
  2781. @cindex graph, in tables
  2782. @cindex plot tables using Gnuplot
  2783. Org Plot can produce graphs of information stored in Org tables,
  2784. either graphically or in ASCII art.
  2785. @anchor{Graphical plots using Gnuplot}
  2786. @subheading Graphical plots using Gnuplot
  2787. @cindex @samp{PLOT}, keyword
  2788. Org Plot can produce 2D and 3D graphs of information stored in Org
  2789. 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
  2790. that you have both Gnuplot and Gnuplot mode installed on your system,
  2791. then call @kbd{C-c " g} or @kbd{M-x org-plot/gnuplot} on the
  2792. following table.
  2793. @example
  2794. #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
  2795. | Sede | Max cites | H-index |
  2796. |-----------+-----------+---------|
  2797. | Chile | 257.72 | 21.39 |
  2798. | Leeds | 165.77 | 19.68 |
  2799. | Sao Paolo | 71.00 | 11.50 |
  2800. | Stockholm | 134.19 | 14.33 |
  2801. | Morelia | 257.56 | 17.67 |
  2802. @end example
  2803. Notice that Org Plot is smart enough to apply the table's headers as
  2804. labels. Further control over the labels, type, content, and
  2805. appearance of plots can be exercised through the @samp{PLOT} keyword
  2806. preceding a table. See below for a complete list of Org Plot options.
  2807. For more information and examples see the @uref{https://orgmode.org/worg/org-tutorials/org-plot.html, Org Plot tutorial}.
  2808. @anchor{Plot options}
  2809. @subsubheading Plot options
  2810. @table @asis
  2811. @item @samp{set}
  2812. Specify any Gnuplot option to be set when graphing.
  2813. @item @samp{title}
  2814. Specify the title of the plot.
  2815. @item @samp{ind}
  2816. Specify which column of the table to use as the @samp{x} axis.
  2817. @item @samp{deps}
  2818. Specify the columns to graph as a Lisp style list, surrounded by
  2819. parentheses and separated by spaces for example @samp{dep:(3 4)} to
  2820. graph the third and fourth columns. Defaults to graphing all
  2821. other columns aside from the @samp{ind} column.
  2822. @item @samp{type}
  2823. Specify whether the plot is @samp{2d}, @samp{3d}, or @samp{grid}.
  2824. @item @samp{with}
  2825. Specify a @samp{with} option to be inserted for every column being
  2826. plotted, e.g., @samp{lines}, @samp{points}, @samp{boxes}, @samp{impulses}. Defaults
  2827. to @samp{lines}.
  2828. @item @samp{file}
  2829. If you want to plot to a file, specify
  2830. @samp{"path/to/desired/output-file"}.
  2831. @item @samp{labels}
  2832. List of labels to be used for the @samp{deps}. Defaults to the column
  2833. headers if they exist.
  2834. @item @samp{line}
  2835. Specify an entire line to be inserted in the Gnuplot script.
  2836. @item @samp{map}
  2837. When plotting @samp{3d} or @samp{grid} types, set this to @samp{t} to graph
  2838. a flat mapping rather than a @samp{3d} slope.
  2839. @item @samp{timefmt}
  2840. Specify format of Org mode timestamps as they will be parsed by
  2841. Gnuplot. Defaults to @samp{%Y-%m-%d-%H:%M:%S}.
  2842. @item @samp{script}
  2843. If you want total control, you can specify a script file---place
  2844. the file name between double-quotes---which will be used to plot.
  2845. Before plotting, every instance of @samp{$datafile} in the specified
  2846. script will be replaced with the path to the generated data file.
  2847. Note: even if you set this option, you may still want to specify
  2848. the plot type, as that can impact the content of the data file.
  2849. @end table
  2850. @anchor{ASCII bar plots}
  2851. @subheading ASCII bar plots
  2852. While the cursor is on a column, typing @kbd{C-c `` a} or
  2853. @kbd{M-x orgtbl-ascii-plot} create a new column containing an
  2854. ASCII-art bars plot. The plot is implemented through a regular column
  2855. formula. When the source column changes, the bar plot may be updated
  2856. by refreshing the table, for example typing @kbd{C-u C-c *}.
  2857. @example
  2858. | Sede | Max cites | |
  2859. |---------------+-----------+--------------|
  2860. | Chile | 257.72 | WWWWWWWWWWWW |
  2861. | Leeds | 165.77 | WWWWWWWh |
  2862. | Sao Paolo | 71.00 | WWW; |
  2863. | Stockholm | 134.19 | WWWWWW: |
  2864. | Morelia | 257.56 | WWWWWWWWWWWH |
  2865. | Rochefourchat | 0.00 | |
  2866. #+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
  2867. @end example
  2868. The formula is an Elisp call.
  2869. @defun orgtbl-ascii-draw value min max &optional width
  2870. Draw an ASCII bar in a table.
  2871. @var{VALUE} is the value to plot.
  2872. @var{MIN} is the value displayed as an empty bar. @var{MAX}
  2873. is the value filling all the @var{WIDTH}. Sources values outside
  2874. this range are displayed as @samp{too small} or @samp{too large}.
  2875. @var{WIDTH} is the number of characters of the bar plot. It
  2876. defaults to @samp{12}.
  2877. @end defun
  2878. @node Hyperlinks
  2879. @chapter Hyperlinks
  2880. @cindex hyperlinks
  2881. Like HTML, Org provides links inside a file, external links to
  2882. other files, Usenet articles, emails, and much more.
  2883. @menu
  2884. * Link Format:: How links in Org are formatted.
  2885. * Internal Links:: Links to other places in the current file.
  2886. * Radio Targets:: Make targets trigger links in plain text.
  2887. * External Links:: URL-like links to the world.
  2888. * Handling Links:: Creating, inserting and following.
  2889. * Using Links Outside Org:: Linking from my C source code?
  2890. * Link Abbreviations:: Shortcuts for writing complex links.
  2891. * Search Options:: Linking to a specific location.
  2892. * Custom Searches:: When the default search is not enough.
  2893. @end menu
  2894. @node Link Format
  2895. @section Link Format
  2896. @cindex link format
  2897. @cindex format, of links
  2898. Org recognizes plain URL-like links and activate them as clickable
  2899. links. The general link format, however, looks like this:
  2900. @example
  2901. [[LINK][DESCRIPTION]]
  2902. @end example
  2903. @noindent
  2904. or alternatively
  2905. @example
  2906. [[LINK]]
  2907. @end example
  2908. @noindent
  2909. Once a link in the buffer is complete (all brackets present), Org
  2910. changes the display so that @samp{DESCRIPTION} is displayed instead of
  2911. @samp{[[LINK][DESCRIPTION]]} and @samp{LINK} is displayed instead of @samp{[[LINK]]}. Links are be
  2912. highlighted in the face @code{org-link}, which by default is an underlined
  2913. face. You can directly edit the visible part of a link. Note that
  2914. this can be either the LINK part, if there is no description, or the
  2915. @var{DESCRIPTION} part. To edit also the invisible
  2916. @var{LINK} part, use @kbd{C-c C-l} with the cursor on the
  2917. link.
  2918. If you place the cursor at the beginning or just behind the end of the
  2919. displayed text and press @kbd{@key{BS}}, you remove
  2920. the---invisible---bracket at that location. This makes the link
  2921. incomplete and the internals are again displayed as plain text.
  2922. Inserting the missing bracket hides the link internals again. To show
  2923. the internal structure of all links, use the menu: Org @arrow{} Hyperlinks @arrow{}
  2924. Literal links.
  2925. @node Internal Links
  2926. @section Internal Links
  2927. @cindex internal links
  2928. @cindex links, internal
  2929. @cindex targets, for links
  2930. @cindex @samp{CUSTOM_ID}, property
  2931. If the link does not look like a URL, it is considered to be internal
  2932. in the current file. The most important case is a link like
  2933. @samp{[[#my-custom-id]]} which links to the entry with the @samp{CUSTOM_ID} property
  2934. @samp{my-custom-id}. You are responsible yourself to make sure these
  2935. custom IDs are unique in a file.
  2936. Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]} lead to a text search in
  2937. the current file.
  2938. The link can be followed with @kbd{C-c C-o} when the cursor is on
  2939. the link, or with a mouse click (see @ref{Handling Links}). Links to
  2940. custom IDs point to the corresponding headline. The preferred match
  2941. for a text link is a @emph{dedicated target}: the same string in double
  2942. angular brackets, like @samp{<<My Target>>}.
  2943. @cindex @samp{NAME}, keyword
  2944. If no dedicated target exists, the link tries to match the exact name
  2945. of an element within the buffer. Naming is done with the @samp{NAME}
  2946. keyword, which has to be put in the line before the element it refers
  2947. to, as in the following example
  2948. @example
  2949. #+NAME: My Target
  2950. | a | table |
  2951. |----+------------|
  2952. | of | four cells |
  2953. @end example
  2954. If none of the above succeeds, Org searches for a headline that is
  2955. exactly the link text but may also include a TODO keyword and
  2956. tags@footnote{To insert a link targeting a headline, in-buffer completion
  2957. can be used. Just type a star followed by a few optional letters into
  2958. the buffer and press @kbd{M-@key{TAB}}. All headlines in the current
  2959. buffer are offered as completions.}.
  2960. During export, internal links are used to mark objects and assign them
  2961. a number. Marked objects are then referenced by links pointing to
  2962. them. In particular, links without a description appear as the number
  2963. assigned to the marked object@footnote{When targeting a @samp{NAME} keyword, @samp{CAPTION} keyword is
  2964. mandatory in order to get proper numbering (see @ref{Images and Tables}).}. In the following excerpt from
  2965. an Org buffer
  2966. @example
  2967. 1. one item
  2968. 2. <<target>>another item
  2969. Here we refer to item [[target]].
  2970. @end example
  2971. @noindent
  2972. The last sentence will appear as @samp{Here we refer to item 2} when
  2973. exported.
  2974. In non-Org files, the search looks for the words in the link text. In
  2975. the above example the search would be for @samp{target}.
  2976. Following a link pushes a mark onto Org's own mark ring. You can
  2977. return to the previous position with @kbd{C-c &}. Using this
  2978. command several times in direct succession goes back to positions
  2979. recorded earlier.
  2980. @node Radio Targets
  2981. @section Radio Targets
  2982. @cindex radio targets
  2983. @cindex targets, radio
  2984. @cindex links, radio targets
  2985. Org can automatically turn any occurrences of certain target names in
  2986. normal text into a link. So without explicitly creating a link, the
  2987. text connects to the target radioing its position. Radio targets are
  2988. enclosed by triple angular brackets. For example, a target @samp{<<<My
  2989. Target>>>} causes each occurrence of @samp{my target} in normal text to
  2990. become activated as a link. The Org file is scanned automatically for
  2991. radio targets only when the file is first loaded into Emacs. To
  2992. update the target list during editing, press @kbd{C-c C-c} with
  2993. the cursor on or at a target.
  2994. @node External Links
  2995. @section External Links
  2996. @cindex links, external
  2997. @cindex external links
  2998. @cindex Gnus links
  2999. @cindex BBDB links
  3000. @cindex irc links
  3001. @cindex URL links
  3002. @cindex file links
  3003. @cindex Rmail links
  3004. @cindex MH-E links
  3005. @cindex Usenet links
  3006. @cindex shell links
  3007. @cindex Info links
  3008. @cindex Elisp links
  3009. Org supports links to files, websites, Usenet and email messages, BBDB
  3010. database entries and links to both IRC conversations and their logs.
  3011. External links are URL-like locators. They start with a short
  3012. identifying string followed by a colon. There can be no space after
  3013. the colon. The following list shows examples for each link type.
  3014. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  3015. @item @samp{http://www.astro.uva.nl/=dominik}
  3016. @tab on the web
  3017. @item @samp{doi:10.1000/182}
  3018. @tab DOI for an electronic resource
  3019. @item @samp{file:/home/dominik/images/jupiter.jpg}
  3020. @tab file, absolute path
  3021. @item @samp{/home/dominik/images/jupiter.jpg}
  3022. @tab same as above
  3023. @item @samp{file:papers/last.pdf}
  3024. @tab file, relative path
  3025. @item @samp{./papers/last.pdf}
  3026. @tab same as above
  3027. @item @samp{file:/ssh:me@@some.where:papers/last.pdf}
  3028. @tab file, path on remote machine
  3029. @item @samp{/ssh:me@@some.where:papers/last.pdf}
  3030. @tab same as above
  3031. @item @samp{file:sometextfile::NNN}
  3032. @tab file, jump to line number
  3033. @item @samp{file:projects.org}
  3034. @tab another Org file
  3035. @item @samp{file:projects.org::some words}
  3036. @tab text search in Org file@footnote{The actual behavior of the search depends on the value of the
  3037. variable @code{org-link-search-must-match-exact-headline}. If its value is
  3038. @code{nil}, then a fuzzy text search is done. If it is @code{t}, then only the
  3039. exact headline is matched, ignoring spaces and statistic cookies. If
  3040. the value is @code{query-to-create}, then an exact headline is searched; if
  3041. it is not found, then the user is queried to create it.}
  3042. @item @samp{file:projects.org::*task title}
  3043. @tab heading search in Org file
  3044. @item @samp{file+sys:/path/to/file}
  3045. @tab open via OS, like double-click
  3046. @item @samp{file+emacs:/path/to/file}
  3047. @tab force opening by Emacs
  3048. @item @samp{docview:papers/last.pdf::NNN}
  3049. @tab open in doc-view mode at page
  3050. @item @samp{id:B7423F4D-2E8A-471B-8810-C40F074717E9}
  3051. @tab Link to heading by ID
  3052. @item @samp{news:comp.emacs}
  3053. @tab Usenet link
  3054. @item @samp{mailto:adent@@galaxy.net}
  3055. @tab Mail link
  3056. @item @samp{mhe:folder}
  3057. @tab MH-E folder link
  3058. @item @samp{mhe:folder#id}
  3059. @tab MH-E message link
  3060. @item @samp{rmail:folder}
  3061. @tab Rmail folder link
  3062. @item @samp{rmail:folder#id}
  3063. @tab Rmail message link
  3064. @item @samp{gnus:group}
  3065. @tab Gnus group link
  3066. @item @samp{gnus:group#id}
  3067. @tab Gnus article link
  3068. @item @samp{bbdb:R.*Stallman}
  3069. @tab BBDB link (with regexp)
  3070. @item @samp{irc:/irc.com/#emacs/bob}
  3071. @tab IRC link
  3072. @item @samp{info:org#External links}
  3073. @tab Info node link
  3074. @item @samp{shell:ls *.org}
  3075. @tab A shell command
  3076. @item @samp{elisp:org-agenda}
  3077. @tab Interactive Elisp command
  3078. @item @samp{elisp:(find-file-other-frame "Elisp.org")}
  3079. @tab Elisp form to evaluate
  3080. @end multitable
  3081. @cindex VM links
  3082. @cindex Wanderlust links
  3083. On top of these built-in link types, some are available through the
  3084. @samp{contrib/} directory (see @ref{Installation}). For example, these links to
  3085. VM or Wanderlust messages are available when you load the
  3086. corresponding libraries from the @samp{contrib/} directory:
  3087. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaa}
  3088. @item @samp{vm:folder}
  3089. @tab VM folder link
  3090. @item @samp{vm:folder#id}
  3091. @tab VM message link
  3092. @item @samp{vm://myself@@some.where.org/folder#id}
  3093. @tab VM on remote machine
  3094. @item @samp{vm-imap:account:folder}
  3095. @tab VM IMAP folder link
  3096. @item @samp{vm-imap:account:folder#id}
  3097. @tab VM IMAP message link
  3098. @item @samp{wl:folder}
  3099. @tab Wanderlust folder link
  3100. @item @samp{wl:folder#id}
  3101. @tab Wanderlust message link
  3102. @end multitable
  3103. For customizing Org to add new link types, see @ref{Adding Hyperlink Types}.
  3104. A link should be enclosed in double brackets and may contain
  3105. a descriptive text to be displayed instead of the URL (see @ref{Link Format}), for example:
  3106. @example
  3107. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  3108. @end example
  3109. @noindent
  3110. If the description is a file name or URL that points to an image, HTML
  3111. export (see @ref{HTML Export}) inlines the image as a clickable button. If
  3112. there is no description at all and the link points to an image, that
  3113. image is inlined into the exported HTML file.
  3114. @cindex square brackets, around links
  3115. @cindex angular brackets, around links
  3116. @cindex plain text external links
  3117. Org also finds external links in the normal text and activates them as
  3118. links. If spaces must be part of the link (for example in
  3119. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities about
  3120. the end of the link, enclose them in square or angular brackets.
  3121. @node Handling Links
  3122. @section Handling Links
  3123. @cindex links, handling
  3124. Org provides methods to create a link in the correct syntax, to insert
  3125. it into an Org file, and to follow the link.
  3126. @findex org-store-link
  3127. @cindex storing links
  3128. 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
  3129. to a widely available key (see @ref{Activation}). It stores a link to the
  3130. current location. The link is stored for later insertion into an Org
  3131. buffer---see below. What kind of link is created depends on the
  3132. current buffer:
  3133. @table @asis
  3134. @item @emph{Org mode buffers}
  3135. For Org files, if there is a @samp{<<target>>} at the cursor, the link
  3136. points to the target. Otherwise it points to the current
  3137. headline, which is also the description@footnote{If the headline contains a timestamp, it is removed from the
  3138. link, which results in a wrong link---you should avoid putting
  3139. a timestamp in the headline.}.
  3140. @vindex org-link-to-org-use-id
  3141. @cindex @samp{CUSTOM_ID}, property
  3142. @cindex @samp{ID}, property
  3143. If the headline has a @samp{CUSTOM_ID} property, store a link to this
  3144. custom ID. In addition or alternatively, depending on the value
  3145. of @code{org-link-to-org-use-id}, create and/or use a globally unique
  3146. ID property for the link@footnote{The Org Id library must first be loaded, either through
  3147. @code{org-customize}, by enabling @code{id} in @code{org-modules}, or by adding
  3148. @code{(require 'org-id)} in your Emacs init file.}. So using this command in Org
  3149. buffers potentially creates two links: a human-readable link from
  3150. the custom ID, and one that is globally unique and works even if
  3151. the entry is moved from file to file. Later, when inserting the
  3152. link, you need to decide which one to use.
  3153. @item @emph{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}
  3154. Pretty much all Emacs mail clients are supported. The link
  3155. points to the current article, or, in some Gnus buffers, to the
  3156. group. The description is constructed from the author and the
  3157. subject.
  3158. @item @emph{Web browsers: W3, W3M and EWW}
  3159. Here the link is the current URL, with the page title as
  3160. description.
  3161. @item @emph{Contacts: BBDB}
  3162. Links created in a BBDB buffer point to the current entry.
  3163. @item @emph{Chat: IRC}
  3164. @vindex org-irc-links-to-logs
  3165. For IRC links, if the variable @code{org-irc-link-to-logs} is
  3166. non-@code{nil}, create a @samp{file} style link to the relevant point in
  3167. the logs for the current conversation. Otherwise store an @samp{irc}
  3168. style link to the user/channel/server under the point.
  3169. @item @emph{Other files}
  3170. For any other file, the link points to the file, with a search
  3171. string (see @ref{Search Options}) pointing to the
  3172. contents of the current line. If there is an active region, the
  3173. selected words form the basis of the search string. If the
  3174. automatically created link is not working correctly or accurately
  3175. enough, you can write custom functions to select the search
  3176. string and to do the search for particular file types (see
  3177. @ref{Custom Searches}).
  3178. You can also define dedicated links to other files. See @ref{Adding Hyperlink Types}.
  3179. @item @emph{Agenda view}
  3180. When the cursor is in an agenda view, the created link points to
  3181. the entry referenced by the current line.
  3182. @end table
  3183. From an Org buffer, the following commands create, navigate or, more
  3184. generally, act on links.
  3185. @table @asis
  3186. @item @kbd{C-c C-l} (@code{org-insert-link})
  3187. @kindex C-c C-l
  3188. @findex org-insert-link
  3189. @cindex link completion
  3190. @cindex completion, of links
  3191. @cindex inserting links
  3192. @vindex org-keep-stored-link-after-insertion
  3193. Insert a link@footnote{Note that you do not have to use this command to insert
  3194. a link. Links in Org are plain text, and you can type or paste them
  3195. straight into the buffer. By using this command, the links are
  3196. automatically enclosed in double brackets, and you will be asked for
  3197. the optional descriptive text.}. This prompts for a link to be inserted
  3198. into the buffer. You can just type a link, using text for an
  3199. internal link, or one of the link type prefixes mentioned in the
  3200. examples above. The link is inserted into the buffer, along with
  3201. a descriptive text@footnote{After insertion of a stored link, the link will be removed
  3202. from the list of stored links. To keep it in the list later use, use
  3203. a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or
  3204. configure the option @code{org-keep-stored-link-after-insertion}.}. If some text was selected at this
  3205. time, it becomes the default description.
  3206. @table @asis
  3207. @item @emph{Inserting stored links}
  3208. All links stored during the current session are part of the
  3209. history for this prompt, so you can access them with
  3210. @kbd{@key{UP}} and @kbd{@key{DOWN}} (or @kbd{M-p},
  3211. @kbd{M-n}).
  3212. @item @emph{Completion support}
  3213. Completion with @kbd{@key{TAB}} helps you to insert valid link
  3214. prefixes like @samp{http} or @samp{ftp}, including the prefixes defined
  3215. through link abbreviations (see @ref{Link Abbreviations}). If you
  3216. press @kbd{@key{RET}} after inserting only the prefix, Org
  3217. offers specific completion support for some link types@footnote{This works if a function has been defined in the @code{:complete}
  3218. property of a link in @code{org-link-parameters}.}.
  3219. For example, if you type @kbd{f i l e @key{RET}}---alternative
  3220. access: @kbd{C-u C-c C-l}, see below---Org offers file
  3221. name completion, and after @kbd{b b d b @key{RET}} you can
  3222. complete contact names.
  3223. @end table
  3224. @item @kbd{C-u C-c C-l}
  3225. @cindex file name completion
  3226. @cindex completion, of file names
  3227. @kindex C-u C-c C-l
  3228. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix
  3229. argument, insert a link to a file. You may use file name
  3230. completion to select the name of the file. The path to the file
  3231. is inserted relative to the directory of the current Org file, if
  3232. the linked file is in the current directory or in a sub-directory
  3233. of it, or if the path is written relative to the current
  3234. directory using @samp{../}. Otherwise an absolute path is used, if
  3235. possible with @samp{~/} for your home directory. You can force an
  3236. absolute path with two @kbd{C-u} prefixes.
  3237. @item @kbd{C-c C-l} (with cursor on existing link)
  3238. @cindex following links
  3239. When the cursor is on an existing link, @kbd{C-c C-l} allows
  3240. you to edit the link and description parts of the link.
  3241. @item @kbd{C-c C-o} (@code{org-open-at-point})
  3242. @kindex C-c C-o
  3243. @findex org-open-at-point
  3244. @vindex org-file-apps
  3245. Open link at point. This launches a web browser for URL (using
  3246. @code{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
  3247. for the corresponding links, and execute the command in a shell
  3248. link. When the cursor is on an internal link, this command runs
  3249. the corresponding search. When the cursor is on a TAG list in
  3250. a headline, it creates the corresponding TAGS view. If the
  3251. cursor is on a timestamp, it compiles the agenda for that date.
  3252. Furthermore, it visits text and remote files in @samp{file} links with
  3253. Emacs and select a suitable application for local non-text files.
  3254. Classification of files is based on file extension only. See
  3255. option @code{org-file-apps}. If you want to override the default
  3256. application and visit the file with Emacs, use a @kbd{C-u}
  3257. prefix. If you want to avoid opening in Emacs, use a @kbd{C-u C-u} prefix.
  3258. @vindex org-link-frame-setup
  3259. If the cursor is on a headline, but not on a link, offer all
  3260. links in the headline and entry text. If you want to setup the
  3261. frame configuration for following links, customize
  3262. @code{org-link-frame-setup}.
  3263. @item @kbd{@key{RET}}
  3264. @vindex org-return-follows-link
  3265. @kindex RET
  3266. When @code{org-return-follows-link} is set, @kbd{@key{RET}} also
  3267. follows the link at point.
  3268. @item @kbd{mouse-2} or @kbd{mouse-1}
  3269. @kindex mouse-2
  3270. @kindex mouse-1
  3271. On links, @kbd{mouse-1} and @kbd{mouse-2} opens the
  3272. link just as @kbd{C-c C-o} does.
  3273. @item @kbd{mouse-3}
  3274. @vindex org-display-internal-link-with-indirect-buffer
  3275. @kindex mouse-3
  3276. Like @kbd{mouse-2}, but force file links to be opened with
  3277. Emacs, and internal links to be displayed in another
  3278. window@footnote{See the variable @code{org-display-internal-link-with-indirect-buffer}.}.
  3279. @item @kbd{C-c C-x C-v} (@code{org-toggle-inline-images})
  3280. @cindex inlining images
  3281. @cindex images, inlining
  3282. @vindex org-startup-with-inline-images
  3283. @kindex C-c C-x C-v
  3284. @findex org-toggle-inline-images
  3285. Toggle the inline display of linked images. Normally this only
  3286. inlines images that have no description part in the link, i.e.,
  3287. images that are inlined during export. When called with a prefix
  3288. argument, also display images that do have a link description.
  3289. You can ask for inline images to be displayed at startup by
  3290. configuring the variable @code{org-startup-with-inline-images}@footnote{The variable @code{org-startup-with-inline-images} can be set
  3291. within a buffer with the @samp{STARTUP} options @samp{inlineimages} and
  3292. @samp{noinlineimages}.}.
  3293. @item @kbd{C-c %} (@code{org-mark-ring-push})
  3294. @kindex C-c %
  3295. @findex org-mark-ring-push
  3296. @cindex mark ring
  3297. Push the current position onto the mark ring, to be able to
  3298. return easily. Commands following an internal link do this
  3299. automatically.
  3300. @item @kbd{C-c &} (@code{org-mark-ring-goto})
  3301. @kindex C-c &
  3302. @findex org-mark-ring-goto
  3303. @cindex links, returning to
  3304. Jump back to a recorded position. A position is recorded by the
  3305. commands following internal links, and by @kbd{C-c %}.
  3306. Using this command several times in direct succession moves
  3307. through a ring of previously recorded positions.
  3308. @item @kbd{C-c C-x C-n} (@code{org-next-link})
  3309. @itemx @kbd{C-c C-x C-p} (@code{org-previous-link})
  3310. @kindex C-c C-x C-p
  3311. @findex org-previous-link
  3312. @kindex C-c C-x C-n
  3313. @findex org-next-link
  3314. @cindex links, finding next/previous
  3315. Move forward/backward to the next link in the buffer. At the
  3316. limit of the buffer, the search fails once, and then wraps
  3317. around. The key bindings for this are really too long; you might
  3318. want to bind this also to @kbd{M-n} and @kbd{M-p}.
  3319. @lisp
  3320. (add-hook 'org-load-hook
  3321. (lambda ()
  3322. (define-key org-mode-map "\M-n" 'org-next-link)
  3323. (define-key org-mode-map "\M-p" 'org-previous-link)))
  3324. @end lisp
  3325. @end table
  3326. @node Using Links Outside Org
  3327. @section Using Links Outside Org
  3328. @findex org-insert-link-global
  3329. @findex org-open-at-point-global
  3330. You can insert and follow links that have Org syntax not only in Org,
  3331. but in any Emacs buffer. For this, Org provides two functions:
  3332. @code{org-insert-link-global} and @code{org-open-at-point-global}.
  3333. You might want to bind them to globally available keys. See
  3334. @ref{Activation} for some advice.
  3335. @node Link Abbreviations
  3336. @section Link Abbreviations
  3337. @cindex link abbreviations
  3338. @cindex abbreviation, links
  3339. Long URL can be cumbersome to type, and often many similar links are
  3340. needed in a document. For this you can use link abbreviations. An
  3341. abbreviated link looks like this
  3342. @example
  3343. [[linkword:tag][description]]
  3344. @end example
  3345. @noindent
  3346. @vindex org-link-abbrev-alist
  3347. where the tag is optional. The @emph{linkword} must be a word, starting
  3348. with a letter, followed by letters, numbers, @samp{-}, and @samp{_}.
  3349. Abbreviations are resolved according to the information in the
  3350. variable @code{org-link-abbrev-alist} that relates the linkwords to
  3351. replacement text. Here is an example:
  3352. @lisp
  3353. (setq org-link-abbrev-alist
  3354. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  3355. ("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h")
  3356. ("google" . "http://www.google.com/search?q=")
  3357. ("gmap" . "http://maps.google.com/maps?q=%s")
  3358. ("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
  3359. ("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
  3360. @end lisp
  3361. If the replacement text contains the string @samp{%s}, it is replaced with
  3362. the tag. Using @samp{%h} instead of @samp{%s} percent-encodes the tag (see the
  3363. example above, where we need to encode the URL parameter). Using
  3364. @samp{%(my-function)} passes the tag to a custom function, and replace it
  3365. by the resulting string.
  3366. If the replacement text do not contain any specifier, it is simply
  3367. appended to the string in order to create the link.
  3368. Instead of a string, you may also specify a function that will be
  3369. called with the tag as the only argument to create the link.
  3370. With the above setting, you could link to a specific bug with
  3371. @samp{[[bugzilla:129]]}, search the web for @samp{OrgMode} with @samp{[[google:OrgMode]]},
  3372. show the map location of the Free Software Foundation @samp{[[gmap:51
  3373. Franklin Street, Boston]]} or of Carsten office @samp{[[omap:Science Park 904,
  3374. Amsterdam, The Netherlands]]} and find out what the Org author is doing
  3375. besides Emacs hacking with @samp{[[ads:Dominik,C]]}.
  3376. If you need special abbreviations just for a single Org buffer, you
  3377. can define them in the file with
  3378. @cindex @samp{LINK}, keyword
  3379. @example
  3380. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  3381. #+LINK: google http://www.google.com/search?q=%s
  3382. @end example
  3383. @noindent
  3384. In-buffer completion (see @ref{Completion}) can be used after @samp{[} to
  3385. complete link abbreviations. You may also define a function that
  3386. implements special (e.g., completion) support for inserting such
  3387. a link with @kbd{C-c C-l}. Such a function should not accept any
  3388. arguments, and return the full link with prefix. You can set the link
  3389. completion function like this:
  3390. @lisp
  3391. (org-link-set-parameter "type" :complete #'some-completion-function)
  3392. @end lisp
  3393. @node Search Options
  3394. @section Search Options in File Links
  3395. @cindex search option in file links
  3396. @cindex file links, searching
  3397. File links can contain additional information to make Emacs jump to
  3398. a particular location in the file when following a link. This can be
  3399. a line number or a search option after a double colon@footnote{For backward compatibility, line numbers can also follow a
  3400. single colon.}. For
  3401. example, when the command @code{org-store-link} creates a link (see
  3402. @ref{Handling Links}) to a file, it encodes the words in the current line
  3403. as a search string that can be used to find this line back later when
  3404. following the link with @kbd{C-c C-o}.
  3405. Here is the syntax of the different ways to attach a search to a file
  3406. link, together with an explanation:
  3407. @example
  3408. [[file:~/code/main.c::255]]
  3409. [[file:~/xx.org::My Target]]
  3410. [[file:~/xx.org::*My Target]]
  3411. [[file:~/xx.org::#my-custom-id]]
  3412. [[file:~/xx.org::/regexp/]]
  3413. @end example
  3414. @table @asis
  3415. @item @samp{255}
  3416. Jump to line 255.
  3417. @item @samp{My Target}
  3418. Search for a link target @samp{<<My Target>>}, or do a text search for
  3419. @samp{my target}, similar to the search in internal links, see
  3420. @ref{Internal Links}. In HTML export (see @ref{HTML Export}), such a file
  3421. link becomes a HTML reference to the corresponding named anchor
  3422. in the linked file.
  3423. @item @samp{*My Target}
  3424. In an Org file, restrict search to headlines.
  3425. @item @samp{#my-custom-id}
  3426. Link to a heading with a @samp{CUSTOM_ID} property
  3427. @item @samp{/REGEXP/}
  3428. Do a regular expression search for @var{REGEXP}. This uses
  3429. the Emacs command @code{occur} to list all matches in a separate
  3430. window. If the target file is in Org mode, @code{org-occur} is used
  3431. to create a sparse tree with the matches.
  3432. @end table
  3433. As a degenerate case, a file link with an empty file name can be used
  3434. to search the current file. For example, @samp{[[file:::find me]]} does
  3435. a search for @samp{find me} in the current file, just as @samp{[[find me]]} would.
  3436. @node Custom Searches
  3437. @section Custom Searches
  3438. @cindex custom search strings
  3439. @cindex search strings, custom
  3440. The default mechanism for creating search strings and for doing the
  3441. actual search related to a file link may not work correctly in all
  3442. cases. For example, Bib@TeX{} database files have many entries like
  3443. @code{year="1993"} which would not result in good search strings, because
  3444. the only unique identification for a Bib@TeX{} entry is the citation key.
  3445. @vindex org-create-file-search-functions
  3446. @vindex org-execute-file-search-functions
  3447. If you come across such a problem, you can write custom functions to
  3448. set the right search string for a particular file type, and to do the
  3449. search for the string in the file. Using @code{add-hook}, these functions
  3450. need to be added to the hook variables
  3451. @code{org-create-file-search-functions} and
  3452. @code{org-execute-file-search-functions}. See the docstring for these
  3453. variables for more information. Org actually uses this mechanism for
  3454. Bib@TeX{} database files, and you can use the corresponding code as an
  3455. implementation example. See the file @samp{org-bibtex.el}.
  3456. @node TODO Items
  3457. @chapter TODO Items
  3458. @cindex TODO items
  3459. Org mode does not maintain TODO lists as separate documents@footnote{Of course, you can make a document that contains only long
  3460. lists of TODO items, but this is not required.}.
  3461. Instead, TODO items are an integral part of the notes file, because
  3462. TODO items usually come up while taking notes! With Org mode, simply
  3463. mark any entry in a tree as being a TODO item. In this way,
  3464. information is not duplicated, and the entire context from which the
  3465. TODO item emerged is always present.
  3466. Of course, this technique for managing TODO items scatters them
  3467. throughout your notes file. Org mode compensates for this by
  3468. providing methods to give you an overview of all the things that you
  3469. have to do.
  3470. @menu
  3471. * TODO Basics:: Marking and displaying TODO entries.
  3472. * TODO Extensions:: Workflow and assignments.
  3473. * Progress Logging:: Dates and notes for progress.
  3474. * Priorities:: Some things are more important than others.
  3475. * Breaking Down Tasks:: Splitting a task into manageable pieces.
  3476. * Checkboxes:: Tick-off lists.
  3477. @end menu
  3478. @node TODO Basics
  3479. @section Basic TODO Functionality
  3480. Any headline becomes a TODO item when it starts with the word @samp{TODO},
  3481. for example:
  3482. @example
  3483. *** TODO Write letter to Sam Fortune
  3484. @end example
  3485. @noindent
  3486. The most important commands to work with TODO entries are:
  3487. @table @asis
  3488. @item @kbd{C-c C-t} (@code{org-todo})
  3489. @kindex C-c C-t
  3490. @cindex cycling, of TODO states
  3491. Rotate the TODO state of the current item among
  3492. @example
  3493. ,-> (unmarked) -> TODO -> DONE --.
  3494. '--------------------------------'
  3495. @end example
  3496. If TODO keywords have fast access keys (see @ref{Fast access to TODO states}), prompt for a TODO keyword through the fast
  3497. selection interface; this is the default behavior when
  3498. @code{org-use-fast-todo-selection} is non-@code{nil}.
  3499. The same rotation can also be done ``remotely'' from the timeline
  3500. and agenda buffers with the @kbd{t} command key (see
  3501. @ref{Agenda Commands}).
  3502. @item @kbd{C-u C-c C-t}
  3503. @kindex C-u C-c C-t
  3504. When TODO keywords have no selection keys, select a specific
  3505. keyword using completion; otherwise force cycling through TODO
  3506. states with no prompt. When @code{org-use-fast-todo-selection} is set
  3507. to @code{prefix}, use the fast selection interface.
  3508. @item @kbd{S-@key{RIGHT}} @kbd{S-@key{LEFT}}
  3509. @kindex S-RIGHT
  3510. @kindex S-LEFT
  3511. @vindex org-treat-S-cursor-todo-selection-as-state-change
  3512. Select the following/preceding TODO state, similar to cycling.
  3513. Useful mostly if more than two TODO states are possible (see
  3514. @ref{TODO Extensions}). See also @ref{Conflicts}, for a discussion of the interaction with
  3515. @code{shift-selection-mode}. See also the variable
  3516. @code{org-treat-S-cursor-todo-selection-as-state-change}.
  3517. @item @kbd{C-c / t} (@code{org-show-todo-tree})
  3518. @kindex C-c / t
  3519. @cindex sparse tree, for TODO
  3520. @vindex org-todo-keywords
  3521. @findex org-show-todo-tree
  3522. View TODO items in a @emph{sparse tree} (see @ref{Sparse Trees}). Folds
  3523. the entire buffer, but shows all TODO items---with not-DONE
  3524. state---and the headings hierarchy above them. With a prefix
  3525. argument, or by using @kbd{C-c / T}, search for a specific
  3526. TODO. You are prompted for the keyword, and you can also give
  3527. a list of keywords like @samp{KWD1|KWD2|...} to list entries that
  3528. match any one of these keywords. With a numeric prefix argument
  3529. N, show the tree for the Nth keyword in the variable
  3530. @code{org-todo-keywords}. With two prefix arguments, find all TODO
  3531. states, both un-done and done.
  3532. @item @kbd{C-c a t} (@code{org-todo-list})
  3533. @kindex C-c a t
  3534. Show the global TODO list. Collects the TODO items (with
  3535. not-DONE states) from all agenda files (see @ref{Agenda Views}) into
  3536. a single buffer. The new buffer is in Org Agenda mode, which
  3537. provides commands to examine and manipulate the TODO entries from
  3538. the new buffer (see @ref{Agenda Commands}). See @ref{Global TODO list}, for more information.
  3539. @item @kbd{S-M-@key{RET}} (@code{org-insert-todo-heading})
  3540. @kindex S-M-RET
  3541. @findex org-insert-todo-heading
  3542. Insert a new TODO entry below the current one.
  3543. @end table
  3544. @vindex org-todo-state-tags-triggers
  3545. @noindent
  3546. Changing a TODO state can also trigger tag changes. See the docstring
  3547. of the option @code{org-todo-state-tags-triggers} for details.
  3548. @node TODO Extensions
  3549. @section Extended Use of TODO Keywords
  3550. @cindex extended TODO keywords
  3551. @vindex org-todo-keywords
  3552. By default, marked TODO entries have one of only two states: TODO and
  3553. DONE. Org mode allows you to classify TODO items in more complex ways
  3554. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With special
  3555. setup, the TODO keyword system can work differently in different
  3556. files.
  3557. Note that @emph{tags} are another way to classify headlines in general and
  3558. TODO items in particular (see @ref{Tags}).
  3559. @menu
  3560. * Workflow states:: From TODO to DONE in steps.
  3561. * TODO types:: I do this, Fred does the rest.
  3562. * Multiple sets in one file:: Mixing it all, still finding your way.
  3563. * Fast access to TODO states:: Single letter selection of state.
  3564. * Per-file keywords:: Different files, different requirements.
  3565. * Faces for TODO keywords:: Highlighting states.
  3566. * TODO dependencies:: When one task needs to wait for others.
  3567. @end menu
  3568. @node Workflow states
  3569. @subsection TODO keywords as workflow states
  3570. @cindex TODO workflow
  3571. @cindex workflow states as TODO keywords
  3572. You can use TODO keywords to indicate different @emph{sequential} states in
  3573. the process of working on an item, for example@footnote{Changing the variable @code{org-todo-keywords} only becomes
  3574. effective after restarting Org mode in a buffer.}:
  3575. @lisp
  3576. (setq org-todo-keywords
  3577. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  3578. @end lisp
  3579. The vertical bar separates the TODO keywords (states that @emph{need
  3580. action}) from the DONE states (which need @emph{no further action}). If
  3581. you do not provide the separator bar, the last state is used as the
  3582. DONE state.
  3583. @cindex completion, of TODO keywords
  3584. With this setup, the command @kbd{C-c C-t} cycles an entry from
  3585. @samp{TODO} to @samp{FEEDBACK}, then to @samp{VERIFY}, and finally to @samp{DONE} and
  3586. @samp{DELEGATED}. You may also use a numeric prefix argument to quickly
  3587. select a specific state. For example @kbd{C-3 C-c C-t} changes
  3588. the state immediately to @samp{VERIFY}. Or you can use @kbd{S-@key{LEFT}}
  3589. to go backward through the sequence. If you define many keywords, you
  3590. can use in-buffer completion (see @ref{Completion}) or even a special
  3591. one-key selection scheme (see @ref{Fast access to TODO states}) to insert
  3592. these words into the buffer. Changing a TODO state can be logged with
  3593. a timestamp, see @ref{Tracking TODO state changes}, for more information.
  3594. @node TODO types
  3595. @subsection TODO keywords as types
  3596. @cindex TODO types
  3597. @cindex names as TODO keywords
  3598. @cindex types as TODO keywords
  3599. The second possibility is to use TODO keywords to indicate different
  3600. @emph{types} of action items. For example, you might want to indicate that
  3601. items are for ``work'' or ``home''. Or, when you work with several people
  3602. on a single project, you might want to assign action items directly to
  3603. persons, by using their names as TODO keywords. This would be set up
  3604. like this:
  3605. @lisp
  3606. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  3607. @end lisp
  3608. In this case, different keywords do not indicate a sequence, but
  3609. rather different types. So the normal work flow would be to assign
  3610. a task to a person, and later to mark it DONE. Org mode supports this
  3611. 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
  3612. and agenda buffers.}. When used several times in succession, it still
  3613. cycles through all names, in order to first select the right type for
  3614. a task. But when you return to the item after some time and execute
  3615. @kbd{C-c C-t} again, it will switch from any name directly to
  3616. @samp{DONE}. Use prefix arguments or completion to quickly select
  3617. a specific name. You can also review the items of a specific TODO
  3618. type in a sparse tree by using a numeric prefix to @kbd{C-c / t}.
  3619. For example, to see all things Lucy has to do, you would use
  3620. @kbd{C-3 C-c / t}. To collect Lucy's items from all agenda files
  3621. into a single buffer, you would use the numeric prefix argument as
  3622. well when creating the global TODO list: @kbd{C-3 C-c a t}.
  3623. @node Multiple sets in one file
  3624. @subsection Multiple keyword sets in one file
  3625. @cindex TODO keyword sets
  3626. Sometimes you may want to use different sets of TODO keywords in
  3627. parallel. For example, you may want to have the basic TODO/DONE, but
  3628. also a workflow for bug fixing, and a separate state indicating that
  3629. an item has been canceled---so it is not DONE, but also does not
  3630. require action. Your setup would then look like this:
  3631. @lisp
  3632. (setq org-todo-keywords
  3633. '((sequence "TODO" "|" "DONE")
  3634. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  3635. (sequence "|" "CANCELED")))
  3636. @end lisp
  3637. The keywords should all be different, this helps Org mode to keep
  3638. track of which subsequence should be used for a given entry. In this
  3639. setup, @kbd{C-c C-t} only operates within a subsequence, so it
  3640. switches from @samp{DONE} to (nothing) to @samp{TODO}, and from @samp{FIXED} to
  3641. (nothing) to @samp{REPORT}. Therefore you need a mechanism to initially
  3642. select the correct sequence. Besides the obvious ways like typing
  3643. a keyword or using completion, you may also apply the following
  3644. commands:
  3645. @table @asis
  3646. @item @kbd{C-u C-u C-c C-t}
  3647. @itemx @kbd{C-S-@key{RIGHT}}
  3648. @itemx @kbd{C-S-@key{LEFT}}
  3649. @kindex C-S-RIGHT
  3650. @kindex C-S-LEFT
  3651. @kindex C-u C-u C-c C-t
  3652. These keys jump from one TODO subset to the next. In the above
  3653. example, @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{RIGHT}} would
  3654. jump from @samp{TODO} or @samp{DONE} to @samp{REPORT}, and any of the words in
  3655. the second row to @samp{CANCELED}. Note that the @kbd{C-S-} key
  3656. binding conflict with @code{shift-selection-mode} (see @ref{Conflicts}).
  3657. @item @kbd{S-@key{RIGHT}}
  3658. @itemx @kbd{S-@key{LEFT}}
  3659. @kindex S-RIGHT
  3660. @kindex S-LEFT
  3661. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}} walk through @emph{all}
  3662. keywords from all sets, so for example @kbd{S-@key{RIGHT}} would
  3663. switch from @samp{DONE} to @samp{REPORT} in the example above. For
  3664. a discussion of the interaction with @code{shift-selection-mode}, see
  3665. @ref{Conflicts}.
  3666. @end table
  3667. @node Fast access to TODO states
  3668. @subsection Fast access to TODO states
  3669. If you would like to quickly change an entry to an arbitrary TODO
  3670. state instead of cycling through the states, you can set up keys for
  3671. single-letter access to the states. This is done by adding the
  3672. selection character after each keyword, in parentheses@footnote{All characters are allowed except @samp{@@}, @samp{^} and @samp{!}, which have
  3673. a special meaning here.}. For
  3674. example:
  3675. @lisp
  3676. (setq org-todo-keywords
  3677. '((sequence "TODO(t)" "|" "DONE(d)")
  3678. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  3679. (sequence "|" "CANCELED(c)")))
  3680. @end lisp
  3681. @vindex org-fast-tag-selection-include-todo
  3682. If you then press @kbd{C-c C-t} followed by the selection key,
  3683. the entry is switched to this state. @kbd{@key{SPC}} can be used to
  3684. remove any TODO keyword from an entry@footnote{Check also the variable @code{org-fast-tag-selection-include-todo},
  3685. it allows you to change the TODO state through the tags interface
  3686. (@ref{Setting Tags}), in case you like to mingle the two concepts. Note
  3687. that this means you need to come up with unique keys across both sets
  3688. of keywords.}.
  3689. @node Per-file keywords
  3690. @subsection Setting up keywords for individual files
  3691. @cindex keyword options
  3692. @cindex per-file keywords
  3693. @cindex @samp{TODO}, keyword
  3694. @cindex @samp{TYP_TODO}, keyword
  3695. @cindex @samp{SEQ_TODO}, keyword
  3696. It can be very useful to use different aspects of the TODO mechanism
  3697. in different files. For file-local settings, you need to add special
  3698. lines to the file which set the keywords and interpretation for that
  3699. file only. For example, to set one of the two examples discussed
  3700. above, you need one of the following lines, starting in column zero
  3701. anywhere in the file:
  3702. @example
  3703. #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  3704. @end example
  3705. @noindent
  3706. you may also write @samp{#+SEQ_TODO} to be explicit about the
  3707. interpretation, but it means the same as @samp{#+TODO}, or
  3708. @example
  3709. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  3710. @end example
  3711. A setup for using several sets in parallel would be:
  3712. @example
  3713. #+TODO: TODO | DONE
  3714. #+TODO: REPORT BUG KNOWNCAUSE | FIXED
  3715. #+TODO: | CANCELED
  3716. @end example
  3717. @cindex completion, of option keywords
  3718. @kindex M-TAB
  3719. @noindent
  3720. To make sure you are using the correct keyword, type @samp{#+} into the
  3721. buffer and then use @kbd{M-@key{TAB}} completion.
  3722. @cindex DONE, final TODO keyword
  3723. Remember that the keywords after the vertical bar---or the last
  3724. keyword if no bar is there---must always mean that the item is DONE,
  3725. although you may use a different word. After changing one of these
  3726. lines, use @kbd{C-c C-c} with the cursor still in the line to
  3727. make the changes known to Org mode@footnote{Org mode parses these lines only when Org mode is activated
  3728. after visiting a file. @kbd{C-c C-c} with the cursor in a line
  3729. starting with @samp{#+} is simply restarting Org mode for the current
  3730. buffer.}.
  3731. @node Faces for TODO keywords
  3732. @subsection Faces for TODO keywords
  3733. @cindex faces, for TODO keywords
  3734. @vindex org-todo, face
  3735. @vindex org-done, face
  3736. @vindex org-todo-keyword-faces
  3737. Org mode highlights TODO keywords with special faces: @code{org-todo} for
  3738. keywords indicating that an item still has to be acted upon, and
  3739. @code{org-done} for keywords indicating that an item is finished. If you
  3740. are using more than two different states, you might want to use
  3741. special faces for some of them. This can be done using the variable
  3742. @code{org-todo-keyword-faces}. For example:
  3743. @lisp
  3744. (setq org-todo-keyword-faces
  3745. '(("TODO" . org-warning) ("STARTED" . "yellow")
  3746. ("CANCELED" . (:foreground "blue" :weight bold))))
  3747. @end lisp
  3748. @vindex org-faces-easy-properties
  3749. While using a list with face properties as shown for @samp{CANCELED}
  3750. @emph{should} work, this does not always seem to be the case. If
  3751. necessary, define a special face and use that. A string is
  3752. interpreted as a color. The variable @code{org-faces-easy-properties}
  3753. determines if that color is interpreted as a foreground or
  3754. a background color.
  3755. @node TODO dependencies
  3756. @subsection TODO dependencies
  3757. @cindex TODO dependencies
  3758. @cindex dependencies, of TODO states
  3759. @vindex org-enforce-todo-dependencies
  3760. @cindex @samp{ORDERED}, property
  3761. The structure of Org files---hierarchy and lists---makes it easy to
  3762. define TODO dependencies. Usually, a parent TODO task should not be
  3763. marked DONE until all subtasks, defined as children tasks, are marked
  3764. as DONE. And sometimes there is a logical sequence to a number of
  3765. (sub)tasks, so that one task cannot be acted upon before all siblings
  3766. above it are done. If you customize the variable
  3767. @code{org-enforce-todo-dependencies}, Org blocks entries from changing
  3768. state to DONE while they have children that are not DONE.
  3769. Furthermore, if an entry has a property @samp{ORDERED}, each of its
  3770. children is blocked until all earlier siblings are marked DONE. Here
  3771. is an example:
  3772. @example
  3773. * TODO Blocked until (two) is done
  3774. ** DONE one
  3775. ** TODO two
  3776. * Parent
  3777. :PROPERTIES:
  3778. :ORDERED: t
  3779. :END:
  3780. ** TODO a
  3781. ** TODO b, needs to wait for (a)
  3782. ** TODO c, needs to wait for (a) and (b)
  3783. @end example
  3784. @cindex TODO dependencies, NOBLOCKING
  3785. @cindex NOBLOCKING, property
  3786. You can ensure an entry is never blocked by using the @samp{NOBLOCKING}
  3787. property:
  3788. @example
  3789. * This entry is never blocked
  3790. :PROPERTIES:
  3791. :NOBLOCKING: t
  3792. :END:
  3793. @end example
  3794. @table @asis
  3795. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  3796. @kindex C-c C-x o
  3797. @findex org-toggle-ordered-property
  3798. @vindex org-track-ordered-property-with-tag
  3799. Toggle the @samp{ORDERED} property of the current entry. A property
  3800. is used for this behavior because this should be local to the
  3801. current entry, not inherited like a tag. However, if you would
  3802. like to @emph{track} the value of this property with a tag for better
  3803. visibility, customize the variable
  3804. @code{org-track-ordered-property-with-tag}.
  3805. @item @kbd{C-u C-u C-u C-c C-t}
  3806. @kindex C-u C-u C-u C-c C-t
  3807. Change TODO state, circumventing any state blocking.
  3808. @end table
  3809. @vindex org-agenda-dim-blocked-tasks
  3810. If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries
  3811. that cannot be closed because of such dependencies are shown in
  3812. a dimmed font or even made invisible in agenda views (see @ref{Agenda Views}).
  3813. @cindex checkboxes and TODO dependencies
  3814. @vindex org-enforce-todo-dependencies
  3815. You can also block changes of TODO states by looking at checkboxes
  3816. (see @ref{Checkboxes}). If you set the variable
  3817. @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked
  3818. checkboxes is blocked from switching to DONE.
  3819. If you need more complex dependency structures, for example
  3820. dependencies between entries in different trees or files, check out
  3821. the contributed module @samp{org-depend.el}.
  3822. @node Progress Logging
  3823. @section Progress Logging
  3824. @cindex progress logging
  3825. @cindex logging, of progress
  3826. Org mode can automatically record a timestamp and possibly a note when
  3827. you mark a TODO item as DONE, or even each time you change the state
  3828. of a TODO item. This system is highly configurable, settings can be
  3829. on a per-keyword basis and can be localized to a file or even
  3830. a subtree. For information on how to clock working time for a task,
  3831. see @ref{Clocking Work Time}.
  3832. @menu
  3833. * Closing items:: When was this entry marked DONE?
  3834. * Tracking TODO state changes:: When did the status change?
  3835. * Tracking your habits:: How consistent have you been?
  3836. @end menu
  3837. @node Closing items
  3838. @subsection Closing items
  3839. The most basic logging is to keep track of @emph{when} a certain TODO item
  3840. was finished. This is achieved with@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP: logdone}.}
  3841. @lisp
  3842. (setq org-log-done 'time)
  3843. @end lisp
  3844. @vindex org-closed-keep-when-no-todo
  3845. @noindent
  3846. Then each time you turn an entry from a TODO (not-done) state into any
  3847. of the DONE states, a line @samp{CLOSED: [timestamp]} is inserted just
  3848. after the headline. If you turn the entry back into a TODO item
  3849. through further state cycling, that line is removed again. If you
  3850. 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
  3851. @code{org-closed-keep-when-no-todo} to non-@code{nil}. If you want to record
  3852. a note along with the timestamp, use@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  3853. lognotedone}.}
  3854. @lisp
  3855. (setq org-log-done 'note)
  3856. @end lisp
  3857. @noindent
  3858. You are then be prompted for a note, and that note is stored below the
  3859. entry with a @samp{Closing Note} heading.
  3860. @node Tracking TODO state changes
  3861. @subsection Tracking TODO state changes
  3862. @cindex drawer, for state change recording
  3863. @vindex org-log-states-order-reversed
  3864. @vindex org-log-into-drawer
  3865. @cindex @samp{LOG_INTO_DRAWER}, property
  3866. When TODO keywords are used as workflow states (see @ref{Workflow states, , *Workflow states}),
  3867. you might want to keep track of when a state change occurred and maybe
  3868. take a note about this change. You can either record just
  3869. a timestamp, or a time-stamped note for a change. These records are
  3870. inserted after the headline as an itemized list, newest first@footnote{See the variable @code{org-log-states-order-reversed}.}.
  3871. When taking a lot of notes, you might want to get the notes out of the
  3872. way into a drawer (see @ref{Drawers}). Customize the variable
  3873. @code{org-log-into-drawer} to get this behavior---the recommended drawer
  3874. for this is called @samp{LOGBOOK}@footnote{Note that the @samp{LOGBOOK} drawer is unfolded when pressing
  3875. @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
  3876. setting of this variable for a subtree by setting a @samp{LOG_INTO_DRAWER}
  3877. property.
  3878. Since it is normally too much to record a note for every state, Org
  3879. mode expects configuration on a per-keyword basis for this. This is
  3880. achieved by adding special markers @samp{!} (for a timestamp) or @samp{@@} (for
  3881. a note with timestamp) in parentheses after each keyword. For
  3882. example, with the setting
  3883. @lisp
  3884. (setq org-todo-keywords
  3885. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  3886. @end lisp
  3887. @noindent
  3888. to record a timestamp without a note for TODO keywords configured with
  3889. @samp{@@}, just type @kbd{C-c C-c} to enter a blank note when prompted.
  3890. @vindex org-log-done
  3891. @noindent
  3892. You not only define global TODO keywords and fast access keys, but
  3893. also request that a time is recorded when the entry is set to @samp{DONE},
  3894. and that a note is recorded when switching to @samp{WAIT} or
  3895. @samp{CANCELED}@footnote{It is possible that Org mode records two timestamps when you
  3896. are using both @code{org-log-done} and state change logging. However, it
  3897. never prompts for two notes: if you have configured both, the state
  3898. change recording note takes precedence and cancel the closing note.}. The setting for @samp{WAIT} is even more special: the
  3899. @samp{!} after the slash means that in addition to the note taken when
  3900. entering the state, a timestamp should be recorded when @emph{leaving} the
  3901. @samp{WAIT} state, if and only if the @emph{target} state does not configure
  3902. logging for entering it. So it has no effect when switching from
  3903. @samp{WAIT} to @samp{DONE}, because @samp{DONE} is configured to record a timestamp
  3904. only. But when switching from @samp{WAIT} back to @samp{TODO}, the @samp{/!} in the
  3905. @samp{WAIT} setting now triggers a timestamp even though @samp{TODO} has no
  3906. logging configured.
  3907. You can use the exact same syntax for setting logging preferences local
  3908. to a buffer:
  3909. @example
  3910. #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  3911. @end example
  3912. @cindex @samp{LOGGING}, property
  3913. In order to define logging settings that are local to a subtree or
  3914. a single item, define a @samp{LOGGING} property in this entry. Any
  3915. non-empty @samp{LOGGING} property resets all logging settings to @code{nil}.
  3916. You may then turn on logging for this specific tree using @samp{STARTUP}
  3917. keywords like @samp{lognotedone} or @samp{logrepeat}, as well as adding state
  3918. specific settings like @samp{TODO(!)}. For example:
  3919. @example
  3920. * TODO Log each state with only a time
  3921. :PROPERTIES:
  3922. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  3923. :END:
  3924. * TODO Only log when switching to WAIT, and when repeating
  3925. :PROPERTIES:
  3926. :LOGGING: WAIT(@@) logrepeat
  3927. :END:
  3928. * TODO No logging at all
  3929. :PROPERTIES:
  3930. :LOGGING: nil
  3931. :END:
  3932. @end example
  3933. @node Tracking your habits
  3934. @subsection Tracking your habits
  3935. @cindex habits
  3936. @cindex STYLE, property
  3937. Org has the ability to track the consistency of a special category of
  3938. TODO, called ``habits.'' A habit has the following properties:
  3939. @enumerate
  3940. @item
  3941. You have enabled the @code{habits} module by customizing the variable
  3942. @code{org-modules}.
  3943. @item
  3944. The habit is a TODO item, with a TODO keyword representing an open
  3945. state.
  3946. @item
  3947. The property @samp{STYLE} is set to the value @samp{habit}.
  3948. @item
  3949. The TODO has a scheduled date, usually with a @samp{.+} style repeat
  3950. interval. A @samp{++} style may be appropriate for habits with time
  3951. constraints, e.g., must be done on weekends, or a @samp{+} style for an
  3952. unusual habit that can have a backlog, e.g., weekly reports.
  3953. @item
  3954. The TODO may also have minimum and maximum ranges specified by
  3955. using the syntax @samp{.+2d/3d}, which says that you want to do the task
  3956. at least every three days, but at most every two days.
  3957. @item
  3958. You must also have state logging for the DONE state enabled (see
  3959. @ref{Tracking TODO state changes}), in order for historical data to be
  3960. represented in the consistency graph. If it is not enabled it is
  3961. not an error, but the consistency graphs are largely meaningless.
  3962. @end enumerate
  3963. To give you an idea of what the above rules look like in action, here's an
  3964. actual habit with some history:
  3965. @example
  3966. ** TODO Shave
  3967. SCHEDULED: <2009-10-17 Sat .+2d/4d>
  3968. :PROPERTIES:
  3969. :STYLE: habit
  3970. :LAST_REPEAT: [2009-10-19 Mon 00:36]
  3971. :END:
  3972. - State "DONE" from "TODO" [2009-10-15 Thu]
  3973. - State "DONE" from "TODO" [2009-10-12 Mon]
  3974. - State "DONE" from "TODO" [2009-10-10 Sat]
  3975. - State "DONE" from "TODO" [2009-10-04 Sun]
  3976. - State "DONE" from "TODO" [2009-10-02 Fri]
  3977. - State "DONE" from "TODO" [2009-09-29 Tue]
  3978. - State "DONE" from "TODO" [2009-09-25 Fri]
  3979. - State "DONE" from "TODO" [2009-09-19 Sat]
  3980. - State "DONE" from "TODO" [2009-09-16 Wed]
  3981. - State "DONE" from "TODO" [2009-09-12 Sat]
  3982. @end example
  3983. What this habit says is: I want to shave at most every 2 days---given
  3984. by the @samp{SCHEDULED} date and repeat interval---and at least every
  3985. 4 days. If today is the 15th, then the habit first appears in the
  3986. agenda on Oct 17, after the minimum of 2 days has elapsed, and will
  3987. appear overdue on Oct 19, after four days have elapsed.
  3988. What's really useful about habits is that they are displayed along
  3989. with a consistency graph, to show how consistent you've been at
  3990. getting that task done in the past. This graph shows every day that
  3991. the task was done over the past three weeks, with colors for each day.
  3992. The colors used are:
  3993. @table @asis
  3994. @item Blue
  3995. If the task was not to be done yet on that day.
  3996. @item Green
  3997. If the task could have been done on that day.
  3998. @item Yellow
  3999. If the task was going to be overdue the next day.
  4000. @item Red
  4001. If the task was overdue on that day.
  4002. @end table
  4003. In addition to coloring each day, the day is also marked with an
  4004. asterisk if the task was actually done that day, and an exclamation
  4005. mark to show where the current day falls in the graph.
  4006. There are several configuration variables that can be used to change
  4007. the way habits are displayed in the agenda.
  4008. @table @asis
  4009. @item @code{org-habit-graph-column}
  4010. @vindex org-habit-graph-column
  4011. The buffer column at which the consistency graph should be drawn.
  4012. This overwrites any text in that column, so it is a good idea to
  4013. keep your habits' titles brief and to the point.
  4014. @item @code{org-habit-preceding-days}
  4015. @vindex org-habit-preceding-days
  4016. The amount of history, in days before today, to appear in
  4017. consistency graphs.
  4018. @item @code{org-habit-following-days}
  4019. @vindex org-habit-following-days
  4020. The number of days after today that appear in consistency graphs.
  4021. @item @code{org-habit-show-habits-only-for-today}
  4022. @vindex org-habit-show-habits-only-for-today
  4023. If non-@code{nil}, only show habits in today's agenda view. This is
  4024. set to true by default.
  4025. @end table
  4026. Lastly, pressing @kbd{K} in the agenda buffer causes habits to
  4027. temporarily be disabled and do not appear at all. Press @kbd{K}
  4028. again to bring them back. They are also subject to tag filtering, if
  4029. you have habits which should only be done in certain contexts, for
  4030. example.
  4031. @node Priorities
  4032. @section Priorities
  4033. @cindex priorities
  4034. @cindex priority cookie
  4035. If you use Org mode extensively, you may end up with enough TODO items
  4036. that it starts to make sense to prioritize them. Prioritizing can be
  4037. done by placing a @emph{priority cookie} into the headline of a TODO item,
  4038. like this
  4039. @example
  4040. *** TODO [#A] Write letter to Sam Fortune
  4041. @end example
  4042. @vindex org-priority-faces
  4043. @noindent
  4044. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
  4045. @samp{A} is the highest priority. An entry without a cookie is treated
  4046. just like priority @samp{B}. Priorities make a difference only for sorting
  4047. in the agenda (see @ref{Weekly/daily agenda}); outside the agenda, they
  4048. have no inherent meaning to Org mode. The cookies can be highlighted
  4049. with special faces by customizing the variable @code{org-priority-faces}.
  4050. Priorities can be attached to any outline node; they do not need to be
  4051. TODO items.
  4052. @table @asis
  4053. @item @kbd{C-c ,} (@code{org-priority})
  4054. @kindex C-c ,
  4055. @findex org-priority
  4056. Set the priority of the current headline. The command prompts
  4057. for a priority character @samp{A}, @samp{B} or @samp{C}. When you press
  4058. @kbd{@key{SPC}} instead, the priority cookie is removed from the
  4059. headline. The priorities can also be changed ``remotely'' from the
  4060. timeline and agenda buffer with the @kbd{,} command (see
  4061. @ref{Agenda Commands}).
  4062. @item @kbd{S-@key{UP}} (@code{org-priority-up})
  4063. @itemx @kbd{S-@key{DOWN}} (@code{org-priority-down})
  4064. @kindex S-UP
  4065. @kindex S-DOWN
  4066. @findex org-priority-up
  4067. @findex org-priority-down
  4068. @vindex org-priority-start-cycle-with-default
  4069. Increase/decrease priority of current headline@footnote{See also the option @code{org-priority-start-cycle-with-default}.}. Note that
  4070. these keys are also used to modify timestamps (see @ref{Creating Timestamps}). See also @ref{Conflicts}, for
  4071. a discussion of the interaction with @code{shift-selection-mode}.
  4072. @end table
  4073. @vindex org-highest-priority
  4074. @vindex org-lowest-priority
  4075. @vindex org-default-priority
  4076. You can change the range of allowed priorities by setting the
  4077. variables @code{org-highest-priority}, @code{org-lowest-priority}, and
  4078. @code{org-default-priority}. For an individual buffer, you may set these
  4079. values (highest, lowest, default) like this (please make sure that the
  4080. highest priority is earlier in the alphabet than the lowest priority):
  4081. @cindex @samp{PRIORITIES}, keyword
  4082. @example
  4083. #+PRIORITIES: A C B
  4084. @end example
  4085. @node Breaking Down Tasks
  4086. @section Breaking Down Tasks into Subtasks
  4087. @cindex tasks, breaking down
  4088. @cindex statistics, for TODO items
  4089. @vindex org-agenda-todo-list-sublevels
  4090. It is often advisable to break down large tasks into smaller,
  4091. manageable subtasks. You can do this by creating an outline tree
  4092. below a TODO item, with detailed subtasks on the tree@footnote{To keep subtasks out of the global TODO list, see the
  4093. @code{org-agenda-todo-list-sublevels}.}. To keep
  4094. the overview over the fraction of subtasks that are already completed,
  4095. insert either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies
  4096. are updated each time the TODO status of a child changes, or when
  4097. pressing @kbd{C-c C-c} on the cookie. For example:
  4098. @example
  4099. * Organize Party [33%]
  4100. ** TODO Call people [1/2]
  4101. *** TODO Peter
  4102. *** DONE Sarah
  4103. ** TODO Buy food
  4104. ** DONE Talk to neighbor
  4105. @end example
  4106. @cindex @samp{COOKIE_DATA}, property
  4107. If a heading has both checkboxes and TODO children below it, the
  4108. meaning of the statistics cookie become ambiguous. Set the property
  4109. @samp{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve this issue.
  4110. @vindex org-hierarchical-todo-statistics
  4111. If you would like to have the statistics cookie count any TODO entries
  4112. in the subtree (not just direct children), configure the variable
  4113. @code{org-hierarchical-todo-statistics}. To do this for a single subtree,
  4114. include the word @samp{recursive} into the value of the @samp{COOKIE_DATA}
  4115. property.
  4116. @example
  4117. * Parent capturing statistics [2/20]
  4118. :PROPERTIES:
  4119. :COOKIE_DATA: todo recursive
  4120. :END:
  4121. @end example
  4122. If you would like a TODO entry to automatically change to DONE when
  4123. all children are done, you can use the following setup:
  4124. @lisp
  4125. (defun org-summary-todo (n-done n-not-done)
  4126. "Switch entry to DONE when all subentries are done, to TODO otherwise."
  4127. (let (org-log-done org-log-states) ; turn off logging
  4128. (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  4129. (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  4130. @end lisp
  4131. Another possibility is the use of checkboxes to identify (a hierarchy
  4132. of) a large number of subtasks (see @ref{Checkboxes}).
  4133. @node Checkboxes
  4134. @section Checkboxes
  4135. @cindex checkboxes
  4136. @vindex org-list-automatic-rules
  4137. Every item in a plain list@footnote{With the exception of description lists. But you can allow it
  4138. by modifying @code{org-list-automatic-rules} accordingly.} (see @ref{Plain Lists}) can be made into
  4139. a checkbox by starting it with the string @samp{[ ]}. This feature is
  4140. similar to TODO items (see @ref{TODO Items}), but is more lightweight.
  4141. Checkboxes are not included into the global TODO list, so they are
  4142. often great to split a task into a number of simple steps. Or you can
  4143. 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
  4144. @samp{org-mouse.el}).
  4145. Here is an example of a checkbox list.
  4146. @example
  4147. * TODO Organize party [2/4]
  4148. - [-] call people [1/3]
  4149. - [ ] Peter
  4150. - [X] Sarah
  4151. - [ ] Sam
  4152. - [X] order food
  4153. - [ ] think about what music to play
  4154. - [X] talk to the neighbors
  4155. @end example
  4156. Checkboxes work hierarchically, so if a checkbox item has children
  4157. that are checkboxes, toggling one of the children checkboxes makes the
  4158. parent checkbox reflect if none, some, or all of the children are
  4159. checked.
  4160. @cindex statistics, for checkboxes
  4161. @cindex checkbox statistics
  4162. @cindex @samp{COOKIE_DATA}, property
  4163. @vindex org-hierarchical-checkbox-statistics
  4164. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies
  4165. indicating how many checkboxes present in this entry have been checked
  4166. off, and the total number of checkboxes present. This can give you an
  4167. idea on how many checkboxes remain, even without opening a folded
  4168. entry. The cookies can be placed into a headline or into (the first
  4169. line of) a plain list item. Each cookie covers checkboxes of direct
  4170. children structurally below the headline/item on which the cookie
  4171. appears@footnote{Set the variable @code{org-hierarchical-checkbox-statistics} if you
  4172. want such cookies to count all checkboxes below the cookie, not just
  4173. those belonging to direct children.}. You have to insert the cookie yourself by typing
  4174. either @samp{[/]} or @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as
  4175. in the examples above. With @samp{[%]} you get information about the
  4176. percentage of checkboxes checked (in the above example, this would be
  4177. @samp{[50%]} and @samp{[33%]}, respectively). In a headline, a cookie can count
  4178. either checkboxes below the heading or TODO states of children, and it
  4179. displays whatever was changed last. Set the property @samp{COOKIE_DATA} to
  4180. either @samp{checkbox} or @samp{todo} to resolve this issue.
  4181. @cindex blocking, of checkboxes
  4182. @cindex checkbox blocking
  4183. @cindex @samp{ORDERED}, property
  4184. If the current outline node has an @samp{ORDERED} property, checkboxes must
  4185. be checked off in sequence, and an error is thrown if you try to check
  4186. off a box while there are unchecked boxes above it.
  4187. @noindent
  4188. The following commands work with checkboxes:
  4189. @table @asis
  4190. @item @kbd{C-c C-c} (@code{org-toggle-checkbox})
  4191. @kindex C-c C-c
  4192. @findex org-toggle-checkbox
  4193. Toggle checkbox status or---with prefix argument---checkbox
  4194. presence at point. With a single prefix argument, add an empty
  4195. checkbox or remove the current one@footnote{@kbd{C-u C-c C-c} on the @emph{first} item of a list with no
  4196. checkbox adds checkboxes to the rest of the list.}. With a double prefix
  4197. argument, set it to @samp{[-]}, which is considered to be an
  4198. intermediate state.
  4199. @item @kbd{C-c C-x C-b} (@code{org-toggle-checkbox})
  4200. @kindex C-c C-x C-b
  4201. Toggle checkbox status or---with prefix argument---checkbox
  4202. presence at point. With double prefix argument, set it to @samp{[-]},
  4203. which is considered to be an intermediate state.
  4204. @itemize
  4205. @item
  4206. If there is an active region, toggle the first checkbox in the
  4207. region and set all remaining boxes to the same status as the
  4208. first. With a prefix argument, add or remove the checkbox for
  4209. all items in the region.
  4210. @item
  4211. If the cursor is in a headline, toggle checkboxes in the region
  4212. between this headline and the next---so @emph{not} the entire
  4213. subtree.
  4214. @item
  4215. If there is no active region, just toggle the checkbox at
  4216. point.
  4217. @end itemize
  4218. @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading})
  4219. @kindex M-S-RET
  4220. @findex org-insert-todo-heading
  4221. Insert a new item with a checkbox. This works only if the cursor
  4222. is already in a plain list item (see @ref{Plain Lists}).
  4223. @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property})
  4224. @kindex C-c C-x o
  4225. @findex org-toggle-ordered-property
  4226. @vindex org-track-ordered-property-with-tag
  4227. Toggle the @samp{ORDERED} property of the entry, to toggle if
  4228. checkboxes must be checked off in sequence. A property is used
  4229. for this behavior because this should be local to the current
  4230. entry, not inherited like a tag. However, if you would like to
  4231. @emph{track} the value of this property with a tag for better
  4232. visibility, customize @code{org-track-ordered-property-with-tag}.
  4233. @item @kbd{C-c #} (@code{org-update-statistics-cookies})
  4234. @kindex C-c #
  4235. @findex org-update-statistics-cookies
  4236. Update the statistics cookie in the current outline entry. When
  4237. called with a @kbd{C-u} prefix, update the entire file.
  4238. Checkbox statistic cookies are updated automatically if you
  4239. toggle checkboxes with @kbd{C-c C-c} and make new ones with
  4240. @kbd{M-S-@key{RET}}. TODO statistics cookies update when changing
  4241. TODO states. If you delete boxes/entries or add/change them by
  4242. hand, use this command to get things back into sync.
  4243. @end table
  4244. @node Tags
  4245. @chapter Tags
  4246. @cindex tags
  4247. @cindex headline tagging
  4248. @cindex matching, tags
  4249. @cindex sparse tree, tag based
  4250. An excellent way to implement labels and contexts for
  4251. cross-correlating information is to assign @emph{tags} to headlines. Org
  4252. mode has extensive support for tags.
  4253. @vindex org-tag-faces
  4254. Every headline can contain a list of tags; they occur at the end of
  4255. the headline. Tags are normal words containing letters, numbers, @samp{_},
  4256. and @samp{@@}. Tags must be preceded and followed by a single colon, e.g.,
  4257. @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}. Tags
  4258. by default are in bold face with the same color as the headline. You
  4259. may specify special faces for specific tags using the variable
  4260. @code{org-tag-faces}, in much the same way as you can for TODO keywords
  4261. (see @ref{Faces for TODO keywords}).
  4262. @menu
  4263. * Tag Inheritance:: Tags use the tree structure of an outline.
  4264. * Setting Tags:: How to assign tags to a headline.
  4265. * Tag Hierarchy:: Create a hierarchy of tags.
  4266. * Tag Searches:: Searching for combinations of tags.
  4267. @end menu
  4268. @node Tag Inheritance
  4269. @section Tag Inheritance
  4270. @cindex tag inheritance
  4271. @cindex inheritance, of tags
  4272. @cindex sublevels, inclusion into tags match
  4273. @emph{Tags} make use of the hierarchical structure of outline trees. If
  4274. a heading has a certain tag, all subheadings inherit the tag as well.
  4275. For example, in the list
  4276. @example
  4277. * Meeting with the French group :work:
  4278. ** Summary by Frank :boss:notes:
  4279. *** TODO Prepare slides for him :action:
  4280. @end example
  4281. @noindent
  4282. the final heading has the tags @samp{work}, @samp{boss}, @samp{notes}, and @samp{action}
  4283. even though the final heading is not explicitly marked with those
  4284. tags. You can also set tags that all entries in a file should inherit
  4285. just as if these tags were defined in a hypothetical level zero that
  4286. 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.}
  4287. @cindex @samp{FILETAGS}, keyword
  4288. @example
  4289. #+FILETAGS: :Peter:Boss:Secret:
  4290. @end example
  4291. @vindex org-use-tag-inheritance
  4292. @vindex org-tags-exclude-from-inheritance
  4293. @noindent
  4294. To limit tag inheritance to specific tags, or to turn it off entirely,
  4295. use the variables @code{org-use-tag-inheritance} and
  4296. @code{org-tags-exclude-from-inheritance}.
  4297. @vindex org-tags-match-list-sublevels
  4298. When a headline matches during a tags search while tag inheritance is
  4299. turned on, all the sublevels in the same tree---for a simple match
  4300. form---match as well@footnote{This is only true if the search does not involve more complex
  4301. tests including properties (see @ref{Property Searches}).}. The list of matches may then become
  4302. very long. If you only want to see the first tags match in a subtree,
  4303. configure the variable @code{org-tags-match-list-sublevels} (not
  4304. recommended).
  4305. @vindex org-agenda-use-tag-inheritance
  4306. Tag inheritance is relevant when the agenda search tries to match
  4307. a tag, either in the @code{tags} or @code{tags-todo} agenda types. In other
  4308. agenda types, @code{org-use-tag-inheritance} has no effect. Still, you may
  4309. want to have your tags correctly set in the agenda, so that tag
  4310. filtering works fine, with inherited tags. Set
  4311. @code{org-agenda-use-tag-inheritance} to control this: the default value
  4312. includes all agenda types, but setting this to @code{nil} can really speed
  4313. up agenda generation.
  4314. @node Setting Tags
  4315. @section Setting Tags
  4316. @cindex setting tags
  4317. @cindex tags, setting
  4318. @kindex M-TAB
  4319. Tags can simply be typed into the buffer at the end of a headline.
  4320. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  4321. also a special command for inserting tags:
  4322. @table @asis
  4323. @item @kbd{C-c C-q} (@code{org-set-tags-command})
  4324. @kindex C-c C-q
  4325. @findex org-set-tags-command
  4326. @cindex completion, of tags
  4327. @vindex org-tags-column
  4328. Enter new tags for the current headline. Org mode either offers
  4329. completion or a special single-key interface for setting tags,
  4330. see below. After pressing @kbd{@key{RET}}, the tags are inserted
  4331. and aligned to @code{org-tags-column}. When called with
  4332. a @kbd{C-u} prefix, all tags in the current buffer are
  4333. aligned to that column, just to make things look nice. Tags are
  4334. automatically realigned after promotion, demotion, and TODO state
  4335. changes (see @ref{TODO Basics}).
  4336. @item @kbd{C-c C-c} (@code{org-set-tags-command})
  4337. @kindex C-c C-c
  4338. When the cursor is in a headline, this does the same as
  4339. @kbd{C-c C-q}.
  4340. @end table
  4341. @vindex org-tag-alist
  4342. Org supports tag insertion based on a @emph{list of tags}. By default this
  4343. list is constructed dynamically, containing all tags currently used in
  4344. the buffer. You may also globally specify a hard list of tags with
  4345. the variable @code{org-tag-alist}. Finally you can set the default tags
  4346. for a given file with lines like
  4347. @cindex @samp{TAGS}, keyword
  4348. @example
  4349. #+TAGS: @@work @@home @@tennisclub
  4350. #+TAGS: laptop car pc sailboat
  4351. @end example
  4352. If you have globally defined your preferred set of tags using the
  4353. variable @code{org-tag-alist}, but would like to use a dynamic tag list in
  4354. a specific file, add an empty @samp{TAGS} keyword to that file:
  4355. @example
  4356. #+TAGS:
  4357. @end example
  4358. @vindex org-tag-persistent-alist
  4359. If you have a preferred set of tags that you would like to use in
  4360. every file, in addition to those defined on a per-file basis by @samp{TAGS}
  4361. keyword, then you may specify a list of tags with the variable
  4362. @code{org-tag-persistent-alist}. You may turn this off on a per-file basis
  4363. by adding a @samp{STARTUP} keyword to that file:
  4364. @example
  4365. #+STARTUP: noptag
  4366. @end example
  4367. By default Org mode uses the standard minibuffer completion facilities
  4368. for entering tags. However, it also implements another, quicker, tag
  4369. selection method called @emph{fast tag selection}. This allows you to
  4370. select and deselect tags with just a single key press. For this to
  4371. work well you should assign unique letters to most of your commonly
  4372. used tags. You can do this globally by configuring the variable
  4373. @code{org-tag-alist} in your Emacs init file. For example, you may find
  4374. the need to tag many items in different files with @samp{@@home}. In this
  4375. case you can set something like:
  4376. @lisp
  4377. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  4378. @end lisp
  4379. @noindent
  4380. If the tag is only relevant to the file you are working on, then you
  4381. can instead set the @samp{TAGS} keyword as:
  4382. @example
  4383. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  4384. @end example
  4385. @noindent
  4386. The tags interface shows the available tags in a splash window. If
  4387. you want to start a new line after a specific tag, insert @samp{\n} into
  4388. the tag list
  4389. @example
  4390. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p)
  4391. @end example
  4392. @noindent
  4393. or write them in two lines:
  4394. @example
  4395. #+TAGS: @@work(w) @@home(h) @@tennisclub(t)
  4396. #+TAGS: laptop(l) pc(p)
  4397. @end example
  4398. @noindent
  4399. You can also group together tags that are mutually exclusive by using
  4400. braces, as in:
  4401. @example
  4402. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  4403. @end example
  4404. @noindent
  4405. you indicate that at most one of @samp{@@work}, @samp{@@home}, and @samp{@@tennisclub}
  4406. should be selected. Multiple such groups are allowed.
  4407. @noindent
  4408. Do not forget to press @kbd{C-c C-c} with the cursor in one of
  4409. these lines to activate any changes.
  4410. @noindent
  4411. To set these mutually exclusive groups in the variable
  4412. @code{org-tags-alist}, you must use the dummy tags @code{:startgroup} and
  4413. @code{:endgroup} instead of the braces. Similarly, you can use @code{:newline}
  4414. to indicate a line break. The previous example would be set globally
  4415. by the following configuration:
  4416. @lisp
  4417. (setq org-tag-alist '((:startgroup . nil)
  4418. ("@@work" . ?w) ("@@home" . ?h)
  4419. ("@@tennisclub" . ?t)
  4420. (:endgroup . nil)
  4421. ("laptop" . ?l) ("pc" . ?p)))
  4422. @end lisp
  4423. If at least one tag has a selection key then pressing @kbd{C-c C-c} automatically presents you with a special interface, listing
  4424. inherited tags, the tags of the current headline, and a list of all
  4425. valid tags with corresponding keys@footnote{Keys are automatically assigned to tags that have no
  4426. configured keys.}.
  4427. Pressing keys assigned to tags adds or removes them from the list of
  4428. tags in the current line. Selecting a tag in a group of mutually
  4429. exclusive tags turns off any other tag from that group.
  4430. In this interface, you can also use the following special keys:
  4431. @table @asis
  4432. @item @kbd{@key{TAB}}
  4433. @kindex TAB
  4434. Enter a tag in the minibuffer, even if the tag is not in the
  4435. predefined list. You can complete on all tags present in the
  4436. buffer. You can also add several tags: just separate them with
  4437. a comma.
  4438. @item @kbd{@key{SPC}}
  4439. @kindex SPC
  4440. Clear all tags for this line.
  4441. @item @kbd{@key{RET}}
  4442. @kindex RET
  4443. Accept the modified set.
  4444. @item @kbd{C-g}
  4445. @kindex C-g
  4446. Abort without installing changes.
  4447. @item @kbd{q}
  4448. @kindex q
  4449. If @kbd{q} is not assigned to a tag, it aborts like
  4450. @kbd{C-g}.
  4451. @item @kbd{!}
  4452. @kindex !
  4453. Turn off groups of mutually exclusive tags. Use this to (as an
  4454. exception) assign several tags from such a group.
  4455. @item @kbd{C-c}
  4456. @kindex C-c C-c
  4457. Toggle auto-exit after the next change (see below). If you are
  4458. using expert mode, the first @kbd{C-c} displays the
  4459. selection window.
  4460. @end table
  4461. @noindent
  4462. This method lets you assign tags to a headline with very few keys.
  4463. With the above setup, you could clear the current tags and set
  4464. @samp{@@home}, @samp{laptop} and @samp{pc} tags with just the following keys:
  4465. @kbd{C-c C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to @samp{@@work}
  4466. would be done with @kbd{C-c C-c w @key{RET}} or alternatively with
  4467. @kbd{C-c C-c C-c w}. Adding the non-predefined tag @samp{Sarah} could
  4468. be done with @kbd{C-c C-c @key{TAB} S a r a h @key{RET}}.
  4469. @vindex org-fast-tag-selection-single-key
  4470. If you find that most of the time you need only a single key press to
  4471. modify your list of tags, set the variable
  4472. @code{org-fast-tag-selection-single-key}. Then you no longer have to press
  4473. @kbd{@key{RET}} to exit fast tag selection---it exits after the first
  4474. change. If you then occasionally need more keys, press @kbd{C-c}
  4475. to turn off auto-exit for the current tag selection process (in
  4476. effect: start selection with @kbd{C-c C-c C-c} instead of
  4477. @kbd{C-c C-c}). If you set the variable to the value @code{expert},
  4478. the special window is not even shown for single-key tag selection, it
  4479. comes up only when you press an extra @kbd{C-c}.
  4480. @node Tag Hierarchy
  4481. @section Tag Hierarchy
  4482. @cindex group tags
  4483. @cindex tags, groups
  4484. @cindex tags hierarchy
  4485. Tags can be defined in hierarchies. A tag can be defined as a @emph{group
  4486. tag} for a set of other tags. The group tag can be seen as the
  4487. ``broader term'' for its set of tags. Defining multiple group tags and
  4488. nesting them creates a tag hierarchy.
  4489. One use-case is to create a taxonomy of terms (tags) that can be used
  4490. to classify nodes in a document or set of documents.
  4491. When you search for a group tag, it return matches for all members in
  4492. the group and its subgroups. In an agenda view, filtering by a group
  4493. tag displays or hide headlines tagged with at least one of the members
  4494. of the group or any of its subgroups. This makes tag searches and
  4495. filters even more flexible.
  4496. You can set group tags by using brackets and inserting a colon between
  4497. the group tag and its related tags---beware that all whitespaces are
  4498. mandatory so that Org can parse this line correctly:
  4499. @example
  4500. #+TAGS: [ GTD : Control Persp ]
  4501. @end example
  4502. In this example, @samp{GTD} is the group tag and it is related to two other
  4503. tags: @samp{Control}, @samp{Persp}. Defining @samp{Control} and @samp{Persp} as group
  4504. tags creates an hierarchy of tags:
  4505. @example
  4506. #+TAGS: [ Control : Context Task ]
  4507. #+TAGS: [ Persp : Vision Goal AOF Project ]
  4508. @end example
  4509. That can conceptually be seen as a hierarchy of tags:
  4510. @itemize
  4511. @item
  4512. @samp{GTD}
  4513. @itemize
  4514. @item
  4515. @samp{Persp}
  4516. @itemize
  4517. @item
  4518. @samp{Vision}
  4519. @item
  4520. @samp{Goal}
  4521. @item
  4522. @samp{AOF}
  4523. @item
  4524. @samp{Project}
  4525. @end itemize
  4526. @item
  4527. @samp{Control}
  4528. @itemize
  4529. @item
  4530. @samp{Context}
  4531. @item
  4532. @samp{Task}
  4533. @end itemize
  4534. @end itemize
  4535. @end itemize
  4536. You can use the @code{:startgrouptag}, @code{:grouptags} and @code{:endgrouptag}
  4537. keyword directly when setting @code{org-tag-alist} directly:
  4538. @lisp
  4539. (setq org-tag-alist '((:startgrouptag)
  4540. ("GTD")
  4541. (:grouptags)
  4542. ("Control")
  4543. ("Persp")
  4544. (:endgrouptag)
  4545. (:startgrouptag)
  4546. ("Control")
  4547. (:grouptags)
  4548. ("Context")
  4549. ("Task")
  4550. (:endgrouptag)))
  4551. @end lisp
  4552. The tags in a group can be mutually exclusive if using the same group
  4553. syntax as is used for grouping mutually exclusive tags together; using
  4554. curly brackets.
  4555. @example
  4556. #+TAGS: @{ Context : @@Home @@Work @@Call @}
  4557. @end example
  4558. When setting @code{org-tag-alist} you can use @code{:startgroup} and @code{:endgroup}
  4559. instead of @code{:startgrouptag} and @code{:endgrouptag} to make the tags
  4560. mutually exclusive.
  4561. Furthermore, the members of a group tag can also be regular
  4562. expressions, creating the possibility of a more dynamic and rule-based
  4563. tag structure. The regular expressions in the group must be specified
  4564. within curly brackets. Here is an expanded example:
  4565. @example
  4566. #+TAGS: [ Vision : @{V@@.+@} ]
  4567. #+TAGS: [ Goal : @{G@@.+@} ]
  4568. #+TAGS: [ AOF : @{AOF@@.+@} ]
  4569. #+TAGS: [ Project : @{P@@.+@} ]
  4570. @end example
  4571. Searching for the tag @samp{Project} now lists all tags also including
  4572. regular expression matches for @samp{P@@.+}, and similarly for tag searches
  4573. on @samp{Vision}, @samp{Goal} and @samp{AOF}. For example, this would work well for
  4574. a project tagged with a common project-identifier,
  4575. e.g. @samp{P@@2014_OrgTags}.
  4576. @kindex C-c C-x q
  4577. @findex org-toggle-tags-groups
  4578. @vindex org-group-tags
  4579. If you want to ignore group tags temporarily, toggle group tags
  4580. support with @code{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}.
  4581. If you want to disable tag groups completely, set @code{org-group-tags} to
  4582. @code{nil}.
  4583. @node Tag Searches
  4584. @section Tag Searches
  4585. @cindex tag searches
  4586. @cindex searching for tags
  4587. Once a system of tags has been set up, it can be used to collect
  4588. related information into special lists.
  4589. @table @asis
  4590. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4591. @kindex C-c / m
  4592. @kindex C-c \
  4593. @findex org-match-sparse-tree
  4594. Create a sparse tree with all headlines matching a tags search.
  4595. With a @kbd{C-u} prefix argument, ignore headlines that are
  4596. not a TODO line.
  4597. @item @kbd{C-c a m} (@code{org-tags-view})
  4598. @kindex C-c a m
  4599. @findex org-tags-view
  4600. Create a global list of tag matches from all agenda files. See
  4601. @ref{Matching tags and properties}.
  4602. @item @kbd{C-c a M} (@code{org-tags-view})
  4603. @kindex C-c a M
  4604. @vindex org-tags-match-list-sublevels
  4605. Create a global list of tag matches from all agenda files, but
  4606. check only TODO items and force checking subitems (see the option
  4607. @code{org-tags-match-list-sublevels}).
  4608. @end table
  4609. These commands all prompt for a match string which allows basic
  4610. Boolean logic like @samp{+boss+urgent-project1}, to find entries with tags
  4611. @samp{boss} and @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find
  4612. entries which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of
  4613. the search string is rich and allows also matching against TODO
  4614. keywords, entry levels and properties. For a complete description
  4615. with many examples, see @ref{Matching tags and properties}.
  4616. @node Properties and Columns
  4617. @chapter Properties and Columns
  4618. @cindex properties
  4619. A property is a key-value pair associated with an entry. Properties
  4620. can be set so they are associated with a single entry, with every
  4621. entry in a tree, or with every entry in an Org file.
  4622. There are two main applications for properties in Org mode. First,
  4623. properties are like tags, but with a value. Imagine maintaining
  4624. a file where you document bugs and plan releases for a piece of
  4625. software. Instead of using tags like @samp{release_1}, @samp{release_2}, you
  4626. can use a property, say @samp{Release}, that in different subtrees has
  4627. different values, such as @samp{1.0} or @samp{2.0}. Second, you can use
  4628. properties to implement (very basic) database capabilities in an Org
  4629. buffer. Imagine keeping track of your music CDs, where properties
  4630. could be things such as the album, artist, date of release, number of
  4631. tracks, and so on.
  4632. Properties can be conveniently edited and viewed in column view (see
  4633. @ref{Column View}).
  4634. @menu
  4635. * Property Syntax:: How properties are spelled out.
  4636. * Special Properties:: Access to other Org mode features.
  4637. * Property Searches:: Matching property values.
  4638. * Property Inheritance:: Passing values down a tree.
  4639. * Column View:: Tabular viewing and editing.
  4640. @end menu
  4641. @node Property Syntax
  4642. @section Property Syntax
  4643. @cindex property syntax
  4644. @cindex drawer, for properties
  4645. Properties are key--value pairs. When they are associated with
  4646. a single entry or with a tree they need to be inserted into a special
  4647. drawer (see @ref{Drawers}) with the name @samp{PROPERTIES}, which has to be
  4648. located right below a headline, and its planning line (see @ref{Deadlines and Scheduling}) when applicable. Each property is specified on
  4649. a single line, with the key---surrounded by colons---first, and the
  4650. value after it. Keys are case-insensitive. Here is an example:
  4651. @example
  4652. * CD collection
  4653. ** Classic
  4654. *** Goldberg Variations
  4655. :PROPERTIES:
  4656. :Title: Goldberg Variations
  4657. :Composer: J.S. Bach
  4658. :Artist: Glen Gould
  4659. :Publisher: Deutsche Grammophon
  4660. :NDisks: 1
  4661. :END:
  4662. @end example
  4663. Depending on the value of @code{org-use-property-inheritance}, a property
  4664. set this way is associated either with a single entry, or with the
  4665. sub-tree defined by the entry, see @ref{Property Inheritance}.
  4666. You may define the allowed values for a particular property @samp{Xyz} by
  4667. setting a property @samp{Xyz_ALL}. This special property is @emph{inherited},
  4668. so if you set it in a level 1 entry, it applies to the entire tree.
  4669. When allowed values are defined, setting the corresponding property
  4670. becomes easier and is less prone to typing errors. For the example
  4671. with the CD collection, we can pre-define publishers and the number of
  4672. disks in a box like this:
  4673. @example
  4674. * CD collection
  4675. :PROPERTIES:
  4676. :NDisks_ALL: 1 2 3 4
  4677. :Publisher_ALL: "Deutsche Grammophon" Philips EMI
  4678. :END:
  4679. @end example
  4680. If you want to set properties that can be inherited by any entry in
  4681. a file, use a line like:
  4682. @cindex @samp{_ALL} suffix, in properties
  4683. @cindex @samp{PROPERTY}, keyword
  4684. @example
  4685. #+PROPERTY: NDisks_ALL 1 2 3 4
  4686. @end example
  4687. @cindex @samp{+} suffix, in properties
  4688. If you want to add to the value of an existing property, append a @samp{+}
  4689. to the property name. The following results in the property @samp{var}
  4690. having the value @samp{foo=1 bar=2}.
  4691. @example
  4692. #+PROPERTY: var foo=1
  4693. #+PROPERTY: var+ bar=2
  4694. @end example
  4695. It is also possible to add to the values of inherited properties. The
  4696. following results in the @samp{Genres} property having the value @samp{Classic
  4697. Baroque} under the @samp{Goldberg Variations} subtree.
  4698. @example
  4699. * CD collection
  4700. ** Classic
  4701. :PROPERTIES:
  4702. :Genres: Classic
  4703. :END:
  4704. *** Goldberg Variations
  4705. :PROPERTIES:
  4706. :Title: Goldberg Variations
  4707. :Composer: J.S. Bach
  4708. :Artist: Glen Gould
  4709. :Publisher: Deutsche Grammophon
  4710. :NDisks: 1
  4711. :Genres+: Baroque
  4712. :END:
  4713. @end example
  4714. Note that a property can only have one entry per drawer.
  4715. @vindex org-global-properties
  4716. Property values set with the global variable @code{org-global-properties}
  4717. can be inherited by all entries in all Org files.
  4718. @noindent
  4719. The following commands help to work with properties:
  4720. @table @asis
  4721. @item @kbd{M-@key{TAB}} (@code{pcomplete})
  4722. @kindex M-TAB
  4723. @findex pcomplete
  4724. After an initial colon in a line, complete property keys. All
  4725. keys used in the current file are offered as possible
  4726. completions.
  4727. @item @kbd{C-c C-x p} (@code{org-set-property})
  4728. @kindex C-c C-x p
  4729. @findex org-set-property
  4730. Set a property. This prompts for a property name and a value.
  4731. If necessary, the property drawer is created as well.
  4732. @item @kbd{C-u M-x org-insert-drawer}
  4733. @findex org-insert-drawer
  4734. Insert a property drawer into the current entry. The drawer is
  4735. inserted early in the entry, but after the lines with planning
  4736. information like deadlines.
  4737. @item @kbd{C-c C-c} (@code{org-property-action})
  4738. @kindex C-c C-c
  4739. @findex org-property-action
  4740. With the cursor in a property drawer, this executes property
  4741. commands.
  4742. @item @kbd{C-c C-c s} (@code{org-set-property})
  4743. @kindex C-c C-c s
  4744. @findex org-set-property
  4745. Set a property in the current entry. Both the property and the value
  4746. can be inserted using completion.
  4747. @item @kbd{S-@key{RIGHT}} (@code{org-property-next-allowed-values})
  4748. @itemx @kbd{S-@key{LEFT}} (@code{org-property-previous-allowed-value})
  4749. @kindex S-RIGHT
  4750. @kindex S-LEFT
  4751. Switch property at point to the next/previous allowed value.
  4752. @item @kbd{C-c C-c d} (@code{org-delete-property})
  4753. @kindex C-c C-c d
  4754. @findex org-delete-property
  4755. Remove a property from the current entry.
  4756. @item @kbd{C-c C-c D} (@code{org-delete-property-globally})
  4757. @kindex C-c C-c D
  4758. @findex org-delete-property-globally
  4759. Globally remove a property, from all entries in the current file.
  4760. @item @kbd{C-c C-c c} (@code{org-compute-property-at-point})
  4761. @kindex C-c C-c c
  4762. @findex org-compute-property-at-point
  4763. Compute the property at point, using the operator and scope from
  4764. the nearest column format definition.
  4765. @end table
  4766. @node Special Properties
  4767. @section Special Properties
  4768. @cindex properties, special
  4769. Special properties provide an alternative access method to Org mode
  4770. features, like the TODO state or the priority of an entry, discussed
  4771. in the previous chapters. This interface exists so that you can
  4772. include these states in a column view (see @ref{Column View}), or to use
  4773. them in queries. The following property names are special and should
  4774. not be used as keys in the properties drawer:
  4775. @cindex @samp{ALLTAGS}, special property
  4776. @cindex @samp{BLOCKED}, special property
  4777. @cindex @samp{CLOCKSUM}, special property
  4778. @cindex @samp{CLOCKSUM_T}, special property
  4779. @cindex @samp{CLOSED}, special property
  4780. @cindex @samp{DEADLINE}, special property
  4781. @cindex @samp{FILE}, special property
  4782. @cindex @samp{ITEM}, special property
  4783. @cindex @samp{PRIORITY}, special property
  4784. @cindex @samp{SCHEDULED}, special property
  4785. @cindex @samp{TAGS}, special property
  4786. @cindex @samp{TIMESTAMP}, special property
  4787. @cindex @samp{TIMESTAMP_IA}, special property
  4788. @cindex @samp{TODO}, special property
  4789. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4790. @item @samp{ALLTAGS}
  4791. @tab All tags, including inherited ones.
  4792. @item @samp{BLOCKED}
  4793. @tab @code{t} if task is currently blocked by children or siblings.
  4794. @item @samp{CATEGORY}
  4795. @tab The category of an entry.
  4796. @item @samp{CLOCKSUM}
  4797. @tab The sum of CLOCK intervals in the subtree. @code{org-clock-sum}
  4798. @item
  4799. @tab must be run first to compute the values in the current buffer.
  4800. @item @samp{CLOCKSUM_T}
  4801. @tab The sum of CLOCK intervals in the subtree for today.
  4802. @item
  4803. @tab @code{org-clock-sum-today} must be run first to compute the
  4804. @item
  4805. @tab values in the current buffer.
  4806. @item @samp{CLOSED}
  4807. @tab When was this entry closed?
  4808. @item @samp{DEADLINE}
  4809. @tab The deadline time string, without the angular brackets.
  4810. @item @samp{FILE}
  4811. @tab The filename the entry is located in.
  4812. @item @samp{ITEM}
  4813. @tab The headline of the entry.
  4814. @item @samp{PRIORITY}
  4815. @tab The priority of the entry, a string with a single letter.
  4816. @item @samp{SCHEDULED}
  4817. @tab The scheduling timestamp, without the angular brackets.
  4818. @item @samp{TAGS}
  4819. @tab The tags defined directly in the headline.
  4820. @item @samp{TIMESTAMP}
  4821. @tab The first keyword-less timestamp in the entry.
  4822. @item @samp{TIMESTAMP_IA}
  4823. @tab The first inactive timestamp in the entry.
  4824. @item @samp{TODO}
  4825. @tab The TODO keyword of the entry.
  4826. @end multitable
  4827. @node Property Searches
  4828. @section Property Searches
  4829. @cindex properties, searching
  4830. @cindex searching, of properties
  4831. To create sparse trees and special lists with selection based on
  4832. properties, the same commands are used as for tag searches (see @ref{Tag Searches}).
  4833. @table @asis
  4834. @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree})
  4835. @kindex C-c / m
  4836. @kindex C-c \
  4837. @findex org-match-sparse-tree
  4838. Create a sparse tree with all matching entries. With
  4839. a @kbd{C-u} prefix argument, ignore headlines that are not
  4840. a TODO line.
  4841. @item @kbd{C-c a m}, @code{org-tags-view}
  4842. @kindex C-c a m
  4843. Create a global list of tag/property matches from all agenda
  4844. files.
  4845. @item @kbd{C-c a M} (@code{org-tags-view})
  4846. @kindex C-c a M
  4847. @findex org-tags-view
  4848. @vindex org-tags-match-list-sublevels
  4849. Create a global list of tag matches from all agenda files, but
  4850. check only TODO items and force checking of subitems (see the
  4851. option @code{org-tags-match-list-sublevels}).
  4852. @end table
  4853. The syntax for the search string is described in @ref{Matching tags and properties}.
  4854. There is also a special command for creating sparse trees based on a
  4855. single property:
  4856. @table @asis
  4857. @item @kbd{C-c / p}
  4858. @kindex C-c / p
  4859. Create a sparse tree based on the value of a property. This
  4860. first prompts for the name of a property, and then for a value.
  4861. A sparse tree is created with all entries that define this
  4862. property with the given value. If you enclose the value in curly
  4863. braces, it is interpreted as a regular expression and matched
  4864. against the property values.
  4865. @end table
  4866. @node Property Inheritance
  4867. @section Property Inheritance
  4868. @cindex properties, inheritance
  4869. @cindex inheritance, of properties
  4870. @vindex org-use-property-inheritance
  4871. The outline structure of Org documents lends itself to an inheritance
  4872. model of properties: if the parent in a tree has a certain property,
  4873. the children can inherit this property. Org mode does not turn this
  4874. on by default, because it can slow down property searches
  4875. significantly and is often not needed. However, if you find
  4876. inheritance useful, you can turn it on by setting the variable
  4877. @code{org-use-property-inheritance}. It may be set to @code{t} to make all
  4878. properties inherited from the parent, to a list of properties that
  4879. should be inherited, or to a regular expression that matches inherited
  4880. properties. If a property has the value @code{nil}, this is interpreted as
  4881. an explicit un-define of the property, so that inheritance search
  4882. stops at this value and returns @code{nil}.
  4883. Org mode has a few properties for which inheritance is hard-coded, at
  4884. least for the special applications for which they are used:
  4885. @table @asis
  4886. @item @code{COLUMNS}
  4887. @cindex @samp{COLUMNS}, property
  4888. The @samp{COLUMNS} property defines the format of column view (see
  4889. @ref{Column View}). It is inherited in the sense that the level where
  4890. a @samp{COLUMNS} property is defined is used as the starting point for
  4891. a column view table, independently of the location in the subtree
  4892. from where columns view is turned on.
  4893. @item @code{CATEGORY}
  4894. @cindex @samp{CATEGORY}, property
  4895. For agenda view, a category set through a @samp{CATEGORY} property
  4896. applies to the entire subtree.
  4897. @item @code{ARCHIVE}
  4898. @cindex @samp{ARCHIVE}, property
  4899. For archiving, the @samp{ARCHIVE} property may define the archive
  4900. location for the entire subtree (see @ref{Moving subtrees}).
  4901. @item @code{LOGGING}
  4902. @cindex @samp{LOGGING}, property
  4903. The @samp{LOGGING} property may define logging settings for an entry
  4904. or a subtree (see @ref{Tracking TODO state changes}).
  4905. @end table
  4906. @node Column View
  4907. @section Column View
  4908. A great way to view and edit properties in an outline tree is @emph{column
  4909. view}. In column view, each outline node is turned into a table row.
  4910. Columns in this table provide access to properties of the entries.
  4911. Org mode implements columns by overlaying a tabular structure over the
  4912. headline of each item. While the headlines have been turned into
  4913. a table row, you can still change the visibility of the outline tree.
  4914. For example, you get a compact table by switching to ``contents''
  4915. view---@kbd{S-@key{TAB}} @kbd{S-@key{TAB}}, or simply @kbd{c}
  4916. while column view is active---but you can still open, read, and edit
  4917. the entry below each headline. Or, you can switch to column view
  4918. after executing a sparse tree command and in this way get a table only
  4919. for the selected items. Column view also works in agenda buffers (see
  4920. @ref{Agenda Views}) where queries have collected selected items, possibly
  4921. from a number of files.
  4922. @menu
  4923. * Defining columns:: The COLUMNS format property.
  4924. * Using column view:: How to create and use column view.
  4925. * Capturing column view:: A dynamic block for column view.
  4926. @end menu
  4927. @node Defining columns
  4928. @subsection Defining columns
  4929. @cindex column view, for properties
  4930. @cindex properties, column view
  4931. Setting up a column view first requires defining the columns. This is
  4932. done by defining a column format line.
  4933. @menu
  4934. * Scope of column definitions:: Where defined, where valid?
  4935. * Column attributes:: Appearance and content of a column.
  4936. @end menu
  4937. @node Scope of column definitions
  4938. @subsubsection Scope of column definitions
  4939. To define a column format for an entire file, use a line like:
  4940. @cindex @samp{COLUMNS}, keyword
  4941. @example
  4942. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4943. @end example
  4944. To specify a format that only applies to a specific tree, add
  4945. a @samp{COLUMNS} property to the top node of that tree, for example:
  4946. @example
  4947. ** Top node for columns view
  4948. :PROPERTIES:
  4949. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  4950. :END:
  4951. @end example
  4952. If a @samp{COLUMNS} property is present in an entry, it defines columns for
  4953. the entry itself, and for the entire subtree below it. Since the
  4954. column definition is part of the hierarchical structure of the
  4955. document, you can define columns on level 1 that are general enough
  4956. for all sublevels, and more specific columns further down, when you
  4957. edit a deeper part of the tree.
  4958. @node Column attributes
  4959. @subsubsection Column attributes
  4960. A column definition sets the attributes of a column. The general
  4961. definition looks like this:
  4962. @example
  4963. %[WIDTH]PROPERTY[(TITLE)][@{SUMMARY-TYPE@}]
  4964. @end example
  4965. @noindent
  4966. Except for the percent sign and the property name, all items are
  4967. optional. The individual parts have the following meaning:
  4968. @table @asis
  4969. @item @var{WIDTH}
  4970. An integer specifying the width of the column in characters. If
  4971. omitted, the width is determined automatically.
  4972. @item @var{PROPERTY}
  4973. The property that should be edited in this column. Special
  4974. properties representing meta data are allowed here as well (see
  4975. @ref{Special Properties}).
  4976. @item @var{TITLE}
  4977. The header text for the column. If omitted, the property name is
  4978. used.
  4979. @item @var{SUMMARY-TYPE}
  4980. The summary type. If specified, the column values for parent
  4981. nodes are computed from the children@footnote{If more than one summary type applies to the same property,
  4982. the parent values are computed according to the first of them.}.
  4983. Supported summary types are:
  4984. @multitable {aaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  4985. @item @samp{+}
  4986. @tab Sum numbers in this column.
  4987. @item @samp{+;%.1f}
  4988. @tab Like @samp{+}, but format result with @samp{%.1f}.
  4989. @item @samp{$}
  4990. @tab Currency, short for @samp{+;%.2f}.
  4991. @item @samp{min}
  4992. @tab Smallest number in column.
  4993. @item @samp{max}
  4994. @tab Largest number.
  4995. @item @samp{mean}
  4996. @tab Arithmetic mean of numbers.
  4997. @item @samp{X}
  4998. @tab Checkbox status, @samp{[X]} if all children are @samp{[X]}.
  4999. @item @samp{X/}
  5000. @tab Checkbox status, @samp{[n/m]}.
  5001. @item @samp{X%}
  5002. @tab Checkbox status, @samp{[n%]}.
  5003. @item @samp{:}
  5004. @tab Sum times, HH:MM, plain numbers are hours.
  5005. @item @samp{:min}
  5006. @tab Smallest time value in column.
  5007. @item @samp{:max}
  5008. @tab Largest time value.
  5009. @item @samp{:mean}
  5010. @tab Arithmetic mean of time values.
  5011. @item @samp{@@min}
  5012. @tab Minimum age@footnote{An age is defined as a duration, using effort modifiers
  5013. defined in @code{org-effort-durations}, e.g., @samp{3d 1h}. If any value in the
  5014. column is as such, the summary is also an effort duration.} (in days/hours/mins/seconds).
  5015. @item @samp{@@max}
  5016. @tab Maximum age (in days/hours/mins/seconds).
  5017. @item @samp{@@mean}
  5018. @tab Arithmetic mean of ages (in days/hours/mins/seconds).
  5019. @item @samp{est+}
  5020. @tab Add low-high estimates.
  5021. @end multitable
  5022. @noindent
  5023. @vindex org-columns-summary-types
  5024. You can also define custom summary types by setting
  5025. @code{org-columns-summary-types}.
  5026. @end table
  5027. The @samp{est+} summary type requires further explanation. It is used for
  5028. combining estimates, expressed as low-high ranges. For example,
  5029. instead of estimating a particular task will take 5 days, you might
  5030. estimate it as 5--6 days if you're fairly confident you know how much
  5031. work is required, or 1--10 days if you do not really know what needs
  5032. to be done. Both ranges average at 5.5 days, but the first represents
  5033. a more predictable delivery.
  5034. When combining a set of such estimates, simply adding the lows and
  5035. highs produces an unrealistically wide result. Instead, @samp{est+} adds
  5036. the statistical mean and variance of the sub-tasks, generating a final
  5037. estimate from the sum. For example, suppose you had ten tasks, each
  5038. of which was estimated at 0.5 to 2 days of work. Straight addition
  5039. produces an estimate of 5 to 20 days, representing what to expect if
  5040. everything goes either extremely well or extremely poorly. In
  5041. contrast, @samp{est+} estimates the full job more realistically, at 10--15
  5042. days.
  5043. Here is an example for a complete columns definition, along with
  5044. allowed values@footnote{Please note that the @samp{COLUMNS} definition must be on a single
  5045. line; it is wrapped here only because of formatting constraints.}.
  5046. @example
  5047. :COLUMNS: %25ITEM %9Approved(Approved?)@{X@} %Owner %11Status \
  5048. %10Time_Estimate@{:@} %CLOCKSUM %CLOCKSUM_T
  5049. :Owner_ALL: Tammy Mark Karl Lisa Don
  5050. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  5051. :Approved_ALL: "[ ]" "[X]"
  5052. @end example
  5053. @noindent
  5054. The first column, @samp{%25ITEM}, means the first 25 characters of the item
  5055. itself, i.e., of the headline. You probably always should start the
  5056. column definition with the @samp{ITEM} specifier. The other specifiers
  5057. create columns @samp{Owner} with a list of names as allowed values, for
  5058. @samp{Status} with four different possible values, and for a checkbox field
  5059. @samp{Approved}. When no width is given after the @samp{%} character, the
  5060. column is exactly as wide as it needs to be in order to fully display
  5061. all values. The @samp{Approved} column does have a modified title
  5062. (@samp{Approved?}, with a question mark). Summaries are created for the
  5063. @samp{Time_Estimate} column by adding time duration expressions like HH:MM,
  5064. and for the @samp{Approved} column, by providing an @samp{[X]} status if all
  5065. children have been checked. The @samp{CLOCKSUM} and @samp{CLOCKSUM_T} columns
  5066. are special, they lists the sums of CLOCK intervals in the subtree,
  5067. either for all clocks or just for today.
  5068. @node Using column view
  5069. @subsection Using column view
  5070. @anchor{Turning column view on or off}
  5071. @subsubheading Turning column view on or off
  5072. @table @asis
  5073. @item @kbd{C-c C-x C-c} (@code{org-columns})
  5074. @kindex C-c C-x C-c
  5075. @vindex org-columns
  5076. @vindex org-columns-default-format
  5077. Turn on column view. If the cursor is before the first headline
  5078. in the file, column view is turned on for the entire file, using
  5079. the @samp{#+COLUMNS} definition. If the cursor is somewhere inside
  5080. the outline, this command searches the hierarchy, up from point,
  5081. for a @samp{COLUMNS} property that defines a format. When one is
  5082. found, the column view table is established for the tree starting
  5083. at the entry that contains the @samp{COLUMNS} property. If no such
  5084. property is found, the format is taken from the @samp{#+COLUMNS} line
  5085. or from the variable @code{org-columns-default-format}, and column
  5086. view is established for the current entry and its subtree.
  5087. @item @kbd{r} or @kbd{g} (@code{org-columns-redo})
  5088. @kindex r
  5089. @kindex g
  5090. @findex org-columns-redo
  5091. Recreate the column view, to include recent changes made in the
  5092. buffer.
  5093. @item @kbd{q} (@code{org-columns-quit})
  5094. @kindex q
  5095. @findex org-columns-quit
  5096. Exit column view.
  5097. @end table
  5098. @anchor{Editing values}
  5099. @subsubheading Editing values
  5100. @table @asis
  5101. @item @kbd{@key{LEFT}}, @kbd{@key{RIGHT}}, @kbd{@key{UP}}, @kbd{@key{DOWN}}
  5102. Move through the column view from field to field.
  5103. @item @kbd{1..9,0}
  5104. @kindex 1..9,0
  5105. Directly select the Nth allowed value, @kbd{0} selects the
  5106. 10th value.
  5107. @item @kbd{n} or @kbd{S-@key{RIGHT}} (@code{org-columns-next-allowed-value})
  5108. @itemx @kbd{p} or @kbd{S-@key{LEFT}} (@code{org-columns-previous-allowed-value})
  5109. @kindex n
  5110. @kindex S-RIGHT
  5111. @kindex p
  5112. @kindex S-LEFT
  5113. @findex org-columns-next-allowed-value
  5114. @findex org-columns-previous-allowed-value
  5115. Switch to the next/previous allowed value of the field. For
  5116. this, you have to have specified allowed values for a property.
  5117. @item @kbd{e} (@code{org-columns-edit-value})
  5118. @kindex e
  5119. @findex org-columns-edit-value
  5120. Edit the property at point. For the special properties, this
  5121. invokes the same interface that you normally use to change that
  5122. property. For example, the tag completion or fast selection
  5123. interface pops up when editing a @samp{TAGS} property.
  5124. @item @kbd{C-c C-c} (@code{org-columns-set-tags-or-toggle})
  5125. @kindex C-c C-c
  5126. @findex org-columns-set-tags-or-toggle
  5127. When there is a checkbox at point, toggle it.
  5128. @item @kbd{v} (@code{org-columns-show-value})
  5129. @kindex v
  5130. @findex org-columns-show-value
  5131. View the full value of this property. This is useful if the
  5132. width of the column is smaller than that of the value.
  5133. @item @kbd{a} (@code{org-columns-edit-allowed})
  5134. @kindex a
  5135. @findex org-columns-edit-allowed
  5136. Edit the list of allowed values for this property. If the list
  5137. is found in the hierarchy, the modified values is stored there.
  5138. If no list is found, the new value is stored in the first entry
  5139. that is part of the current column view.
  5140. @end table
  5141. @anchor{Modifying column view on-the-fly}
  5142. @subsubheading Modifying column view on-the-fly:
  5143. @table @asis
  5144. @item @kbd{<} (@code{org-columns-narrow})
  5145. @itemx @kbd{>} (@code{org-columns-widen})
  5146. @kindex <
  5147. @kindex >
  5148. @findex org-columns-narrow
  5149. @findex org-columns-widen
  5150. Make the column narrower/wider by one character.
  5151. @item @kbd{S-M-@key{RIGHT}} (@code{org-columns-new})
  5152. @kindex S-M-RIGHT
  5153. @findex org-columns-new
  5154. Insert a new column, to the left of the current column.
  5155. @item @kbd{S-M-@key{LEFT}} (@code{org-columns-delete})
  5156. @kindex S-M-LEFT
  5157. @findex org-columns-delete
  5158. Delete the current column.
  5159. @end table
  5160. @node Capturing column view
  5161. @subsection Capturing column view
  5162. Since column view is just an overlay over a buffer, it cannot be
  5163. exported or printed directly. If you want to capture a column view,
  5164. use a @samp{columnview} dynamic block (see @ref{Dynamic Blocks}). The frame of
  5165. this block looks like this:
  5166. @cindex @samp{BEGIN columnview}
  5167. @example
  5168. * The column view
  5169. #+BEGIN: columnview :hlines 1 :id "label"
  5170. #+END:
  5171. @end example
  5172. @noindent
  5173. This dynamic block has the following parameters:
  5174. @table @asis
  5175. @item @samp{:id}
  5176. This is the most important parameter. Column view is a feature
  5177. that is often localized to a certain (sub)tree, and the capture
  5178. block might be at a different location in the file. To identify
  5179. the tree whose view to capture, you can use four values:
  5180. @table @asis
  5181. @item @samp{local}
  5182. Use the tree in which the capture block is located.
  5183. @item @samp{global}
  5184. Make a global view, including all headings in the file.
  5185. @item @samp{file:FILENAME}
  5186. Run column view at the top of the @var{FILENAME} file
  5187. @item @samp{LABEL}
  5188. @cindex @samp{ID}, property
  5189. Call column view in the tree that has an @samp{ID} property with
  5190. the value @var{LABEL}. You can use @kbd{M-x org-id-copy} to create a globally unique ID for the
  5191. current entry and copy it to the kill-ring.
  5192. @end table
  5193. @item @samp{:hlines}
  5194. When @code{t}, insert an hline after every line. When a number N,
  5195. insert an hline before each headline with level @code{<= N}.
  5196. @item @samp{:vlines}
  5197. When non-@code{nil}, force column groups to get vertical lines.
  5198. @item @samp{:maxlevel}
  5199. When set to a number, do not capture entries below this level.
  5200. @item @samp{:skip-empty-rows}
  5201. When non-@code{nil}, skip rows where the only non-empty specifier of
  5202. the column view is @samp{ITEM}.
  5203. @item @samp{:indent}
  5204. When non-@code{nil}, indent each @samp{ITEM} field according to its level.
  5205. @end table
  5206. @noindent
  5207. The following commands insert or update the dynamic block:
  5208. @table @asis
  5209. @item @kbd{C-c C-x i} (@code{org-insert-columns-dblock})
  5210. @kindex C-c C-x i
  5211. @findex org-insert-columns-dblock
  5212. Insert a dynamic block capturing a column view. Prompt for the
  5213. scope or ID of the view.
  5214. @item @kbd{C-c C-c} @kbd{C-c C-x C-u} (@code{org-dblock-update})
  5215. @kindex C-c C-c
  5216. @kindex C-c C-x C-u
  5217. @findex org-dblock-update
  5218. Update dynamic block at point. The cursor needs to be in the
  5219. @samp{#+BEGIN} line of the dynamic block.
  5220. @item @kbd{C-u C-c C-x C-u} (@code{org-update-all-dblocks})
  5221. @kindex C-u C-c C-x C-u
  5222. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  5223. if you have several clock table blocks, column-capturing blocks
  5224. or other dynamic blocks in a buffer.
  5225. @end table
  5226. You can add formulas to the column view table and you may add plotting
  5227. instructions in front of the table---these survive an update of the
  5228. block. If there is a @samp{TBLFM} keyword after the table, the table is
  5229. recalculated automatically after an update.
  5230. An alternative way to capture and process property values into a table
  5231. is provided by Eric Schulte's @samp{org-collector.el} which is
  5232. a contributed package@footnote{Contributed packages are not part of Emacs, but are
  5233. distributed with the main distribution of Org---visit
  5234. @uref{https://orgmode.org}.}. It provides a general API to collect
  5235. properties from entries in a certain scope, and arbitrary Lisp
  5236. expressions to process these values before inserting them into a table
  5237. or a dynamic block.
  5238. @node Dates and Times
  5239. @chapter Dates and Times
  5240. @cindex dates
  5241. @cindex times
  5242. @cindex timestamp
  5243. @cindex date stamp
  5244. To assist project planning, TODO items can be labeled with a date
  5245. and/or a time. The specially formatted string carrying the date and
  5246. time information is called a @emph{timestamp} in Org mode. This may be
  5247. a little confusing because timestamp is often used as indicating when
  5248. something was created or last changed. However, in Org mode this term
  5249. is used in a much wider sense.
  5250. @menu
  5251. * Timestamps:: Assigning a time to a tree entry.
  5252. * Creating Timestamps:: Commands to insert timestamps.
  5253. * Deadlines and Scheduling:: Planning your work.
  5254. * Clocking Work Time:: Tracking how long you spend on a task.
  5255. * Effort Estimates:: Planning work effort in advance.
  5256. * Timers:: Notes with a running timer.
  5257. @end menu
  5258. @node Timestamps
  5259. @section Timestamps, Deadlines and Scheduling
  5260. @cindex timestamps
  5261. @cindex ranges, time
  5262. @cindex date stamps
  5263. @cindex deadlines
  5264. @cindex scheduling
  5265. A timestamp is a specification of a date (possibly with a time or
  5266. a range of times) in a special format, either @samp{<2003-09-16 Tue>} or
  5267. @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
  5268. date/time format. To use an alternative format, see @ref{Custom time format}. The day name is optional when you type the date yourself.
  5269. However, any date inserted or modified by Org adds that day name, for
  5270. reading convenience.}.
  5271. A timestamp can appear anywhere in the headline or body of an Org tree
  5272. entry. Its presence causes entries to be shown on specific dates in
  5273. the agenda (see @ref{Weekly/daily agenda}). We distinguish:
  5274. @table @asis
  5275. @item Plain timestamp; Event; Appointment
  5276. @cindex timestamp
  5277. @cindex appointment
  5278. A simple timestamp just assigns a date/time to an item. This is
  5279. just like writing down an appointment or event in a paper agenda.
  5280. In the timeline and agenda displays, the headline of an entry
  5281. associated with a plain timestamp is shown exactly on that date.
  5282. @example
  5283. * Meet Peter at the movies
  5284. <2006-11-01 Wed 19:15>
  5285. * Discussion on climate change
  5286. <2006-11-02 Thu 20:00-22:00>
  5287. @end example
  5288. @item Timestamp with repeater interval
  5289. @cindex timestamp, with repeater interval
  5290. A timestamp may contain a @emph{repeater interval}, indicating that it
  5291. applies not only on the given date, but again and again after
  5292. a certain interval of N days (d), weeks (w), months (m), or years
  5293. (y). The following shows up in the agenda every Wednesday:
  5294. @example
  5295. * Pick up Sam at school
  5296. <2007-05-16 Wed 12:30 +1w>
  5297. @end example
  5298. @item Diary-style sexp entries
  5299. @cindex diary style timestamps
  5300. @cindex sexp timestamps
  5301. For more complex date specifications, Org mode supports using the
  5302. special sexp diary entries implemented in the Emacs
  5303. calendar/diary package@footnote{When working with the standard diary sexp functions, you need
  5304. to be very careful with the order of the arguments. That order
  5305. depends evilly on the variable @code{calendar-date-style}. For example, to
  5306. specify a date December 12, 2005, the call might look like
  5307. @samp{(diary-date 12 1 2005)} or @samp{(diary-date 1 12 2005)} or @samp{(diary-date
  5308. 2005 12 1)}, depending on the settings. This has been the source of
  5309. much confusion. Org mode users can resort to special versions of
  5310. these functions like @code{org-date} or @code{org-anniversary}. These work just
  5311. like the corresponding @code{diary-} functions, but with stable ISO order
  5312. of arguments (year, month, day) wherever applicable, independent of
  5313. the value of @code{calendar-date-style}.}. For example, with optional time:
  5314. @example
  5315. * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
  5316. <%%(org-float t 4 2)>
  5317. @end example
  5318. @item Time/Date range
  5319. @cindex timerange
  5320. @cindex date range
  5321. Two timestamps connected by @samp{--} denote a range. The headline is
  5322. shown on the first and last day of the range, and on any dates
  5323. that are displayed and fall in the range. Here is an example:
  5324. @example
  5325. ** Meeting in Amsterdam
  5326. <2004-08-23 Mon>--<2004-08-26 Thu>
  5327. @end example
  5328. @item Inactive timestamp
  5329. @cindex timestamp, inactive
  5330. @cindex inactive timestamp
  5331. Just like a plain timestamp, but with square brackets instead of
  5332. angular ones. These timestamps are inactive in the sense that
  5333. they do @emph{not} trigger an entry to show up in the agenda.
  5334. @example
  5335. * Gillian comes late for the fifth time
  5336. [2006-11-01 Wed]
  5337. @end example
  5338. @end table
  5339. @node Creating Timestamps
  5340. @section Creating Timestamps
  5341. For Org mode to recognize timestamps, they need to be in the specific
  5342. format. All commands listed below produce timestamps in the correct
  5343. format.
  5344. @table @asis
  5345. @item @kbd{C-c .} (@code{org-time-stamp})
  5346. @kindex C-c .
  5347. @findex org-time-stamp
  5348. Prompt for a date and insert a corresponding timestamp. When the
  5349. cursor is at an existing timestamp in the buffer, the command is
  5350. used to modify this timestamp instead of inserting a new one.
  5351. When this command is used twice in succession, a time range is
  5352. inserted.
  5353. @kindex C-u C-c .
  5354. @vindex org-time-stamp-rounding-minutes
  5355. When called with a prefix argument, use the alternative format
  5356. which contains date and time. The default time can be rounded to
  5357. multiples of 5 minutes. See the option
  5358. @code{org-time-stamp-rounding-minutes}.
  5359. @kindex C-u C-u C-c .
  5360. With two prefix arguments, insert an active timestamp with the
  5361. current time without prompting.
  5362. @item @kbd{C-c !} (@code{org-time-stamp-inactive})
  5363. @kindex C-c !
  5364. @kindex C-u C-c !
  5365. @kindex C-u C-u C-c !
  5366. @findex org-time-stamp-inactive
  5367. Like @kbd{C-c .}, but insert an inactive timestamp that does
  5368. not cause an agenda entry.
  5369. @item @kbd{C-c C-c}
  5370. @kindex C-c C-c
  5371. Normalize timestamp, insert or fix day name if missing or wrong.
  5372. @item @kbd{C-c <} (@code{org-date-from-calendar})
  5373. @kindex C-c <
  5374. @findex org-date-from-calendar
  5375. Insert a timestamp corresponding to the cursor date in the
  5376. calendar.
  5377. @item @kbd{C-c >} (@code{org-goto-calendar})
  5378. @kindex C-c >
  5379. @findex org-goto-calendar
  5380. Access the Emacs calendar for the current date. If there is
  5381. a timestamp in the current line, go to the corresponding date
  5382. instead.
  5383. @item @kbd{C-c C-o} (@code{org-open-at-point})
  5384. @kindex C-c C-o
  5385. @findex org-open-at-point
  5386. Access the agenda for the date given by the timestamp or -range
  5387. at point (see @ref{Weekly/daily agenda}).
  5388. @item @kbd{S-@key{LEFT}} (@code{org-timestamp-down-day})
  5389. @itemx @kbd{S-@key{RIGHT}} (@code{org-timestamp-up-day})
  5390. @kindex S-LEFT
  5391. @kindex S-RIGHT
  5392. @findex org-timestamp-down-day
  5393. @findex org-timestamp-up-day
  5394. Change date at cursor by one day. These key bindings conflict
  5395. with shift-selection and related modes (see @ref{Conflicts}).
  5396. @item @kbd{S-@key{UP}} (@code{org-timestamp-up})
  5397. @itemx @kbd{S-@key{DOWN}} (@code{org-timestamp-down})
  5398. @kindex S-UP
  5399. @kindex S-DOWN
  5400. Change the item under the cursor in a timestamp. The cursor can
  5401. be on a year, month, day, hour or minute. When the timestamp
  5402. contains a time range like @samp{15:30-16:30}, modifying the first
  5403. time also shifts the second, shifting the time block with
  5404. constant length. To change the length, modify the second time.
  5405. Note that if the cursor is in a headline and not at a timestamp,
  5406. these same keys modify the priority of an item. (see
  5407. @ref{Priorities}). The key bindings also conflict with
  5408. shift-selection and related modes (see @ref{Conflicts}).
  5409. @item @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5410. @kindex C-c C-y
  5411. @findex org-evaluate-time-range
  5412. @cindex evaluate time range
  5413. Evaluate a time range by computing the difference between start
  5414. and end. With a prefix argument, insert result after the time
  5415. range (in a table: into the following column).
  5416. @end table
  5417. @menu
  5418. * The date/time prompt:: How Org mode helps you enter dates and times.
  5419. * Custom time format:: Making dates look different.
  5420. @end menu
  5421. @node The date/time prompt
  5422. @subsection The date/time prompt
  5423. @cindex date, reading in minibuffer
  5424. @cindex time, reading in minibuffer
  5425. @vindex org-read-date-prefer-future
  5426. When Org mode prompts for a date/time, the default is shown in default
  5427. date/time format, and the prompt therefore seems to ask for a specific
  5428. format. But it in fact accepts date/time information in a variety of
  5429. formats. Generally, the information should start at the beginning of
  5430. the string. Org mode finds whatever information is in there and
  5431. derives anything you have not specified from the @emph{default date and
  5432. time}. The default is usually the current date and time, but when
  5433. modifying an existing timestamp, or when entering the second stamp of
  5434. a range, it is taken from the stamp in the buffer. When filling in
  5435. information, Org mode assumes that most of the time you want to enter
  5436. a date in the future: if you omit the month/year and the given
  5437. day/month is @emph{before} today, it assumes that you mean a future
  5438. date@footnote{See the variable @code{org-read-date-prefer-future}. You may set
  5439. that variable to the symbol @code{time} to even make a time before now
  5440. shift the date to tomorrow.}. If the date has been automatically shifted into the
  5441. future, the time prompt shows this with @samp{(=>F)}.
  5442. For example, let's assume that today is @strong{June 13, 2006}. Here is how
  5443. various inputs are interpreted, the items filled in by Org mode are in
  5444. @strong{bold}.
  5445. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5446. @item @samp{3-2-5}
  5447. @tab @result{} 2003-02-05
  5448. @item @samp{2/5/3}
  5449. @tab @result{} 2003-02-05
  5450. @item @samp{14}
  5451. @tab @result{} @strong{2006}-@strong{06}-14
  5452. @item @samp{12}
  5453. @tab @result{} @strong{2006}-@strong{07}-12
  5454. @item @samp{2/5}
  5455. @tab @result{} @strong{2007}-02-05
  5456. @item @samp{Fri}
  5457. @tab @result{} nearest Friday (default date or later)
  5458. @item @samp{sep 15}
  5459. @tab @result{} @strong{2006}-09-15
  5460. @item @samp{feb 15}
  5461. @tab @result{} @strong{2007}-02-15
  5462. @item @samp{sep 12 9}
  5463. @tab @result{} 2009-09-12
  5464. @item @samp{12:45}
  5465. @tab @result{} @strong{2006}-@strong{06}-@strong{13} 12:45
  5466. @item @samp{22 sept 0:34}
  5467. @tab @result{} @strong{2006}-09-22 0:34
  5468. @item @samp{w4}
  5469. @tab @result{} ISO week for of the current year @strong{2006}
  5470. @item @samp{2012 w4 fri}
  5471. @tab @result{} Friday of ISO week 4 in 2012
  5472. @item @samp{2012-w04-5}
  5473. @tab @result{} Same as above
  5474. @end multitable
  5475. Furthermore you can specify a relative date by giving, as the @emph{first}
  5476. thing in the input: a plus/minus sign, a number and a letter---@samp{d},
  5477. @samp{w}, @samp{m} or @samp{y}---to indicate change in days, weeks, months, or
  5478. years. With a single plus or minus, the date is always relative to
  5479. today. With a double plus or minus, it is relative to the default
  5480. date. If instead of a single letter, you use the abbreviation of day
  5481. name, the date is the Nth such day, e.g.:
  5482. @multitable {aaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  5483. @item @samp{+0}
  5484. @tab @result{} today
  5485. @item @samp{.}
  5486. @tab @result{} today
  5487. @item @samp{+4d}
  5488. @tab @result{} four days from today
  5489. @item @samp{+4}
  5490. @tab @result{} same as +4d
  5491. @item @samp{+2w}
  5492. @tab @result{} two weeks from today
  5493. @item @samp{++5}
  5494. @tab @result{} five days from default date
  5495. @item @samp{+2tue}
  5496. @tab @result{} second Tuesday from now
  5497. @end multitable
  5498. @vindex parse-time-months
  5499. @vindex parse-time-weekdays
  5500. The function understands English month and weekday abbreviations. If
  5501. you want to use un-abbreviated names and/or other languages, configure
  5502. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  5503. @vindex org-read-date-force-compatible-dates
  5504. Not all dates can be represented in a given Emacs implementation. By
  5505. default Org mode forces dates into the compatibility range 1970--2037
  5506. which works on all Emacs implementations. If you want to use dates
  5507. outside of this range, read the docstring of the variable
  5508. @code{org-read-date-force-compatible-dates}.
  5509. You can specify a time range by giving start and end times or by
  5510. giving a start time and a duration (in HH:MM format). Use one or two
  5511. dash(es) as the separator in the former case and use @samp{+} as the
  5512. separator in the latter case, e.g.:
  5513. @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  5514. @item @samp{11am-1:15pm}
  5515. @tab @result{} 11:00-13:15
  5516. @item @samp{11am--1:15pm}
  5517. @tab @result{} same as above
  5518. @item @samp{11am+2:15}
  5519. @tab @result{} same as above
  5520. @end multitable
  5521. @cindex calendar, for selecting date
  5522. @vindex org-popup-calendar-for-date-prompt
  5523. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If you do not need/want the calendar, configure the variable
  5524. @code{org-popup-calendar-for-date-prompt}.}.
  5525. When you exit the date prompt, either by clicking on a date in the
  5526. calendar, or by pressing @kbd{@key{RET}}, the date selected in the
  5527. calendar is combined with the information entered at the prompt. You
  5528. can control the calendar fully from the minibuffer:
  5529. @kindex <
  5530. @kindex >
  5531. @kindex M-v
  5532. @kindex C-v
  5533. @kindex mouse-1
  5534. @kindex S-RIGHT
  5535. @kindex S-LEFT
  5536. @kindex S-DOWN
  5537. @kindex S-UP
  5538. @kindex M-S-RIGHT
  5539. @kindex M-S-LEFT
  5540. @kindex RET
  5541. @multitable @columnfractions 0.25 0.55
  5542. @item @kbd{@key{RET}}
  5543. @tab Choose date at cursor in calendar.
  5544. @item @kbd{mouse-1}
  5545. @tab Select date by clicking on it.
  5546. @item @kbd{S-@key{RIGHT}}
  5547. @tab One day forward.
  5548. @item @kbd{S-@key{LEFT}}
  5549. @tab One day backward.
  5550. @item @kbd{S-@key{DOWN}}
  5551. @tab One week forward.
  5552. @item @kbd{S-@key{UP}}
  5553. @tab One week backward.
  5554. @item @kbd{M-S-@key{RIGHT}}
  5555. @tab One month forward.
  5556. @item @kbd{M-S-@key{LEFT}}
  5557. @tab One month backward.
  5558. @item @kbd{>}
  5559. @tab Scroll calendar forward by one month.
  5560. @item @kbd{<}
  5561. @tab Scroll calendar backward by one month.
  5562. @item @kbd{M-v}
  5563. @tab Scroll calendar forward by 3 months.
  5564. @item @kbd{C-v}
  5565. @tab Scroll calendar backward by 3 months.
  5566. @end multitable
  5567. @vindex org-read-date-display-live
  5568. The actions of the date/time prompt may seem complex, but I assure you
  5569. they will grow on you, and you will start getting annoyed by pretty
  5570. much any other way of entering a date/time out there. To help you
  5571. understand what is going on, the current interpretation of your input
  5572. is displayed live in the minibuffer@footnote{If you find this distracting, turn off the display with
  5573. @code{org-read-date-display-live}.}.
  5574. @node Custom time format
  5575. @subsection Custom time format
  5576. @cindex custom date/time format
  5577. @cindex time format, custom
  5578. @cindex date format, custom
  5579. @vindex org-display-custom-times
  5580. @vindex org-time-stamp-custom-formats
  5581. Org mode uses the standard ISO notation for dates and times as it is
  5582. defined in ISO 8601. If you cannot get used to this and require
  5583. another representation of date and time to keep you happy, you can get
  5584. it by customizing the variables @code{org-display-custom-times} and
  5585. @code{org-time-stamp-custom-formats}.
  5586. @table @asis
  5587. @item @kbd{C-c C-x C-t} (@code{org-toggle-time-stamp-overlays})
  5588. @kindex C-c C-x C-t
  5589. @findex org-toggle-time-stamp-overlays
  5590. Toggle the display of custom formats for dates and times.
  5591. @end table
  5592. @noindent
  5593. Org mode needs the default format for scanning, so the custom
  5594. date/time format does not @emph{replace} the default format. Instead, it
  5595. is put @emph{over} the default format using text properties. This has the
  5596. following consequences:
  5597. @itemize
  5598. @item
  5599. You cannot place the cursor onto a timestamp anymore, only before or
  5600. after.
  5601. @item
  5602. The @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} keys can no longer be used
  5603. to adjust each component of a timestamp. If the cursor is at the
  5604. beginning of the stamp, @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} change
  5605. the stamp by one day, just like @kbd{S-@key{LEFT}}
  5606. @kbd{S-@key{RIGHT}}. At the end of the stamp, change the time by one
  5607. minute.
  5608. @item
  5609. If the timestamp contains a range of clock times or a repeater,
  5610. these are not overlaid, but remain in the buffer as they were.
  5611. @item
  5612. When you delete a timestamp character-by-character, it only
  5613. disappears from the buffer after @emph{all} (invisible) characters
  5614. belonging to the ISO timestamp have been removed.
  5615. @item
  5616. If the custom timestamp format is longer than the default and you
  5617. are using dates in tables, table alignment will be messed up. If
  5618. the custom format is shorter, things do work as expected.
  5619. @end itemize
  5620. @node Deadlines and Scheduling
  5621. @section Deadlines and Scheduling
  5622. A timestamp may be preceded by special keywords to facilitate
  5623. planning. Both the timestamp and the keyword have to be positioned
  5624. immediately after the task they refer to.
  5625. @table @asis
  5626. @item @samp{DEADLINE}
  5627. @cindex @samp{DEADLINE}
  5628. Meaning: the task (most likely a TODO item, though not
  5629. necessarily) is supposed to be finished on that date.
  5630. @vindex org-deadline-warning-days
  5631. On the deadline date, the task is listed in the agenda. In
  5632. addition, the agenda for @emph{today} carries a warning about the
  5633. approaching or missed deadline, starting
  5634. @code{org-deadline-warning-days} before the due date, and continuing
  5635. until the entry is marked DONE. An example:
  5636. @example
  5637. *** TODO write article about the Earth for the Guide
  5638. DEADLINE: <2004-02-29 Sun>
  5639. The editor in charge is [[bbdb:Ford Prefect]]
  5640. @end example
  5641. @vindex org-agenda-skip-deadline-prewarning-if-scheduled
  5642. You can specify a different lead time for warnings for a specific
  5643. deadlines using the following syntax. Here is an example with
  5644. a warning period of 5 days @samp{DEADLINE: <2004-02-29 Sun -5d>}.
  5645. This warning is deactivated if the task gets scheduled and you
  5646. set @code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}.
  5647. @item @samp{SCHEDULED}
  5648. @cindex @samp{SCHEDULED}
  5649. Meaning: you are planning to start working on that task on the
  5650. given date.
  5651. @vindex org-agenda-skip-scheduled-if-done
  5652. The headline is listed under the given date@footnote{It will still be listed on that date after it has been marked
  5653. DONE. If you do not like this, set the variable
  5654. @code{org-agenda-skip-scheduled-if-done}.}. In addition,
  5655. a reminder that the scheduled date has passed is present in the
  5656. compilation for @emph{today}, until the entry is marked DONE, i.e.,
  5657. the task is automatically forwarded until completed.
  5658. @example
  5659. *** TODO Call Trillian for a date on New Years Eve.
  5660. SCHEDULED: <2004-12-25 Sat>
  5661. @end example
  5662. @vindex org-scheduled-delay-days
  5663. @vindex org-agenda-skip-scheduled-delay-if-deadline
  5664. If you want to @emph{delay} the display of this task in the agenda,
  5665. use @samp{SCHEDULED: <2004-12-25 Sat -2d>}: the task is still
  5666. scheduled on the 25th but will appear two days later. In case
  5667. the task contains a repeater, the delay is considered to affect
  5668. all occurrences; if you want the delay to only affect the first
  5669. scheduled occurrence of the task, use @samp{--2d} instead. See
  5670. @code{org-scheduled-delay-days} and
  5671. @code{org-agenda-skip-scheduled-delay-if-deadline} for details on how
  5672. to control this globally or per agenda.
  5673. @noindent
  5674. @strong{Important:} Scheduling an item in Org mode should @emph{not} be
  5675. understood in the same way that we understand @emph{scheduling
  5676. a meeting}. Setting a date for a meeting is just a simple
  5677. appointment, you should mark this entry with a simple plain
  5678. timestamp, to get this item shown on the date where it applies.
  5679. This is a frequent misunderstanding by Org users. In Org mode,
  5680. @emph{scheduling} means setting a date when you want to start working
  5681. on an action item.
  5682. @end table
  5683. You may use timestamps with repeaters in scheduling and deadline
  5684. entries. Org mode issues early and late warnings based on the
  5685. assumption that the timestamp represents the @emph{nearest instance} of the
  5686. repeater. However, the use of diary S-exp entries like
  5687. @example
  5688. <%%(org-float t 42)>
  5689. @end example
  5690. @noindent
  5691. in scheduling and deadline timestamps is limited. Org mode does not
  5692. know enough about the internals of each S-exp function to issue early
  5693. and late warnings. However, it shows the item on each day where the
  5694. S-exp entry matches.
  5695. @menu
  5696. * Inserting deadline/schedule:: Planning items.
  5697. * Repeated tasks:: Items that show up again and again.
  5698. @end menu
  5699. @node Inserting deadline/schedule
  5700. @subsection Inserting deadlines or schedules
  5701. The following commands allow you to quickly insert a deadline or to
  5702. schedule an item:@footnote{The @samp{SCHEDULED} and @samp{DEADLINE} dates are inserted on the line
  5703. right below the headline. Do not put any text between this line and
  5704. the headline.}
  5705. @table @asis
  5706. @item @kbd{C-c C-d} (@code{org-deadline})
  5707. @kindex C-c C-d
  5708. @findex org-deadline
  5709. @vindex org-log-redeadline
  5710. Insert @samp{DEADLINE} keyword along with a stamp. The insertion
  5711. happens in the line directly following the headline. Remove any
  5712. @samp{CLOSED} timestamp . When called with a prefix argument, also
  5713. remove any existing deadline from the entry. Depending on the
  5714. variable @code{org-log-redeadline}, take a note when changing an
  5715. existing deadline@footnote{Note the corresponding @samp{STARTUP} options @samp{logredeadline},
  5716. @samp{lognoteredeadline}, and @samp{nologredeadline}.}.
  5717. @item @kbd{C-c C-s} (@code{org-schedule})
  5718. @kindex C-c C-s
  5719. @findex org-schedule
  5720. @vindex org-log-reschedule
  5721. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion
  5722. happens in the line directly following the headline. Remove any
  5723. @samp{CLOSED} timestamp. When called with a prefix argument, also
  5724. remove the scheduling date from the entry. Depending on the
  5725. variable @code{org-log-reschedule}, take a note when changing an
  5726. existing scheduling time@footnote{Note the corresponding @samp{STARTUP} options @samp{logreschedule},
  5727. @samp{lognotereschedule}, and @samp{nologreschedule}.}.
  5728. @item @kbd{C-c C-x C-k} (@code{org-mark-entry-for-agenda-action})
  5729. @kindex C-c C-x C-k
  5730. @kindex k a
  5731. @kindex k s
  5732. @findex org-mark-entry-for-agenda-action
  5733. Mark the current entry for agenda action. After you have marked
  5734. the entry like this, you can open the agenda or the calendar to
  5735. find an appropriate date. With the cursor on the selected date,
  5736. press @kbd{k s} or @kbd{k d} to schedule the marked
  5737. item.
  5738. @item @kbd{C-c / d} (@code{org-check-deadlines})
  5739. @kindex C-c / d
  5740. @findex org-check-deadlines
  5741. @cindex sparse tree, for deadlines
  5742. @vindex org-deadline-warning-days
  5743. Create a sparse tree with all deadlines that are either past-due,
  5744. or which will become due within @code{org-deadline-warning-days}.
  5745. With @kbd{C-u} prefix, show all deadlines in the file. With
  5746. a numeric prefix, check that many days. For example, @kbd{C-1 C-c / d} shows all deadlines due tomorrow.
  5747. @item @kbd{C-c / b}, @code{org-check-before-date}
  5748. @kindex C-c / b
  5749. @findex org-check-before-date
  5750. Sparse tree for deadlines and scheduled items before a given
  5751. date.
  5752. @item @kbd{C-c / a}, @code{org-check-after-date}
  5753. @kindex C-c / a
  5754. @findex org-check-after-date
  5755. Sparse tree for deadlines and scheduled items after a given date.
  5756. @end table
  5757. Note that @code{org-schedule} and @code{org-deadline} supports setting the date
  5758. by indicating a relative time e.g., @samp{+1d} sets the date to the next
  5759. day after today, and @samp{--1w} sets the date to the previous week before
  5760. any current timestamp.
  5761. @node Repeated tasks
  5762. @subsection Repeated tasks
  5763. @cindex tasks, repeated
  5764. @cindex repeated tasks
  5765. Some tasks need to be repeated again and again. Org mode helps to
  5766. organize such tasks using a so-called repeater in a @samp{DEADLINE},
  5767. @samp{SCHEDULED}, or plain timestamp. In the following example:
  5768. @example
  5769. ** TODO Pay the rent
  5770. DEADLINE: <2005-10-01 Sat +1m>
  5771. @end example
  5772. noindent
  5773. the @samp{+1m} is a repeater; the intended interpretation is that the task
  5774. has a deadline on @samp{<2005-10-01>} and repeats itself every (one) month
  5775. starting from that time. You can use yearly, monthly, weekly, daily
  5776. and hourly repeat cookies by using the @code{y/w/m/d/h} letters. If you
  5777. need both a repeater and a special warning period in a deadline entry,
  5778. the repeater should come first and the warning period last: @samp{DEADLINE:
  5779. <2005-10-01 Sat +1m -3d>}.
  5780. @vindex org-todo-repeat-to-state
  5781. Deadlines and scheduled items produce entries in the agenda when they
  5782. are over-due, so it is important to be able to mark such an entry as
  5783. completed once you have done so. When you mark a @samp{DEADLINE} or
  5784. a @samp{SCHEDULED} with the TODO keyword @samp{DONE}, it no longer produces
  5785. entries in the agenda. The problem with this is, however, is that
  5786. then also the @emph{next} instance of the repeated entry will not be
  5787. active. Org mode deals with this in the following way: when you try
  5788. to mark such an entry DONE, using @kbd{C-c C-t}, it shifts the
  5789. base date of the repeating timestamp by the repeater interval, and
  5790. immediately sets the entry state back to TODO@footnote{In fact, the target state is taken from, in this sequence, the
  5791. @samp{REPEAT_TO_STATE} property, the variable @code{org-todo-repeat-to-state} if
  5792. it is a string, the previous TODO state if @code{org-todo-repeat-to-state}
  5793. is @code{t}, or the first state of the TODO state sequence.}. In the example
  5794. above, setting the state to DONE would actually switch the date like
  5795. this:
  5796. @example
  5797. ** TODO Pay the rent
  5798. DEADLINE: <2005-11-01 Tue +1m>
  5799. @end example
  5800. To mark a task with a repeater as DONE, use @kbd{C-- 1 C-c C-t},
  5801. i.e., @code{org-todo} with a numeric prefix argument of @samp{-1}.
  5802. @vindex org-log-repeat
  5803. A timestamp@footnote{You can change this using the option @code{org-log-repeat}, or the
  5804. @samp{STARTUP} options @samp{logrepeat}, @samp{lognoterepeat}, and @samp{nologrepeat}.
  5805. With @samp{lognoterepeat}, you will also be prompted for a note.} is added under the deadline, to keep a record that
  5806. you actually acted on the previous instance of this deadline.
  5807. As a consequence of shifting the base date, this entry is no longer
  5808. visible in the agenda when checking past dates, but all future
  5809. instances will be visible.
  5810. With the @samp{+1m} cookie, the date shift is always exactly one month. So
  5811. if you have not paid the rent for three months, marking this entry
  5812. DONE still keeps it as an overdue deadline. Depending on the task,
  5813. this may not be the best way to handle it. For example, if you forgot
  5814. to call your father for 3 weeks, it does not make sense to call him
  5815. 3 times in a single day to make up for it. Finally, there are tasks
  5816. like changing batteries which should always repeat a certain time
  5817. @emph{after} the last time you did it. For these tasks, Org mode has
  5818. special repeaters @samp{++} and @samp{.+}. For example:
  5819. @example
  5820. ** TODO Call Father
  5821. DEADLINE: <2008-02-10 Sun ++1w>
  5822. Marking this DONE shifts the date by at least one week, but also
  5823. by as many weeks as it takes to get this date into the future.
  5824. However, it stays on a Sunday, even if you called and marked it
  5825. done on Saturday.
  5826. ** TODO Empty kitchen trash
  5827. DEADLINE: <2008-02-08 Fri 20:00 ++1d>
  5828. Marking this DONE shifts the date by at least one day, and also
  5829. by as many days as it takes to get the timestamp into the future.
  5830. Since there is a time in the timestamp, the next deadline in the
  5831. future will be on today's date if you complete the task before
  5832. 20:00.
  5833. ** TODO Check the batteries in the smoke detectors
  5834. DEADLINE: <2005-11-01 Tue .+1m>
  5835. Marking this DONE will shift the date to one month after today.
  5836. @end example
  5837. @vindex org-agenda-skip-scheduled-if-deadline-is-shown
  5838. You may have both scheduling and deadline information for a specific
  5839. task. If the repeater is set for the scheduling information only, you
  5840. probably want the repeater to be ignored after the deadline. If so,
  5841. set the variable @code{org-agenda-skip-scheduled-if-deadline-is-shown} to
  5842. @code{repeated-after-deadline}. However, any scheduling information
  5843. without a repeater is no longer relevant once the task is done, and
  5844. thus, removed upon repeating the task. If you want both scheduling
  5845. and deadline information to repeat after the same interval, set the
  5846. same repeater for both timestamps.
  5847. An alternative to using a repeater is to create a number of copies of
  5848. a task subtree, with dates shifted in each copy. The command
  5849. @kbd{C-c C-x c} was created for this purpose; it is described in
  5850. @ref{Structure Editing}.
  5851. @node Clocking Work Time
  5852. @section Clocking Work Time
  5853. @cindex clocking time
  5854. @cindex time clocking
  5855. Org mode allows you to clock the time you spend on specific tasks in
  5856. a project. When you start working on an item, you can start the
  5857. clock. When you stop working on that task, or when you mark the task
  5858. done, the clock is stopped and the corresponding time interval is
  5859. recorded. It also computes the total time spent on each
  5860. subtree@footnote{Clocking only works if all headings are indented with less
  5861. than 30 stars. This is a hard-coded limitation of @code{lmax} in
  5862. @code{org-clock-sum}.} of a project. And it remembers a history or tasks
  5863. recently clocked, to that you can jump quickly between a number of
  5864. tasks absorbing your time.
  5865. To save the clock history across Emacs sessions, use:
  5866. @lisp
  5867. (setq org-clock-persist 'history)
  5868. (org-clock-persistence-insinuate)
  5869. @end lisp
  5870. @vindex org-clock-persist
  5871. When you clock into a new task after resuming Emacs, the incomplete
  5872. clock@footnote{To resume the clock under the assumption that you have worked
  5873. on this task while outside Emacs, use @code{(setq org-clock-persist t)}.} is retrieved (see @ref{Resolving idle time (1)}) and you are
  5874. prompted about what to do with it.
  5875. @menu
  5876. * Clocking commands:: Starting and stopping a clock.
  5877. * The clock table:: Detailed reports.
  5878. * Resolving idle time:: Resolving time when you've been idle.
  5879. @end menu
  5880. @node Clocking commands
  5881. @subsection Clocking commands
  5882. @table @asis
  5883. @item @kbd{C-c C-x C-i} (@code{org-clock-in})
  5884. @kindex C-c C-x C-i
  5885. @findex org-clock-in
  5886. @vindex org-clock-into-drawer
  5887. @vindex org-clock-continuously
  5888. @cindex @samp{LOG_INTO_DRAWER}, property
  5889. Start the clock on the current item (clock-in). This inserts the
  5890. CLOCK keyword together with a timestamp. If this is not the
  5891. first clocking of this item, the multiple CLOCK lines are wrapped
  5892. into a @samp{LOGBOOK} drawer (see also the variable
  5893. @code{org-clock-into-drawer}). You can also overrule the setting of
  5894. this variable for a subtree by setting a @samp{CLOCK_INTO_DRAWER} or
  5895. @samp{LOG_INTO_DRAWER} property. When called with a @kbd{C-u}
  5896. prefix argument, select the task from a list of recently clocked
  5897. tasks. With two @kbd{C-u C-u} prefixes, clock into the task
  5898. at point and mark it as the default task; the default task is
  5899. always be available with letter @kbd{d} when selecting
  5900. a clocking task. With three @kbd{C-u C-u C-u} prefixes,
  5901. force continuous clocking by starting the clock when the last
  5902. clock stopped.
  5903. @cindex @samp{CLOCK_MODELINE_TOTAL}, property
  5904. @cindex @samp{LAST_REPEAT}, property
  5905. @vindex org-clock-mode-line-total
  5906. @vindex org-clock-in-prepare-hook
  5907. While the clock is running, Org shows the current clocking time
  5908. in the mode line, along with the title of the task. The clock
  5909. time shown is all time ever clocked for this task and its
  5910. children. If the task has an effort estimate (see @ref{Effort Estimates}), the mode line displays the current clocking time
  5911. against it@footnote{To add an effort estimate ``on the fly'', hook a function doing
  5912. 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
  5913. task@footnote{The last reset of the task is recorded by the @samp{LAST_REPEAT}
  5914. property.}. You can exercise more control over show time with
  5915. the @samp{CLOCK_MODELINE_TOTAL} property. It may have the values
  5916. @samp{current} to show only the current clocking instance, @samp{today} to
  5917. show all time clocked on this tasks today---see also the
  5918. variable @code{org-extend-today-until}, @code{all} to include all time, or
  5919. @code{auto} which is the default@footnote{See also the variable @code{org-clock-mode-line-total}.}. Clicking with
  5920. @kbd{mouse-1} onto the mode line entry pops up a menu with
  5921. clocking options.
  5922. @item @kbd{C-c C-x C-o} (@code{org-clock-out})
  5923. @kindex C-c C-x C-o
  5924. @findex org-clock-out
  5925. @vindex org-log-note-clock-out
  5926. Stop the clock (clock-out). This inserts another timestamp at
  5927. the same location where the clock was last started. It also
  5928. directly computes the resulting time in inserts it after the time
  5929. range as @samp{=>HH:MM}. See the variable @code{org-log-note-clock-out}
  5930. for the possibility to record an additional note together with
  5931. the clock-out timestamp@footnote{The corresponding in-buffer setting is: @samp{#+STARTUP:
  5932. lognoteclock-out}.}.
  5933. @item @kbd{C-c C-x C-x} (@code{org-clock-in-last})
  5934. @kindex C-c C-x C-x
  5935. @findex org-clock-in-last
  5936. @vindex org-clock-continuously
  5937. Re-clock the last clocked task. With one @kbd{C-u} prefix
  5938. argument, select the task from the clock history. With two
  5939. @kbd{C-u} prefixes, force continuous clocking by starting
  5940. the clock when the last clock stopped.
  5941. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  5942. @kindex C-c C-x C-e
  5943. @findex org-clock-modify-effort-estimate
  5944. Update the effort estimate for the current clock task.
  5945. @item @kbd{C-c C-c} or @kbd{C-c C-y} (@code{org-evaluate-time-range})
  5946. @kindex C-c C-c
  5947. @kindex C-c C-y
  5948. @findex org-evaluate-time-range
  5949. Recompute the time interval after changing one of the timestamps.
  5950. This is only necessary if you edit the timestamps directly. If
  5951. you change them with @kbd{S-<cursor>} keys, the update is
  5952. automatic.
  5953. @item @kbd{C-S-@key{UP}} (@code{org-clock-timestamps-up})
  5954. @itemx @kbd{C-S-@key{DOWN}} (@code{org-clock-timestamps-down})
  5955. @kindex C-S-UP
  5956. @findex org-clock-timestamps-up
  5957. @kindex C-S-DOWN
  5958. @findex org-clock-timestamps-down
  5959. On CLOCK log lines, increase/decrease both timestamps so that the
  5960. clock duration keeps the same value.
  5961. @item @kbd{S-M-@key{UP}} (@code{org-timestamp-up})
  5962. @itemx @kbd{S-M-@key{DOWN}} (@code{org-timestamp-down})
  5963. @kindex S-M-UP
  5964. @findex org-clock-timestamp-up
  5965. @kindex S-M-DOWN
  5966. @findex org-clock-timestamp-down
  5967. On @samp{CLOCK} log lines, increase/decrease the timestamp at point
  5968. and the one of the previous, or the next, clock timestamp by the
  5969. same duration. For example, if you hit @kbd{S-M-@key{UP}} to
  5970. increase a clocked-out timestamp by five minutes, then the
  5971. clocked-in timestamp of the next clock is increased by five
  5972. minutes.
  5973. @item @kbd{C-c C-t} (@code{org-todo})
  5974. @kindex C-c C-t
  5975. @findex org-todo
  5976. Changing the TODO state of an item to DONE automatically stops
  5977. the clock if it is running in this same item.
  5978. @item @kbd{C-c C-x C-q} (@code{org-clock-cancel})
  5979. @kindex C-c C-x C-q
  5980. @findex org-clock-cancel
  5981. Cancel the current clock. This is useful if a clock was started
  5982. by mistake, or if you ended up working on something else.
  5983. @item @kbd{C-c C-x C-j} (@code{org-clock-goto})
  5984. @kindex C-c C-x C-j
  5985. @findex or-clock-goto
  5986. Jump to the headline of the currently clocked in task. With
  5987. a @kbd{C-u} prefix argument, select the target task from
  5988. a list of recently clocked tasks.
  5989. @item @kbd{C-c C-x C-d} (@code{org-clock-display})
  5990. @kindex C-c C-x C-d
  5991. @findex org-clock-display
  5992. @vindex org-remove-highlights-with-change
  5993. Display time summaries for each subtree in the current buffer.
  5994. This puts overlays at the end of each headline, showing the total
  5995. time recorded under that heading, including the time of any
  5996. subheadings. You can use visibility cycling to study the tree,
  5997. but the overlays disappear when you change the buffer (see
  5998. variable @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  5999. @end table
  6000. 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
  6001. a day.
  6002. @strong{Important:} note that both @code{org-clock-out} and @code{org-clock-in-last}
  6003. can have a global keybinding and do not modify the window disposition.
  6004. @node The clock table
  6005. @subsection The clock table
  6006. @cindex clocktable, dynamic block
  6007. @cindex report, of clocked time
  6008. Org mode can produce quite complex reports based on the time clocking
  6009. information. Such a report is called a @emph{clock table}, because it is
  6010. formatted as one or several Org tables.
  6011. @table @asis
  6012. @item @kbd{C-c C-x C-r} (@code{org-clock-report})
  6013. @kindex C-c C-x C-r
  6014. @findex org-clock-report
  6015. Insert a dynamic block (see @ref{Dynamic Blocks}) containing a clock
  6016. report as an Org mode table into the current file. When the
  6017. cursor is at an existing clock table, just update it. When
  6018. called with a prefix argument, jump to the first clock report in
  6019. the current document and update it. The clock table includes
  6020. archived trees.
  6021. @item @kbd{C-c C-c} or @kbd{C-c C-x C-u} (@code{org-dblock-update})
  6022. @kindex C-c C-c
  6023. @kindex C-c C-x C-u
  6024. @findex org-dblock-update
  6025. Update dynamic block at point. The cursor needs to be in the
  6026. @samp{BEGIN} line of the dynamic block.
  6027. @item @kbd{C-u C-c C-x C-u}
  6028. @kindex C-u C-c C-x C-u
  6029. Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful
  6030. if you have several clock table blocks in a buffer.
  6031. @item @kbd{S-@key{LEFT}}
  6032. @itemx @kbd{S-@key{RIGHT}} (@code{org-clocktable-try-shift})
  6033. @kindex S-LEFT
  6034. @kindex S-RIGHT
  6035. @findex org-clocktable-try-shift
  6036. Shift the current @samp{:block} interval and update the table. The
  6037. cursor needs to be in the @samp{#+BEGIN: clocktable} line for this
  6038. command. If @samp{:block} is @samp{today}, it is shifted to @samp{today-1},
  6039. etc.
  6040. @end table
  6041. Here is an example of the frame for a clock table as it is inserted
  6042. into the buffer with the @kbd{C-c C-x C-r} command:
  6043. @cindex @samp{BEGIN clocktable}
  6044. @example
  6045. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  6046. #+END: clocktable
  6047. @end example
  6048. @noindent
  6049. @vindex org-clocktable-defaults
  6050. The @samp{#+BEGIN} line and specify a number of options to define the
  6051. scope, structure, and formatting of the report. Defaults for all
  6052. these options can be configured in the variable
  6053. @code{org-clocktable-defaults}.
  6054. @noindent
  6055. First there are options that determine which clock entries are to
  6056. be selected:
  6057. @table @asis
  6058. @item :maxlevel
  6059. Maximum level depth to which times are listed in the table.
  6060. Clocks at deeper levels are summed into the upper level.
  6061. @item :scope
  6062. The scope to consider. This can be any of the following:
  6063. @multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6064. @item @code{nil}
  6065. @tab the current buffer or narrowed region
  6066. @item @code{file}
  6067. @tab the full current buffer
  6068. @item @code{subtree}
  6069. @tab the subtree where the clocktable is located
  6070. @item @code{treeN}
  6071. @tab the surrounding level N tree, for example @samp{tree3}
  6072. @item @code{tree}
  6073. @tab the surrounding level 1 tree
  6074. @item @code{agenda}
  6075. @tab all agenda files
  6076. @item @samp{("file" ...)}
  6077. @tab scan these files
  6078. @item @samp{FUNCTION}
  6079. @tab scan files returned by calling FUNCTION with no argument
  6080. @item @code{file-with-archives}
  6081. @tab current file and its archives
  6082. @item @code{agenda-with-archives}
  6083. @tab all agenda files, including archives
  6084. @end multitable
  6085. @item :block
  6086. The time block to consider. This block is specified either
  6087. absolutely, or relative to the current time and may be any of
  6088. these formats:
  6089. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa}
  6090. @item @samp{2007-12-31}
  6091. @tab New year eve 2007
  6092. @item @samp{2007-12}
  6093. @tab December 2007
  6094. @item @samp{2007-W50}
  6095. @tab ISO-week 50 in 2007
  6096. @item @samp{2007-Q2}
  6097. @tab 2nd quarter in 2007
  6098. @item @samp{2007}
  6099. @tab the year 2007
  6100. @item @code{today}, @code{yesterday}, @code{today-N}
  6101. @tab a relative day
  6102. @item @code{thisweek}, @code{lastweek}, @code{thisweek-N}
  6103. @tab a relative week
  6104. @item @code{thismonth}, @code{lastmonth}, @code{thismonth-N}
  6105. @tab a relative month
  6106. @item @code{thisyear}, @code{lastyear}, @code{thisyear-N}
  6107. @tab a relative year
  6108. @item @code{untilnow}
  6109. @tab all clocked time ever
  6110. @end multitable
  6111. @vindex org-clock-display-default-range
  6112. When this option is not set, Org falls back to the value in
  6113. @code{org-clock-display-default-range}, which defaults to the current
  6114. year.
  6115. Use @kbd{S-@key{LEFT}} or @kbd{S-@key{RIGHT}} to shift the time
  6116. interval.
  6117. @item :tstart
  6118. A time string specifying when to start considering times.
  6119. Relative times like @samp{"<-2w>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6120. @item :tend
  6121. A time string specifying when to stop considering times.
  6122. Relative times like @samp{"<now>"} can also be used. See @ref{Matching tags and properties} for relative time syntax.
  6123. @item wstart
  6124. The starting day of the week. The default is 1 for Monday.
  6125. @item mstart
  6126. The starting day of the month. The default is 1 for the first.
  6127. @item :step
  6128. Set to @code{week} or @code{day} to split the table into chunks. To use
  6129. this, @code{:block} or @code{:tstart}, @code{:tend} are needed.
  6130. @item :stepskip0
  6131. Do not show steps that have zero time.
  6132. @item :fileskip0
  6133. Do not show table sections from files which did not contribute.
  6134. @item :tags
  6135. A tags match to select entries that should contribute. See
  6136. @ref{Matching tags and properties} for the match syntax.
  6137. @end table
  6138. @findex org-clocktable-write-default
  6139. Then there are options that determine the formatting of the table.
  6140. There options are interpreted by the function
  6141. @code{org-clocktable-write-default}, but you can specify your own function
  6142. using the @samp{:formatter} parameter.
  6143. @table @asis
  6144. @item :emphasize
  6145. When @code{t}, emphasize level one and level two items.
  6146. @item :lang
  6147. Language@footnote{Language terms can be set through the variable
  6148. @code{org-clock-clocktable-language-setup}.} to use for descriptive cells like ``Task''.
  6149. @item :link
  6150. Link the item headlines in the table to their origins.
  6151. @item :narrow
  6152. An integer to limit the width of the headline column in the Org
  6153. table. If you write it like @samp{50!}, then the headline is also
  6154. shortened in export.
  6155. @item :indent
  6156. Indent each headline field according to its level.
  6157. @item :tcolumns
  6158. Number of columns to be used for times. If this is smaller than
  6159. @samp{:maxlevel}, lower levels are lumped into one column.
  6160. @item :level
  6161. Should a level number column be included?
  6162. @item :sort
  6163. A cons cell containing the column to sort and a sorting type.
  6164. E.g., @samp{:sort (1 . ?a)} sorts the first column alphabetically.
  6165. @item :compact
  6166. Abbreviation for @samp{:level nil :indent t :narrow 40! :tcolumns 1}.
  6167. All are overwritten except if there is an explicit @samp{:narrow}.
  6168. @item :timestamp
  6169. A timestamp for the entry, when available. Look for SCHEDULED,
  6170. DEADLINE, TIMESTAMP and TIMESTAMP_IA special properties (see
  6171. @ref{Special Properties}), in this order.
  6172. @item :properties
  6173. List of properties shown in the table. Each property gets its
  6174. own column.
  6175. @item :inherit-props
  6176. When this flag is non-@code{nil}, the values for @samp{:properties} are
  6177. inherited.
  6178. @item :formula
  6179. Content of a @samp{TBLFM} keyword to be added and evaluated. As
  6180. a special case, @samp{:formula %} adds a column with % time. If you
  6181. do not specify a formula here, any existing formula below the
  6182. clock table survives updates and is evaluated.
  6183. @item :formatter
  6184. A function to format clock data and insert it into the buffer.
  6185. @end table
  6186. To get a clock summary of the current level 1 tree, for the current
  6187. day, you could write:
  6188. @example
  6189. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  6190. #+END: clocktable
  6191. @end example
  6192. @noindent
  6193. To use a specific time range you could write@footnote{Note that all parameters must be specified in a single
  6194. line---the line is broken here only to fit it into the manual.}
  6195. @example
  6196. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  6197. :tend "<2006-08-10 Thu 12:00>"
  6198. #+END: clocktable
  6199. @end example
  6200. A range starting a week ago and ending right now could be written as
  6201. @example
  6202. #+BEGIN: clocktable :tstart "<-1w>" :tend "<now>"
  6203. #+END: clocktable
  6204. @end example
  6205. A summary of the current subtree with % times would be:
  6206. @example
  6207. #+BEGIN: clocktable :scope subtree :link t :formula %
  6208. #+END: clocktable
  6209. @end example
  6210. A horizontally compact representation of everything clocked during
  6211. last week would be:
  6212. @example
  6213. #+BEGIN: clocktable :scope agenda :block lastweek :compact t
  6214. #+END: clocktable
  6215. @end example
  6216. @node Resolving idle time
  6217. @subsection Resolving idle time and continuous clocking
  6218. @anchor{Resolving idle time (1)}
  6219. @subsubheading Resolving idle time
  6220. @cindex resolve idle time
  6221. @cindex idle, resolve, dangling
  6222. If you clock in on a work item, and then walk away from your
  6223. computer---perhaps to take a phone call---you often need to
  6224. ``resolve'' the time you were away by either subtracting it from the
  6225. current clock, or applying it to another one.
  6226. @vindex org-clock-idle-time
  6227. @vindex org-clock-x11idle-program-name
  6228. By customizing the variable @code{org-clock-idle-time} to some integer,
  6229. such as 10 or 15, Emacs can alert you when you get back to your
  6230. computer after being idle for that many minutes@footnote{On computers using macOS, idleness is based on actual user
  6231. idleness, not just Emacs' idle time. For X11, you can install
  6232. a utility program @samp{x11idle.c}, available in the @samp{contrib/scripts/}
  6233. directory of the Org Git distribution, or install the xprintidle
  6234. package and set it to the variable @code{org-clock-x11idle-program-name} if
  6235. you are running Debian, to get the same general treatment of idleness.
  6236. On other systems, idle time refers to Emacs idle time only.}, and ask what
  6237. you want to do with the idle time. There will be a question waiting
  6238. for you when you get back, indicating how much idle time has passed
  6239. constantly updated with the current amount, as well as a set of
  6240. choices to correct the discrepancy:
  6241. @table @asis
  6242. @item @kbd{k}
  6243. @kindex k
  6244. To keep some or all of the minutes and stay clocked in, press
  6245. @kbd{k}. Org asks how many of the minutes to keep. Press
  6246. @kbd{@key{RET}} to keep them all, effectively changing nothing, or
  6247. enter a number to keep that many minutes.
  6248. @item @kbd{K}
  6249. @kindex K
  6250. If you use the shift key and press @kbd{K}, it keeps however
  6251. many minutes you request and then immediately clock out of that
  6252. task. If you keep all of the minutes, this is the same as just
  6253. clocking out of the current task.
  6254. @item @kbd{s}
  6255. @kindex s
  6256. To keep none of the minutes, use @kbd{s} to subtract all the
  6257. away time from the clock, and then check back in from the moment
  6258. you returned.
  6259. @item @kbd{S}
  6260. @kindex S
  6261. To keep none of the minutes and just clock out at the start of
  6262. the away time, use the shift key and press @kbd{S}.
  6263. Remember that using shift always leave you clocked out, no matter
  6264. which option you choose.
  6265. @item @kbd{C}
  6266. @kindex C
  6267. To cancel the clock altogether, use @kbd{C}. Note that if
  6268. instead of canceling you subtract the away time, and the
  6269. resulting clock amount is less than a minute, the clock is still
  6270. canceled rather than cluttering up the log with an empty entry.
  6271. @end table
  6272. What if you subtracted those away minutes from the current clock, and
  6273. now want to apply them to a new clock? Simply clock in to any task
  6274. immediately after the subtraction. Org will notice that you have
  6275. subtracted time ``on the books'', so to speak, and will ask if you want
  6276. to apply those minutes to the next task you clock in on.
  6277. There is one other instance when this clock resolution magic occurs.
  6278. Say you were clocked in and hacking away, and suddenly your cat chased
  6279. a mouse who scared a hamster that crashed into your UPS's power
  6280. button! You suddenly lose all your buffers, but thanks to auto-save
  6281. you still have your recent Org mode changes, including your last clock
  6282. in.
  6283. If you restart Emacs and clock into any task, Org will notice that you
  6284. have a dangling clock which was never clocked out from your last
  6285. session. Using that clock's starting time as the beginning of the
  6286. unaccounted-for period, Org will ask how you want to resolve that
  6287. time. The logic and behavior is identical to dealing with away time
  6288. due to idleness; it is just happening due to a recovery event rather
  6289. than a set amount of idle time.
  6290. You can also check all the files visited by your Org agenda for
  6291. dangling clocks at any time using @kbd{M-x org-resolve-clocks @key{RET}} (or @kbd{C-c C-x C-z}).
  6292. @anchor{Continuous clocking}
  6293. @subsubheading Continuous clocking
  6294. @cindex continuous clocking
  6295. @vindex org-clock-continuously
  6296. You may want to start clocking from the time when you clocked out the
  6297. previous task. To enable this systematically, set
  6298. @code{org-clock-continuously} to non-@code{nil}. Each time you clock in, Org
  6299. retrieves the clock-out time of the last clocked entry for this
  6300. session, and start the new clock from there.
  6301. If you only want this from time to time, use three universal prefix
  6302. arguments with @code{org-clock-in} and two @kbd{C-u C-u} with
  6303. @code{org-clock-in-last}.
  6304. @node Effort Estimates
  6305. @section Effort Estimates
  6306. @cindex effort estimates
  6307. @cindex @samp{EFFORT}, property
  6308. @vindex org-effort-property
  6309. If you want to plan your work in a very detailed way, or if you need
  6310. to produce offers with quotations of the estimated work effort, you
  6311. may want to assign effort estimates to entries. If you are also
  6312. clocking your work, you may later want to compare the planned effort
  6313. with the actual working time, a great way to improve planning
  6314. estimates. Effort estimates are stored in a special property
  6315. @samp{EFFORT}. You can set the effort for an entry with the following
  6316. commands:
  6317. @table @asis
  6318. @item @kbd{C-c C-x e} (@code{org-set-effort})
  6319. @kindex C-c C-x e
  6320. @findex org-set-effort
  6321. Set the effort estimate for the current entry. With a prefix
  6322. argument, set it to the next allowed value---see below. This
  6323. command is also accessible from the agenda with the @kbd{e}
  6324. key.
  6325. @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate})
  6326. @kindex C-c C-x C-e
  6327. @findex org-clock-modify-effort-estimate
  6328. Modify the effort estimate of the item currently being clocked.
  6329. @end table
  6330. Clearly the best way to work with effort estimates is through column
  6331. view (see @ref{Column View}). You should start by setting up discrete
  6332. values for effort estimates, and a @samp{COLUMNS} format that displays
  6333. these values together with clock sums---if you want to clock your
  6334. time. For a specific buffer you can use:
  6335. @example
  6336. #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00
  6337. #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM
  6338. @end example
  6339. noindent
  6340. @vindex org-global-properties
  6341. @vindex org-columns-default-format
  6342. or, even better, you can set up these values globally by customizing
  6343. the variables @code{org-global-properties} and
  6344. @code{org-columns-default-format}. In particular if you want to use this
  6345. setup also in the agenda, a global setup may be advised.
  6346. The way to assign estimates to individual items is then to switch to
  6347. column mode, and to use @kbd{S-@key{RIGHT}} and @kbd{S-@key{LEFT}} to
  6348. change the value. The values you enter are immediately summed up in
  6349. the hierarchy. In the column next to it, any clocked time is
  6350. displayed.
  6351. @vindex org-agenda-columns-add-appointments-to-effort-sum
  6352. If you switch to column view in the daily/weekly agenda, the effort
  6353. column summarizes the estimated work effort for each day@footnote{Please note the pitfalls of summing hierarchical data in
  6354. a flat list (@ref{Agenda Column View}).}, and
  6355. you can use this to find space in your schedule. To get an overview
  6356. of the entire part of the day that is committed, you can set the
  6357. option @code{org-agenda-columns-add-appointments-to-effort-sum}. The
  6358. appointments on a day that take place over a specified time interval
  6359. are then also added to the load estimate of the day.
  6360. Effort estimates can be used in secondary agenda filtering that is
  6361. triggered with the @kbd{/} key in the agenda (see @ref{Agenda Commands}). If you have these estimates defined consistently,
  6362. two or three key presses narrow down the list to stuff that fits into
  6363. an available time slot.
  6364. @node Timers
  6365. @section Taking Notes with a Relative Timer
  6366. @cindex relative timer
  6367. @cindex countdown timer
  6368. Org provides two types of timers. There is a relative timer that
  6369. counts up, which can be useful when taking notes during, for example,
  6370. a meeting or a video viewing. There is also a countdown timer.
  6371. The relative and countdown are started with separate commands.
  6372. @table @asis
  6373. @item @kbd{C-c C-x 0} (@code{org-timer-start})
  6374. @kindex C-c C-x 0
  6375. @findex org-timer-start
  6376. Start or reset the relative timer. By default, the timer is set
  6377. to 0. When called with a @kbd{C-u} prefix, prompt the user
  6378. for a starting offset. If there is a timer string at point, this
  6379. is taken as the default, providing a convenient way to restart
  6380. taking notes after a break in the process. When called with
  6381. a double prefix argument @kbd{C-u C-u}, change all timer
  6382. strings in the active region by a certain amount. This can be
  6383. used to fix timer strings if the timer was not started at exactly
  6384. the right moment.
  6385. @item @kbd{C-c C-x ;} (@code{org-timer-set-timer})
  6386. @kindex C-c C-x ;
  6387. @findex org-timer-set-timer
  6388. @vindex org-timer-default-timer
  6389. Start a countdown timer. The user is prompted for a duration.
  6390. @code{org-timer-default-timer} sets the default countdown value.
  6391. Giving a numeric prefix argument overrides this default value.
  6392. This command is available as @kbd{;} in agenda buffers.
  6393. @end table
  6394. Once started, relative and countdown timers are controlled with the
  6395. same commands.
  6396. @table @asis
  6397. @item @kbd{C-c C-x .} (@code{org-timer})
  6398. @kindex C-c C-x .
  6399. @findex org-timer
  6400. Insert a relative time into the buffer. The first time you use
  6401. this, the timer starts. Using a prefix argument restarts it.
  6402. @item @kbd{C-c C-x -} (@code{org-timer-item})
  6403. @kindex C-c C-x -
  6404. @findex org-timer-item
  6405. Insert a description list item with the current relative time.
  6406. With a prefix argument, first reset the timer to 0.
  6407. @item @kbd{M-@key{RET}} (@code{org-insert-heading})
  6408. @kindex M-RET
  6409. @findex org-insert-heading
  6410. Once the timer list is started, you can also use
  6411. @kbd{M-@key{RET}} to insert new timer items.
  6412. @item @kbd{C-c C-x ,} (@code{org-timer-pause-or-continue})
  6413. @kindex C-c C-x ,
  6414. @findex org-timer-pause-or-continue
  6415. Pause the timer, or continue it if it is already paused.
  6416. @item @kbd{C-c C-x _} (@code{org-timer-stop})
  6417. @kindex C-c C-x _
  6418. @findex org-timer-stop
  6419. Stop the timer. After this, you can only start a new timer, not
  6420. continue the old one. This command also removes the timer from
  6421. the mode line.
  6422. @end table
  6423. @node Capture Refile Archive
  6424. @chapter Capture, Refile, Archive
  6425. @cindex capture
  6426. An important part of any organization system is the ability to quickly
  6427. capture new ideas and tasks, and to associate reference material with
  6428. them. Org does this using a process called @emph{capture}. It also can
  6429. store files related to a task (@emph{attachments}) in a special directory.
  6430. Once in the system, tasks and projects need to be moved around.
  6431. Moving completed project trees to an archive file keeps the system
  6432. compact and fast.
  6433. @menu
  6434. * Capture:: Capturing new stuff.
  6435. * Attachments:: Add files to tasks.
  6436. * RSS Feeds:: Getting input from RSS feeds.
  6437. * Protocols:: External access to Emacs and Org.
  6438. * Refile and Copy:: Moving/copying a tree from one place to another.
  6439. * Archiving:: What to do with finished products.
  6440. @end menu
  6441. @node Capture
  6442. @section Capture
  6443. @cindex capture
  6444. Capture lets you quickly store notes with little interruption of your
  6445. work flow. Org's method for capturing new items is heavily inspired
  6446. by John Wiegley's excellent Remember package.
  6447. @menu
  6448. * Setting up capture:: Where notes will be stored.
  6449. * Using capture:: Commands to invoke and terminate capture.
  6450. * Capture templates:: Define the outline of different note types.
  6451. @end menu
  6452. @node Setting up capture
  6453. @subsection Setting up capture
  6454. The following customization sets a default target file for notes.
  6455. @vindex org-default-notes-file
  6456. @lisp
  6457. (setq org-default-notes-file (concat org-directory "/notes.org"))
  6458. @end lisp
  6459. You may also define a global key for capturing new material (see
  6460. @ref{Activation}).
  6461. @node Using capture
  6462. @subsection Using capture
  6463. @table @asis
  6464. @item @kbd{M-x org-capture} (@code{org-capture})
  6465. @findex org-capture
  6466. @cindex date tree
  6467. Display the capture templates menu. If you have templates
  6468. defined (see @ref{Capture templates}), it offers these templates for
  6469. selection or use a new Org outline node as the default template.
  6470. It inserts the template into the target file and switch to an
  6471. indirect buffer narrowed to this new node. You may then insert
  6472. the information you want.
  6473. @item @kbd{C-c C-c} (@code{org-capture-finalize})
  6474. @kindex C-c C-c @r{(Capture buffer)}
  6475. @findex org-capture-finalize
  6476. Once you have finished entering information into the capture
  6477. buffer, @kbd{C-c C-c} returns you to the window
  6478. configuration before the capture process, so that you can resume
  6479. your work without further distraction. When called with a prefix
  6480. argument, finalize and then jump to the captured item.
  6481. @item @kbd{C-c C-w} (@code{org-capture-refile})
  6482. @kindex C-c C-w @r{(Capture buffer)}
  6483. @findex org-capture-refile
  6484. Finalize the capture process by refiling the note to a different
  6485. place (see @ref{Refile and Copy}). Please realize that this is
  6486. a normal refiling command that will be executed---so the cursor
  6487. position at the moment you run this command is important. If you
  6488. have inserted a tree with a parent and children, first move the
  6489. cursor back to the parent. Any prefix argument given to this
  6490. command is passed on to the @code{org-refile} command.
  6491. @item @kbd{C-c C-k} (@code{org-capture-kill})
  6492. @kindex C-c C-k @r{(Capture buffer)}
  6493. @findex org-capture-kill
  6494. Abort the capture process and return to the previous state.
  6495. @end table
  6496. @kindex k c @r{(Agenda)}
  6497. You can also call @code{org-capture} in a special way from the agenda,
  6498. using the @kbd{k c} key combination. With this access, any
  6499. timestamps inserted by the selected capture template defaults to the
  6500. cursor date in the agenda, rather than to the current date.
  6501. To find the locations of the last stored capture, use @code{org-capture}
  6502. with prefix commands:
  6503. @table @asis
  6504. @item @kbd{C-u M-x org-capture}
  6505. Visit the target location of a capture template. You get to
  6506. select the template in the usual way.
  6507. @item @kbd{C-u C-u M-x org-capture}
  6508. Visit the last stored capture item in its buffer.
  6509. @end table
  6510. @vindex org-capture-bookmark
  6511. @vindex org-capture-last-stored
  6512. You can also jump to the bookmark @code{org-capture-last-stored}, which is
  6513. automatically created unless you set @code{org-capture-bookmark} to @code{nil}.
  6514. To insert the capture at point in an Org buffer, call @code{org-capture}
  6515. with a @code{C-0} prefix argument.
  6516. @node Capture templates
  6517. @subsection Capture templates
  6518. @cindex templates, for Capture
  6519. You can use templates for different types of capture items, and for
  6520. different target locations. The easiest way to create such templates
  6521. is through the customize interface.
  6522. @table @asis
  6523. @item @kbd{C}
  6524. @kindex C @r{(Capture menu}
  6525. @vindex org-capture-templates
  6526. Customize the variable @code{org-capture-templates}.
  6527. @end table
  6528. Before we give the formal description of template definitions, let's
  6529. look at an example. Say you would like to use one template to create
  6530. general TODO entries, and you want to put these entries under the
  6531. heading @samp{Tasks} in your file @samp{~/org/gtd.org}. Also, a date tree in
  6532. the file @samp{journal.org} should capture journal entries. A possible
  6533. configuration would look like:
  6534. @lisp
  6535. (setq org-capture-templates
  6536. '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
  6537. "* TODO %?\n %i\n %a")
  6538. ("j" "Journal" entry (file+datetree "~/org/journal.org")
  6539. "* %?\nEntered on %U\n %i\n %a")))
  6540. @end lisp
  6541. @noindent
  6542. If you then press @kbd{t} from the capture menu, Org will prepare
  6543. the template for you like this:
  6544. @example
  6545. * TODO
  6546. [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
  6547. @end example
  6548. @noindent
  6549. During expansion of the template, @code{%a} has been replaced by a link to
  6550. the location from where you called the capture command. This can be
  6551. extremely useful for deriving tasks from emails, for example. You
  6552. fill in the task definition, press @kbd{C-c C-c} and Org returns
  6553. you to the same place where you started the capture process.
  6554. To define special keys to capture to a particular template without
  6555. going through the interactive template selection, you can create your
  6556. key binding like this:
  6557. @lisp
  6558. (define-key global-map "\C-cx"
  6559. (lambda () (interactive) (org-capture nil "x")))
  6560. @end lisp
  6561. @menu
  6562. * Template elements:: What is needed for a complete template entry.
  6563. * Template expansion:: Filling in information about time and context.
  6564. * Templates in contexts:: Only show a template in a specific context.
  6565. @end menu
  6566. @node Template elements
  6567. @subsubsection Template elements
  6568. Now lets look at the elements of a template definition. Each entry in
  6569. @code{org-capture-templates} is a list with the following items:
  6570. @table @asis
  6571. @item keys
  6572. The keys that selects the template, as a string, characters only,
  6573. for example @samp{"a"}, for a template to be selected with a single
  6574. key, or @samp{"bt"} for selection with two keys. When using several
  6575. keys, keys using the same prefix key must be sequential in the
  6576. list and preceded by a 2-element entry explaining the prefix key,
  6577. for example:
  6578. @lisp
  6579. ("b" "Templates for marking stuff to buy")
  6580. @end lisp
  6581. @noindent
  6582. If you do not define a template for the @kbd{C} key, this
  6583. key opens the Customize buffer for this complex variable.
  6584. @item description
  6585. A short string describing the template, shown during selection.
  6586. @item type
  6587. The type of entry, a symbol. Valid values are:
  6588. @table @asis
  6589. @item @code{entry}
  6590. An Org mode node, with a headline. Will be filed as the child
  6591. of the target entry or as a top-level entry. The target file
  6592. should be an Org file.
  6593. @item @code{item}
  6594. A plain list item, placed in the first plain list at the
  6595. target location. Again the target file should be an Org
  6596. file.
  6597. @item @code{checkitem}
  6598. A checkbox item. This only differs from the plain list item
  6599. by the default template.
  6600. @item @code{table-line}
  6601. A new line in the first table at the target location. Where
  6602. exactly the line will be inserted depends on the properties
  6603. @code{:prepend} and @code{:table-line-pos} (see below).
  6604. @item @code{plain}
  6605. Text to be inserted as it is.
  6606. @end table
  6607. @item target
  6608. @vindex org-default-notes-file
  6609. @vindex org-directory
  6610. Specification of where the captured item should be placed. In
  6611. Org files, targets usually define a node. Entries will become
  6612. children of this node. Other types will be added to the table or
  6613. list in the body of this node. Most target specifications
  6614. contain a file name. If that file name is the empty string, it
  6615. defaults to @code{org-default-notes-file}. A file can also be given
  6616. as a variable or as a function called with no argument. When an
  6617. absolute path is not specified for a target, it is taken as
  6618. relative to @code{org-directory}.
  6619. Valid values are:
  6620. @table @asis
  6621. @item @samp{(file "path/to/file")}
  6622. Text will be placed at the beginning or end of that file.
  6623. @item @samp{(id "id of existing org entry")}
  6624. Filing as child of this entry, or in the body of the entry.
  6625. @item @samp{(file+headline "filename" "node headline")}
  6626. Fast configuration if the target heading is unique in the file.
  6627. @item @samp{(file+olp "filename" "Level 1 heading" "Level 2" ...)}
  6628. For non-unique headings, the full path is safer.
  6629. @item @samp{(file+regexp "filename" "regexp to find location")}
  6630. Use a regular expression to position the cursor.
  6631. @item @samp{(file+olp+datetree "filename" [ "Level 1 heading" ...])}
  6632. This target@footnote{Org used to offer four different targets for date/week tree
  6633. capture. Now, Org automatically translates these to use
  6634. @code{file+olp+datetree}, applying the @code{:time-prompt} and @code{:tree-type}
  6635. properties. Please rewrite your date/week-tree targets using
  6636. @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
  6637. level, months or ISO weeks as sublevels and then dates on the lowest
  6638. level. Tags are allowed in the tree structure.} for
  6639. today's date. If the optional outline path is given, the tree
  6640. will be built under the node it is pointing to, instead of at
  6641. top level. Check out the @code{:time-prompt} and @code{:tree-type}
  6642. properties below for additional options.
  6643. @item @code{(file+function "filename" function-finding-location)}
  6644. A function to find the right location in the file.
  6645. @item @code{(clock)}
  6646. File to the entry that is currently being clocked.
  6647. @item @code{(function function-finding-location)}
  6648. Most general way: write your own function which both visits the
  6649. file and moves point to the right location.
  6650. @end table
  6651. @item template
  6652. The template for creating the capture item. If you leave this
  6653. empty, an appropriate default template will be used. Otherwise
  6654. this is a string with escape codes, which will be replaced
  6655. depending on time and context of the capture call. The string
  6656. with escapes may be loaded from a template file, using the
  6657. special syntax @samp{(file "template filename")}. See below for more
  6658. details.
  6659. @item properties
  6660. The rest of the entry is a property list of additional options.
  6661. Recognized properties are:
  6662. @table @asis
  6663. @item @code{:prepend}
  6664. Normally new captured information will be appended at the
  6665. target location (last child, last table line, last list item,
  6666. @dots{}). Setting this property changes that.
  6667. @item @code{:immediate-finish}
  6668. When set, do not offer to edit the information, just file it
  6669. away immediately. This makes sense if the template only needs
  6670. information that can be added automatically.
  6671. @item @code{:empty-lines}
  6672. Set this to the number of lines to insert before and after the
  6673. new item. Default 0, and the only other common value is 1.
  6674. @item @code{:clock-in}
  6675. Start the clock in this item.
  6676. @item @code{:clock-keep}
  6677. Keep the clock running when filing the captured entry.
  6678. @item @code{:clock-resume}
  6679. If starting the capture interrupted a clock, restart that clock
  6680. when finished with the capture. Note that @code{:clock-keep} has
  6681. precedence over @code{:clock-resume}. When setting both to
  6682. non-@code{nil}, the current clock will run and the previous one will
  6683. not be resumed.
  6684. @item @code{:time-prompt}
  6685. Prompt for a date/time to be used for date/week trees and when
  6686. filling the template. Without this property, capture uses the
  6687. current date and time. Even if this property has not been set,
  6688. you can force the same behavior by calling @code{org-capture} with
  6689. a @kbd{C-1} prefix argument.
  6690. @item @code{:tree-type}
  6691. When @code{week}, make a week tree instead of the month tree, i.e.,
  6692. place the headings for each day under a heading with the
  6693. current ISO week.
  6694. @item @code{:unnarrowed}
  6695. Do not narrow the target buffer, simply show the full buffer. Default
  6696. is to narrow it so that you only see the new material.
  6697. @item @code{:table-line-pos}
  6698. Specification of the location in the table where the new line
  6699. should be inserted. It should be a string like @samp{II-3} meaning
  6700. that the new line should become the third line before the
  6701. second horizontal separator line.
  6702. @item @code{:kill-buffer}
  6703. If the target file was not yet visited when capture was invoked, kill
  6704. the buffer again after capture is completed.
  6705. @end table
  6706. @end table
  6707. @node Template expansion
  6708. @subsubsection Template expansion
  6709. In the template itself, special ``%-escapes''@footnote{If you need one of these sequences literally, escape the @samp{%}
  6710. with a backslash.} allow dynamic
  6711. insertion of content. The templates are expanded in the order given
  6712. here:
  6713. @table @asis
  6714. @item @code{%[FILE]}
  6715. Insert the contents of the file given by @var{FILE}.
  6716. @item @code{%(SEXP)}
  6717. Evaluate Elisp SEXP and replace with the result. The
  6718. @var{SEXP} must return a string.
  6719. @item @code{%<FORMAT>}
  6720. The result of format-time-string on the @var{FORMAT}
  6721. specification.
  6722. @item @code{%t}
  6723. Timestamp, date only.
  6724. @item @code{%T}
  6725. Timestamp, with date and time.
  6726. @item @code{%u}, @code{%U}
  6727. Like @code{%t}, @code{%T} above, but inactive timestamps.
  6728. @item @code{%i}
  6729. Initial content, the region when capture is called while the
  6730. region is active. The entire text will be indented like @code{%i}
  6731. itself.
  6732. @item @code{%a}
  6733. Annotation, normally the link created with @code{org-store-link}.
  6734. @item @code{%A}
  6735. Like @code{%a}, but prompt for the description part.
  6736. @item @code{%l}
  6737. Like @code{%a}, but only insert the literal link.
  6738. @item @code{%c}
  6739. Current kill ring head.
  6740. @item @code{%x}
  6741. Content of the X clipboard.
  6742. @item @code{%k}
  6743. Title of the currently clocked task.
  6744. @item @code{%K}
  6745. Link to the currently clocked task.
  6746. @item @code{%n}
  6747. User name (taken from @code{user-full-name}).
  6748. @item @code{%f}
  6749. File visited by current buffer when org-capture was called.
  6750. @item @code{%F}
  6751. Full path of the file or directory visited by current buffer.
  6752. @item @code{%:keyword}
  6753. Specific information for certain link types, see below.
  6754. @item @code{%^g}
  6755. Prompt for tags, with completion on tags in target file.
  6756. @item @code{%^G}
  6757. Prompt for tags, with completion all tags in all agenda files.
  6758. @item @code{%^t}
  6759. Like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}. You may
  6760. define a prompt like @code{%^@{Birthday@}t}.
  6761. @item @code{%^C}
  6762. Interactive selection of which kill or clip to use.
  6763. @item @code{%^L}
  6764. Like @code{%^C}, but insert as link.
  6765. @item @code{%^@{PROP@}p}
  6766. Prompt the user for a value for property PROP.
  6767. @item @code{%^@{PROMPT@}}
  6768. Prompt the user for a string and replace this sequence with it.
  6769. You may specify a default value and a completion table with
  6770. @code{%^@{prompt|default|completion2|completion3...@}}. The arrow keys
  6771. access a prompt-specific history.
  6772. @item @code{%\n}
  6773. Insert the text entered at the Nth @code{%^@{PROMPT@}}, where N is
  6774. a number, starting from 1.
  6775. @item @code{%?}
  6776. After completing the template, position cursor here.
  6777. @end table
  6778. @noindent
  6779. @vindex org-store-link-props
  6780. 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
  6781. accessed in capture templates in a similar way.}:
  6782. @vindex org-from-is-user-regexp
  6783. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  6784. @headitem Link type
  6785. @tab Available keywords
  6786. @item bbdb
  6787. @tab @code{%:name}, @code{%:company}
  6788. @item irc
  6789. @tab @code{%:server}, @code{%:port}, @code{%:nick}
  6790. @item mh, rmail
  6791. @tab @code{%:type}, @code{%:subject}, @code{%:message-id}
  6792. @item
  6793. @tab @code{%:from}, @code{%:fromname}, @code{%:fromaddress}
  6794. @item
  6795. @tab @code{%:to}, @code{%:toname}, @code{%:toaddress}
  6796. @item
  6797. @tab @code{%:date} (message date header field)
  6798. @item
  6799. @tab @code{%:date-timestamp} (date as active timestamp)
  6800. @item
  6801. @tab @code{%:date-timestamp-inactive} (date as inactive timestamp)
  6802. @item
  6803. @tab @code{%:fromto} (either ``to NAME'' or ``from NAME'')@footnote{This is always the other, not the user. See the variable
  6804. @code{org-from-is-user-regexp}.}
  6805. @item gnus
  6806. @tab @code{%:group}, for messages also all email fields
  6807. @item w3, w3m
  6808. @tab @code{%:url}
  6809. @item info
  6810. @tab @code{%:file}, @code{%:node}
  6811. @item calendar
  6812. @tab @code{%:date}
  6813. @item org-protocol
  6814. @tab @code{%:link}, @code{%:description}, @code{%:annotation}
  6815. @end multitable
  6816. @node Templates in contexts
  6817. @subsubsection Templates in contexts
  6818. @vindex org-capture-templates-contexts
  6819. To control whether a capture template should be accessible from
  6820. a specific context, you can customize
  6821. @code{org-capture-templates-contexts}. Let's say, for example, that you
  6822. have a capture template ``p'' for storing Gnus emails containing
  6823. patches. Then you would configure this option like this:
  6824. @lisp
  6825. (setq org-capture-templates-contexts
  6826. '(("p" (in-mode . "message-mode"))))
  6827. @end lisp
  6828. You can also tell that the command key @kbd{p} should refer to
  6829. another template. In that case, add this command key like this:
  6830. @lisp
  6831. (setq org-capture-templates-contexts
  6832. '(("p" "q" (in-mode . "message-mode"))))
  6833. @end lisp
  6834. See the docstring of the variable for more information.
  6835. @node Attachments
  6836. @section Attachments
  6837. @cindex attachments
  6838. @vindex org-attach-directory
  6839. It is often useful to associate reference material with an outline
  6840. node/task. Small chunks of plain text can simply be stored in the
  6841. subtree of a project. Hyperlinks (see @ref{Hyperlinks}) can establish
  6842. associations with files that live elsewhere on your computer or in the
  6843. cloud, like emails or source code files belonging to a project.
  6844. Another method is @emph{attachments}, which are files located in
  6845. a directory belonging to an outline node. Org uses directories named
  6846. by the unique ID of each entry. These directories are located in the
  6847. @code{data} directory which lives in the same directory where your Org file
  6848. lives@footnote{If you move entries or Org files from one directory to
  6849. another, you may want to configure @code{org-attach-directory} to contain
  6850. an absolute path.}. If you initialize this directory with @samp{git init}, Org
  6851. automatically commits changes when it sees them. The attachment
  6852. system has been contributed to Org by John Wiegley.
  6853. In cases where it seems better to do so, you can attach a directory of
  6854. your choice to an entry. You can also make children inherit the
  6855. attachment directory from a parent, so that an entire subtree uses the
  6856. same attached directory.
  6857. @noindent
  6858. The following commands deal with attachments:
  6859. @table @asis
  6860. @item @kbd{C-c C-a} (@code{org-attach})
  6861. @kindex C-c C-a
  6862. @findex org-attach
  6863. The dispatcher for commands related to the attachment system.
  6864. After these keys, a list of commands is displayed and you must
  6865. press an additional key to select a command:
  6866. @table @asis
  6867. @item @kbd{a} (@code{org-attach-attach})
  6868. @kindex C-c C-a a
  6869. @findex org-attach-attach
  6870. @vindex org-attach-method
  6871. Select a file and move it into the task's attachment
  6872. directory. The file is copied, moved, or linked, depending
  6873. on @code{org-attach-method}. Note that hard links are not
  6874. supported on all systems.
  6875. @item @kbd{c}/@kbd{m}/@kbd{l}
  6876. @kindex C-c C-a c
  6877. @kindex C-c C-a m
  6878. @kindex C-c C-a l
  6879. Attach a file using the copy/move/link method. Note that
  6880. hard links are not supported on all systems.
  6881. @item @kbd{n} (@code{org-attach-new})
  6882. @kindex C-c C-a n
  6883. @findex org-attach-new
  6884. Create a new attachment as an Emacs buffer.
  6885. @item @kbd{z} (@code{org-attach-sync})
  6886. @kindex C-c C-a z
  6887. @findex org-attach-sync
  6888. Synchronize the current task with its attachment directory, in case
  6889. you added attachments yourself.
  6890. @item @kbd{o} (@code{org-attach-open})
  6891. @kindex C-c C-a o
  6892. @findex org-attach-open
  6893. @vindex org-file-apps
  6894. Open current task's attachment. If there is more than one,
  6895. prompt for a file name first. Opening follows the rules set
  6896. by @code{org-file-apps}. For more details, see the information
  6897. on following hyperlinks (see @ref{Handling Links}).
  6898. @item @kbd{O} (@code{org-attach-open-in-emacs})
  6899. @kindex C-c C-a O
  6900. @findex org-attach-open-in-emacs
  6901. Also open the attachment, but force opening the file in
  6902. Emacs.
  6903. @item @kbd{f} (@code{org-attach-reveal})
  6904. @kindex C-c C-a f
  6905. @findex org-attach-reveal
  6906. Open the current task's attachment directory.
  6907. @item @kbd{F} (@code{org-attach-reveal-in-emacs})
  6908. @kindex C-c C-a F
  6909. @findex org-attach-reveal-in-emacs
  6910. Also open the directory, but force using Dired in Emacs.
  6911. @item @kbd{d} (@code{org-attach-delete-one})
  6912. @kindex C-c C-a d
  6913. Select and delete a single attachment.
  6914. @item @kbd{D} (@code{org-attach-delete-all})
  6915. @kindex C-c C-a D
  6916. Delete all of a task's attachments. A safer way is to open
  6917. the directory in Dired and delete from there.
  6918. @item @kbd{s} (@code{org-attach-set-directory})
  6919. @kindex C-c C-a s
  6920. @cindex @samp{ATTACH_DIR}, property
  6921. Set a specific directory as the entry's attachment
  6922. directory. This works by putting the directory path into
  6923. the @samp{ATTACH_DIR} property.
  6924. @item @kbd{i} (@code{org-attach-set-inherit})
  6925. @kindex C-c C-a i
  6926. @cindex @samp{ATTACH_DIR_INHERIT}, property
  6927. Set the @samp{ATTACH_DIR_INHERIT} property, so that children use
  6928. the same directory for attachments as the parent does.
  6929. @end table
  6930. @end table
  6931. @cindex attach from Dired
  6932. @findex org-attach-dired-to-subtree
  6933. It is possible to attach files to a subtree from a Dired buffer. To
  6934. use this feature, have one window in Dired mode containing the file(s)
  6935. to be attached and another window with point in the subtree that shall
  6936. get the attachments. In the Dired window, with point on a file,
  6937. @kbd{M-x org-attach-dired-to-subtree} attaches the file to the
  6938. subtree using the attachment method set by variable
  6939. @code{org-attach-method}. When files are marked in the Dired window then
  6940. all marked files get attached.
  6941. Add the following lines to the Emacs init file to have @kbd{C-c C-x a} attach files in Dired buffers.
  6942. @lisp
  6943. (add-hook 'dired-mode-hook
  6944. (lambda ()
  6945. (define-key dired-mode-map
  6946. (kbd "C-c C-x a")
  6947. #'org-attach-dired-to-subtree))))
  6948. @end lisp
  6949. The following code shows how to bind the previous command with
  6950. a specific attachment method.
  6951. @lisp
  6952. (add-hook 'dired-mode-hook
  6953. (lambda ()
  6954. (define-key dired-mode-map (kbd "C-c C-x c")
  6955. (lambda ()
  6956. (interactive)
  6957. (let ((org-attach-method 'cp))
  6958. (call-interactively #'org-attach-dired-to-subtree))))))
  6959. @end lisp
  6960. @node RSS Feeds
  6961. @section RSS Feeds
  6962. @cindex RSS feeds
  6963. @cindex Atom feeds
  6964. Org can add and change entries based on information found in RSS feeds
  6965. and Atom feeds. You could use this to make a task out of each new
  6966. podcast in a podcast feed. Or you could use a phone-based
  6967. note-creating service on the web to import tasks into Org. To access
  6968. feeds, configure the variable @code{org-feed-alist}. The docstring of this
  6969. variable has detailed information. With the following
  6970. @lisp
  6971. (setq org-feed-alist
  6972. '(("Slashdot"
  6973. "http://rss.slashdot.org/Slashdot/slashdot"
  6974. "~/txt/org/feeds.org" "Slashdot Entries")))
  6975. @end lisp
  6976. @noindent
  6977. new items from the feed provided by @samp{rss.slashdot.org} result in new
  6978. entries in the file @samp{~/org/feeds.org} under the heading @samp{Slashdot
  6979. Entries}, whenever the following command is used:
  6980. @table @asis
  6981. @item @kbd{C-c C-x g} (@code{org-feed-update-all})
  6982. @kindex C-c C-x g
  6983. Collect items from the feeds configured in @code{org-feed-alist} and
  6984. act upon them.
  6985. @item @kbd{C-c C-x G} (@code{org-feed-goto-inbox})
  6986. @kindex C-c C-x G
  6987. Prompt for a feed name and go to the inbox configured for this feed.
  6988. @end table
  6989. Under the same headline, Org creates a drawer @samp{FEEDSTATUS} in which it
  6990. stores information about the status of items in the feed, to avoid
  6991. adding the same item several times.
  6992. For more information, including how to read atom feeds, see
  6993. @samp{org-feed.el} and the docstring of @code{org-feed-alist}.
  6994. @node Protocols
  6995. @section Protocols for External Access
  6996. @cindex protocols, for external access
  6997. Org protocol is a means to trigger custom actions in Emacs from
  6998. external applications. Any application that supports calling external
  6999. programs with an URL as argument may be used with this functionality.
  7000. For example, you can configure bookmarks in your web browser to send
  7001. a link to the current page to Org and create a note from it using
  7002. capture (see @ref{Capture}). You can also create a bookmark that tells
  7003. Emacs to open the local source file of a remote website you are
  7004. browsing.
  7005. @cindex Org protocol, set-up
  7006. @cindex Installing Org protocol
  7007. In order to use Org protocol from an application, you need to register
  7008. @samp{org-protocol://} as a valid scheme-handler. External calls are
  7009. passed to Emacs through the @samp{emacsclient} command, so you also need to
  7010. ensure an Emacs server is running. More precisely, when the
  7011. application calls
  7012. @example
  7013. emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2
  7014. @end example
  7015. @noindent
  7016. Emacs calls the handler associated to @var{PROTOCOL} with
  7017. argument @samp{(:key1 val1 :key2 val2)}.
  7018. @cindex protocol, new protocol
  7019. @cindex defining new protocols
  7020. Org protocol comes with three predefined protocols, detailed in the
  7021. following sections. Configure @code{org-protocol-protocol-alist} to define
  7022. your own.
  7023. @menu
  7024. * @code{store-link} protocol:: Store a link, push URL to kill-ring.
  7025. * @code{capture} protocol:: Fill a buffer with external information.
  7026. * @code{open-source} protocol:: Edit published contents.
  7027. @end menu
  7028. @node @code{store-link} protocol
  7029. @subsection @code{store-link} protocol
  7030. @cindex store-link protocol
  7031. @cindex protocol, store-link
  7032. Using @code{store-link} handler, you can copy links, insertable through
  7033. @kbd{M-x org-insert-link} or yanking thereafter. More precisely,
  7034. the command
  7035. @example
  7036. emacsclient org-protocol://store-link?url=URL&title=TITLE
  7037. @end example
  7038. @noindent
  7039. stores the following link:
  7040. @example
  7041. [[URL][TITLE]]
  7042. @end example
  7043. In addition, @var{URL} is pushed on the kill-ring for yanking.
  7044. You need to encode @var{URL} and @var{TITLE} if they contain
  7045. slashes, and probably quote those for the shell.
  7046. To use this feature from a browser, add a bookmark with an arbitrary
  7047. name, e.g., @samp{Org: store-link} and enter this as @emph{Location}:
  7048. @example
  7049. javascript:location.href='org-protocol://store-link?url='+
  7050. encodeURIComponent(location.href);
  7051. @end example
  7052. @node @code{capture} protocol
  7053. @subsection @code{capture} protocol
  7054. @cindex capture protocol
  7055. @cindex protocol, capture
  7056. Activating ``capture'' handler pops up a @samp{Capture} buffer and fills the
  7057. capture template associated to the @samp{X} key with them.
  7058. @example
  7059. emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY
  7060. @end example
  7061. To use this feature, add a bookmark with an arbitrary name, e.g.
  7062. @samp{Org: capture} and enter this as @samp{Location}:
  7063. @example
  7064. javascript:location.href='org-protocol://capture?template=x'+
  7065. '&url='+encodeURIComponent(window.location.href)+
  7066. '&title='+encodeURIComponent(document.title)+
  7067. '&body='+encodeURIComponent(window.getSelection());
  7068. @end example
  7069. @vindex org-protocol-default-template-key
  7070. The result depends on the capture template used, which is set in the
  7071. bookmark itself, as in the example above, or in
  7072. @code{org-protocol-default-template-key}.
  7073. The following template placeholders are available:
  7074. @example
  7075. %:link The URL
  7076. %:description The webpage title
  7077. %:annotation Equivalent to [[%:link][%:description]]
  7078. %i The selected text
  7079. @end example
  7080. @node @code{open-source} protocol
  7081. @subsection @code{open-source} protocol
  7082. @cindex open-source protocol
  7083. @cindex protocol, open-source
  7084. The @code{open-source} handler is designed to help with editing local
  7085. sources when reading a document. To that effect, you can use
  7086. a bookmark with the following location:
  7087. @example
  7088. javascript:location.href='org-protocol://open-source?&url='+
  7089. encodeURIComponent(location.href)
  7090. @end example
  7091. @vindex org-protocol-project-alist
  7092. The variable @code{org-protocol-project-alist} maps URLs to local file
  7093. names, by stripping URL parameters from the end and replacing the
  7094. @code{:base-url} with @code{:working-directory} and @code{:online-suffix} with
  7095. @code{:working-suffix}. For example, assuming you own a local copy of
  7096. @samp{https://orgmode.org/worg/} contents at @samp{/home/user/worg}, you can set
  7097. @code{org-protocol-project-alist} to the following
  7098. @lisp
  7099. (setq org-protocol-project-alist
  7100. '(("Worg"
  7101. :base-url "https://orgmode.org/worg/"
  7102. :working-directory "/home/user/worg/"
  7103. :online-suffix ".html"
  7104. :working-suffix ".org")))
  7105. @end lisp
  7106. @noindent
  7107. If you are now browsing
  7108. @samp{https://orgmode.org/worg/org-contrib/org-protocol.html} and find
  7109. a typo or have an idea about how to enhance the documentation, simply
  7110. click the bookmark and start editing.
  7111. @cindex rewritten URL in open-source protocol
  7112. @cindex protocol, open-source rewritten URL
  7113. However, such mapping may not yield the desired results. Suppose you
  7114. maintain an online store located at @samp{http://example.com/}. The local
  7115. sources reside in @samp{/home/user/example/}. It is common practice to
  7116. serve all products in such a store through one file and rewrite URLs
  7117. that do not match an existing file on the server. That way, a request
  7118. to @samp{http://example.com/print/posters.html} might be rewritten on the
  7119. server to something like
  7120. @samp{http://example.com/shop/products.php/posters.html.php}. The
  7121. @code{open-source} handler probably cannot find a file named
  7122. @samp{/home/user/example/print/posters.html.php} and fails.
  7123. Such an entry in @code{org-protocol-project-alist} may hold an additional
  7124. property @code{:rewrites}. This property is a list of cons cells, each of
  7125. which maps a regular expression to a path relative to the
  7126. @code{:working-directory}.
  7127. Now map the URL to the path @samp{/home/user/example/products.php} by
  7128. adding @code{:rewrites} rules like this:
  7129. @lisp
  7130. (setq org-protocol-project-alist
  7131. '(("example.com"
  7132. :base-url "http://example.com/"
  7133. :working-directory "/home/user/example/"
  7134. :online-suffix ".php"
  7135. :working-suffix ".php"
  7136. :rewrites (("example.com/print/" . "products.php")
  7137. ("example.com/$" . "index.php")))))
  7138. @end lisp
  7139. @noindent
  7140. Since @samp{example.com/$} is used as a regular expression, it maps
  7141. @samp{http://example.com/}, @samp{https://example.com},
  7142. @samp{http://www.example.com/} and similar to
  7143. @samp{/home/user/example/index.php}.
  7144. The @code{:rewrites} rules are searched as a last resort if and only if no
  7145. existing file name is matched.
  7146. @cindex protocol, open-source, set-up mapping
  7147. @cindex mappings in open-source protocol
  7148. @findex org-protocol-create
  7149. @findex org-protocol-create-for-org
  7150. Two functions can help you filling @code{org-protocol-project-alist} with
  7151. valid contents: @code{org-protocol-create} and
  7152. @code{org-protocol-create-for-org}. The latter is of use if you're editing
  7153. an Org file that is part of a publishing project.
  7154. @node Refile and Copy
  7155. @section Refile and Copy
  7156. @cindex refiling notes
  7157. @cindex copying notes
  7158. When reviewing the captured data, you may want to refile or to copy
  7159. some of the entries into a different list, for example into a project.
  7160. Cutting, finding the right location, and then pasting the note is
  7161. cumbersome. To simplify this process, you can use the following
  7162. special command:
  7163. @table @asis
  7164. @item @kbd{C-c M-w} (@code{org-copy})
  7165. @kindex C-c M-w
  7166. @findex org-copy
  7167. Copying works like refiling, except that the original note is not
  7168. deleted.
  7169. @item @kbd{C-c C-w} (@code{org-refile})
  7170. @kindex C-c C-w
  7171. @findex org-refile
  7172. @vindex org-reverse-note-order
  7173. @vindex org-refile-targets
  7174. @vindex org-refile-use-outline-path
  7175. @vindex org-outline-path-complete-in-steps
  7176. @vindex org-refile-allow-creating-parent-nodes
  7177. @vindex org-log-refile
  7178. Refile the entry or region at point. This command offers
  7179. possible locations for refiling the entry and lets you select one
  7180. with completion. The item (or all items in the region) is filed
  7181. below the target heading as a subitem. Depending on
  7182. @code{org-reverse-note-order}, it is either the first or last subitem.
  7183. By default, all level 1 headlines in the current buffer are
  7184. considered to be targets, but you can have more complex
  7185. definitions across a number of files. See the variable
  7186. @code{org-refile-targets} for details. If you would like to select
  7187. a location via a file-path-like completion along the outline
  7188. path, see the variables @code{org-refile-use-outline-path} and
  7189. @code{org-outline-path-complete-in-steps}. If you would like to be
  7190. able to create new nodes as new parents for refiling on the fly,
  7191. check the variable @code{org-refile-allow-creating-parent-nodes}.
  7192. When the variable @code{org-log-refile}@footnote{Note the corresponding @samp{STARTUP} options @samp{logrefile},
  7193. @samp{lognoterefile}, and @samp{nologrefile}.} is set, a timestamp or
  7194. a note is recorded whenever an entry is refiled.
  7195. @item @kbd{C-u C-c C-w}
  7196. @kindex C-u C-c C-w
  7197. Use the refile interface to jump to a heading.
  7198. @item @kbd{C-u C-u C-c C-w} (@code{org-refile-goto-last-stored})
  7199. @kindex C-u C-u C-c C-w
  7200. @findex org-refile-goto-last-stored
  7201. Jump to the location where @code{org-refile} last moved a tree to.
  7202. @item @kbd{C-2 C-c C-w}
  7203. @kindex C-2 C-c C-w
  7204. Refile as the child of the item currently being clocked.
  7205. @item @kbd{C-3 C-c C-w}
  7206. @kindex C-3 C-c C-w
  7207. @vindex org-refile-keep
  7208. Refile and keep the entry in place. Also see @code{org-refile-keep}
  7209. to make this the default behavior, and beware that this may
  7210. result in duplicated @code{ID} properties.
  7211. @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})
  7212. @kindex C-u C-u C-u C-c C-w
  7213. @kindex C-0 C-c C-w
  7214. @findex org-refile-cache-clear
  7215. @vindex org-refile-use-cache
  7216. Clear the target cache. Caching of refile targets can be turned
  7217. on by setting @code{org-refile-use-cache}. To make the command see
  7218. new possible targets, you have to clear the cache with this
  7219. command.
  7220. @end table
  7221. @node Archiving
  7222. @section Archiving
  7223. @cindex archiving
  7224. When a project represented by a (sub)tree is finished, you may want to
  7225. move the tree out of the way and to stop it from contributing to the
  7226. agenda. Archiving is important to keep your working files compact and
  7227. global searches like the construction of agenda views fast.
  7228. @table @asis
  7229. @item @kbd{C-c C-x C-a} (@code{org-archive-subtree-default})
  7230. @kindex C-c C-x C-a
  7231. @findex org-archive-subtree-default
  7232. @vindex org-archive-default-command
  7233. Archive the current entry using the command specified in the
  7234. variable @code{org-archive-default-command}.
  7235. @end table
  7236. @menu
  7237. * Moving subtrees:: Moving a tree to an archive file.
  7238. * Internal archiving:: Switch off a tree but keep it in the file.
  7239. @end menu
  7240. @node Moving subtrees
  7241. @subsection Moving a tree to an archive file
  7242. @cindex external archiving
  7243. The most common archiving action is to move a project tree to another
  7244. file, the archive file.
  7245. @table @asis
  7246. @item @kbd{C-c C-x C-s} or short @kbd{C-c $} (@code{org-archive-subtree})
  7247. @kindex C-c C-x C-s
  7248. @kindex C-c $
  7249. @findex org-archive-subtree
  7250. @vindex org-archive-location
  7251. Archive the subtree starting at the cursor position to the
  7252. location given by @code{org-archive-location}.
  7253. @item @kbd{C-u C-c C-x C-s}
  7254. @kindex C-u C-c C-x C-s
  7255. Check if any direct children of the current headline could be
  7256. moved to the archive. To do this, check each subtree for open
  7257. TODO entries. If none is found, the command offers to move it to
  7258. the archive location. If the cursor is @emph{not} on a headline when
  7259. this command is invoked, check level 1 trees.
  7260. @item @kbd{C-u C-u C-c C-x C-s}
  7261. @kindex C-u C-u C-c C-x C-s
  7262. As above, but check subtree for timestamps instead of TODO
  7263. entries. The command offers to archive the subtree if it @emph{does}
  7264. contain a timestamp, and that timestamp is in the past.
  7265. @end table
  7266. @cindex archive locations
  7267. The default archive location is a file in the same directory as the
  7268. current file, with the name derived by appending @samp{_archive} to the
  7269. current file name. You can also choose what heading to file archived
  7270. items under, with the possibility to add them to a datetree in a file.
  7271. For information and examples on how to specify the file and the
  7272. heading, see the documentation string of the variable
  7273. @code{org-archive-location}.
  7274. There is also an in-buffer option for setting this variable, for
  7275. example:
  7276. @cindex @samp{ARCHIVE}, keyword
  7277. @example
  7278. #+ARCHIVE: %s_done::
  7279. @end example
  7280. @noindent
  7281. @cindex ARCHIVE, property
  7282. If you would like to have a special archive location for a single
  7283. entry or a (sub)tree, give the entry an @samp{ARCHIVE} property with the
  7284. location as the value (see @ref{Properties and Columns}).
  7285. @vindex org-archive-save-context-info
  7286. When a subtree is moved, it receives a number of special properties
  7287. that record context information like the file from where the entry
  7288. came, its outline path the archiving time etc. Configure the variable
  7289. @code{org-archive-save-context-info} to adjust the amount of information
  7290. added.
  7291. @node Internal archiving
  7292. @subsection Internal archiving
  7293. @cindex @samp{ARCHIVE}, tag
  7294. If you want to just switch off---for agenda views---certain subtrees
  7295. without moving them to a different file, you can use the @samp{ARCHIVE}
  7296. tag.
  7297. A headline that is marked with the @samp{ARCHIVE} tag (see @ref{Tags}) stays at
  7298. its location in the outline tree, but behaves in the following way:
  7299. @itemize
  7300. @item
  7301. @vindex org-cycle-open-archived-trees
  7302. It does not open when you attempt to do so with a visibility cycling
  7303. command (see @ref{Visibility Cycling}). You can force cycling archived
  7304. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  7305. @code{org-cycle-open-archived-trees}. Also normal outline commands, like
  7306. @code{outline-show-all}, open archived subtrees.
  7307. @item
  7308. @vindex org-sparse-tree-open-archived-trees
  7309. During sparse tree construction (see @ref{Sparse Trees}), matches in
  7310. archived subtrees are not exposed, unless you configure the option
  7311. @code{org-sparse-tree-open-archived-trees}.
  7312. @item
  7313. @vindex org-agenda-skip-archived-trees
  7314. During agenda view construction (see @ref{Agenda Views}), the content of
  7315. archived trees is ignored unless you configure the option
  7316. @code{org-agenda-skip-archived-trees}, in which case these trees are
  7317. always included. In the agenda you can press @kbd{v a} to get
  7318. archives temporarily included.
  7319. @item
  7320. @vindex org-export-with-archived-trees
  7321. Archived trees are not exported (see @ref{Exporting}), only the headline
  7322. is. Configure the details using the variable
  7323. @code{org-export-with-archived-trees}.
  7324. @item
  7325. @vindex org-columns-skip-archived-trees
  7326. Archived trees are excluded from column view unless the variable
  7327. @code{org-columns-skip-archived-trees} is configured to @code{nil}.
  7328. @end itemize
  7329. The following commands help manage the @samp{ARCHIVE} tag:
  7330. @table @asis
  7331. @item @kbd{C-c C-x a} (@code{org-toggle-archive-tag})
  7332. @kindex C-c C-x a
  7333. @findex org-toggle-archive-tag
  7334. Toggle the archive tag for the current headline. When the tag is
  7335. set, the headline changes to a shadowed face, and the subtree
  7336. below it is hidden.
  7337. @item @kbd{C-u C-c C-x a}
  7338. @kindex C-u C-c C-x a
  7339. Check if any direct children of the current headline should be
  7340. archived. To do this, check each subtree for open TODO entries.
  7341. If none is found, the command offers to set the @samp{ARCHIVE} tag for
  7342. the child. If the cursor is @emph{not} on a headline when this
  7343. command is invoked, check the level 1 trees.
  7344. @item @kbd{C-@key{TAB}}, @code{org-force-cycle-archived}
  7345. @kindex C-TAB
  7346. Cycle a tree even if it is tagged with @samp{ARCHIVE}.
  7347. @item @kbd{C-c C-x A} (@code{org-archive-to-archive-sibling})
  7348. @kindex C-c C-x A
  7349. @findex org-archive-to-archive-sibling
  7350. Move the current entry to the @emph{Archive Sibling}. This is
  7351. a sibling of the entry with the heading @samp{Archive} and the archive
  7352. tag. The entry becomes a child of that sibling and in this way
  7353. retains a lot of its original context, including inherited tags
  7354. and approximate position in the outline.
  7355. @end table
  7356. @node Agenda Views
  7357. @chapter Agenda Views
  7358. @cindex agenda views
  7359. Due to the way Org works, TODO items, time-stamped items, and tagged
  7360. headlines can be scattered throughout a file or even a number of
  7361. files. To get an overview of open action items, or of events that are
  7362. important for a particular date, this information must be collected,
  7363. sorted and displayed in an organized way.
  7364. Org can select items based on various criteria and display them in
  7365. a separate buffer. Seven different view types are provided:
  7366. @itemize
  7367. @item
  7368. an @emph{agenda} that is like a calendar and shows information for
  7369. specific dates,
  7370. @item
  7371. a @emph{TODO list} that covers all unfinished action items,
  7372. @item
  7373. a @emph{match view}, showings headlines based on the tags, properties,
  7374. and TODO state associated with them,
  7375. @item
  7376. a @emph{timeline view} that shows all events in a single Org file, in
  7377. time-sorted view,
  7378. @item
  7379. a @emph{text search view} that shows all entries from multiple files that
  7380. contain specified keywords,
  7381. @item
  7382. a @emph{stuck projects view} showing projects that currently do not move
  7383. along, and
  7384. @item
  7385. @emph{custom views} that are special searches and combinations of
  7386. different views.
  7387. @end itemize
  7388. @noindent
  7389. The extracted information is displayed in a special @emph{agenda buffer}.
  7390. This buffer is read-only, but provides commands to visit the
  7391. corresponding locations in the original Org files, and even to edit
  7392. these files remotely.
  7393. @vindex org-agenda-skip-comment-trees
  7394. @vindex org-agenda-skip-archived-trees
  7395. @cindex commented entries, in agenda views
  7396. @cindex archived entries, in agenda views
  7397. By default, the report ignores commented (see @ref{Comment Lines}) and
  7398. archived (see @ref{Internal archiving}) entries. You can override this by
  7399. setting @code{org-agenda-skip-comment-trees} and
  7400. @code{org-agenda-skip-archived-trees} to @code{nil}.
  7401. @vindex org-agenda-window-setup
  7402. @vindex org-agenda-restore-windows-after-quit
  7403. Two variables control how the agenda buffer is displayed and whether
  7404. the window configuration is restored when the agenda exits:
  7405. @code{org-agenda-window-setup} and @code{org-agenda-restore-windows-after-quit}.
  7406. @menu
  7407. * Agenda Files:: Files being searched for agenda information.
  7408. * Agenda Dispatcher:: Keyboard access to agenda views.
  7409. * Built-in Agenda Views:: What is available out of the box?
  7410. * Presentation and Sorting:: How agenda items are prepared for display.
  7411. * Agenda Commands:: Remote editing of Org trees.
  7412. * Custom Agenda Views:: Defining special searches and views.
  7413. * Exporting Agenda Views:: Writing a view to a file.
  7414. * Agenda Column View:: Using column view for collected entries.
  7415. @end menu
  7416. @node Agenda Files
  7417. @section Agenda Files
  7418. @cindex agenda files
  7419. @cindex files for agenda
  7420. @vindex org-agenda-files
  7421. The information to be shown is normally collected from all @emph{agenda
  7422. 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
  7423. name, then the list of agenda files in maintained in that external
  7424. file.}.
  7425. If a directory is part of this list, all files with the extension
  7426. @samp{.org} in this directory are part of the list.
  7427. Thus, even if you only work with a single Org file, that file should
  7428. be put into the list@footnote{When using the dispatcher, pressing @kbd{<} before
  7429. selecting a command actually limits the command to the current file,
  7430. and ignores @code{org-agenda-files} until the next dispatcher command.}. You can customize @code{org-agenda-files},
  7431. but the easiest way to maintain it is through the following commands
  7432. @table @asis
  7433. @item @kbd{C-c [} (@code{org-agenda-file-to-front})
  7434. @kindex C-c [
  7435. @findex org-agenda-file-to-front
  7436. @cindex files, adding to agenda list
  7437. Add current file to the list of agenda files. The file is added
  7438. to the front of the list. If it was already in the list, it is
  7439. moved to the front. With a prefix argument, file is added/moved
  7440. to the end.
  7441. @item @kbd{C-c ]} (@code{org-remove-file})
  7442. @kindex C-c ]
  7443. @findex org-remove-file
  7444. Remove current file from the list of agenda files.
  7445. @item @kbd{C-'}
  7446. @itemx @kbd{C-,} (@code{org-cycle-agenda-files})
  7447. @kindex C-'
  7448. @kindex C-,
  7449. @findex org-cycle-agenda-files
  7450. @cindex cycling, of agenda files
  7451. Cycle through agenda file list, visiting one file after the other.
  7452. @item @kbd{M-x org-switchb}
  7453. @findex org-switchb
  7454. Command to use an iswitchb-like interface to switch to and
  7455. between Org buffers.
  7456. @end table
  7457. @noindent
  7458. The Org menu contains the current list of files and can be used to
  7459. visit any of them.
  7460. If you would like to focus the agenda temporarily on a file not in
  7461. this list, or on just one file in the list, or even on only a subtree
  7462. in a file, then this can be done in different ways. For a single
  7463. agenda command, you may press @kbd{<} once or several times in
  7464. the dispatcher (see @ref{Agenda Dispatcher}). To restrict the agenda
  7465. scope for an extended period, use the following commands:
  7466. @table @asis
  7467. @item @kbd{C-c C-x <} (@code{org-agenda-set-restriction-lock})
  7468. @kindex C-c C-x <
  7469. @findex org-agenda-set-restriction-lock
  7470. Permanently restrict the agenda to the current subtree. When
  7471. called with a prefix argument, or with the cursor before the
  7472. first headline in a file, set the agenda scope to the entire
  7473. file. This restriction remains in effect until removed with
  7474. @kbd{C-c C-x >}, or by typing either @kbd{<} or
  7475. @kbd{>} in the agenda dispatcher. If there is a window
  7476. displaying an agenda view, the new restriction takes effect
  7477. immediately.
  7478. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  7479. @kindex C-c C-x >
  7480. @findex org-agenda-remove-restriction-lock
  7481. Remove the permanent restriction created by @kbd{C-c C-x <}.
  7482. @end table
  7483. @noindent
  7484. When working with @samp{speedbar.el}, you can use the following commands in
  7485. the Speedbar frame:
  7486. @table @asis
  7487. @item @kbd{<} (@code{org-speedbar-set-agenda-restriction})
  7488. @findex org-speedbar-set-agenda-restriction
  7489. Permanently restrict the agenda to the item---either an Org file
  7490. or a subtree in such a file---at the cursor in the Speedbar
  7491. frame. If there is a window displaying an agenda view, the new
  7492. restriction takes effect immediately.
  7493. @item @kbd{>} (@code{org-agenda-remove-restriction-lock})
  7494. @findex org-agenda-remove-restriction-lock
  7495. Lift the restriction.
  7496. @end table
  7497. @node Agenda Dispatcher
  7498. @section The Agenda Dispatcher
  7499. @cindex agenda dispatcher
  7500. @cindex dispatching agenda commands
  7501. The views are created through a dispatcher, accessible with @kbd{M-x org-agenda}, or, better, bound to a global key (see @ref{Activation}).
  7502. It displays a menu from which an additional letter is required to
  7503. execute a command. The dispatcher offers the following default
  7504. commands:
  7505. @table @asis
  7506. @item @kbd{a}
  7507. Create the calendar-like agenda (see @ref{Weekly/daily agenda}).
  7508. @item @kbd{t} or @kbd{T}
  7509. Create a list of all TODO items (see @ref{Global TODO list}).
  7510. @item @kbd{m} or @kbd{M}
  7511. Create a list of headlines matching a given expression (see
  7512. @ref{Matching tags and properties}).
  7513. @item @kbd{s}
  7514. @kindex s @r{(Agenda dispatcher)}
  7515. Create a list of entries selected by a boolean expression of
  7516. keywords and/or regular expressions that must or must not occur
  7517. in the entry.
  7518. @item @kbd{/}
  7519. @kindex / @r{(Agenda dispatcher)}
  7520. @vindex org-agenda-text-search-extra-files
  7521. Search for a regular expression in all agenda files and
  7522. additionally in the files listed in
  7523. @code{org-agenda-text-search-extra-files}. This uses the Emacs
  7524. command @code{multi-occur}. A prefix argument can be used to specify
  7525. the number of context lines for each match, default is
  7526. @enumerate
  7527. @item
  7528. @end enumerate
  7529. @item @kbd{#} or @kbd{!}
  7530. Create a list of stuck projects (see @ref{Stuck projects}).
  7531. @item @kbd{<}
  7532. @kindex < @r{(Agenda dispatcher)}
  7533. Restrict an agenda command to the current buffer@footnote{For backward compatibility, you can also press @kbd{1} to
  7534. restrict to the current buffer.}. After
  7535. pressing @kbd{<}, you still need to press the character
  7536. selecting the command.
  7537. @item @kbd{< <}
  7538. @kindex < < @r{(Agenda dispatcher)}
  7539. If there is an active region, restrict the following agenda
  7540. command to the region. Otherwise, restrict it to the current
  7541. subtree@footnote{For backward compatibility, you can also press @kbd{0} to
  7542. restrict to the current region/subtree.}. After pressing @kbd{< <}, you still need to
  7543. press the character selecting the command.
  7544. @item @kbd{*}
  7545. @kindex * @r{(Agenda dispatcher)}
  7546. @vindex org-agenda-sticky
  7547. @findex org-toggle-sticky-agenda
  7548. Toggle sticky agenda views. By default, Org maintains only
  7549. a single agenda buffer and rebuilds it each time you change the
  7550. view, to make sure everything is always up to date. If you
  7551. switch between views often and the build time bothers you, you
  7552. can turn on sticky agenda buffers (make this the default by
  7553. customizing the variable @code{org-agenda-sticky}). With sticky
  7554. agendas, the dispatcher only switches to the selected view, you
  7555. need to update it by hand with @kbd{r} or @kbd{g}. You
  7556. can toggle sticky agenda view any time with
  7557. @code{org-toggle-sticky-agenda}.
  7558. @end table
  7559. You can also define custom commands that are accessible through the
  7560. dispatcher, just like the default commands. This includes the
  7561. possibility to create extended agenda buffers that contain several
  7562. blocks together, for example the weekly agenda, the global TODO list
  7563. and a number of special tags matches. See @ref{Custom Agenda Views}.
  7564. @node Built-in Agenda Views
  7565. @section The Built-in Agenda Views
  7566. In this section we describe the built-in views.
  7567. @menu
  7568. * Weekly/daily agenda:: The calendar page with current tasks.
  7569. * Global TODO list:: All unfinished action items.
  7570. * Matching tags and properties:: Structured information with fine-tuned search.
  7571. * Search view:: Find entries by searching for text.
  7572. * Stuck projects:: Find projects you need to review.
  7573. @end menu
  7574. @node Weekly/daily agenda
  7575. @subsection Weekly/daily agenda
  7576. @cindex agenda
  7577. @cindex weekly agenda
  7578. @cindex daily agenda
  7579. The purpose of the weekly/daily @emph{agenda} is to act like a page of
  7580. a paper agenda, showing all the tasks for the current week or day.
  7581. @table @asis
  7582. @item @kbd{M-x org-agenda a} (@code{org-agenda-list})
  7583. @kindex a @r{(Agenda dispatcher)}
  7584. @findex org-agenda-list
  7585. @cindex org-agenda, command
  7586. Compile an agenda for the current week from a list of Org files.
  7587. The agenda shows the entries for each day. With a numeric prefix
  7588. argument@footnote{For backward compatibility, the universal prefix argument
  7589. @kbd{C-u} causes all TODO entries to be listed before the agenda.
  7590. This feature is deprecated, use the dedicated TODO list, or a block
  7591. agenda instead (see @ref{Block agenda}).}---like @kbd{C-u 2 1 M-x org-agenda a}---you
  7592. may set the number of days to be displayed.
  7593. @end table
  7594. @vindex org-agenda-span
  7595. @vindex org-agenda-start-day
  7596. @vindex org-agenda-start-on-weekday
  7597. The default number of days displayed in the agenda is set by the
  7598. variable @code{org-agenda-span}. This variable can be set to any number of
  7599. days you want to see by default in the agenda, or to a span name, such
  7600. a @code{day}, @code{week}, @code{month} or @code{year}. For weekly agendas, the default
  7601. is to start on the previous Monday (see
  7602. @code{org-agenda-start-on-weekday}). You can also set the start date using
  7603. a date shift: @code{(setq org-agenda-start-day "+10d")} starts the agenda
  7604. ten days from today in the future.
  7605. Remote editing from the agenda buffer means, for example, that you can
  7606. change the dates of deadlines and appointments from the agenda buffer.
  7607. The commands available in the Agenda buffer are listed in @ref{Agenda Commands}.
  7608. @anchor{Calendar/Diary integration}
  7609. @subsubheading Calendar/Diary integration
  7610. @cindex calendar integration
  7611. @cindex diary integration
  7612. Emacs contains the calendar and diary by Edward M. Reingold. The
  7613. calendar displays a three-month calendar with holidays from different
  7614. countries and cultures. The diary allows you to keep track of
  7615. anniversaries, lunar phases, sunrise/set, recurrent appointments
  7616. (weekly, monthly) and more. In this way, it is quite complementary to
  7617. Org. It can be very useful to combine output from Org with the diary.
  7618. In order to include entries from the Emacs diary into Org mode's
  7619. agenda, you only need to customize the variable
  7620. @lisp
  7621. (setq org-agenda-include-diary t)
  7622. @end lisp
  7623. @noindent
  7624. After that, everything happens automatically. All diary entries
  7625. including holidays, anniversaries, etc., are included in the agenda
  7626. buffer created by Org mode. @kbd{@key{SPC}}, @kbd{@key{TAB}}, and
  7627. @kbd{@key{RET}} can be used from the agenda buffer to jump to the diary
  7628. file in order to edit existing diary entries. The @kbd{i}
  7629. command to insert new entries for the current date works in the agenda
  7630. buffer, as well as the commands @kbd{S}, @kbd{M}, and
  7631. @kbd{C} to display Sunrise/Sunset times, show lunar phases and to
  7632. convert to other calendars, respectively. @kbd{c} can be used to
  7633. switch back and forth between calendar and agenda.
  7634. If you are using the diary only for S-exp entries and holidays, it is
  7635. faster to not use the above setting, but instead to copy or even move
  7636. the entries into an Org file. Org mode evaluates diary-style sexp
  7637. entries, and does it faster because there is no overhead for first
  7638. creating the diary display. Note that the sexp entries must start at
  7639. the left margin, no whitespace is allowed before them, as seen in the
  7640. following segment of an Org file:@footnote{The variable @code{org-anniversary} used in the example is just
  7641. like @code{diary-anniversary}, but the argument order is always according
  7642. to ISO and therefore independent of the value of
  7643. @code{calendar-date-style}.}
  7644. @example
  7645. * Holidays
  7646. :PROPERTIES:
  7647. :CATEGORY: Holiday
  7648. :END:
  7649. %%(org-calendar-holiday) ; special function for holiday names
  7650. * Birthdays
  7651. :PROPERTIES:
  7652. :CATEGORY: Ann
  7653. :END:
  7654. %%(org-anniversary 1956 5 14) Arthur Dent is %d years old
  7655. %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
  7656. @end example
  7657. @anchor{Anniversaries from BBDB}
  7658. @subsubheading Anniversaries from BBDB
  7659. @cindex BBDB, anniversaries
  7660. @cindex anniversaries, from BBDB
  7661. @findex org-bbdb-anniversaries
  7662. If you are using the Insidious Big Brother Database to store your
  7663. contacts, you very likely prefer to store anniversaries in BBDB rather
  7664. than in a separate Org or diary file. Org supports this and can show
  7665. BBDB anniversaries as part of the agenda. All you need to do is to
  7666. add the following to one of your agenda files:
  7667. @example
  7668. * Anniversaries
  7669. :PROPERTIES:
  7670. :CATEGORY: Anniv
  7671. :END:
  7672. %%(org-bbdb-anniversaries)
  7673. @end example
  7674. You can then go ahead and define anniversaries for a BBDB record.
  7675. Basically, you need to press @kbd{C-o anniversary @key{RET}} with the
  7676. cursor in a BBDB record and then add the date in the format
  7677. @samp{YYYY-MM-DD} or @samp{MM-DD}, followed by a space and the class of the
  7678. anniversary (@samp{birthday}, @samp{wedding}, or a format string). If you omit
  7679. the class, it defaults to @samp{birthday}. Here are a few examples, the
  7680. header for the file @samp{org-bbdb.el} contains more detailed information.
  7681. @example
  7682. 1973-06-22
  7683. 06-22
  7684. 1955-08-02 wedding
  7685. 2008-04-14 %s released version 6.01 of Org mode, %d years ago
  7686. @end example
  7687. After a change to BBDB, or for the first agenda display during an
  7688. Emacs session, the agenda display suffers a short delay as Org updates
  7689. its hash with anniversaries. However, from then on things will be
  7690. very fast, much faster in fact than a long list of
  7691. @samp{%%(diary-anniversary)} entries in an Org or Diary file.
  7692. @findex org-bbdb-anniversaries-future
  7693. If you would like to see upcoming anniversaries with a bit of
  7694. forewarning, you can use the following instead:
  7695. @example
  7696. * Anniversaries
  7697. :PROPERTIES:
  7698. :CATEGORY: Anniv
  7699. :END:
  7700. %%(org-bbdb-anniversaries-future 3)
  7701. @end example
  7702. That will give you three days' warning: on the anniversary date itself
  7703. and the two days prior. The argument is optional: if omitted, it
  7704. defaults to 7.
  7705. @anchor{Appointment reminders}
  7706. @subsubheading Appointment reminders
  7707. @cindex @file{appt.el}
  7708. @cindex appointment reminders
  7709. @cindex appointment
  7710. @cindex reminders
  7711. @cindex APPT_WARNTIME, keyword
  7712. Org can interact with Emacs appointments notification facility. To
  7713. add the appointments of your agenda files, use the command
  7714. @code{org-agenda-to-appt}. This command lets you filter through the list
  7715. of your appointments and add only those belonging to a specific
  7716. category or matching a regular expression. It also reads
  7717. a @samp{APPT_WARNTIME} property which overrides the value of
  7718. @code{appt-message-warning-time} for this appointment. See the docstring
  7719. for details.
  7720. @node Global TODO list
  7721. @subsection The global TODO list
  7722. @cindex global TODO list
  7723. @cindex TODO list, global
  7724. The global TODO list contains all unfinished TODO items formatted and
  7725. collected into a single place.
  7726. @table @asis
  7727. @item @kbd{M-x org-agenda t} (@code{org-todo-list})
  7728. @kindex t @r{(Agenda dispatcher)}
  7729. @findex org-todo-list
  7730. Show the global TODO list. This collects the TODO items from all
  7731. agenda files (see @ref{Agenda Views}) into a single buffer. By
  7732. default, this lists items with a state the is not a DONE state.
  7733. The buffer is in @code{agenda-mode}, so there are commands to examine
  7734. and manipulate the TODO entries directly from that buffer (see
  7735. @ref{Agenda Commands}).
  7736. @item @kbd{M-x org-agenda T} (@code{org-todo-list})
  7737. @kindex T @r{(Agenda dispatcher)}
  7738. @findex org-todo-list
  7739. @cindex TODO keyword matching
  7740. @vindex org-todo-keywords
  7741. Like the above, but allows selection of a specific TODO keyword.
  7742. You can also do this by specifying a prefix argument to
  7743. @kbd{t}. You are prompted for a keyword, and you may also
  7744. specify several keywords by separating them with @samp{|} as the
  7745. boolean OR operator. With a numeric prefix, the Nth keyword in
  7746. @code{org-todo-keywords} is selected.
  7747. @kindex r
  7748. The @kbd{r} key in the agenda buffer regenerates it, and you
  7749. can give a prefix argument to this command to change the selected
  7750. TODO keyword, for example @kbd{3 r}. If you often need
  7751. a search for a specific keyword, define a custom command for it
  7752. (see @ref{Agenda Dispatcher}).
  7753. Matching specific TODO keywords can also be done as part of
  7754. a tags search (see @ref{Tag Searches}).
  7755. @end table
  7756. Remote editing of TODO items means that you can change the state of
  7757. a TODO entry with a single key press. The commands available in the
  7758. TODO list are described in @ref{Agenda Commands}.
  7759. @cindex sublevels, inclusion into TODO list
  7760. Normally the global TODO list simply shows all headlines with TODO
  7761. keywords. This list can become very long. There are two ways to keep
  7762. it more compact:
  7763. @itemize
  7764. @item
  7765. @vindex org-agenda-todo-ignore-scheduled
  7766. @vindex org-agenda-todo-ignore-deadlines
  7767. @vindex org-agenda-todo-ignore-timestamp
  7768. @vindex org-agenda-todo-ignore-with-date
  7769. Some people view a TODO item that has been @emph{scheduled} for execution
  7770. or have a @emph{deadline} (see @ref{Timestamps}) as
  7771. no longer @emph{open}. Configure the variables
  7772. @code{org-agenda-todo-ignore-scheduled},
  7773. @code{org-agenda-todo-ignore-deadlines},
  7774. @code{org-agenda-todo-ignore-timestamp} and/or
  7775. @code{org-agenda-todo-ignore-with-date} to exclude such items from the
  7776. global TODO list.
  7777. @item
  7778. @vindex org-agenda-todo-list-sublevels
  7779. TODO items may have sublevels to break up the task into subtasks.
  7780. In such cases it may be enough to list only the highest level TODO
  7781. headline and omit the sublevels from the global list. Configure the
  7782. variable @code{org-agenda-todo-list-sublevels} to get this behavior.
  7783. @end itemize
  7784. @node Matching tags and properties
  7785. @subsection Matching tags and properties
  7786. @cindex matching, of tags
  7787. @cindex matching, of properties
  7788. @cindex tags view
  7789. @cindex match view
  7790. If headlines in the agenda files are marked with @emph{tags} (see @ref{Tags}),
  7791. or have properties (see @ref{Properties and Columns}), you can select
  7792. headlines based on this metadata and collect them into an agenda
  7793. buffer. The match syntax described here also applies when creating
  7794. sparse trees with @kbd{C-c / m}.
  7795. @table @asis
  7796. @item @kbd{M-x org-agenda m} (@code{org-tags-view})
  7797. @kindex m @r{(Agenda dispatcher)}
  7798. @findex org-tags-view
  7799. Produce a list of all headlines that match a given set of tags.
  7800. The command prompts for a selection criterion, which is a boolean
  7801. logic expression with tags, like @samp{+work+urgent-withboss} or
  7802. @samp{work|home} (see @ref{Tags}). If you often need a specific search,
  7803. define a custom command for it (see @ref{Agenda Dispatcher}).
  7804. @item @kbd{M-x org-agenda M} (@code{org-tags-view})
  7805. @kindex M @r{(Agenda dispatcher)}
  7806. @findex org-tags-view
  7807. @vindex org-tags-match-list-sublevels
  7808. @vindex org-agenda-tags-todo-honor-ignore-options
  7809. Like @kbd{m}, but only select headlines that are also TODO
  7810. items and force checking subitems (see the variable
  7811. @code{org-tags-match-list-sublevels}). To exclude scheduled/deadline
  7812. items, see the variable
  7813. @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific
  7814. TODO keywords together with a tags match is also possible, see
  7815. @ref{Tag Searches}.
  7816. @end table
  7817. The commands available in the tags list are described in @ref{Agenda Commands}.
  7818. @cindex boolean logic, for agenda searches
  7819. A search string can use Boolean operators @samp{&} for AND and @samp{|} for OR.
  7820. @samp{&} binds more strongly than @samp{|}. Parentheses are currently not
  7821. implemented. Each element in the search is either a tag, a regular
  7822. expression matching tags, or an expression like @samp{PROPERTY OPERATOR
  7823. VALUE} with a comparison operator, accessing a property value. Each
  7824. element may be preceded by @samp{-} to select against it, and @samp{+} is
  7825. syntactic sugar for positive selection. The AND operator @samp{&} is
  7826. optional when @samp{+} or @samp{-} is present. Here are some examples, using
  7827. only tags.
  7828. @table @asis
  7829. @item @code{+work-boss}
  7830. Select headlines tagged @samp{work}, but discard those also tagged
  7831. @samp{boss}.
  7832. @item @code{work|laptop}
  7833. Selects lines tagged @samp{work} or @samp{laptop}.
  7834. @item @code{work|laptop+night}
  7835. Like before, but require the @samp{laptop} lines to be tagged
  7836. also @samp{night}.
  7837. @end table
  7838. @cindex regular expressions, with tags search
  7839. Instead of a tag, you may also specify a regular expression enclosed
  7840. in curly braces. For example, @samp{work+@{^boss.*@}} matches headlines that
  7841. contain the tag @samp{:work:} and any tag @emph{starting} with @samp{boss}.
  7842. @cindex group tags, as regular expressions
  7843. Group tags (see @ref{Tag Hierarchy}) are expanded as regular expressions.
  7844. E.g., if @samp{work} is a group tag for the group @samp{:work:lab:conf:}, then
  7845. searching for @samp{work} also searches for @samp{@{\(?:work\|lab\|conf\)@}} and
  7846. searching for @samp{-work} searches for all headlines but those with one of
  7847. the tags in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}).
  7848. @cindex TODO keyword matching, with tags search
  7849. @cindex level, for tags/property match
  7850. @cindex category, for tags/property match
  7851. @vindex org-odd-levels-only
  7852. You may also test for properties (see @ref{Properties and Columns}) at the
  7853. same time as matching tags. The properties may be real properties, or
  7854. special properties that represent other metadata (see @ref{Special Properties}). For example, the property @samp{TODO} represents the TODO
  7855. keyword of the entry. Or, the property @samp{LEVEL} represents the level
  7856. of an entry. So searching @samp{+LEVEL=3+boss-TODO​="DONE"} lists all level
  7857. three headlines that have the tag @samp{boss} and are @emph{not} marked with the
  7858. TODO keyword @samp{DONE}. In buffers with @code{org-odd-levels-only} set,
  7859. @samp{LEVEL} does not count the number of stars, but @samp{LEVEL=2} corresponds
  7860. to 3 stars etc.
  7861. Here are more examples:
  7862. @table @asis
  7863. @item @samp{work+TODO​="WAITING"}
  7864. Select @samp{work}-tagged TODO lines with the specific TODO keyword
  7865. @samp{WAITING}.
  7866. @item @samp{work+TODO​="WAITING"|home+TODO​="WAITING"}
  7867. Waiting tasks both at work and at home.
  7868. @end table
  7869. When matching properties, a number of different operators can be used
  7870. to test the value of a property. Here is a complex example:
  7871. @example
  7872. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2
  7873. +With=@{Sarah|Denny@}+SCHEDULED>="<2008-10-11>"
  7874. @end example
  7875. @noindent
  7876. The type of comparison depends on how the comparison value is written:
  7877. @itemize
  7878. @item
  7879. If the comparison value is a plain number, a numerical comparison is
  7880. done, and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=}, @samp{>=}, and
  7881. @samp{<>}.
  7882. @item
  7883. If the comparison value is enclosed in double-quotes, a string
  7884. comparison is done, and the same operators are allowed.
  7885. @item
  7886. If the comparison value is enclosed in double-quotes @emph{and} angular
  7887. brackets (like @samp{DEADLINE<​="<2008-12-24 18:30>"}), both values are
  7888. assumed to be date/time specifications in the standard Org way, and
  7889. the comparison is done accordingly. Valid values also include
  7890. @samp{"<now>"} for now (including time), @samp{"<today>"}, and @samp{"<tomorrow>"}
  7891. for these days at 0:00 hours, i.e., without a time specification.
  7892. You can also use strings like @samp{"<+5d>"} or @samp{"<-2m>"} with units @samp{d},
  7893. @samp{w}, @samp{m}, and @samp{y} for day, week, month, and year, respectively.
  7894. @item
  7895. If the comparison value is enclosed in curly braces, a regexp match
  7896. is performed, with @samp{=} meaning that the regexp matches the property
  7897. value, and @samp{<>} meaning that it does not match.
  7898. @end itemize
  7899. So the search string in the example finds entries tagged @samp{work} but
  7900. not @samp{boss}, which also have a priority value @samp{A}, a @samp{Coffee} property
  7901. with the value @samp{unlimited}, an @samp{EFFORT} property that is numerically
  7902. smaller than 2, a @samp{With} property that is matched by the regular
  7903. expression @samp{Sarah|Denny}, and that are scheduled on or after October
  7904. 11, 2008.
  7905. You can configure Org mode to use property inheritance during
  7906. a search, but beware that this can slow down searches considerably.
  7907. See @ref{Property Inheritance}, for details.
  7908. For backward compatibility, and also for typing speed, there is also
  7909. a different way to test TODO states in a search. For this, terminate
  7910. the tags/property part of the search string (which may include several
  7911. terms connected with @samp{|}) with a @samp{/} and then specify a Boolean
  7912. expression just for TODO keywords. The syntax is then similar to that
  7913. for tags, but should be applied with care: for example, a positive
  7914. selection on several TODO keywords cannot meaningfully be combined
  7915. with boolean AND. However, @emph{negative selection} combined with AND can
  7916. be meaningful. To make sure that only lines are checked that actually
  7917. 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
  7918. with @samp{!}. Using @kbd{M-x org-agenda M} or @samp{/!} does not match
  7919. TODO keywords in a DONE state. Examples:
  7920. @table @asis
  7921. @item @samp{work/WAITING}
  7922. Same as @samp{work+TODO​="WAITING"}.
  7923. @item @samp{work/!-WAITING-NEXT}
  7924. Select @samp{work}-tagged TODO lines that are neither @samp{WAITING} nor
  7925. @samp{NEXT}.
  7926. @item @samp{work/!+WAITING|+NEXT}
  7927. Select @samp{work}-tagged TODO lines that are either @samp{WAITING} or
  7928. @samp{NEXT}.
  7929. @end table
  7930. @node Search view
  7931. @subsection Search view
  7932. @cindex search view
  7933. @cindex text search
  7934. @cindex searching, for text
  7935. This agenda view is a general text search facility for Org mode
  7936. entries. It is particularly useful to find notes.
  7937. @table @asis
  7938. @item @kbd{M-x org-agenda s} (@code{org-search-view})
  7939. @kindex s @r{(Agenda dispatcher)}
  7940. @findex org-search-view
  7941. This is a special search that lets you select entries by matching
  7942. a substring or specific words using a boolean logic.
  7943. @end table
  7944. For example, the search string @samp{computer equipment} matches entries
  7945. that contain @samp{computer equipment} as a substring, even if the two
  7946. words are separated by more space or a line break.
  7947. Search view can also search for specific keywords in the entry, using
  7948. Boolean logic. The search string @samp{+computer
  7949. +wifi -ethernet -@{8\.11[bg]@}} matches note entries that contain the
  7950. keywords @samp{computer} and @samp{wifi}, but not the keyword @samp{ethernet}, and
  7951. which are also not matched by the regular expression @samp{8\.11[bg]},
  7952. meaning to exclude both @samp{8.11b} and @samp{8.11g}. The first @samp{+} is
  7953. necessary to turn on boolean search, other @samp{+} characters are
  7954. optional. For more details, see the docstring of the command
  7955. @code{org-search-view}.
  7956. You can incrementally adjust a boolean search with the following keys
  7957. @multitable @columnfractions 0.1 0.6
  7958. @item @kbd{[}
  7959. @tab Add a positive search word
  7960. @item @kbd{]}
  7961. @tab Add a negative search word
  7962. @item @kbd{@{}
  7963. @tab Add a positive regular expression
  7964. @item @kbd{@}}
  7965. @tab Add a negative regular expression
  7966. @end multitable
  7967. @vindex org-agenda-text-search-extra-files
  7968. Note that in addition to the agenda files, this command also searches
  7969. the files listed in @code{org-agenda-text-search-extra-files}.
  7970. @node Stuck projects
  7971. @subsection Stuck projects
  7972. @pindex GTD, Getting Things Done
  7973. If you are following a system like David Allen's GTD to organize your
  7974. work, one of the ``duties'' you have is a regular review to make sure
  7975. that all projects move along. A @emph{stuck} project is a project that has
  7976. no defined next actions, so it never shows up in the TODO lists Org
  7977. mode produces. During the review, you need to identify such projects
  7978. and define next actions for them.
  7979. @table @asis
  7980. @item @kbd{M-x org-agenda #} (@code{org-agenda-list-stuck-projects})
  7981. @kindex # @r{(Agenda dispatcher)}
  7982. @findex org-agenda-list-stuck-projects
  7983. List projects that are stuck.
  7984. @item @kbd{M-x org-agenda !}
  7985. @kindex ! @r{(Agenda dispatcher)}
  7986. @vindex org-stuck-projects
  7987. Customize the variable @code{org-stuck-projects} to define what
  7988. a stuck project is and how to find it.
  7989. @end table
  7990. You almost certainly need to configure this view before it works for
  7991. you. The built-in default assumes that all your projects are level-2
  7992. headlines, and that a project is not stuck if it has at least one
  7993. entry marked with a TODO keyword @samp{TODO} or @samp{NEXT} or @samp{NEXTACTION}.
  7994. Let's assume that you, in your own way of using Org mode, identify
  7995. projects with a tag @samp{:PROJECT:}, and that you use a TODO keyword
  7996. @samp{MAYBE} to indicate a project that should not be considered yet.
  7997. Let's further assume that the TODO keyword @samp{DONE} marks finished
  7998. projects, and that @samp{NEXT} and @samp{TODO} indicate next actions. The tag
  7999. @samp{:@@shop:} indicates shopping and is a next action even without the
  8000. NEXT tag. Finally, if the project contains the special word @samp{IGNORE}
  8001. anywhere, it should not be listed either. In this case you would
  8002. start by identifying eligible projects with a tags/TODO match (see
  8003. @ref{Tag Searches}) @samp{+PROJECT/-MAYBE-DONE}, and then check for @samp{TODO},
  8004. @samp{NEXT}, @samp{@@shop}, and @samp{IGNORE} in the subtree to identify projects that
  8005. are not stuck. The correct customization for this is:
  8006. @lisp
  8007. (setq org-stuck-projects
  8008. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@shop")
  8009. "\\<IGNORE\\>"))
  8010. @end lisp
  8011. Note that if a project is identified as non-stuck, the subtree of this
  8012. entry is searched for stuck projects.
  8013. @node Presentation and Sorting
  8014. @section Presentation and Sorting
  8015. @cindex presentation, of agenda items
  8016. @vindex org-agenda-prefix-format
  8017. @vindex org-agenda-tags-column
  8018. Before displaying items in an agenda view, Org mode visually prepares
  8019. the items and sorts them. Each item occupies a single line. The line
  8020. starts with a @emph{prefix} that contains the @emph{category} (see @ref{Categories})
  8021. of the item and other important information. You can customize in
  8022. which column tags are displayed through @code{org-agenda-tags-column}. You
  8023. can also customize the prefix using the option
  8024. @code{org-agenda-prefix-format}. This prefix is followed by a cleaned-up
  8025. version of the outline headline associated with the item.
  8026. @menu
  8027. * Categories:: Not all tasks are equal.
  8028. * Time-of-day specifications:: How the agenda knows the time.
  8029. * Sorting of agenda items:: The order of things.
  8030. * Filtering/limiting agenda times:: Dynamically narrow the agenda.
  8031. @end menu
  8032. @node Categories
  8033. @subsection Categories
  8034. @cindex category
  8035. @cindex @samp{CATEGORY}, keyword
  8036. The category is a broad label assigned to each agenda item. By
  8037. default, the category is simply derived from the file name, but you
  8038. can also specify it with a special line in the buffer, like
  8039. this:
  8040. @example
  8041. #+CATEGORY: Thesis
  8042. @end example
  8043. @noindent
  8044. @cindex @samp{CATEGORY}, property
  8045. If you would like to have a special category for a single entry or
  8046. a (sub)tree, give the entry a @samp{CATEGORY} property with the special
  8047. category you want to apply as the value.
  8048. @noindent
  8049. The display in the agenda buffer looks best if the category is not
  8050. longer than 10 characters.
  8051. @noindent
  8052. @vindex org-agenda-category-icon-alist
  8053. You can set up icons for category by customizing the
  8054. @code{org-agenda-category-icon-alist} variable.
  8055. @node Time-of-day specifications
  8056. @subsection Time-of-day specifications
  8057. @cindex time-of-day specification
  8058. Org mode checks each agenda item for a time-of-day specification. The
  8059. time can be part of the timestamp that triggered inclusion into the
  8060. agenda, for example
  8061. @example
  8062. <2005-05-10 Tue 19:00>
  8063. @end example
  8064. @noindent
  8065. Time ranges can be specified with two timestamps:
  8066. @example
  8067. <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>
  8068. @end example
  8069. @vindex org-agenda-search-headline-for-time
  8070. In the headline of the entry itself, a time(range)---like @samp{12:45} or
  8071. a @samp{8:30-1pm}---may also appear as plain text@footnote{You can, however, disable this by setting
  8072. @code{org-agenda-search-headline-for-time} variable to a @code{nil} value.}.
  8073. If the agenda integrates the Emacs diary (see @ref{Weekly/daily agenda}),
  8074. time specifications in diary entries are recognized as well.
  8075. For agenda display, Org mode extracts the time and displays it in
  8076. a standard 24 hour format as part of the prefix. The example times in
  8077. the previous paragraphs would end up in the agenda like this:
  8078. @example
  8079. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8080. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8081. 19:00...... The Vogon reads his poem
  8082. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8083. @end example
  8084. @cindex time grid
  8085. If the agenda is in single-day mode, or for the display of today, the
  8086. timed entries are embedded in a time grid, like
  8087. @example
  8088. 8:00...... ------------------
  8089. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  8090. 10:00...... ------------------
  8091. 12:00...... ------------------
  8092. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  8093. 14:00...... ------------------
  8094. 16:00...... ------------------
  8095. 18:00...... ------------------
  8096. 19:00...... The Vogon reads his poem
  8097. 20:00...... ------------------
  8098. 20:30-22:15 Marvin escorts the Hitchhikers to the bridge
  8099. @end example
  8100. @vindex org-agenda-use-time-grid
  8101. @vindex org-agenda-time-grid
  8102. The time grid can be turned on and off with the variable
  8103. @code{org-agenda-use-time-grid}, and can be configured with
  8104. @code{org-agenda-time-grid}.
  8105. @node Sorting of agenda items
  8106. @subsection Sorting of agenda items
  8107. @cindex sorting, of agenda items
  8108. @cindex priorities, of agenda items
  8109. Before being inserted into a view, the items are sorted. How this is
  8110. done depends on the type of view.
  8111. @itemize
  8112. @item
  8113. @vindex org-agenda-files
  8114. For the daily/weekly agenda, the items for each day are sorted. The
  8115. default order is to first collect all items containing an explicit
  8116. time-of-day specification. These entries are shown at the beginning
  8117. of the list, as a @emph{schedule} for the day. After that, items remain
  8118. grouped in categories, in the sequence given by @code{org-agenda-files}.
  8119. Within each category, items are sorted by priority (see
  8120. @ref{Priorities}), which is composed of the base priority (2000 for
  8121. priority @samp{A}, 1000 for @samp{B}, and 0 for @samp{C}), plus additional
  8122. increments for overdue scheduled or deadline items.
  8123. @item
  8124. For the TODO list, items remain in the order of categories, but
  8125. within each category, sorting takes place according to priority (see
  8126. @ref{Priorities}). The priority used for sorting derives from the
  8127. priority cookie, with additions depending on how close an item is to
  8128. its due or scheduled date.
  8129. @item
  8130. For tags matches, items are not sorted at all, but just appear in
  8131. the sequence in which they are found in the agenda files.
  8132. @end itemize
  8133. @vindex org-agenda-sorting-strategy
  8134. Sorting can be customized using the variable
  8135. @code{org-agenda-sorting-strategy}, and may also include criteria based on
  8136. the estimated effort of an entry (see @ref{Effort Estimates}).
  8137. @node Filtering/limiting agenda times
  8138. @subsection Filtering/limiting agenda times
  8139. Agenda built-in or customized commands are statically defined. Agenda
  8140. filters and limits provide two ways of dynamically narrowing down the
  8141. list of agenda entries: @emph{filters} and @emph{limits}. Filters only act on
  8142. the display of the items, while limits take effect before the list of
  8143. agenda entries is built. Filters are more often used interactively,
  8144. while limits are mostly useful when defined as local variables within
  8145. custom agenda commands.
  8146. @anchor{Filtering in the agenda}
  8147. @subsubheading Filtering in the agenda
  8148. @cindex agenda filtering
  8149. @cindex filtering entries, in agenda
  8150. @cindex tag filtering, in agenda
  8151. @cindex category filtering, in agenda
  8152. @cindex top headline filtering, in agenda
  8153. @cindex effort filtering, in agenda
  8154. @cindex query editing, in agenda
  8155. @table @asis
  8156. @item @kbd{/} (@code{org-agenda-filter-by-tag})
  8157. @findex org-agenda-filter-by-tag
  8158. @vindex org-agenda-tag-filter-preset
  8159. Filter the agenda view with respect to a tag and/or effort
  8160. estimates. The difference between this and a custom agenda
  8161. command is that filtering is very fast, so that you can switch
  8162. quickly between different filters without having to recreate the
  8163. agenda.@footnote{Custom commands can preset a filter by binding the variable
  8164. @code{org-agenda-tag-filter-preset} as an option. This filter is then
  8165. applied to the view and persists as a basic filter through refreshes
  8166. and more secondary filtering. The filter is a global property of the
  8167. entire agenda view---in a block agenda, you should only set this in
  8168. the global options section, not in the section of an individual block.}
  8169. You are prompted for a tag selection letter; @kbd{@key{SPC}} means
  8170. any tag at all. Pressing @kbd{@key{TAB}} at that prompt offers
  8171. completion to select a tag, including any tags that do not have
  8172. a selection character. The command then hides all entries that
  8173. do not contain or inherit this tag. When called with prefix
  8174. argument, remove the entries that @emph{do} have the tag. A second
  8175. @kbd{/} at the prompt turns off the filter and shows any
  8176. hidden entries. Pressing @kbd{+} or @kbd{-} switches
  8177. between filtering and excluding the next tag.
  8178. @vindex org-agenda-auto-exclude-function
  8179. Org also supports automatic, context-aware tag filtering. If the
  8180. variable @code{org-agenda-auto-exclude-function} is set to
  8181. a user-defined function, that function can decide which tags
  8182. should be excluded from the agenda automatically. Once this is
  8183. set, the @kbd{/} command then accepts @kbd{@key{RET}} as
  8184. a sub-option key and runs the auto exclusion logic. For example,
  8185. let's say you use a @samp{Net} tag to identify tasks which need
  8186. network access, an @samp{Errand} tag for errands in town, and a @samp{Call}
  8187. tag for making phone calls. You could auto-exclude these tags
  8188. based on the availability of the Internet, and outside of
  8189. business hours, with something like this:
  8190. @lisp
  8191. (defun org-my-auto-exclude-function (tag)
  8192. (and (cond
  8193. ((string= tag "Net")
  8194. (/= 0 (call-process "/sbin/ping" nil nil nil
  8195. "-c1" "-q" "-t1" "mail.gnu.org")))
  8196. ((or (string= tag "Errand") (string= tag "Call"))
  8197. (let ((hour (nth 2 (decode-time))))
  8198. (or (< hour 8) (> hour 21)))))
  8199. (concat "-" tag)))
  8200. (setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function)
  8201. @end lisp
  8202. @item @kbd{<} (@code{org-agenda-filter-by-category})
  8203. @findex org-agenda-filter-by-category
  8204. Filter the current agenda view with respect to the category of
  8205. the item at point. Pressing @kbd{<} another time removes
  8206. this filter. When called with a prefix argument exclude the
  8207. category of the item at point from the agenda.
  8208. @vindex org-agenda-category-filter-preset
  8209. You can add a filter preset in custom agenda commands through the
  8210. option @code{org-agenda-category-filter-preset}. See @ref{Setting options}.
  8211. @item @kbd{^} (@code{org-agenda-filter-by-top-headline})
  8212. @findex org-agenda-filter-by-top-headline
  8213. Filter the current agenda view and only display the siblings and
  8214. the parent headline of the one at point.
  8215. @item @kbd{=} (@code{org-agenda-filter-by-regexp})
  8216. @findex org-agenda-filter-by-regexp
  8217. Filter the agenda view by a regular expression: only show agenda
  8218. entries matching the regular expression the user entered. When
  8219. called with a prefix argument, it filters @emph{out} entries matching
  8220. the regexp. With two universal prefix arguments, it removes all
  8221. the regexp filters, which can be accumulated.
  8222. @vindex org-agenda-regexp-filter-preset
  8223. You can add a filter preset in custom agenda commands through the
  8224. option @code{org-agenda-regexp-filter-preset}. See @ref{Setting options}.
  8225. @item @kbd{_} (@code{org-agenda-filter-by-effort})
  8226. @findex org-agenda-filter-by-effort
  8227. Filter the agenda view with respect to effort estimates. You
  8228. first need to set up allowed efforts globally, for example
  8229. @lisp
  8230. (setq org-global-properties
  8231. '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
  8232. @end lisp
  8233. @vindex org-sort-agenda-noeffort-is-high
  8234. You can then filter for an effort by first typing an operator,
  8235. one of @kbd{<}, @kbd{>} and @kbd{=}, and then the
  8236. one-digit index of an effort estimate in your array of allowed
  8237. values, where @kbd{0} means the 10th value. The filter then
  8238. restricts to entries with effort smaller-or-equal, equal, or
  8239. larger-or-equal than the selected value. For application of the
  8240. operator, entries without a defined effort are treated according
  8241. to the value of @code{org-sort-agenda-noeffort-is-high}.
  8242. When called with a prefix argument, it removes entries matching
  8243. the condition. With two universal prefix arguments, it clears
  8244. effort filters, which can be accumulated.
  8245. @vindex org-agenda-effort-filter-preset
  8246. You can add a filter preset in custom agenda commands through the
  8247. option @code{org-agenda-effort-filter-preset}. See @ref{Setting options}.
  8248. @item @kbd{|} (@code{org-agenda-filter-remove-all})
  8249. Remove all filters in the current agenda view.
  8250. @end table
  8251. @anchor{Setting limits for the agenda}
  8252. @subsubheading Setting limits for the agenda
  8253. @cindex limits, in agenda
  8254. Here is a list of options that you can set, either globally, or
  8255. locally in your custom agenda views (see @ref{Custom Agenda Views}).
  8256. @table @asis
  8257. @item @code{org-agenda-max-entries}
  8258. @vindex org-agenda-max-entries
  8259. Limit the number of entries.
  8260. @item @code{org-agenda-max-effort}
  8261. @vindex org-agenda-max-effort
  8262. Limit the duration of accumulated efforts (as minutes).
  8263. @item @code{org-agenda-max-todos}
  8264. @vindex org-agenda-max-todos
  8265. Limit the number of entries with TODO keywords.
  8266. @item @code{org-agenda-max-tags}
  8267. @vindex org-agenda-max-tags
  8268. Limit the number of tagged entries.
  8269. @end table
  8270. When set to a positive integer, each option excludes entries from
  8271. other categories: for example, @code{(setq org-agenda-max-effort 100)}
  8272. limits the agenda to 100 minutes of effort and exclude any entry that
  8273. has no effort property. If you want to include entries with no effort
  8274. property, use a negative value for @code{org-agenda-max-effort}. One
  8275. useful setup is to use @code{org-agenda-max-entries} locally in a custom
  8276. command. For example, this custom command displays the next five
  8277. entries with a @samp{NEXT} TODO keyword.
  8278. @lisp
  8279. (setq org-agenda-custom-commands
  8280. '(("n" todo "NEXT"
  8281. ((org-agenda-max-entries 5)))))
  8282. @end lisp
  8283. Once you mark one of these five entry as DONE, rebuilding the agenda
  8284. will again the next five entries again, including the first entry that
  8285. was excluded so far.
  8286. You can also dynamically set temporary limits, which are lost when
  8287. rebuilding the agenda:
  8288. @table @asis
  8289. @item @kbd{~} (@code{org-agenda-limit-interactively})
  8290. @findex org-agenda-limit-interactively
  8291. This prompts for the type of limit to apply and its value.
  8292. @end table
  8293. @node Agenda Commands
  8294. @section Commands in the Agenda Buffer
  8295. @cindex commands, in agenda buffer
  8296. Entries in the agenda buffer are linked back to the Org file or diary
  8297. file where they originate. You are not allowed to edit the agenda
  8298. buffer itself, but commands are provided to show and jump to the
  8299. original entry location, and to edit the Org files ``remotely'' from the
  8300. agenda buffer. In this way, all information is stored only once,
  8301. removing the risk that your agenda and note files may diverge.
  8302. Some commands can be executed with mouse clicks on agenda lines. For
  8303. the other commands, the cursor needs to be in the desired line.
  8304. @anchor{Motion (1)}
  8305. @subheading Motion
  8306. @cindex motion commands in agenda
  8307. @table @asis
  8308. @item @kbd{n} (@code{org-agenda-next-line})
  8309. @kindex n
  8310. @findex org-agenda-next-line
  8311. Next line (same as @kbd{@key{DOWN}} and @kbd{C-n}).
  8312. @item @kbd{p} (@code{org-agenda-previous-line})
  8313. @kindex p
  8314. @findex org-agenda-previous-line
  8315. Previous line (same as @kbd{@key{UP}} and @kbd{C-p}).
  8316. @end table
  8317. @anchor{View/Go to Org file}
  8318. @subheading View/Go to Org file
  8319. @cindex view file commands in agenda
  8320. @table @asis
  8321. @item @kbd{@key{SPC}} or @kbd{mouse-3} (@code{org-agenda-show-and-scroll-up})
  8322. @kindex SPC
  8323. @kindex mouse-3
  8324. @findex org-agenda-show-and-scroll-up
  8325. Display the original location of the item in another window.
  8326. With a prefix argument, make sure that drawers stay folded.
  8327. @item @kbd{L} (@code{org-agenda-recenter})
  8328. @findex org-agenda-recenter
  8329. Display original location and recenter that window.
  8330. @item @kbd{@key{TAB}} or @kbd{mouse-2} (@code{org-agenda-goto})
  8331. @kindex TAB
  8332. @kindex mouse-2
  8333. @findex org-agenda-goto
  8334. Go to the original location of the item in another window.
  8335. @item @kbd{@key{RET}} (@code{org-agenda-switch-to})
  8336. @kindex RET
  8337. @findex org-agenda-switch-to
  8338. Go to the original location of the item and delete other windows.
  8339. @item @kbd{F} (@code{org-agenda-follow-mode})
  8340. @kindex F
  8341. @findex org-agenda-follow-mode
  8342. @vindex org-agenda-start-with-follow-mode
  8343. Toggle Follow mode. In Follow mode, as you move the cursor
  8344. through the agenda buffer, the other window always shows the
  8345. corresponding location in the Org file. The initial setting for
  8346. this mode in new agenda buffers can be set with the variable
  8347. @code{org-agenda-start-with-follow-mode}.
  8348. @item @kbd{C-c C-x b} (@code{org-agenda-tree-to-indirect-buffer})
  8349. @kindex C-c C-x b
  8350. @findex org-agenda-tree-to-indirect-buffer
  8351. Display the entire subtree of the current item in an indirect
  8352. buffer. With a numeric prefix argument N, go up to level N and
  8353. then take that tree. If N is negative, go up that many levels.
  8354. With a @kbd{C-u} prefix, do not remove the previously used
  8355. indirect buffer.
  8356. @item @kbd{C-c C-o} (@code{org-agenda-open-link})
  8357. @kindex C-c C-o
  8358. @findex org-agenda-open-link
  8359. Follow a link in the entry. This offers a selection of any links
  8360. in the text belonging to the referenced Org node. If there is
  8361. only one link, follow it without a selection prompt.
  8362. @end table
  8363. @anchor{Change display}
  8364. @subheading Change display
  8365. @cindex change agenda display
  8366. @cindex display changing, in agenda
  8367. @table @asis
  8368. @item @kbd{A}
  8369. @kindex A
  8370. Interactively select another agenda view and append it to the
  8371. current view.
  8372. @item @kbd{o}
  8373. @kindex o
  8374. Delete other windows.
  8375. @item @kbd{v d} or short @kbd{d} (@code{org-agenda-day-view})
  8376. @kindex v d
  8377. @kindex d
  8378. @findex org-agenda-day-view
  8379. Switch to day view. When switching to day view, this setting
  8380. becomes the default for subsequent agenda refreshes. A numeric
  8381. prefix argument may be used to jump directly to a specific day of
  8382. the year. For example, @kbd{32 d} jumps to February 1st.
  8383. When setting day view, a year may be encoded in the prefix
  8384. argument as well. For example, @kbd{200712 d} jumps to
  8385. January 12, 2007. If such a year specification has only one or
  8386. two digits, it is expanded into one of the 30 next years or the
  8387. last 69 years.
  8388. @item @kbd{v w} or short @kbd{w} (@code{org-agenda-week-view})
  8389. @kindex v w
  8390. @kindex w
  8391. @findex org-agenda-week-view
  8392. Switch to week view. When switching week view, this setting
  8393. becomes the default for subsequent agenda refreshes. A numeric
  8394. prefix argument may be used to jump directly to a specific day of
  8395. the ISO week. For example @kbd{9 w} to ISO week number 9.
  8396. When setting week view, a year may be encoded in the prefix
  8397. argument as well. For example, @kbd{200712 w} jumps to week
  8398. 12 in 2007. If such a year specification has only one or two
  8399. digits, it is expanded into one of the 30 next years or the last
  8400. 69 years.
  8401. @item @kbd{v m} (@code{org-agenda-month-view})
  8402. @kindex v m
  8403. @findex org-agenda-month-view
  8404. Switch to month view. Because month views are slow to create,
  8405. they do not become the default for subsequent agenda refreshes.
  8406. A numeric prefix argument may be used to jump directly to
  8407. a specific day of the month. When setting month view, a year may
  8408. be encoded in the prefix argument as well. For example,
  8409. @kbd{200712 m} jumps to December, 2007. If such a year
  8410. specification has only one or two digits, it is expanded into one
  8411. of the 30 next years or the last 69 years.
  8412. @item @kbd{v y} (@code{org-agenda-year-view})
  8413. @kindex v y
  8414. @findex org-agenda-year-view
  8415. Switch to year view. Because year views are slow to create, they
  8416. do not become the default for subsequent agenda refreshes.
  8417. A numeric prefix argument may be used to jump directly to
  8418. a specific day of the year.
  8419. @item @kbd{v @key{SPC}} (@code{org-agenda-reset-view})
  8420. @kindex v SPC
  8421. @findex org-agenda-reset-view
  8422. @vindex org-agenda-span
  8423. Reset the current view to @code{org-agenda-span}.
  8424. @item @kbd{f} (@code{org-agenda-later})
  8425. @kindex f
  8426. @findex org-agenda-later
  8427. Go forward in time to display the span following the current one.
  8428. For example, if the display covers a week, switch to the
  8429. following week. With a prefix argument, repeat that many times.
  8430. @item @kbd{b} (@code{org-agenda-earlier})
  8431. @kindex b
  8432. @findex org-agenda-earlier
  8433. Go backward in time to display earlier dates.
  8434. @item @kbd{.} (@code{org-agenda-goto-today})
  8435. @kindex .
  8436. @findex org-agenda-goto-today
  8437. Go to today.
  8438. @item @kbd{j} (@code{org-agenda-goto-date})
  8439. @kindex j
  8440. @findex org-agenda-goto-date
  8441. Prompt for a date and go there.
  8442. @item @kbd{J} (@code{org-agenda-clock-goto})
  8443. @kindex J
  8444. @findex org-agenda-clock-goto
  8445. Go to the currently clocked-in task @emph{in the agenda buffer}.
  8446. @item @kbd{D} (@code{org-agenda-toggle-diary})
  8447. @kindex D
  8448. @findex org-agenda-toggle-diary
  8449. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  8450. @item @kbd{v l} or @kbd{v L} or short @kbd{l} (@code{org-agenda-log-mode})
  8451. @kindex v l
  8452. @kindex l
  8453. @kindex v L
  8454. @findex org-agenda-log-mode
  8455. @vindex org-log-done
  8456. @vindex org-agenda-log-mode-items
  8457. Toggle Logbook mode. In Logbook mode, entries that were marked
  8458. DONE while logging was on (see the variable @code{org-log-done}) are
  8459. shown in the agenda, as are entries that have been clocked on
  8460. that day. You can configure the entry types that should be
  8461. included in log mode using the variable
  8462. @code{org-agenda-log-mode-items}. When called with a @kbd{C-u}
  8463. prefix, show all possible logbook entries, including state
  8464. 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}.
  8465. @item @kbd{v [} or short @kbd{[} (@code{org-agenda-manipulate-query-add})
  8466. @kindex v [
  8467. @kindex [
  8468. @findex org-agenda-manipulate-query-add
  8469. Include inactive timestamps into the current view. Only for
  8470. weekly/daily agenda and timeline views.
  8471. @item @kbd{v a} (@code{org-agenda-archives-mode})
  8472. @kindex v a
  8473. @findex org-agenda-archives-mode
  8474. Toggle Archives mode. In Archives mode, trees that are archived
  8475. (see @ref{Internal archiving}) are also scanned when producing the
  8476. agenda. To exit archives mode, press @kbd{v a} again.
  8477. @item @kbd{v A}
  8478. @kindex v A
  8479. Toggle Archives mode. Include all archive files as well.
  8480. @item @kbd{v R} or short @kbd{R} (@code{org-agenda-clockreport-mode})
  8481. @kindex v R
  8482. @kindex R
  8483. @findex org-agenda-clockreport-mode
  8484. @vindex org-agenda-start-with-clockreport-mode
  8485. @vindex org-clock-report-include-clocking-task
  8486. Toggle Clockreport mode. In Clockreport mode, the daily/weekly
  8487. agenda always shows a table with the clocked times for the time
  8488. span and file scope covered by the current agenda view. The
  8489. initial setting for this mode in new agenda buffers can be set
  8490. with the variable @code{org-agenda-start-with-clockreport-mode}. By
  8491. using a prefix argument when toggling this mode (i.e., @kbd{C-u R}), the clock table does not show contributions from entries
  8492. that are hidden by agenda filtering@footnote{Only tags filtering is respected here, effort filtering is
  8493. ignored.}. See also the
  8494. variable @code{org-clock-report-include-clocking-task}.
  8495. @item @kbd{v c}
  8496. @kindex v c
  8497. @vindex org-agenda-clock-consistency-checks
  8498. Show overlapping clock entries, clocking gaps, and other clocking
  8499. problems in the current agenda range. You can then visit
  8500. clocking lines and fix them manually. See the variable
  8501. @code{org-agenda-clock-consistency-checks} for information on how to
  8502. customize the definition of what constituted a clocking problem.
  8503. To return to normal agenda display, press @kbd{l} to exit
  8504. Logbook mode.
  8505. @item @kbd{v E} or short @kbd{E} (@code{org-agenda-entry-text-mode})
  8506. @kindex v E
  8507. @kindex E
  8508. @findex org-agenda-entry-text-mode
  8509. @vindex org-agenda-start-with-entry-text-mode
  8510. @vindex org-agenda-entry-text-maxlines
  8511. Toggle entry text mode. In entry text mode, a number of lines
  8512. from the Org outline node referenced by an agenda line are
  8513. displayed below the line. The maximum number of lines is given
  8514. by the variable @code{org-agenda-entry-text-maxlines}. Calling this
  8515. command with a numeric prefix argument temporarily modifies that
  8516. number to the prefix value.
  8517. @item @kbd{G} (@code{org-agenda-toggle-time-grid})
  8518. @kindex G
  8519. @vindex org-agenda-use-time-grid
  8520. @vindex org-agenda-time-grid
  8521. Toggle the time grid on and off. See also the variables
  8522. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  8523. @item @kbd{r} (@code{org-agenda-redo})
  8524. @itemx @kbd{g}
  8525. @kindex r
  8526. @kindex g
  8527. @findex org-agenda-redo
  8528. Recreate the agenda buffer, for example to reflect the changes
  8529. after modification of the timestamps of items with
  8530. @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}}. When the
  8531. buffer is the global TODO list, a prefix argument is interpreted
  8532. to create a selective list for a specific TODO keyword.
  8533. @item @kbd{C-x C-s} or short @kbd{s} (@code{org-save-all-org-buffers})
  8534. @kindex C-x C-s
  8535. @findex org-save-all-org-buffers
  8536. @kindex s
  8537. Save all Org buffers in the current Emacs session, and also the
  8538. locations of IDs.
  8539. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  8540. @kindex C-c C-x C-c
  8541. @findex org-agenda-columns
  8542. @vindex org-columns-default-format
  8543. Invoke column view (see @ref{Column View}) in the agenda buffer. The
  8544. column view format is taken from the entry at point, or, if there
  8545. is no entry at point, from the first entry in the agenda view.
  8546. So whatever the format for that entry would be in the original
  8547. buffer (taken from a property, from a @samp{COLUMNS} keyword, or from
  8548. the default variable @code{org-columns-default-format}) is used in the
  8549. agenda.
  8550. @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock})
  8551. @kindex C-c C-x >
  8552. @findex org-agenda-remove-restriction-lock
  8553. Remove the restriction lock on the agenda, if it is currently
  8554. restricted to a file or subtree (see @ref{Agenda Files}).
  8555. @item @kbd{M-@key{UP}} (@code{org-agenda-drag-line-backward})
  8556. @kindex M-UP
  8557. @findex org-agenda-drag-line-backward
  8558. Drag the line at point backward one line. With a numeric prefix
  8559. argument, drag backward by that many lines.
  8560. Moving agenda lines does not persist after an agenda refresh and
  8561. does not modify the contributing Org files.
  8562. @item @kbd{M-@key{DOWN}} (@code{org-agenda-drag-line-forward})
  8563. @kindex M-DOWN
  8564. @findex org-agenda-drag-line-forward
  8565. Drag the line at point forward one line. With a numeric prefix
  8566. argument, drag forward by that many lines.
  8567. @end table
  8568. @anchor{Remote editing}
  8569. @subheading Remote editing
  8570. @cindex remote editing, from agenda
  8571. @table @asis
  8572. @item @kbd{0--9}
  8573. Digit argument.
  8574. @item @kbd{C-_} (@code{org-agenda-undo})
  8575. @kindex C-_
  8576. @findex org-agenda-undo
  8577. @cindex undoing remote-editing events
  8578. @cindex remote editing, undo
  8579. Undo a change due to a remote editing command. The change is
  8580. undone both in the agenda buffer and in the remote buffer.
  8581. @item @kbd{t} (@code{org-agenda-todo})
  8582. @kindex t
  8583. @findex org-agenda-todo
  8584. Change the TODO state of the item, both in the agenda and in the
  8585. original Org file.
  8586. @item @kbd{C-S-@key{RIGHT}} (@code{org-agenda-todo-nextset})
  8587. @kindex C-S-RIGHT
  8588. @findex org-agenda-todo-nextset
  8589. Switch to the next set of TODO keywords.
  8590. @item @kbd{C-S-@key{LEFT}}, @code{org-agenda-todo-previousset}
  8591. @kindex C-S-LEFT
  8592. Switch to the previous set of TODO keywords.
  8593. @item @kbd{C-k} (@code{org-agenda-kill})
  8594. @kindex C-k
  8595. @findex org-agenda-kill
  8596. @vindex org-agenda-confirm-kill
  8597. Delete the current agenda item along with the entire subtree
  8598. belonging to it in the original Org file. If the text to be
  8599. deleted remotely is longer than one line, the kill needs to be
  8600. confirmed by the user. See variable @code{org-agenda-confirm-kill}.
  8601. @item @kbd{C-c C-w} (@code{org-agenda-refile})
  8602. @kindex C-c C-w
  8603. @findex org-agenda-refile
  8604. Refile the entry at point.
  8605. @item @kbd{C-c C-x C-a} or short @kbd{a} (@code{org-agenda-archive-default-with-confirmation})
  8606. @kindex C-c C-x C-a
  8607. @kindex a
  8608. @findex org-agenda-archive-default-with-confirmation
  8609. @vindex org-archive-default-command
  8610. Archive the subtree corresponding to the entry at point using the
  8611. default archiving command set in @code{org-archive-default-command}.
  8612. When using the @kbd{a} key, confirmation is required.
  8613. @item @kbd{C-c C-x a} (@code{org-agenda-toggle-archive-tag})
  8614. @kindex C-c C-x a
  8615. @findex org-agenda-toggle-archive-tag
  8616. Toggle the archive tag (see @ref{Internal archiving}) for the current
  8617. headline.
  8618. @item @kbd{C-c C-x A} (@code{org-agenda-archive-to-archive-sibling})
  8619. @kindex C-c C-x A
  8620. @findex org-agenda-archive-to-archive-sibling
  8621. Move the subtree corresponding to the current entry to its
  8622. @emph{archive sibling}.
  8623. @item @kbd{C-c C-x C-s} or short @kbd{$} (@code{org-agenda-archive})
  8624. @kindex C-c C-x C-s
  8625. @kindex $
  8626. @findex org-agenda-archive
  8627. Archive the subtree corresponding to the current headline. This
  8628. means the entry is moved to the configured archive location, most
  8629. likely a different file.
  8630. @item @kbd{T} (@code{org-agenda-show-tags})
  8631. @kindex T
  8632. @findex org-agenda-show-tags
  8633. @vindex org-agenda-show-inherited-tags
  8634. Show all tags associated with the current item. This is useful
  8635. if you have turned off @code{org-agenda-show-inherited-tags}, but
  8636. still want to see all tags of a headline occasionally.
  8637. @item @kbd{:} (@code{org-agenda-set-tags})
  8638. @kindex :
  8639. @findex org-agenda-set-tags
  8640. Set tags for the current headline. If there is an active region
  8641. in the agenda, change a tag for all headings in the region.
  8642. @item @kbd{,} (@code{org-agenda-priority})
  8643. @kindex ,
  8644. @findex org-agenda-priority
  8645. Set the priority for the current item. Org mode prompts for the
  8646. priority character. If you reply with @kbd{@key{SPC}}, the
  8647. priority cookie is removed from the entry.
  8648. @item @kbd{P} (@code{org-agenda-show-priority})
  8649. @kindex P
  8650. @findex org-agenda-show-priority
  8651. Display weighted priority of current item.
  8652. @item @kbd{+} or @kbd{S-@key{UP}} (@code{org-agenda-priority-up})
  8653. @kindex +
  8654. @kindex S-UP
  8655. @findex org-agenda-priority-up
  8656. Increase the priority of the current item. The priority is
  8657. changed in the original buffer, but the agenda is not resorted.
  8658. Use the @kbd{r} key for this.
  8659. @item @kbd{-} or @kbd{S-@key{DOWN}} (@code{org-agenda-priority-down})
  8660. @kindex -
  8661. @kindex S-DOWN
  8662. @findex org-agenda-priority-down
  8663. Decrease the priority of the current item.
  8664. @item @kbd{C-c C-z} or short @kbd{z} (@code{org-agenda-add-note})
  8665. @kindex z
  8666. @kindex C-c C-z
  8667. @findex org-agenda-add-note
  8668. @vindex org-log-into-drawer
  8669. Add a note to the entry. This note is recorded, and then filed
  8670. to the same location where state change notes are put. Depending
  8671. on @code{org-log-into-drawer}, this may be inside a drawer.
  8672. @item @kbd{C-c C-a} (@code{org-attach})
  8673. @kindex C-c C-a
  8674. @findex org-attach
  8675. Dispatcher for all command related to attachments.
  8676. @item @kbd{C-c C-s} (@code{org-agenda-schedule})
  8677. @kindex C-c C-s
  8678. @findex org-agenda-schedule
  8679. Schedule this item. With a prefix argument, remove the
  8680. scheduling timestamp
  8681. @item @kbd{C-c C-d} (@code{org-agenda-deadline})
  8682. @kindex C-c C-d
  8683. @findex org-agenda-deadline
  8684. Set a deadline for this item. With a prefix argument, remove the
  8685. deadline.
  8686. @item @kbd{S-@key{RIGHT}} (@code{org-agenda-do-date-later})
  8687. @kindex S-RIGHT
  8688. @findex org-agenda-do-date-later
  8689. Change the timestamp associated with the current line by one day
  8690. into the future. If the date is in the past, the first call to
  8691. this command moves it to today. With a numeric prefix argument,
  8692. 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}
  8693. prefix, change the time by one hour. If you immediately repeat
  8694. the command, it will continue to change hours even without the
  8695. prefix argument. With a double @kbd{C-u C-u} prefix, do the
  8696. same for changing minutes. The stamp is changed in the original
  8697. Org file, but the change is not directly reflected in the agenda
  8698. buffer. Use @kbd{r} or @kbd{g} to update the buffer.
  8699. @item @kbd{S-@key{LEFT}} (@code{org-agenda-do-date-earlier})
  8700. @kindex S-LEFT
  8701. @findex org-agenda-do-date-earlier
  8702. Change the timestamp associated with the current line by one day
  8703. into the past.
  8704. @item @kbd{>} (@code{org-agenda-date-prompt})
  8705. @kindex >
  8706. @findex org-agenda-date-prompt
  8707. Change the timestamp associated with the current line. The key
  8708. @kbd{>} has been chosen, because it is the same as
  8709. @kbd{S-.} on my keyboard.
  8710. @item @kbd{I} (@code{org-agenda-clock-in})
  8711. @kindex I
  8712. @findex org-agenda-clock-in
  8713. Start the clock on the current item. If a clock is running
  8714. already, it is stopped first.
  8715. @item @kbd{O} (@code{org-agenda-clock-out})
  8716. @kindex O
  8717. @findex org-agenda-clock-out
  8718. Stop the previously started clock.
  8719. @item @kbd{X} (@code{org-agenda-clock-cancel})
  8720. @kindex X
  8721. @findex org-agenda-clock-cancel
  8722. Cancel the currently running clock.
  8723. @item @kbd{J} (@code{org-agenda-clock-goto})
  8724. @kindex J
  8725. @findex org-agenda-clock-goto
  8726. Jump to the running clock in another window.
  8727. @item @kbd{k} (@code{org-agenda-capture})
  8728. @kindex k
  8729. @findex org-agenda-capture
  8730. @cindex capturing, from agenda
  8731. @vindex org-capture-use-agenda-date
  8732. Like @code{org-capture}, but use the date at point as the default date
  8733. for the capture template. See @code{org-capture-use-agenda-date} to
  8734. make this the default behavior of @code{org-capture}.
  8735. @end table
  8736. @anchor{Bulk remote editing selected entries}
  8737. @subheading Bulk remote editing selected entries
  8738. @cindex remote editing, bulk, from agenda
  8739. @vindex org-agenda-bulk-custom-functions
  8740. @table @asis
  8741. @item @kbd{m} (@code{org-agenda-bulk-mark})
  8742. @kindex m
  8743. @findex org-agenda-bulk-mark
  8744. Mark the entry at point for bulk action. If there is an active
  8745. region in the agenda, mark the entries in the region. With
  8746. numeric prefix argument, mark that many successive entries.
  8747. @item @kbd{*} (@code{org-agenda-bulk-mark-all})
  8748. @kindex *
  8749. @findex org-agenda-bulk-mark-all
  8750. Mark all visible agenda entries for bulk action.
  8751. @item @kbd{u} (@code{org-agenda-bulk-unmark})
  8752. @kindex u
  8753. @findex org-agenda-bulk-unmark
  8754. Unmark entry for bulk action.
  8755. @item @kbd{U} (@code{org-agenda-bulk-remove-all-marks})
  8756. @kindex U
  8757. @findex org-agenda-bulk-remove-all-marks
  8758. Unmark all marked entries for bulk action.
  8759. @item @kbd{M-m} (@code{org-agenda-bulk-toggle})
  8760. @kindex M-m
  8761. @findex org-agenda-bulk-toggle
  8762. Toggle mark of the entry at point for bulk action.
  8763. @item @kbd{M-*} (@code{org-agenda-bulk-toggle-all})
  8764. @kindex M-*
  8765. @findex org-agenda-bulk-toggle-all
  8766. Mark entries matching a regular expression for bulk action.
  8767. @item @kbd{%} (@code{org-agenda-bulk-mark-regexp})
  8768. @kindex %
  8769. @findex org-agenda-bulk-mark-regexp
  8770. Mark entries matching a regular expression for bulk action.
  8771. @item @kbd{B} (@code{org-agenda-bulk-action})
  8772. @kindex B
  8773. @findex org-agenda-bulk-action
  8774. @vindex org-agenda-bulk-persistent-marks
  8775. Bulk action: act on all marked entries in the agenda. This
  8776. prompts for another key to select the action to be applied. The
  8777. prefix argument to @kbd{B} is passed through to the
  8778. @kbd{s} and @kbd{d} commands, to bulk-remove these
  8779. special timestamps. By default, marks are removed after the
  8780. bulk. If you want them to persist, set
  8781. @code{org-agenda-bulk-persistent-marks} to @code{t} or hit @kbd{p} at
  8782. the prompt.
  8783. @table @asis
  8784. @item @kbd{*}
  8785. Toggle persistent marks.
  8786. @item @kbd{$}
  8787. Archive all selected entries.
  8788. @item @kbd{A}
  8789. Archive entries by moving them to their respective archive
  8790. siblings.
  8791. @item @kbd{t}
  8792. Change TODO state. This prompts for a single TODO keyword and
  8793. changes the state of all selected entries, bypassing blocking
  8794. and suppressing logging notes---but not timestamps.
  8795. @item @kbd{+}
  8796. Add a tag to all selected entries.
  8797. @item @kbd{-}
  8798. Remove a tag from all selected entries.
  8799. @item @kbd{s}
  8800. Schedule all items to a new date. To shift existing schedule
  8801. dates by a fixed number of days, use something starting with
  8802. double plus at the prompt, for example @samp{++8d} or @samp{++2w}.
  8803. @item @kbd{d}
  8804. Set deadline to a specific date.
  8805. @item @kbd{r}
  8806. Prompt for a single refile target and move all entries. The
  8807. entries are no longer in the agenda; refresh (@kbd{g}) to
  8808. bring them back.
  8809. @item @kbd{S}
  8810. Reschedule randomly into the coming N days. N is prompted for.
  8811. With a prefix argument (@kbd{C-u B S}), scatter only
  8812. across weekdays.
  8813. @item @kbd{f}
  8814. @vindex org-agenda-bulk-custom-functions
  8815. Apply a function@footnote{You can also create persistent custom functions through
  8816. @code{org-agenda-bulk-custom-functions}.} to marked entries. For example, the
  8817. function below sets the @samp{CATEGORY} property of the entries to
  8818. @samp{web}.
  8819. @lisp
  8820. (defun set-category ()
  8821. (interactive "P")
  8822. (let ((marker (or (org-get-at-bol 'org-hd-marker)
  8823. (org-agenda-error))))
  8824. (org-with-point-at marker
  8825. (org-back-to-heading t)
  8826. (org-set-property "CATEGORY" "web"))))
  8827. @end lisp
  8828. @end table
  8829. @end table
  8830. @anchor{Calendar commands}
  8831. @subheading Calendar commands
  8832. @cindex calendar commands, from agenda
  8833. @table @asis
  8834. @item @kbd{c} (@code{org-agenda-goto-calendar})
  8835. @kindex c
  8836. @findex org-agenda-goto-calendar
  8837. Open the Emacs calendar and move to the date at the agenda
  8838. cursor.
  8839. @item @kbd{c} (@code{org-calendar-goto-agenda})
  8840. @kindex c
  8841. @findex org-calendar-goto-agenda
  8842. When in the calendar, compute and show the Org agenda for the
  8843. date at the cursor.
  8844. @item @kbd{i} (@code{org-agenda-diary-entry})
  8845. @kindex i
  8846. @findex org-agenda-diary-entry
  8847. @cindex diary entries, creating from agenda
  8848. Insert a new entry into the diary, using the date at the cursor
  8849. and (for block entries) the date at the mark. This adds to the
  8850. Emacs diary file@footnote{This file is parsed for the agenda when
  8851. @code{org-agenda-include-diary} is set.}, in a way similar to the @kbd{i}
  8852. command in the calendar. The diary file pops up in another
  8853. window, where you can add the entry.
  8854. @vindex org-agenda-diary-file
  8855. If you configure @code{org-agenda-diary-file} to point to an Org file,
  8856. Org creates entries in that file instead. Most entries are
  8857. stored in a date-based outline tree that will later make it easy
  8858. to archive appointments from previous months/years. The tree is
  8859. built under an entry with a @samp{DATE_TREE} property, or else with
  8860. years as top-level entries. Emacs prompts you for the entry
  8861. text---if you specify it, the entry is created in
  8862. @code{org-agenda-diary-file} without further interaction. If you
  8863. directly press @kbd{@key{RET}} at the prompt without typing text,
  8864. the target file is shown in another window for you to finish the
  8865. entry there. See also the @kbd{k r} command.
  8866. @item @kbd{M} (@code{org-agenda-phases-of-moon})
  8867. @kindex M
  8868. @findex org-agenda-phases-of-moon
  8869. Show the phases of the moon for the three months around current
  8870. date.
  8871. @item @kbd{S} (@code{org-agenda-sunrise-sunset})
  8872. @kindex S
  8873. @findex org-agenda-sunrise-sunset
  8874. Show sunrise and sunset times. The geographical location must be
  8875. set with calendar variables, see the documentation for the Emacs
  8876. calendar.
  8877. @item @kbd{C} (@code{org-agenda-convert-date})
  8878. @kindex C
  8879. @findex org-agenda-convert-date
  8880. Convert the date at cursor into many other cultural and historic
  8881. calendars.
  8882. @item @kbd{H} (@code{org-agenda-holidays})
  8883. @kindex H
  8884. @findex org-agenda-holidays
  8885. Show holidays for three months around the cursor date.
  8886. @end table
  8887. @anchor{Quit and exit}
  8888. @subheading Quit and exit
  8889. @table @asis
  8890. @item @kbd{q} (@code{org-agenda-quit})
  8891. @kindex q
  8892. @findex org-agenda-quit
  8893. Quit agenda, remove the agenda buffer.
  8894. @item @kbd{x} (@code{org-agenda-exit})
  8895. @kindex x
  8896. @findex org-agenda-exit
  8897. @cindex agenda files, removing buffers
  8898. Exit agenda, remove the agenda buffer and all buffers loaded by
  8899. Emacs for the compilation of the agenda. Buffers created by the
  8900. user to visit Org files are not removed.
  8901. @end table
  8902. @node Custom Agenda Views
  8903. @section Custom Agenda Views
  8904. @cindex custom agenda views
  8905. @cindex agenda views, custom
  8906. Custom agenda commands serve two purposes: to store and quickly access
  8907. frequently used TODO and tags searches, and to create special
  8908. composite agenda buffers. Custom agenda commands are accessible
  8909. through the dispatcher (see @ref{Agenda Dispatcher}), just like the
  8910. default commands.
  8911. @menu
  8912. * Storing searches:: Type once, use often.
  8913. * Block agenda:: All the stuff you need in a single buffer.
  8914. * Setting options:: Changing the rules.
  8915. @end menu
  8916. @node Storing searches
  8917. @subsection Storing searches
  8918. The first application of custom searches is the definition of keyboard
  8919. shortcuts for frequently used searches, either creating an agenda
  8920. buffer, or a sparse tree (the latter covering of course only the
  8921. current buffer).
  8922. @kindex C @r{(Agenda dispatcher)}
  8923. @vindex org-agenda-custom-commands
  8924. @cindex agenda views, main example
  8925. @cindex agenda, as an agenda views
  8926. @cindex agenda*, as an agenda views
  8927. @cindex tags, as an agenda view
  8928. @cindex todo, as an agenda view
  8929. @cindex tags-todo
  8930. @cindex todo-tree
  8931. @cindex occur-tree
  8932. @cindex tags-tree
  8933. Custom commands are configured in the variable
  8934. @code{org-agenda-custom-commands}. You can customize this variable, for
  8935. example by pressing @kbd{C} from the agenda dispatcher (see @ref{Agenda Dispatcher}). You can also directly set it with Emacs Lisp in
  8936. the Emacs init file. The following example contains all valid agenda
  8937. views:
  8938. @lisp
  8939. (setq org-agenda-custom-commands
  8940. '(("x" agenda)
  8941. ("y" agenda*)
  8942. ("w" todo "WAITING")
  8943. ("W" todo-tree "WAITING")
  8944. ("u" tags "+boss-urgent")
  8945. ("v" tags-todo "+boss-urgent")
  8946. ("U" tags-tree "+boss-urgent")
  8947. ("f" occur-tree "\\<FIXME\\>")
  8948. ("h" . "HOME+Name tags searches") ;description for "h" prefix
  8949. ("hl" tags "+home+Lisa")
  8950. ("hp" tags "+home+Peter")
  8951. ("hk" tags "+home+Kim")))
  8952. @end lisp
  8953. @noindent
  8954. The initial string in each entry defines the keys you have to press
  8955. after the dispatcher command in order to access the command. Usually
  8956. this will be just a single character, but if you have many similar
  8957. commands, you can also define two-letter combinations where the first
  8958. character is the same in several combinations and serves as a prefix
  8959. key@footnote{You can provide a description for a prefix key by inserting
  8960. a cons cell with the prefix and the description.}. The second parameter is the search type, followed by the
  8961. string or regular expression to be used for the matching. The example
  8962. above will therefore define:
  8963. @table @asis
  8964. @item @kbd{x}
  8965. as a global search for agenda entries planned@footnote{@emph{Planned} means here that these entries have some planning
  8966. information attached to them, like a time-stamp, a scheduled or
  8967. a deadline string. See @code{org-agenda-entry-types} on how to set what
  8968. planning information is taken into account.} this
  8969. week/day.
  8970. @item @kbd{y}
  8971. as the same search, but only for entries with an hour
  8972. specification like @samp{[h]h:mm}---think of them as appointments.
  8973. @item @kbd{w}
  8974. as a global search for TODO entries with @samp{WAITING} as the TODO
  8975. keyword.
  8976. @item @kbd{W}
  8977. as the same search, but only in the current buffer and displaying
  8978. the results as a sparse tree.
  8979. @item @kbd{u}
  8980. as a global tags search for headlines tagged @samp{boss} but not
  8981. @samp{urgent}.
  8982. @item @kbd{v}
  8983. The same search, but limiting it to headlines that are also TODO
  8984. items.
  8985. @item @kbd{U}
  8986. as the same search, but only in the current buffer and displaying
  8987. the result as a sparse tree.
  8988. @item @kbd{f}
  8989. to create a sparse tree (again, current buffer only) with all
  8990. entries containing the word @samp{FIXME}.
  8991. @item @kbd{h}
  8992. as a prefix command for a @samp{HOME} tags search where you have to
  8993. press an additional key (@kbd{l}, @kbd{p} or
  8994. @kbd{k}) to select a name (Lisa, Peter, or Kim) as
  8995. additional tag to match.
  8996. @end table
  8997. Note that @code{*-tree} agenda views need to be called from an Org buffer
  8998. as they operate on the current buffer only.
  8999. @node Block agenda
  9000. @subsection Block agenda
  9001. @cindex block agenda
  9002. @cindex agenda, with block views
  9003. Another possibility is the construction of agenda views that comprise
  9004. the results of @emph{several} commands, each of which creates a block in
  9005. the agenda buffer. The available commands include @code{agenda} for the
  9006. daily or weekly agenda (as created with @kbd{a}) , @code{alltodo} for
  9007. the global TODO list (as constructed with @kbd{t}), and the
  9008. matching commands discussed above: @code{todo}, @code{tags}, and @code{tags-todo}.
  9009. Here are two examples:
  9010. @lisp
  9011. (setq org-agenda-custom-commands
  9012. '(("h" "Agenda and Home-related tasks"
  9013. ((agenda "")
  9014. (tags-todo "home")
  9015. (tags "garden")))
  9016. ("o" "Agenda and Office-related tasks"
  9017. ((agenda "")
  9018. (tags-todo "work")
  9019. (tags "office")))))
  9020. @end lisp
  9021. @noindent
  9022. This defines @kbd{h} to create a multi-block view for stuff you
  9023. need to attend to at home. The resulting agenda buffer contains your
  9024. agenda for the current week, all TODO items that carry the tag @samp{home},
  9025. and also all lines tagged with @samp{garden}. Finally the command
  9026. @kbd{o} provides a similar view for office tasks.
  9027. @node Setting options
  9028. @subsection Setting options for custom commands
  9029. @cindex options, for custom agenda views
  9030. @vindex org-agenda-custom-commands
  9031. Org mode contains a number of variables regulating agenda construction
  9032. and display. The global variables define the behavior for all agenda
  9033. commands, including the custom commands. However, if you want to
  9034. change some settings just for a single custom view, you can do so.
  9035. Setting options requires inserting a list of variable names and values
  9036. at the right spot in @code{org-agenda-custom-commands}. For example:
  9037. @lisp
  9038. (setq org-agenda-custom-commands
  9039. '(("w" todo "WAITING"
  9040. ((org-agenda-sorting-strategy '(priority-down))
  9041. (org-agenda-prefix-format " Mixed: ")))
  9042. ("U" tags-tree "+boss-urgent"
  9043. ((org-show-context-detail 'minimal)))
  9044. ("N" search ""
  9045. ((org-agenda-files '("~org/notes.org"))
  9046. (org-agenda-text-search-extra-files nil)))))
  9047. @end lisp
  9048. @noindent
  9049. Now the @kbd{w} command sorts the collected entries only by
  9050. priority, and the prefix format is modified to just say @samp{Mixed:}
  9051. instead of giving the category of the entry. The sparse tags tree of
  9052. @kbd{U} now turns out ultra-compact, because neither the headline
  9053. hierarchy above the match, nor the headline following the match are
  9054. shown. The command @kbd{N} does a text search limited to only
  9055. a single file.
  9056. For command sets creating a block agenda, @code{org-agenda-custom-commands}
  9057. has two separate spots for setting options. You can add options that
  9058. should be valid for just a single command in the set, and options that
  9059. should be valid for all commands in the set. The former are just
  9060. added to the command entry; the latter must come after the list of
  9061. command entries. Going back to the block agenda example (see @ref{Block agenda}), let's change the sorting strategy for the @kbd{h}
  9062. commands to @code{priority-down}, but let's sort the results for GARDEN
  9063. tags query in the opposite order, @code{priority-up}. This would look like
  9064. this:
  9065. @lisp
  9066. (setq org-agenda-custom-commands
  9067. '(("h" "Agenda and Home-related tasks"
  9068. ((agenda)
  9069. (tags-todo "home")
  9070. (tags "garden"
  9071. ((org-agenda-sorting-strategy '(priority-up)))))
  9072. ((org-agenda-sorting-strategy '(priority-down))))
  9073. ("o" "Agenda and Office-related tasks"
  9074. ((agenda)
  9075. (tags-todo "work")
  9076. (tags "office")))))
  9077. @end lisp
  9078. As you see, the values and parentheses setting is a little complex.
  9079. When in doubt, use the customize interface to set this variable---it
  9080. fully supports its structure. Just one caveat: when setting options
  9081. in this interface, the @emph{values} are just Lisp expressions. So if the
  9082. value is a string, you need to add the double-quotes around the value
  9083. yourself.
  9084. @vindex org-agenda-custom-commands-contexts
  9085. To control whether an agenda command should be accessible from
  9086. a specific context, you can customize
  9087. @code{org-agenda-custom-commands-contexts}. Let's say for example that you
  9088. have an agenda command @kbd{o} displaying a view that you only
  9089. need when reading emails. Then you would configure this option like
  9090. this:
  9091. @lisp
  9092. (setq org-agenda-custom-commands-contexts
  9093. '(("o" (in-mode . "message-mode"))))
  9094. @end lisp
  9095. You can also tell that the command key @kbd{o} should refer to
  9096. another command key @kbd{r}. In that case, add this command key
  9097. like this:
  9098. @lisp
  9099. (setq org-agenda-custom-commands-contexts
  9100. '(("o" "r" (in-mode . "message-mode"))))
  9101. @end lisp
  9102. See the docstring of the variable for more information.
  9103. @node Exporting Agenda Views
  9104. @section Exporting Agenda Views
  9105. @cindex agenda views, exporting
  9106. If you are away from your computer, it can be very useful to have
  9107. a printed version of some agenda views to carry around. Org mode can
  9108. export custom agenda views as plain text, HTML@footnote{For HTML you need to install Hrvoje Niksic's @samp{htmlize.el}
  9109. from @uref{https://github.com/hniksic/emacs-htmlize, Hrvoje Niksic's repository}.}, Postscript,
  9110. PDF@footnote{To create PDF output, the Ghostscript ps2pdf utility must be
  9111. installed on the system. Selecting a PDF file also creates the
  9112. postscript file.}, and iCalendar files. If you want to do this only
  9113. occasionally, use the following command:
  9114. @table @asis
  9115. @item @kbd{C-x C-w} (@code{org-agenda-write})
  9116. @kindex C-x C-w
  9117. @findex org-agenda-write
  9118. @cindex exporting agenda views
  9119. @cindex agenda views, exporting
  9120. @vindex org-agenda-exporter-settings
  9121. Write the agenda view to a file.
  9122. @end table
  9123. If you need to export certain agenda views frequently, you can
  9124. associate any custom agenda command with a list of output file
  9125. names@footnote{If you want to store standard views like the weekly agenda or
  9126. the global TODO list as well, you need to define custom commands for
  9127. them in order to be able to specify file names.}. Here is an example that first defines custom commands
  9128. for the agenda and the global TODO list, together with a number of
  9129. files to which to export them. Then we define two block agenda
  9130. commands and specify file names for them as well. File names can be
  9131. relative to the current working directory, or absolute.
  9132. @lisp
  9133. (setq org-agenda-custom-commands
  9134. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  9135. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  9136. ("h" "Agenda and Home-related tasks"
  9137. ((agenda "")
  9138. (tags-todo "home")
  9139. (tags "garden"))
  9140. nil
  9141. ("~/views/home.html"))
  9142. ("o" "Agenda and Office-related tasks"
  9143. ((agenda)
  9144. (tags-todo "work")
  9145. (tags "office"))
  9146. nil
  9147. ("~/views/office.ps" "~/calendars/office.ics"))))
  9148. @end lisp
  9149. The extension of the file name determines the type of export. If it
  9150. is @samp{.html}, Org mode uses the htmlize package to convert the buffer to
  9151. HTML and save it to this file name. If the extension is @samp{.ps},
  9152. @code{ps-print-buffer-with-faces} is used to produce Postscript output. If
  9153. the extension is @samp{.ics}, iCalendar export is run export over all files
  9154. that were used to construct the agenda, and limit the export to
  9155. entries listed in the agenda. Any other extension produces a plain
  9156. ASCII file.
  9157. The export files are @emph{not} created when you use one of those
  9158. commands interactively because this might use too much overhead.
  9159. Instead, there is a special command to produce @emph{all} specified
  9160. files in one step:
  9161. @table @asis
  9162. @item @kbd{e} (@code{org-store-agenda-views})
  9163. @kindex e @r{(Agenda dispatcher)}
  9164. @findex org-store-agenda-views
  9165. Export all agenda views that have export file names associated
  9166. with them.
  9167. @end table
  9168. You can use the options section of the custom agenda commands to also
  9169. set options for the export commands. For example:
  9170. @lisp
  9171. (setq org-agenda-custom-commands
  9172. '(("X" agenda ""
  9173. ((ps-number-of-columns 2)
  9174. (ps-landscape-mode t)
  9175. (org-agenda-prefix-format " [ ] ")
  9176. (org-agenda-with-colors nil)
  9177. (org-agenda-remove-tags t))
  9178. ("theagenda.ps"))))
  9179. @end lisp
  9180. @noindent
  9181. @vindex org-agenda-exporter-settings
  9182. This command sets two options for the Postscript exporter, to make it
  9183. print in two columns in landscape format---the resulting page can be
  9184. cut in two and then used in a paper agenda. The remaining settings
  9185. modify the agenda prefix to omit category and scheduling information,
  9186. and instead include a checkbox to check off items. We also remove the
  9187. tags to make the lines compact, and we do not want to use colors for
  9188. the black-and-white printer. Settings specified in
  9189. @code{org-agenda-exporter-settings} also apply, e.g.,
  9190. @lisp
  9191. (setq org-agenda-exporter-settings
  9192. '((ps-number-of-columns 2)
  9193. (ps-landscape-mode t)
  9194. (org-agenda-add-entry-text-maxlines 5)
  9195. (htmlize-output-type 'css)))
  9196. @end lisp
  9197. @noindent
  9198. but the settings in @code{org-agenda-custom-commands} take precedence.
  9199. @noindent
  9200. From the command line you may also use:
  9201. @example
  9202. emacs -eval (org-batch-store-agenda-views) -kill
  9203. @end example
  9204. @noindent
  9205. or, if you need to modify some parameters@footnote{Quoting depends on the system you use, please check the FAQ
  9206. for examples.}
  9207. @example
  9208. emacs -eval '(org-batch-store-agenda-views \
  9209. org-agenda-span (quote month) \
  9210. org-agenda-start-day "2007-11-01" \
  9211. org-agenda-include-diary nil \
  9212. org-agenda-files (quote ("~/org/project.org")))' \
  9213. -kill
  9214. @end example
  9215. @noindent
  9216. which creates the agenda views restricted to the file
  9217. @samp{~/org/project.org}, without diary entries and with a 30-day extent.
  9218. You can also extract agenda information in a way that allows further
  9219. processing by other programs. See @ref{Extracting Agenda Information}, for
  9220. more information.
  9221. @node Agenda Column View
  9222. @section Using Column View in the Agenda
  9223. @cindex column view, in agenda
  9224. @cindex agenda, column view
  9225. Column view (see @ref{Column View}) is normally used to view and edit
  9226. properties embedded in the hierarchical structure of an Org file. It
  9227. can be quite useful to use column view also from the agenda, where
  9228. entries are collected by certain criteria.
  9229. @table @asis
  9230. @item @kbd{C-c C-x C-c} (@code{org-agenda-columns})
  9231. @kindex C-c C-x C-c
  9232. @findex org-agenda-columns
  9233. Turn on column view in the agenda.
  9234. @end table
  9235. To understand how to use this properly, it is important to realize
  9236. that the entries in the agenda are no longer in their proper outline
  9237. environment. This causes the following issues:
  9238. @enumerate
  9239. @item
  9240. @vindex org-columns-default-format
  9241. @vindex org-overriding-columns-format
  9242. Org needs to make a decision which columns format to use. Since
  9243. the entries in the agenda are collected from different files, and
  9244. different files may have different columns formats, this is
  9245. a non-trivial problem. Org first checks if the variable
  9246. @code{org-agenda-overriding-columns-format} is currently set, and if so,
  9247. takes the format from there. Otherwise it takes the format
  9248. associated with the first item in the agenda, or, if that item does
  9249. not have a specific format (defined in a property, or in its file),
  9250. it uses @code{org-columns-default-format}.
  9251. @item
  9252. @cindex @samp{CLOCKSUM}, special property
  9253. If any of the columns has a summary type defined (see @ref{Column attributes}), turning on column view in the agenda visits all
  9254. relevant agenda files and make sure that the computations of this
  9255. property are up to date. This is also true for the special
  9256. @samp{CLOCKSUM} property. Org then sums the values displayed in the
  9257. agenda. In the daily/weekly agenda, the sums cover a single day;
  9258. in all other views they cover the entire block.
  9259. It is important to realize that the agenda may show the same entry
  9260. @emph{twice}---for example as scheduled and as a deadline---and it may
  9261. show two entries from the same hierarchy (for example a @emph{parent}
  9262. and its @emph{child}). In these cases, the summation in the agenda
  9263. leads to incorrect results because some values count double.
  9264. @item
  9265. When the column view in the agenda shows the @samp{CLOCKSUM} property,
  9266. that is always the entire clocked time for this item. So even in
  9267. the daily/weekly agenda, the clocksum listed in column view may
  9268. originate from times outside the current view. This has the
  9269. advantage that you can compare these values with a column listing
  9270. the planned total effort for a task---one of the major
  9271. applications for column view in the agenda. If you want
  9272. information about clocked time in the displayed period use clock
  9273. table mode (press @kbd{R} in the agenda).
  9274. @item
  9275. @cindex @samp{CLOCKSUM_T}, special property
  9276. When the column view in the agenda shows the @samp{CLOCKSUM_T} property,
  9277. that is always today's clocked time for this item. So even in the
  9278. weekly agenda, the clocksum listed in column view only originates
  9279. from today. This lets you compare the time you spent on a task for
  9280. today, with the time already spent---via @samp{CLOCKSUM}---and with
  9281. the planned total effort for it.
  9282. @end enumerate
  9283. @node Markup
  9284. @chapter Markup for Rich Export
  9285. When exporting Org documents, the exporter tries to reflect the
  9286. structure of the document as accurately as possible in the back-end.
  9287. Since export targets like HTML and @LaTeX{} allow much richer formatting,
  9288. Org mode has rules on how to prepare text for rich export. This
  9289. section summarizes the markup rules used in an Org mode buffer.
  9290. @menu
  9291. * Paragraphs:: The basic unit of text.
  9292. * Emphasis and Monospace:: Bold, italic, etc.
  9293. * Horizontal Rules:: Make a line.
  9294. * Images and Tables:: Images, tables and caption mechanism.
  9295. * Literal Examples:: Source code examples with special formatting.
  9296. * Special Symbols:: Greek letters and other symbols.
  9297. * Subscripts and Superscripts:: Simple syntax for raising/lowering text.
  9298. * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents.
  9299. @end menu
  9300. @node Paragraphs
  9301. @section Paragraphs
  9302. @cindex paragraphs, markup rules
  9303. Paragraphs are separated by at least one empty line. If you need to
  9304. enforce a line break within a paragraph, use @code{\\} at the end of
  9305. a line.
  9306. To preserve the line breaks, indentation and blank lines in a region,
  9307. but otherwise use normal formatting, you can use this construct, which
  9308. can also be used to format poetry.
  9309. @cindex @samp{BEGIN_VERSE}
  9310. @cindex verse blocks
  9311. @example
  9312. #+BEGIN_VERSE
  9313. Great clouds overhead
  9314. Tiny black birds rise and fall
  9315. Snow covers Emacs
  9316. ---AlexSchroeder
  9317. #+END_VERSE
  9318. @end example
  9319. When quoting a passage from another document, it is customary to
  9320. format this as a paragraph that is indented on both the left and the
  9321. right margin. You can include quotations in Org documents like this:
  9322. @cindex @samp{BEGIN_QUOTE}
  9323. @cindex quote blocks
  9324. @example
  9325. #+BEGIN_QUOTE
  9326. Everything should be made as simple as possible,
  9327. but not any simpler ---Albert Einstein
  9328. #+END_QUOTE
  9329. @end example
  9330. If you would like to center some text, do it like this:
  9331. @cindex @samp{BEGIN_CENTER}
  9332. @cindex center blocks
  9333. @example
  9334. #+BEGIN_CENTER
  9335. Everything should be made as simple as possible, \\
  9336. but not any simpler
  9337. #+END_CENTER
  9338. @end example
  9339. @node Emphasis and Monospace
  9340. @section Emphasis and Monospace
  9341. @cindex underlined text, markup rules
  9342. @cindex bold text, markup rules
  9343. @cindex italic text, markup rules
  9344. @cindex verbatim text, markup rules
  9345. @cindex code text, markup rules
  9346. @cindex strike-through text, markup rules
  9347. You can make words @samp{*bold*}, @samp{/italic/}, @samp{_underlined_}, @samp{=verbatim=}
  9348. and @samp{~code~}, and, if you must, @samp{+strike-through+}. Text in the code
  9349. and verbatim string is not processed for Org mode specific syntax; it
  9350. is exported verbatim.
  9351. @vindex org-fontify-emphasized-text
  9352. To turn off fontification for marked up text, you can set
  9353. @code{org-fontify-emphasized-text} to @code{nil}. To narrow down the list of
  9354. available markup syntax, you can customize @code{org-emphasis-alist}.
  9355. @node Horizontal Rules
  9356. @section Horizontal Rules
  9357. @cindex horizontal rules, markup rules
  9358. A line consisting of only dashes, and at least 5 of them, is exported
  9359. as a horizontal line.
  9360. @node Images and Tables
  9361. @section Images and Tables
  9362. @cindex tables, markup rules
  9363. @cindex @samp{CAPTION}, keyword
  9364. @cindex @samp{NAME}, keyword
  9365. Both the native Org mode tables (see @ref{Tables}) and tables formatted
  9366. with the @samp{table.el} package are exported properly. For Org mode
  9367. tables, the lines before the first horizontal separator line become
  9368. table header lines. You can use the following lines somewhere before
  9369. the table to assign a caption and a label for cross references, and in
  9370. the text you can refer to the object with @samp{[[tab:basic-data]]} (see
  9371. @ref{Internal Links}):
  9372. @example
  9373. #+CAPTION: This is the caption for the next table (or link)
  9374. #+NAME: tab:basic-data
  9375. | ... | ... |
  9376. |-----+-----|
  9377. @end example
  9378. Optionally, the caption can take the form:
  9379. @example
  9380. #+CAPTION[Caption for list of tables]: Caption for table.
  9381. @end example
  9382. @cindex inlined images, markup rules
  9383. Some back-ends allow you to directly include images into the exported
  9384. document. Org does this, if a link to an image file does not have
  9385. a description part, for example @samp{[[./img/a.jpg]]}. If you wish to define
  9386. a caption for the image and maybe a label for internal cross
  9387. references, make sure that the link is on a line by itself and precede
  9388. it with @samp{CAPTION} and @samp{NAME} keywords as follows:
  9389. @example
  9390. #+CAPTION: This is the caption for the next figure link (or table)
  9391. #+NAME: fig:SED-HR4049
  9392. [[./img/a.jpg]]
  9393. @end example
  9394. @noindent
  9395. Such images can be displayed within the buffer. See @ref{Handling Links, , the discussion of
  9396. image links}.
  9397. Even though images and tables are prominent examples of captioned
  9398. structures, the same caption mechanism can apply to many
  9399. others---e.g., @LaTeX{} equations, source code blocks. Depending on the
  9400. export back-end, those may or may not be handled.
  9401. @node Literal Examples
  9402. @section Literal Examples
  9403. @cindex literal examples, markup
  9404. @cindex code line references, markup
  9405. You can include literal examples that should not be subjected to
  9406. markup. Such examples are typeset in monospace, so this is well
  9407. suited for source code and similar examples.
  9408. @cindex @samp{BEGIN_EXAMPLE}
  9409. @cindex example block
  9410. @example
  9411. #+BEGIN_EXAMPLE
  9412. Some example from a text file.
  9413. #+END_EXAMPLE
  9414. @end example
  9415. Note that such blocks may be @emph{indented} in order to align nicely with
  9416. indented text and in particular with plain list structure (see
  9417. @ref{Plain Lists}). For simplicity when using small examples, you can
  9418. also start the example lines with a colon followed by a space. There
  9419. may also be additional whitespace before the colon:
  9420. @example
  9421. Here is an example
  9422. : Some example from a text file.
  9423. @end example
  9424. @cindex formatting source code, markup rules
  9425. @vindex org-latex-listings
  9426. If the example is source code from a programming language, or any
  9427. other text that can be marked up by Font Lock in Emacs, you can ask
  9428. for the example to look like the fontified Emacs buffer@footnote{This works automatically for the HTML backend (it requires
  9429. version 1.34 of the @samp{htmlize.el} package, which you need to install).
  9430. Fontified code chunks in @LaTeX{} can be achieved using either the
  9431. listings package or the @uref{https://github.com/gpoore/minted, minted} package. Refer to
  9432. @code{org-export-latex-listings} for details.}. This
  9433. is done with the code block, where you also need to specify the name
  9434. of the major mode that should be used to fontify the example@footnote{Source code in code blocks may also be evaluated either
  9435. interactively or on export. See @ref{Working with Source Code} for more
  9436. information on evaluating code blocks.},
  9437. see @ref{Structure Templates} for shortcuts to easily insert code blocks.
  9438. @cindex @samp{BEGIN_SRC}
  9439. @cindex src block
  9440. @example
  9441. #+BEGIN_SRC emacs-lisp
  9442. (defun org-xor (a b)
  9443. "Exclusive or."
  9444. (if a (not b) b))
  9445. #+END_SRC
  9446. @end example
  9447. Both in @samp{example} and in @samp{src} snippets, you can add a @samp{-n} switch to
  9448. the end of the @samp{#+BEGIN} line, to get the lines of the example
  9449. numbered. The @samp{-n} takes an optional numeric argument specifying the
  9450. starting line number of the block. If you use a @samp{+n} switch, the
  9451. numbering from the previous numbered snippet is continued in the
  9452. current one. The @samp{+n} switch can also take a numeric argument. This
  9453. adds the value of the argument to the last line of the previous block
  9454. to determine the starting line number.
  9455. @example
  9456. #+BEGIN_SRC emacs-lisp -n 20
  9457. ;; This exports with line number 20.
  9458. (message "This is line 21")
  9459. #+END_SRC
  9460. #+BEGIN_SRC emacs-lisp +n 10
  9461. ;; This is listed as line 31.
  9462. (message "This is line 32")
  9463. #+END_SRC
  9464. @end example
  9465. In literal examples, Org interprets strings like @samp{(ref:name)} as
  9466. labels, and use them as targets for special hyperlinks like
  9467. @samp{[[(name)]]}---i.e., the reference name enclosed in single parenthesis.
  9468. In HTML, hovering the mouse over such a link remote-highlights the
  9469. corresponding code line, which is kind of cool.
  9470. You can also add a @samp{-r} switch which @emph{removes} the labels from the
  9471. source code@footnote{Adding @samp{-k} to @samp{-n -r} @emph{keeps} the labels in the source code
  9472. while using line numbers for the links, which might be useful to
  9473. explain those in an Org mode example code.}. With the @samp{-n} switch, links to these references
  9474. are labeled by the line numbers from the code listing. Otherwise
  9475. links use the labels with no parentheses. Here is an example:
  9476. @example
  9477. #+BEGIN_SRC emacs-lisp -n -r
  9478. (save-excursion (ref:sc)
  9479. (goto-char (point-min)) (ref:jump)
  9480. #+END_SRC
  9481. In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
  9482. jumps to point-min.
  9483. @end example
  9484. @cindex indentation, in source blocks
  9485. Finally, you can use @samp{-i} to preserve the indentation of a specific
  9486. code block (see @ref{Editing Source Code}).
  9487. @vindex org-coderef-label-format
  9488. If the syntax for the label format conflicts with the language syntax,
  9489. use a @samp{-l} switch to change the format, for example
  9490. @example
  9491. #+BEGIN_SRC pascal -n -r -l "((%s))"
  9492. @end example
  9493. @noindent
  9494. See also the variable @code{org-coderef-label-format}.
  9495. HTML export also allows examples to be published as text areas (see
  9496. @ref{Text areas in HTML export}).
  9497. Because the @samp{#+BEGIN} @dots{} @samp{#+END} patterns need to be added so often,
  9498. a shortcut is provided (see @ref{Structure Templates}).
  9499. @table @asis
  9500. @item @kbd{C-c '} (@code{org-edit-special})
  9501. @kindex C-c '
  9502. @findex org-edit-special
  9503. Edit the source code example at point in its native mode. This
  9504. works by switching to a temporary buffer with the source code.
  9505. You need to exit by pressing @kbd{C-c '} again@footnote{Upon exit, lines starting with @samp{*}, @samp{,*}, @samp{#+} and @samp{,#+} get
  9506. a comma prepended, to keep them from being interpreted by Org as
  9507. outline nodes or special syntax. These commas are stripped when
  9508. editing with @kbd{C-c '}, and also before export.}. The
  9509. edited version then replaces the old version in the Org buffer.
  9510. Fixed-width regions---where each line starts with a colon
  9511. followed by a space---are edited using @code{artist-mode}@footnote{You may select a different-mode with the variable
  9512. @code{org-edit-fixed-width-region-mode}.} to
  9513. allow creating ASCII drawings easily. Using this command in an
  9514. empty line creates a new fixed-width region.
  9515. @end table
  9516. @cindex storing link, in a source code buffer
  9517. Calling @code{org-store-link} (see @ref{Handling Links}) while editing a source
  9518. code example in a temporary buffer created with @kbd{C-c '}
  9519. prompts for a label. Make sure that it is unique in the current
  9520. buffer, and insert it with the proper formatting like @samp{(ref:label)} at
  9521. the end of the current line. Then the label is stored as a link
  9522. @samp{(label)}, for retrieval with @kbd{C-c C-l}.
  9523. @node Special Symbols
  9524. @section Special Symbols
  9525. @cindex math symbols
  9526. @cindex special symbols
  9527. @cindex @TeX{} macros
  9528. @cindex @LaTeX{} fragments, markup rules
  9529. @cindex HTML entities
  9530. @cindex @LaTeX{} entities
  9531. You can use @LaTeX{}-like syntax to insert special symbols---named
  9532. entities---like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to indicate
  9533. an arrow. Completion for these symbols is available, just type @samp{\}
  9534. and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible
  9535. completions. If you need such a symbol inside a word, terminate it
  9536. with a pair of curly brackets. For example
  9537. @example
  9538. Pro tip: Given a circle \Gamma of diameter d, the length of its
  9539. circumference is \pi@{@}d.
  9540. @end example
  9541. @findex org-entities-help
  9542. @vindex org-entities-user
  9543. A large number of entities is provided, with names taken from both
  9544. HTML and @LaTeX{}; you can comfortably browse the complete list from
  9545. a dedicated buffer using the command @code{org-entities-help}. It is also
  9546. possible to provide your own special symbols in the variable
  9547. @code{org-entities-user}.
  9548. During export, these symbols are transformed into the native format of
  9549. the exporter back-end. Strings like @samp{\alpha} are exported as @samp{&alpha;} in
  9550. the HTML output, and as @samp{\(\alpha\)} in the @LaTeX{} output. Similarly, @samp{\nbsp}
  9551. becomes @samp{&nbsp;} in HTML and @samp{~} in @LaTeX{}.
  9552. @cindex escaping characters
  9553. Entities may also be used as a way to escape markup in an Org
  9554. document, e.g., @samp{\under@{@}not underlined\under} exports as @samp{_not underlined_}.
  9555. @cindex special symbols, in-buffer display
  9556. If you would like to see entities displayed as UTF-8 characters, use
  9557. the following command@footnote{You can turn this on by default by setting the variable
  9558. @code{org-pretty-entities}, or on a per-file base with the @samp{STARTUP} option
  9559. @samp{entitiespretty}.}:
  9560. @table @asis
  9561. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities})
  9562. @kindex C-c C-x \
  9563. @findex org-toggle-pretty-entities
  9564. Toggle display of entities as UTF-8 characters. This does not
  9565. change the buffer content which remains plain ASCII, but it
  9566. overlays the UTF-8 character for display purposes only.
  9567. @end table
  9568. @cindex shy hyphen, special symbol
  9569. @cindex dash, special symbol
  9570. @cindex ellipsis, special symbol
  9571. In addition to regular entities defined above, Org exports in
  9572. a special way@footnote{This behavior can be disabled with @samp{-} export setting (see
  9573. @ref{Export Settings}).} the following commonly used character
  9574. combinations: @samp{\-} is treated as a shy hyphen, @samp{--} and @samp{---} are
  9575. converted into dashes, and @samp{...} becomes a compact set of dots.
  9576. @node Subscripts and Superscripts
  9577. @section Subscripts and Superscripts
  9578. @cindex subscript
  9579. @cindex superscript
  9580. @samp{^} and @samp{_} are used to indicate super- and subscripts. To increase
  9581. the readability of ASCII text, it is not necessary, but OK, to
  9582. surround multi-character sub- and superscripts with curly braces. For
  9583. example
  9584. @example
  9585. The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand,
  9586. the radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}.
  9587. @end example
  9588. @vindex org-use-sub-superscripts
  9589. If you write a text where the underscore is often used in a different
  9590. context, Org's convention to always interpret these as subscripts can
  9591. get in your way. Configure the variable @code{org-use-sub-superscripts} to
  9592. change this convention. For example, when setting this variable to
  9593. @code{@{@}}, @samp{a_b} is not interpreted as a subscript, but @samp{a_@{b@}} is.
  9594. @table @asis
  9595. @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities~})
  9596. @kindex C-c C-x \
  9597. @findex org-toggle-pretty-entities
  9598. In addition to showing entities as UTF-8 characters, this command
  9599. also formats sub- and superscripts in a WYSIWYM way.
  9600. @end table
  9601. @node Embedded @LaTeX{}
  9602. @section Embedded @LaTeX{}
  9603. @cindex @TeX{} interpretation
  9604. @cindex @LaTeX{} interpretation
  9605. Plain ASCII is normally sufficient for almost all note taking.
  9606. Exceptions include scientific notes, which often require mathematical
  9607. symbols and the occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on Donald@tie{}E.@tie{}Knuth's @TeX{}
  9608. system. Many of the features described here as ``@LaTeX{}'' are really
  9609. from @TeX{}, but for simplicity I am blurring this distinction.} is widely used to
  9610. typeset scientific documents. Org mode supports embedding @LaTeX{} code
  9611. into its files, because many academics are used to writing and reading
  9612. @LaTeX{} source code, and because it can be readily processed to produce
  9613. pretty output for a number of export back-ends.
  9614. @menu
  9615. * @LaTeX{} fragments:: Complex formulas made easy.
  9616. * Previewing @LaTeX{} fragments:: What will this snippet look like?
  9617. * CD@LaTeX{} mode:: Speed up entering of formulas.
  9618. @end menu
  9619. @node @LaTeX{} fragments
  9620. @subsection @LaTeX{} fragments
  9621. @cindex @LaTeX{} fragments
  9622. @vindex org-format-latex-header
  9623. Org mode can contain @LaTeX{} math fragments, and it supports ways to
  9624. process these for several export back-ends. When exporting to @LaTeX{},
  9625. the code is left as it is. When exporting to HTML, Org can use either
  9626. @uref{http://www.mathjax.org, MathJax} (see @ref{Math formatting in HTML export}) or transcode the math
  9627. into images (see @ref{Previewing @LaTeX{} fragments}).
  9628. @LaTeX{} fragments do not need any special marking at all. The following
  9629. snippets are identified as @LaTeX{} source code:
  9630. @itemize
  9631. @item
  9632. Environments of any kind@footnote{When MathJax is used, only the environments recognized by
  9633. MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is
  9634. used to create images, any @LaTeX{} environment is handled.}. The only requirement is that the
  9635. @samp{\begin} statement appears on a new line, preceded by only
  9636. whitespace.
  9637. @item
  9638. Text within the usual @LaTeX{} math delimiters. To avoid conflicts
  9639. with currency specifications, single @samp{$} characters are only
  9640. recognized as math delimiters if the enclosed text contains at most
  9641. two line breaks, is directly attached to the @samp{$} characters with no
  9642. whitespace in between, and if the closing @samp{$} is followed by
  9643. whitespace, punctuation or a dash. For the other delimiters, there
  9644. is no such restriction, so when in doubt, use @samp{\(...\)} as inline
  9645. math delimiters.
  9646. @end itemize
  9647. @noindent
  9648. For example:
  9649. @example
  9650. \begin@{equation@} % arbitrary environments,
  9651. x=\sqrt@{b@} % even tables, figures
  9652. \end@{equation@} % etc
  9653. If $a^2=b$ and \( b=2 \), then the solution must be
  9654. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  9655. @end example
  9656. @vindex org-export-with-latex
  9657. @LaTeX{} processing can be configured with the variable
  9658. @code{org-export-with-latex}. The default setting is @code{t} which means
  9659. MathJax for HTML, and no processing for ASCII and @LaTeX{} back-ends.
  9660. You can also set this variable on a per-file basis using one of these
  9661. lines:
  9662. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  9663. @item @samp{#+OPTIONS: tex:t}
  9664. @tab Do the right thing automatically (MathJax)
  9665. @item @samp{#+OPTIONS: tex:nil}
  9666. @tab Do not process @LaTeX{} fragments at all
  9667. @item @samp{#+OPTIONS: tex:verbatim}
  9668. @tab Verbatim export, for jsMath or so
  9669. @end multitable
  9670. @node Previewing @LaTeX{} fragments
  9671. @subsection Previewing @LaTeX{} fragments
  9672. @cindex @LaTeX{} fragments, preview
  9673. @vindex org-preview-latex-default-process
  9674. If you have a working @LaTeX{} installation and @samp{dvipng}, @samp{dvisvgm} or
  9675. @samp{convert} installed@footnote{These are respectively available at
  9676. @uref{http://sourceforge.net/projects/dvipng/}, @uref{http://dvisvgm.bplaced.net/}
  9677. and from the ImageMagick suite. Choose the converter by setting the
  9678. variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{} fragments can be processed to
  9679. produce images of the typeset expressions to be used for inclusion
  9680. while exporting to HTML (see @ref{@LaTeX{} fragments}), or for inline
  9681. previewing within Org mode.
  9682. @vindex org-format-latex-options
  9683. @vindex org-format-latex-header
  9684. You can customize the variables @code{org-format-latex-options} and
  9685. @code{org-format-latex-header} to influence some aspects of the preview.
  9686. In particular, the @code{:scale} (and for HTML export, @code{:html-scale})
  9687. property of the former can be used to adjust the size of the preview
  9688. images.
  9689. @table @asis
  9690. @item @kbd{C-c C-x C-l} (@code{org-toggle-latex-fragment})
  9691. @kindex C-c C-x C-l
  9692. @findex org-toggle-latex-fragment
  9693. Produce a preview image of the @LaTeX{} fragment at point and
  9694. overlay it over the source code. If there is no fragment at
  9695. point, process all fragments in the current entry (between two
  9696. headlines). When called with a prefix argument, process the
  9697. entire subtree. When called with two prefix arguments, or when
  9698. the cursor is before the first headline, process the entire
  9699. buffer.
  9700. @end table
  9701. @vindex org-startup-with-latex-preview
  9702. You can turn on the previewing of all @LaTeX{} fragments in a file with
  9703. @example
  9704. #+STARTUP: latexpreview
  9705. @end example
  9706. To disable it, simply use
  9707. @example
  9708. #+STARTUP: nolatexpreview
  9709. @end example
  9710. @node CD@LaTeX{} mode
  9711. @subsection Using CD@LaTeX{} to enter math
  9712. @cindex CD@LaTeX{}
  9713. CD@LaTeX{} mode is a minor mode that is normally used in combination with
  9714. a major @LaTeX{} mode like AUC@TeX{} in order to speed-up insertion of
  9715. environments and math templates. Inside Org mode, you can make use of
  9716. some of the features of CD@LaTeX{} mode. You need to install
  9717. @samp{cdlatex.el} and @samp{texmathp.el} (the latter comes also with AUC@TeX{})
  9718. from @uref{http://www.astro.uva.nl/~dominik/Tools/cdlatex}. Do not use
  9719. CD@LaTeX{} mode itself under Org mode, but use the light version
  9720. @code{org-cdlatex-mode} that comes as part of Org mode. Turn it on for the
  9721. current buffer with @kbd{M-x org-cdlatex-mode}, or for all Org
  9722. files with
  9723. @lisp
  9724. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  9725. @end lisp
  9726. When this mode is enabled, the following features are present (for
  9727. more details see the documentation of CD@LaTeX{} mode):
  9728. @table @asis
  9729. @item @kbd{C-c @{}
  9730. @kindex C-c @{
  9731. Insert an environment template.
  9732. @item @kbd{@key{TAB}}
  9733. @kindex TAB
  9734. The @kbd{@key{TAB}} key expands the template if the cursor is
  9735. inside a @LaTeX{} fragment@footnote{Org mode has a method to test if the cursor is inside such
  9736. a fragment, see the documentation of the function
  9737. @code{org-inside-LaTeX-fragment-p}.}. For example, @kbd{@key{TAB}}
  9738. expands @samp{fr} to @samp{\frac@{@}@{@}} and position the cursor correctly
  9739. inside the first brace. Another @kbd{@key{TAB}} gets you into the
  9740. second brace.
  9741. Even outside fragments, @kbd{@key{TAB}} expands environment
  9742. abbreviations at the beginning of a line. For example, if you
  9743. write @samp{equ} at the beginning of a line and press @kbd{@key{TAB}},
  9744. this abbreviation is expanded to an @samp{equation} environment. To
  9745. get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  9746. @item @kbd{^}
  9747. @itemx @kbd{_}
  9748. @kindex _
  9749. @kindex ^
  9750. @vindex cdlatex-simplify-sub-super-scripts
  9751. Pressing @kbd{_} and @kbd{^} inside a @LaTeX{} fragment
  9752. inserts these characters together with a pair of braces. If you
  9753. use @kbd{@key{TAB}} to move out of the braces, and if the braces
  9754. surround only a single character or macro, they are removed again
  9755. (depending on the variable @code{cdlatex-simplify-sub-super-scripts}).
  9756. @item @kbd{`}
  9757. @kindex `
  9758. Pressing the backquote followed by a character inserts math
  9759. macros, also outside @LaTeX{} fragments. If you wait more than 1.5
  9760. seconds after the backquote, a help window pops up.
  9761. @item @kbd{'}
  9762. @kindex '
  9763. Pressing the single-quote followed by another character modifies
  9764. the symbol before point with an accent or a font. If you wait
  9765. more than 1.5 seconds after the single-quote, a help window pops
  9766. up. Character modification works only inside @LaTeX{} fragments;
  9767. outside the quote is normal.
  9768. @end table
  9769. @node Exporting
  9770. @chapter Exporting
  9771. @cindex exporting
  9772. Sometimes, you may want to pretty print your notes, publish them on
  9773. the web or even share them with people not using Org. In these cases,
  9774. the Org export facilities can be used to convert your documents to
  9775. a variety of other formats, while retaining as much structure (see
  9776. @ref{Document Structure}) and markup (see @ref{Markup}) as
  9777. possible.
  9778. @cindex export back-end
  9779. Libraries responsible for such translation are called back-ends. Org
  9780. ships with the following ones
  9781. @itemize
  9782. @item
  9783. @emph{ascii} (ASCII format)
  9784. @item
  9785. @emph{beamer} (@LaTeX{} Beamer format)
  9786. @item
  9787. @emph{html} (HTML format)
  9788. @item
  9789. @emph{icalendar} (iCalendar format)
  9790. @item
  9791. @emph{latex} (@LaTeX{} format)
  9792. @item
  9793. @emph{md} (Markdown format)
  9794. @item
  9795. @emph{odt} (OpenDocument Text format)
  9796. @item
  9797. @emph{org} (Org format)
  9798. @item
  9799. @emph{texinfo} (Texinfo format)
  9800. @item
  9801. @emph{man} (Man page format)
  9802. @end itemize
  9803. @noindent
  9804. Org also uses additional libraries located in @samp{contrib/} directory
  9805. (see @ref{Installation}). Users can install additional export libraries
  9806. for additional formats from the Emacs packaging system. For easy
  9807. discovery, these packages have a common naming scheme: @code{ox-NAME},
  9808. where @var{NAME} is one of the formats. For example,
  9809. @code{ox-koma-letter} @emph{koma-letter} back-end.
  9810. @vindex org-export-backends
  9811. Org loads back-ends for the following formats by default: ASCII, HTML,
  9812. iCalendar, @LaTeX{} and ODT. Org can load additional back-ends either of
  9813. two ways: through the @code{org-export-backends} variable configuration;
  9814. or, by requiring the library in the Emacs init file like this:
  9815. @lisp
  9816. (require 'ox-md)
  9817. @end lisp
  9818. @menu
  9819. * The Export Dispatcher:: The main interface.
  9820. * Export Settings:: Common export settings.
  9821. * Table of Contents:: The if and where of the table of contents.
  9822. * Include Files:: Include additional files into a document.
  9823. * Macro Replacement:: Use macros to create templates.
  9824. * Comment Lines:: What will not be exported.
  9825. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding.
  9826. * Beamer Export::
  9827. * HTML Export:: Exporting to HTML.
  9828. * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF.
  9829. * Markdown Export:: Exporting to Markdown.
  9830. * OpenDocument Text Export:: Exporting to OpenDocument Text.
  9831. * Org Export:: Exporting to Org.
  9832. * Texinfo Export:: Exporting to Texinfo.
  9833. * iCalendar Export:: Exporting to iCalendar.
  9834. * Other Built-in Back-ends:: Exporting to a man page.
  9835. * Advanced Configuration:: Fine-tuning the export output.
  9836. * Export in Foreign Buffers:: Author tables and lists in Org syntax.
  9837. @end menu
  9838. @node The Export Dispatcher
  9839. @section The Export Dispatcher
  9840. @cindex dispatcher, for export commands
  9841. @cindex Export, dispatcher
  9842. The export dispatcher is the main interface for Org's exports.
  9843. A hierarchical menu presents the currently configured export formats.
  9844. Options are shown as easy toggle switches on the same screen.
  9845. @vindex org-export-dispatch-use-expert-ui
  9846. Org also has a minimal prompt interface for the export dispatcher.
  9847. When the variable @code{org-export-dispatch-use-expert-ui} is set to
  9848. a non-@code{nil} value, Org prompts in the minibuffer. To switch back to
  9849. the hierarchical menu, press @kbd{?}.
  9850. @table @asis
  9851. @item @kbd{C-c C-e} (@code{org-export})
  9852. @kindex C-c C-e
  9853. @findex org-export
  9854. Invokes the export dispatcher interface. The options show
  9855. default settings. The @kbd{C-u} prefix argument preserves
  9856. options from the previous export, including any sub-tree
  9857. selections.
  9858. @end table
  9859. Org exports the entire buffer by default. If the Org buffer has an
  9860. active region, then Org exports just that region.
  9861. Within the dispatcher interface, the following key combinations can
  9862. further alter what is exported, and how.
  9863. @table @asis
  9864. @item @kbd{C-a}
  9865. @kindex C-c C-e C-a
  9866. Toggle asynchronous export. Asynchronous export uses an external
  9867. Emacs process with a specially configured initialization file to
  9868. complete the exporting process in the background thereby
  9869. releasing the current interface. This is particularly useful
  9870. when exporting long documents.
  9871. Output from an asynchronous export is saved on the ``the export
  9872. stack''. To view this stack, call the export dispatcher with
  9873. a double @kbd{C-u} prefix argument. If already in the
  9874. export dispatcher menu, @kbd{&} displays the stack.
  9875. @vindex org-export-async-init-file
  9876. To make the background export process the default, customize the
  9877. variable, @code{org-export-in-background}. Additionally, you can set
  9878. the initialization file used by the background process with
  9879. @code{org-export-async-init-file}.
  9880. @vindex org-export-in-background
  9881. You can make asynchronous export the default by setting
  9882. @code{org-export-in-background}.
  9883. @item @kbd{C-b}
  9884. @kindex C-c C-e C-b
  9885. Toggle body-only export. Useful for excluding headers and
  9886. footers in the export. Affects only those back-end formats that
  9887. have such sections---like @samp{<head>...</head>} in HTML.
  9888. @item @{@{@{kbd(C-s@}@}@}
  9889. @kindex C-c C-e C-s
  9890. Toggle sub-tree export. When turned on, Org exports only the
  9891. sub-tree starting from the cursor position at the time the export
  9892. dispatcher was invoked. Org uses the top heading of this
  9893. sub-tree as the document's title. If the cursor is not on
  9894. a heading, Org uses the nearest enclosing header. If the cursor
  9895. is in the document preamble, Org signals an error and aborts
  9896. export.
  9897. @vindex org-export-initial-scope
  9898. To make the sub-tree export the default, customize the variable
  9899. @code{org-export-initial-scope}.
  9900. @item @kbd{C-v}
  9901. @kindex C-c C-e C-v
  9902. Toggle visible-only export. Useful for exporting only visible
  9903. parts of an Org document by adjusting outline visibility
  9904. settings.
  9905. @end table
  9906. @node Export Settings
  9907. @section Export Settings
  9908. @cindex options, for export
  9909. @cindex Export, settings
  9910. @cindex @samp{OPTIONS}, keyword
  9911. Export options can be set: globally with variables; for an individual
  9912. file by making variables buffer-local with in-buffer settings (see
  9913. @ref{In-buffer Settings}), by setting individual keywords, or by
  9914. specifying them in a compact form with the @samp{OPTIONS} keyword; or for
  9915. a tree by setting properties (see @ref{Properties and Columns}). Options
  9916. set at a specific level override options set at a more general level.
  9917. @cindex SETUPFILE, keyword
  9918. In-buffer settings may appear anywhere in the file, either directly or
  9919. indirectly through a file included using @samp{#+SETUPFILE: filename or
  9920. URL} syntax. Option keyword sets tailored to a particular back-end
  9921. can be inserted from the export dispatcher (see @ref{The Export Dispatcher}) using the @samp{Insert template} command by pressing
  9922. @kbd{#}. To insert keywords individually, a good way to make
  9923. sure the keyword is correct is to type @samp{#+} and then to use
  9924. @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows.
  9925. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.} for completion.
  9926. The export keywords available for every back-end, and their equivalent
  9927. global variables, include:
  9928. @table @asis
  9929. @item @samp{AUTHOR}
  9930. @cindex @samp{AUTHOR}, keyword
  9931. @vindex user-full-name
  9932. The document author (@code{user-full-name}).
  9933. @item @samp{CREATOR}
  9934. @cindex @samp{CREATOR}, keyword
  9935. @vindex org-expot-creator-string
  9936. Entity responsible for output generation
  9937. (@code{org-export-creator-string}).
  9938. @item @samp{DATE}
  9939. @cindex @samp{DATE}, keyword
  9940. @vindex org-export-date-timestamp-format
  9941. A date or a time-stamp@footnote{The variable @code{org-export-date-timestamp-format} defines how
  9942. this timestamp are exported.}.
  9943. @item @samp{EMAIL}
  9944. @cindex @samp{EMAIL}, keyword
  9945. @vindex user-mail-address
  9946. The email address (@code{user-mail-address}).
  9947. @item @samp{LANGUAGE}
  9948. @cindex @samp{LANGUAGE}, keyword
  9949. @vindex org-export-default-language
  9950. Language to use for translating certain strings
  9951. (@code{org-export-default-language}). With @samp{#+LANGUAGE: fr}, for
  9952. example, Org translates @samp{Table of contents} to the French @samp{Table
  9953. des matières}.
  9954. @item @samp{SELECT_TAGS}
  9955. @cindex @samp{SELECT_TAGS}, keyword
  9956. @vindex org-export-select-tags
  9957. The default value is @code{("export")}. When a tree is tagged with
  9958. @samp{export} (@code{org-export-select-tags}), Org selects that tree and
  9959. its sub-trees for export. Org excludes trees with @samp{noexport}
  9960. tags, see below. When selectively exporting files with @samp{export}
  9961. tags set, Org does not export any text that appears before the
  9962. first headline.
  9963. @item @samp{EXCLUDE_TAGS}
  9964. @cindex @samp{EXCLUDE_TAGS}, keyword
  9965. @vindex org-export-exclude-tags
  9966. The default value is @code{("noexport")}. When a tree is tagged with
  9967. @samp{noexport} (@code{org-export-exclude-tags}), Org excludes that tree
  9968. and its sub-trees from export. Entries tagged with @samp{noexport}
  9969. are unconditionally excluded from the export, even if they have
  9970. an @samp{export} tag. Even if a sub-tree is not exported, Org
  9971. executes any code blocks contained there.
  9972. @item @samp{TITLE}
  9973. @cindex @samp{TITLE}, keyword
  9974. @cindex document title
  9975. Org displays this title. For long titles, use multiple @samp{#+TITLE}
  9976. lines.
  9977. @item @samp{EXPORT_FILE_NAME}
  9978. @cindex @samp{EXPORT_FILE_NAME}, keyword
  9979. The name of the output file to be generated. Otherwise, Org
  9980. generates the file name based on the buffer name and the
  9981. extension based on the back-end format.
  9982. @end table
  9983. The @samp{OPTIONS} keyword is a compact form. To configure multiple
  9984. options, use several @samp{OPTIONS} lines. @samp{OPTIONS} recognizes the
  9985. following arguments.
  9986. @table @asis
  9987. @item @code{'}
  9988. @vindex org-export-with-smart-quotes
  9989. Toggle smart quotes (@code{org-export-with-smart-quotes}). Depending
  9990. on the language used, when activated, Org treats pairs of double
  9991. quotes as primary quotes, pairs of single quotes as secondary
  9992. quotes, and single quote marks as apostrophes.
  9993. @item @code{*}
  9994. @vindex org-export-with-emphasize
  9995. Toggle emphasized text (@code{org-export-with-emphasize}).
  9996. @item @code{-}
  9997. @vindex org-export-with-special-strings
  9998. Toggle conversion of special strings
  9999. (@code{org-export-with-special-strings}).
  10000. @item @code{:}
  10001. @vindex org-export-with-fixed-width
  10002. Toggle fixed-width sections (@code{org-export-with-fixed-width}).
  10003. @item @code{<}
  10004. @vindex org-export-with-timestamps
  10005. Toggle inclusion of time/date active/inactive stamps
  10006. (@code{org-export-with-timestamps}).
  10007. @item @code{\n}
  10008. @vindex org-export-preserve-breaks
  10009. Toggles whether to preserve line breaks
  10010. (@code{org-export-preserve-breaks}).
  10011. @item @code{^}
  10012. @vindex org-export-with-sub-superscripts
  10013. Toggle @TeX{}-like syntax for sub- and superscripts. If you write
  10014. @samp{^:@{@}}, @samp{a_@{b@}} is interpreted, but the simple @samp{a_b} is left as
  10015. it is (@code{org-export-with-sub-superscripts}).
  10016. @item @code{arch}
  10017. @vindex org-export-with-archived-trees
  10018. Configure how archived trees are exported. When set to
  10019. @code{headline}, the export process skips the contents and processes
  10020. only the headlines (@code{org-export-with-archived-trees}).
  10021. @item @code{author}
  10022. @vindex org-export-with-author
  10023. Toggle inclusion of author name into exported file
  10024. (@code{org-export-with-author}).
  10025. @item @code{broken-links}
  10026. @vindex org-export-with-broken-links
  10027. Toggles if Org should continue exporting upon finding a broken
  10028. internal link. When set to @code{mark}, Org clearly marks the problem
  10029. link in the output (@code{org-export-with-broken-links}).
  10030. @item @code{c}
  10031. @vindex org-export-with-clocks
  10032. Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}).
  10033. @item @code{creator}
  10034. @vindex org-export-with-creator
  10035. Toggle inclusion of creator information in the exported file
  10036. (@code{org-export-with-creator}).
  10037. @item @code{d}
  10038. @vindex org-export-with-drawers
  10039. Toggles inclusion of drawers, or list of drawers to include, or
  10040. list of drawers to exclude (@code{org-export-with-drawers}).
  10041. @item @code{date}
  10042. @vindex org-export-with-date
  10043. Toggle inclusion of a date into exported file
  10044. (@code{org-export-with-date}).
  10045. @item @code{e}
  10046. @vindex org-export-with-entities
  10047. Toggle inclusion of entities (@code{org-export-with-entities}).
  10048. @item @code{email}
  10049. @vindex org-export-with-email
  10050. Toggle inclusion of the author's e-mail into exported file
  10051. (@code{org-export-with-email}).
  10052. @item @code{f}
  10053. @vindex org-export-with-footnotes
  10054. Toggle the inclusion of footnotes (@code{org-export-with-footnotes}).
  10055. @item @code{H}
  10056. @vindex org-export-headline-levels
  10057. Set the number of headline levels for export
  10058. (@code{org-export-headline-levels}). Below that level, headlines are
  10059. treated differently. In most back-ends, they become list items.
  10060. @item @code{inline}
  10061. @vindex org-export-with-inlinetasks
  10062. Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
  10063. @item @code{num}
  10064. @vindex org-export-with-section-numbers
  10065. @cindex @samp{UNNUMBERED}, property
  10066. Toggle section-numbers (@code{org-export-with-section-numbers}). When
  10067. set to number N, Org numbers only those headlines at level N or
  10068. above. Set @samp{UNNUMBERED} property to non-@code{nil} to disable
  10069. numbering of heading and subheadings entirely. Moreover, when
  10070. the value is @samp{notoc} the headline, and all its children, do not
  10071. appear in the table of contents either (see @ref{Table of Contents}).
  10072. @item @code{p}
  10073. @vindex org-export-with-planning
  10074. Toggle export of planning information
  10075. (@code{org-export-with-planning}). ``Planning information'' comes from
  10076. lines located right after the headline and contain any
  10077. combination of these cookies: @samp{SCHEDULED}, @samp{DEADLINE}, or
  10078. @samp{CLOSED}.
  10079. @item @code{pri}
  10080. @vindex org-export-with-priority
  10081. Toggle inclusion of priority cookies
  10082. (@code{org-export-with-priority}).
  10083. @item @code{prop}
  10084. @vindex org-export-with-properties
  10085. Toggle inclusion of property drawers, or list the properties to
  10086. include (@code{org-export-with-properties}).
  10087. @item @code{stat}
  10088. @vindex org-export-with-statistics-cookies
  10089. Toggle inclusion of statistics cookies
  10090. (@code{org-export-with-statistics-cookies}).
  10091. @item @code{tags}
  10092. @vindex org-export-with-tags
  10093. Toggle inclusion of tags, may also be @code{not-in-toc}
  10094. (@code{org-export-with-tags}).
  10095. @item @code{tasks}
  10096. @vindex org-export-with-tasks
  10097. Toggle inclusion of tasks (TODO items); or @code{nil} to remove all
  10098. tasks; or @code{todo} to remove DONE tasks; or list the keywords to
  10099. keep (@code{org-export-with-tasks}).
  10100. @item @code{tex}
  10101. @vindex org-export-with-latex
  10102. @code{nil} does not export; @code{t} exports; @code{verbatim} keeps everything
  10103. in verbatim (@code{org-export-with-latex}).
  10104. @item @code{timestamp}
  10105. @vindex org-export-time-stamp-file
  10106. Toggle inclusion of the creation time in the exported file
  10107. (@code{org-export-time-stamp-file}).
  10108. @item @code{title}
  10109. @vindex org-export-with-title
  10110. Toggle inclusion of title (@code{org-export-with-title}).
  10111. @item @code{toc}
  10112. @vindex org-export-with-toc
  10113. Toggle inclusion of the table of contents, or set the level limit
  10114. (@code{org-export-with-toc}).
  10115. @item @code{todo}
  10116. @vindex org-export-with-todo-keywords
  10117. Toggle inclusion of TODO keywords into exported text
  10118. (@code{org-export-with-todo-keywords}).
  10119. @item @code{|}
  10120. @vindex org-export-with-tables
  10121. Toggle inclusion of tables (@code{org-export-with-tables}).
  10122. @end table
  10123. When exporting sub-trees, special node properties in them can override
  10124. the above keywords. They are special because they have an @samp{EXPORT_}
  10125. prefix. For example, @samp{DATE} and @samp{EXPORT_FILE_NAME} keywords become,
  10126. respectively, @samp{EXPORT_DATE} and @samp{EXPORT_FILE_NAME}. Except for
  10127. @samp{SETUPFILE}, all other keywords listed above have an @samp{EXPORT_}
  10128. equivalent.
  10129. @cindex @samp{BIND}, keyword
  10130. @vindex org-export-allow-bind-keywords
  10131. If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables can
  10132. become buffer-local during export by using the @samp{BIND} keyword. Its
  10133. syntax is @samp{#+BIND: variable value}. This is particularly useful for
  10134. in-buffer settings that cannot be changed using keywords.
  10135. @node Table of Contents
  10136. @section Table of Contents
  10137. @cindex table of contents
  10138. @cindex list of tables
  10139. @cindex list of listings
  10140. @cindex @samp{toc}, in @samp{OPTIONS} keyword
  10141. @vindex org-export-with-toc
  10142. The table of contents includes all headlines in the document. Its
  10143. depth is therefore the same as the headline levels in the file. If
  10144. you need to use a different depth, or turn it off entirely, set the
  10145. @code{org-export-with-toc} variable accordingly. You can achieve the same
  10146. on a per file basis, using the following @samp{toc} item in @samp{OPTIONS}
  10147. keyword:
  10148. @example
  10149. #+OPTIONS: toc:2 (only include two levels in TOC)
  10150. #+OPTIONS: toc:nil (no default TOC at all)
  10151. @end example
  10152. @cindex excluding entries from table of contents
  10153. @cindex table of contents, exclude entries
  10154. Org includes both numbered and unnumbered headlines in the table of
  10155. contents@footnote{At the moment, some export back-ends do not obey this
  10156. specification. For example, @LaTeX{} export excludes every unnumbered
  10157. headline from the table of contents.}. If you need to exclude an unnumbered headline,
  10158. along with all its children, set the @samp{UNNUMBERED} property to @samp{notoc}
  10159. value.
  10160. @example
  10161. * Subtree not numbered, not in table of contents either
  10162. :PROPERTIES:
  10163. :UNNUMBERED: notoc
  10164. :END:
  10165. @end example
  10166. @cindex @samp{TOC}, keyword
  10167. Org normally inserts the table of contents directly before the first
  10168. headline of the file. To move the table of contents to a different
  10169. location, first turn off the default with @code{org-export-with-toc}
  10170. variable or with @samp{#+OPTIONS: toc:nil}. Then insert @samp{#+TOC: headlines
  10171. N} at the desired location(s).
  10172. @example
  10173. #+OPTIONS: toc:nil
  10174. ...
  10175. #+TOC: headlines 2
  10176. @end example
  10177. To adjust the table of contents depth for a specific section of the
  10178. Org document, append an additional @samp{local} parameter. This parameter
  10179. becomes a relative depth for the current level. The following example
  10180. inserts a local table of contents, with direct children only.
  10181. @example
  10182. * Section
  10183. #+TOC: headlines 1 local
  10184. @end example
  10185. Note that for this feature to work properly in @LaTeX{} export, the Org
  10186. file requires the inclusion of the titletoc package. Because of
  10187. compatibility issues, titletoc has to be loaded @emph{before} hyperref.
  10188. Customize the @code{org-latex-default-packages-alist} variable.
  10189. Use the @samp{TOC} keyword to generate list of tables---respectively, all
  10190. listings---with captions.
  10191. @example
  10192. #+TOC: listings
  10193. #+TOC: tables
  10194. @end example
  10195. @cindex @samp{ALT_TITLE}, property
  10196. Normally Org uses the headline for its entry in the table of contents.
  10197. But with @samp{ALT_TITLE} property, a different entry can be specified for
  10198. the table of contents.
  10199. @node Include Files
  10200. @section Include Files
  10201. @cindex include files, during export
  10202. @cindex Export, include files
  10203. @cindex @samp{INCLUDE}, keyword
  10204. During export, you can include the content of another file. For
  10205. example, to include your @samp{.emacs} file, you could use:
  10206. @example
  10207. #+INCLUDE: "~/.emacs" src emacs-lisp
  10208. @end example
  10209. @noindent
  10210. The optional second and third parameter are the markup (e.g., @samp{quote},
  10211. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the language for
  10212. formatting the contents. The markup is optional; if it is not given,
  10213. assume text is in Org syntax and process it normally. The @samp{INCLUDE}
  10214. keyword also allows additional parameters @samp{:prefix1} and @samp{:prefix} to
  10215. specify prefixes for the first line and for each following line,
  10216. @samp{:minlevel} in order to get Org mode content demoted to a specified
  10217. level, as well as any options accepted by the selected markup. For
  10218. example, to include a file as an item, use:
  10219. @example
  10220. #+INCLUDE: "~/snippets/xx" :prefix1 " + " :prefix " "
  10221. @end example
  10222. You can also include a portion of a file by specifying a lines range
  10223. using the @samp{:lines} parameter. The line at the upper end of the range
  10224. is not included. The start and/or the end of the range may be omitted
  10225. to use the obvious defaults.
  10226. @table @asis
  10227. @item @samp{#+INCLUDE: "~/.emacs" :lines "5-10"}
  10228. Include lines 5 to 10, 10 excluded.
  10229. @item @samp{#+INCLUDE: "~/.emacs" :lines "-10"}
  10230. Include lines 1 to 10, 10 excluded.
  10231. @item @samp{#+INCLUDE: "~/.emacs" :lines "10-"}
  10232. Include lines from 10 to EOF.
  10233. @end table
  10234. You can visit the file being included with the following command.
  10235. @table @asis
  10236. @item @kbd{C-c '} (@code{org-edit~special})
  10237. @kindex C-c '
  10238. @findex org-edit-special
  10239. Visit the include file at point.
  10240. @end table
  10241. @node Macro Replacement
  10242. @section Macro Replacement
  10243. @cindex macro replacement, during export
  10244. @cindex @samp{MACRO}, keyword
  10245. @vindex org-export-global-macros
  10246. Macros replace text snippets during export. Macros are defined
  10247. globally in @code{org-export-global-macros}, or document-wise with the
  10248. following syntax:
  10249. @example
  10250. #+MACRO: name replacement text; $1, $2 are arguments
  10251. @end example
  10252. @noindent
  10253. which can be referenced using @samp{@{@{@{name(arg1, arg2)@}@}@}}@footnote{Since commas separate the arguments, commas within arguments
  10254. have to be escaped with the backslash character. So only those
  10255. backslash characters before a comma need escaping with another
  10256. backslash character.}. For
  10257. example
  10258. @example
  10259. #+MACRO: poem The rose is $1, The violet's $2. Life's ordered: Org assists you.
  10260. @{@{@{poem(red,blue)@}@}@}
  10261. @end example
  10262. @noindent
  10263. becomes
  10264. @example
  10265. The rose is red, The violet's blue. Life's ordered: Org assists you.
  10266. @end example
  10267. As a special case, Org parses any replacement text starting with
  10268. @samp{(eval} as an Emacs Lisp expression and evaluates it accordingly.
  10269. Within such templates, arguments become strings. Thus, the following
  10270. macro
  10271. @example
  10272. #+MACRO: gnucheck (eval (concat "GNU/" (capitalize $1)))
  10273. @end example
  10274. @noindent
  10275. turns @samp{@{@{@{gnucheck(linux)@}@}@}} into @samp{GNU/Linux} during export.
  10276. Org recognizes macro references in following Org markup areas:
  10277. paragraphs, headlines, verse blocks, tables cells and lists. Org also
  10278. recognizes macro references in keywords, such as @samp{CAPTION}, @samp{TITLE},
  10279. @samp{AUTHOR}, @samp{DATE}, and for some back-end specific export options.
  10280. Org comes with following pre-defined macros:
  10281. @table @asis
  10282. @item @samp{@{@{@{keyword(NAME)@}@}@}}
  10283. @itemx @samp{@{@{@{title@}@}@}}
  10284. @itemx @samp{@{@{@{author@}@}@}}
  10285. @itemx @samp{@{@{@{email@}@}@}}
  10286. @cindex @samp{keyword}, macro
  10287. @cindex @samp{title}, macro
  10288. @cindex @samp{author}, macro
  10289. @cindex @samp{email}, macro
  10290. The @samp{keyword} macro collects all values from @var{NAME}
  10291. keywords throughout the buffer, separated with white space.
  10292. @samp{title}, @samp{author} and @samp{email} macros are shortcuts for,
  10293. respectively, @samp{@{@{@{keyword(TITLE)@}@}@}}, @samp{@{@{@{keyword(AUTHOR)@}@}@}} and
  10294. @samp{@{@{@{keyword(EMAIL)@}@}@}}.
  10295. @item @samp{@{@{@{date@}@}@}}
  10296. @itemx @samp{@{@{@{date(FORMAT)@}@}@}}
  10297. @cindex @samp{date}, macro
  10298. This macro refers to the @samp{DATE} keyword. @var{FORMAT} is an
  10299. optional argument to the @samp{date} macro that is used only if @samp{DATE}
  10300. is a single timestamp. @var{FORMAT} should be a format
  10301. string understood by @code{format-time-string}.
  10302. @item @samp{@{@{@{time(FORMAT)@}@}@}}
  10303. @itemx @samp{@{@{@{modification-time(FORMAT, VC)@}@}@}}
  10304. @cindex @samp{time}, macro
  10305. @cindex @samp{modification-time}, macro
  10306. These macros refer to the document's date and time of export and
  10307. date and time of modification. @var{FORMAT} is a string
  10308. understood by @code{format-time-string}. If the second argument to
  10309. the @code{modification-time} macro is non-@code{nil}, Org uses @samp{vc.el} to
  10310. retrieve the document's modification time from the version
  10311. control system. Otherwise Org reads the file attributes.
  10312. @item @samp{@{@{@{input-file@}@}@}}
  10313. @cindex @samp{input-file}, macro
  10314. This macro refers to the filename of the exported file.
  10315. @item @samp{@{@{@{property(PROPERTY-NAME)@}@}@}}
  10316. @itemx @samp{@{@{@{property(PROPERTY-NAME, SEARCH OPTION)@}@}@}}
  10317. @cindex @samp{property}, macro
  10318. This macro returns the value of property @var{PROPERTY-NAME}
  10319. in the current entry. If @var{SEARCH-OPTION} (see @ref{Search Options}) refers to a remote entry, use it instead.
  10320. @item @samp{@{@{@{n@}@}@}}
  10321. @itemx @samp{@{@{@{n(NAME)@}@}@}}
  10322. @itemx @samp{@{@{@{n(NAME, ACTION)@}@}@}}
  10323. @cindex @samp{n}, macro
  10324. @cindex counter, macro
  10325. This macro implements custom counters by returning the number of
  10326. times the macro has been expanded so far while exporting the
  10327. buffer. You can create more than one counter using different
  10328. @var{NAME} values. If @var{ACTION} is @samp{-}, previous
  10329. value of the counter is held, i.e., the specified counter is not
  10330. incremented. If the value is a number, the specified counter is
  10331. set to that value. If it is any other non-empty string, the
  10332. specified counter is reset to 1. You may leave @var{NAME}
  10333. empty to reset the default counter.
  10334. @end table
  10335. @vindex org-hide-macro-markers
  10336. The surrounding brackets can be made invisible by setting
  10337. @code{org-hide-macro-markers} non-@code{nil}.
  10338. Org expands macros at the very beginning of the export process.
  10339. @node Comment Lines
  10340. @section Comment Lines
  10341. @cindex exporting, not
  10342. @cindex comment lines
  10343. Lines starting with zero or more whitespace characters followed by one
  10344. @samp{#} and a whitespace are treated as comments and, as such, are not
  10345. exported.
  10346. @cindex @samp{BEGIN_COMMENT}
  10347. @cindex comment block
  10348. Likewise, regions surrounded by @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  10349. are not exported.
  10350. @cindex comment trees
  10351. Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after
  10352. any other keyword or priority cookie, comments out the entire subtree.
  10353. In this case, the subtree is not exported and no code block within it
  10354. is executed either@footnote{For a less drastic behavior, consider using a select tag (see
  10355. @ref{Export Settings}) instead.}. The command below helps changing the
  10356. comment status of a headline.
  10357. @table @asis
  10358. @item @kbd{C-c ;} (@code{org-toggle-comment})
  10359. @kindex C-c ;
  10360. @findex org-toggle-comment
  10361. Toggle the @samp{COMMENT} keyword at the beginning of an entry.
  10362. @end table
  10363. @node ASCII/Latin-1/UTF-8 export
  10364. @section ASCII/Latin-1/UTF-8 export
  10365. @cindex ASCII export
  10366. @cindex Latin-1 export
  10367. @cindex UTF-8 export
  10368. ASCII export produces an output file containing only plain ASCII
  10369. characters. This is the simplest and most direct text output. It
  10370. does not contain any Org markup. Latin-1 and UTF-8 export use
  10371. additional characters and symbols available in these encoding
  10372. standards. All three of these export formats offer the most basic of
  10373. text output for maximum portability.
  10374. @vindex org-ascii-text-width
  10375. On export, Org fills and justifies text according to the text width
  10376. set in @code{org-ascii-text-width}.
  10377. @vindex org-ascii-links-to-notes
  10378. Org exports links using a footnote-like style where the descriptive
  10379. part is in the text and the link is in a note before the next heading.
  10380. See the variable @code{org-ascii-links-to-notes} for details.
  10381. @anchor{ASCII export commands}
  10382. @subheading ASCII export commands
  10383. @table @asis
  10384. @item @kbd{C-c C-e t a} (@code{org-ascii-export-to-ascii})
  10385. @itemx @kbd{C-c C-e t l}
  10386. @itemx @kbd{C-c C-e t u}
  10387. @kindex C-c C-e t a
  10388. @kindex C-c C-e t l
  10389. @kindex C-c C-e t u
  10390. @findex org-ascii-export-to-ascii
  10391. Export as an ASCII file with a @samp{.txt} extension. For
  10392. @samp{myfile.org}, Org exports to @samp{myfile.txt}, overwriting without
  10393. warning. For @samp{myfile.txt}, Org exports to @samp{myfile.txt.txt} in
  10394. order to prevent data loss.
  10395. @end table
  10396. @table @asis
  10397. @item @kbd{C-c C-e t A} (@code{org-ascii-export-to-ascii})
  10398. @itemx @kbd{C-c C-e t L}
  10399. @itemx @kbd{C-c C-e t U}
  10400. @kindex C-c C-e t A
  10401. @kindex C-c C-e t L
  10402. @kindex C-c C-e t U
  10403. @findex org-ascii-export-to-ascii
  10404. Export to a temporary buffer. Does not create a file.
  10405. @end table
  10406. @anchor{ASCII specific export settings}
  10407. @subheading ASCII specific export settings
  10408. The ASCII export back-end has one extra keyword for customizing ASCII
  10409. output. Setting this keyword works similar to the general options
  10410. (see @ref{Export Settings}).
  10411. @table @asis
  10412. @item @samp{SUBTITLE}
  10413. @cindex @samp{SUBTITLE}, keyword
  10414. The document subtitle. For long subtitles, use multiple
  10415. @samp{#+SUBTITLE} lines in the Org file. Org prints them on one
  10416. continuous line, wrapping into multiple lines if necessary.
  10417. @end table
  10418. @anchor{Header and sectioning structure}
  10419. @subheading Header and sectioning structure
  10420. Org converts the first three outline levels into headlines for ASCII
  10421. export. The remaining levels are turned into lists. To change this
  10422. cut-off point where levels become lists, see @ref{Export Settings}.
  10423. @anchor{Quoting ASCII text}
  10424. @subheading Quoting ASCII text
  10425. To insert text within the Org file by the ASCII back-end, use one the
  10426. following constructs, inline, keyword, or export block:
  10427. @cindex @samp{ASCII}, keyword
  10428. @cindex @samp{BEGIN_EXPORT ascii}
  10429. @example
  10430. Inline text @@@@ascii:and additional text@@@@ within a paragraph.
  10431. #+ASCII: Some text
  10432. #+BEGIN_EXPORT ascii
  10433. Org exports text in this block only when using ASCII back-end.
  10434. #+END_EXPORT
  10435. @end example
  10436. @anchor{ASCII specific attributes}
  10437. @subheading ASCII specific attributes
  10438. @cindex @samp{ATTR_ASCII}, keyword
  10439. @cindex horizontal rules, in ASCII export
  10440. ASCII back-end recognizes only one attribute, @code{:width}, which
  10441. specifies the width of an horizontal rule in number of characters.
  10442. The keyword and syntax for specifying widths is:
  10443. @example
  10444. #+ATTR_ASCII: :width 10
  10445. -----
  10446. @end example
  10447. @anchor{ASCII special blocks}
  10448. @subheading ASCII special blocks
  10449. @cindex special blocks, in ASCII export
  10450. @cindex @samp{BEGIN_JUSTIFYLEFT}
  10451. @cindex @samp{BEGIN_JUSTIFYRIGHT}
  10452. Besides @samp{#+BEGIN_CENTER} blocks (see @ref{Paragraphs}), ASCII back-end has
  10453. these two left and right justification blocks:
  10454. @example
  10455. #+BEGIN_JUSTIFYLEFT
  10456. It's just a jump to the left...
  10457. #+END_JUSTIFYLEFT
  10458. #+BEGIN_JUSTIFYRIGHT
  10459. ...and then a step to the right.
  10460. #+END_JUSTIFYRIGHT
  10461. @end example
  10462. @node Beamer Export
  10463. @section Beamer Export
  10464. @cindex Beamer export
  10465. Org uses Beamer export to convert an Org file tree structure into
  10466. high-quality interactive slides for presentations. Beamer is a @LaTeX{}
  10467. document class for creating presentations in PDF, HTML, and other
  10468. popular display formats.
  10469. @menu
  10470. * Beamer export commands:: For creating Beamer documents.
  10471. * Beamer specific export settings:: For customizing Beamer export.
  10472. * Frames and Blocks in Beamer:: For composing Beamer slides.
  10473. * Beamer specific syntax:: For using in Org documents.
  10474. * Editing support:: Editing support.
  10475. * A Beamer example:: A complete presentation.
  10476. @end menu
  10477. @node Beamer export commands
  10478. @subsection Beamer export commands
  10479. @table @asis
  10480. @item @kbd{C-c C-e l b} (@code{org-beamer-export-to-latex})
  10481. @kindex C-c C-e l b
  10482. @findex org-beamer-export-to-latex
  10483. Export as @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org},
  10484. Org exports to @samp{myfile.tex}, overwriting without warning.
  10485. @item @kbd{C-c C-e l B} (@code{org-beamer-export-as-latex})
  10486. @kindex C-c C-e l B
  10487. @findex org-beamer-export-as-latex
  10488. Export to a temporary buffer. Does not create a file.
  10489. @item @kbd{C-c C-e l P} (@code{org-beamer-export-to-pdf})
  10490. @kindex C-c C-e l P
  10491. @findex org-beamer-export-to-pdf
  10492. Export as @LaTeX{} file and then convert it to PDF format.
  10493. @item @kbd{C-c C-e l O}
  10494. @kindex C-c C-e l O
  10495. Export as @LaTeX{} file, convert it to PDF format, and then open the
  10496. PDF file.
  10497. @end table
  10498. @node Beamer specific export settings
  10499. @subsection Beamer specific export settings
  10500. Beamer export back-end has several additional keywords for customizing
  10501. Beamer output. These keywords work similar to the general options
  10502. settings (see @ref{Export Settings}).
  10503. @table @asis
  10504. @item @samp{BEAMER_THEME}
  10505. @cindex @samp{BEAMER_THEME}, keyword
  10506. @vindex org-beamer-theme
  10507. The Beamer layout theme (@code{org-beamer-theme}). Use square
  10508. brackets for options. For example:
  10509. @example
  10510. #+BEAMER_THEME: Rochester [height=20pt]
  10511. @end example
  10512. @item @samp{BEAMER_FONT_THEME}
  10513. @cindex @samp{BEAMER_FONT_THEME}, keyword
  10514. The Beamer font theme.
  10515. @item @samp{BEAMER_INNER_THEME}
  10516. @cindex @samp{BEAMER_INNER_THEME}, keyword
  10517. The Beamer inner theme.
  10518. @item @samp{BEAMER_OUTER_THEME}
  10519. @cindex @samp{BEAMER_OUTER_THEME}, keyword
  10520. The Beamer outer theme.
  10521. @item @samp{BEAMER_HEADER}
  10522. @cindex @samp{BEAMER_HEADER}, keyword
  10523. Arbitrary lines inserted in the preamble, just before the
  10524. @samp{hyperref} settings.
  10525. @item @samp{DESCRIPTION}
  10526. @cindex @samp{DESCRIPTION}, keyword
  10527. The document description. For long descriptions, use multiple
  10528. @samp{DESCRIPTION} keywords. By default, @samp{hyperref} inserts
  10529. @samp{DESCRIPTION} as metadata. Use @code{org-latex-hyperref-template} to
  10530. configure document metadata. Use @code{org-latex-title-command} to
  10531. configure typesetting of description as part of front matter.
  10532. @item @samp{KEYWORDS}
  10533. @cindex @samp{KEYWORDS}, keyword
  10534. The keywords for defining the contents of the document. Use
  10535. multiple @samp{KEYWORDS} lines if necessary. By default, @samp{hyperref}
  10536. inserts @samp{KEYWORDS} as metadata. Use
  10537. @code{org-latex-hyperref-template} to configure document metadata.
  10538. Use @code{org-latex-title-command} to configure typesetting of
  10539. keywords as part of front matter.
  10540. @item @samp{SUBTITLE}
  10541. @cindex @samp{SUBTITLE}, keyword
  10542. Document's subtitle. For typesetting, use
  10543. @code{org-beamer-subtitle-format} string. Use
  10544. @code{org-latex-hyperref-template} to configure document metadata.
  10545. Use @code{org-latex-title-command} to configure typesetting of
  10546. subtitle as part of front matter.
  10547. @end table
  10548. @node Frames and Blocks in Beamer
  10549. @subsection Frames and Blocks in Beamer
  10550. Org transforms heading levels into Beamer's sectioning elements,
  10551. frames and blocks. Any Org tree with a not-too-deep-level nesting
  10552. should in principle be exportable as a Beamer presentation.
  10553. @itemize
  10554. @item
  10555. @vindex org-beamer-frame-level
  10556. Org headlines become Beamer frames when the heading level in Org is
  10557. equal to @code{org-beamer-frame-level} or @samp{H} value in a @samp{OPTIONS} line
  10558. (see @ref{Export Settings}).
  10559. @cindex @samp{BEAMER_ENV}, property
  10560. Org overrides headlines to frames conversion for the current tree of
  10561. an Org file if it encounters the @samp{BEAMER_ENV} property set to
  10562. @samp{frame} or @samp{fullframe}. Org ignores whatever
  10563. @code{org-beamer-frame-level} happens to be for that headline level in
  10564. the Org tree. In Beamer terminology, a full frame is a frame
  10565. without its title.
  10566. @item
  10567. Org exports a Beamer frame's objects as block environments. Org can
  10568. enforce wrapping in special block types when @samp{BEAMER_ENV} property
  10569. is set@footnote{If @samp{BEAMER_ENV} is set, Org export adds @samp{B_environment} tag
  10570. to make it visible. The tag serves as a visual aid and has no
  10571. semantic relevance.}. For valid values see
  10572. @code{org-beamer-environments-default}. To add more values, see
  10573. @code{org-beamer-environments-extra}.
  10574. @vindex org-beamer-environments-default
  10575. @vindex org-beamer-environments-extra
  10576. @item
  10577. @cindex @samp{BEAMER_REF}, property
  10578. If @samp{BEAMER_ENV} is set to @samp{appendix}, Org exports the entry as an
  10579. appendix. When set to @samp{note}, Org exports the entry as a note
  10580. within the frame or between frames, depending on the entry's heading
  10581. level. When set to @samp{noteNH}, Org exports the entry as a note
  10582. without its title. When set to @samp{againframe}, Org exports the entry
  10583. with @samp{\againframe} command, which makes setting the @samp{BEAMER_REF}
  10584. property mandatory because @samp{\againframe} needs frame to resume.
  10585. When @samp{ignoreheading} is set, Org export ignores the entry's headline
  10586. but not its content. This is useful for inserting content between
  10587. frames. It is also useful for properly closing a @samp{column}
  10588. environment. @@end itemize
  10589. @cindex @samp{BEAMER_ACT}, property
  10590. @cindex @samp{BEAMER_OPT}, property
  10591. When @samp{BEAMER_ACT} is set for a headline, Org export translates that
  10592. headline as an overlay or action specification. When enclosed in
  10593. square brackets, Org export makes the overlay specification
  10594. a default. Use @samp{BEAMER_OPT} to set any options applicable to the
  10595. current Beamer frame or block. The Beamer export back-end wraps
  10596. with appropriate angular or square brackets. It also adds the
  10597. @samp{fragile} option for any code that may require a verbatim block.
  10598. @cindex @samp{BEAMER_COL}, property
  10599. To create a column on the Beamer slide, use the @samp{BEAMER_COL}
  10600. property for its headline in the Org file. Set the value of
  10601. @samp{BEAMER_COL} to a decimal number representing the fraction of the
  10602. total text width. Beamer export uses this value to set the column's
  10603. width and fills the column with the contents of the Org entry. If
  10604. the Org entry has no specific environment defined, Beamer export
  10605. ignores the heading. If the Org entry has a defined environment,
  10606. Beamer export uses the heading as title. Behind the scenes, Beamer
  10607. export automatically handles @LaTeX{} column separations for contiguous
  10608. headlines. To manually adjust them for any unique configurations
  10609. needs, use the @samp{BEAMER_ENV} property.
  10610. @end itemize
  10611. @node Beamer specific syntax
  10612. @subsection Beamer specific syntax
  10613. Since Org's Beamer export back-end is an extension of the @LaTeX{}
  10614. back-end, it recognizes other @LaTeX{} specific syntax---for example,
  10615. @samp{#+LATEX:} or @samp{#+ATTR_LATEX:}. See @ref{@LaTeX{} Export}, for details.
  10616. Beamer export wraps the table of contents generated with @samp{toc:t}
  10617. @samp{OPTION} keyword in a @samp{frame} environment. Beamer export does not
  10618. wrap the table of contents generated with @samp{TOC} keyword (see @ref{Table of Contents}). Use square brackets for specifying options.
  10619. @example
  10620. #+TOC: headlines [currentsection]
  10621. @end example
  10622. Insert Beamer-specific code using the following constructs:
  10623. @cindex @samp{BEAMER}, keyword
  10624. @cindex @samp{BEGIN_EXPORT beamer}
  10625. @example
  10626. #+BEAMER: \pause
  10627. #+BEGIN_EXPORT beamer
  10628. Only Beamer export back-end exports this.
  10629. #+END_BEAMER
  10630. Text @@@@beamer:some code@@@@ within a paragraph.
  10631. @end example
  10632. Inline constructs, such as the last one above, are useful for adding
  10633. overlay specifications to objects with @code{bold}, @code{item}, @code{link},
  10634. @code{radio-target} and @code{target} types. Enclose the value in angular
  10635. brackets and place the specification at the beginning of the object as
  10636. shown in this example:
  10637. @example
  10638. A *@@@@beamer:<2->@@@@useful* feature
  10639. @end example
  10640. @cindex @samp{ATTR_BEAMER}, keyword
  10641. Beamer export recognizes the @samp{ATTR_BEAMER} keyword with the following
  10642. attributes from Beamer configurations: @samp{:environment} for changing
  10643. local Beamer environment, @samp{:overlay} for specifying Beamer overlays in
  10644. angular or square brackets, and @samp{:options} for inserting optional
  10645. arguments.
  10646. @example
  10647. #+ATTR_BEAMER: :environment nonindentlist
  10648. - item 1, not indented
  10649. - item 2, not indented
  10650. - item 3, not indented
  10651. @end example
  10652. @example
  10653. #+ATTR_BEAMER: :overlay <+->
  10654. - item 1
  10655. - item 2
  10656. @end example
  10657. @example
  10658. #+ATTR_BEAMER: :options [Lagrange]
  10659. Let $G$ be a finite group, and let $H$ be
  10660. a subgroup of $G$. Then the order of $H$ divides the order of $G$.
  10661. @end example
  10662. @node Editing support
  10663. @subsection Editing support
  10664. The @code{org-beamer-mode} is a special minor mode for faster editing of
  10665. Beamer documents.
  10666. @example
  10667. #+STARTUP: beamer
  10668. @end example
  10669. @table @asis
  10670. @item @kbd{C-c C-b} (@code{org-beamer-select-environment})
  10671. @kindex C-c C-b
  10672. @findex org-beamer-select-environment
  10673. The @code{org-beamer-mode} provides this key for quicker selections in
  10674. Beamer normal environments, and for selecting the @samp{BEAMER_COL}
  10675. property.
  10676. @end table
  10677. @node A Beamer example
  10678. @subsection A Beamer example
  10679. Here is an example of an Org document ready for Beamer export.
  10680. @example
  10681. ;#+TITLE: Example Presentation
  10682. ;#+AUTHOR: Carsten Dominik
  10683. ;#+OPTIONS: H:2 toc:t num:t
  10684. ;#+LATEX_CLASS: beamer
  10685. ;#+LATEX_CLASS_OPTIONS: [presentation]
  10686. ;#+BEAMER_THEME: Madrid
  10687. ;#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)
  10688. * This is the first structural section
  10689. ** Frame 1
  10690. *** Thanks to Eric Fraga :B_block:
  10691. :PROPERTIES:
  10692. :BEAMER_COL: 0.48
  10693. :BEAMER_ENV: block
  10694. :END:
  10695. for the first viable Beamer setup in Org
  10696. *** Thanks to everyone else :B_block:
  10697. :PROPERTIES:
  10698. :BEAMER_COL: 0.48
  10699. :BEAMER_ACT: <2->
  10700. :BEAMER_ENV: block
  10701. :END:
  10702. for contributing to the discussion
  10703. **** This will be formatted as a beamer note :B_note:
  10704. :PROPERTIES:
  10705. :BEAMER_env: note
  10706. :END:
  10707. ** Frame 2 (where we will not use columns)
  10708. *** Request
  10709. Please test this stuff!
  10710. @end example
  10711. @node HTML Export
  10712. @section HTML Export
  10713. @cindex HTML export
  10714. Org mode contains an HTML exporter with extensive HTML formatting
  10715. compatible with XHTML 1.0 strict standard.
  10716. @menu
  10717. * HTML export commands:: Invoking HTML export.
  10718. * HTML specific export settings:: Settings for HTML export.
  10719. * HTML doctypes:: Exporting various (X)HTML flavors.
  10720. * HTML preamble and postamble:: Inserting preamble and postamble.
  10721. * Quoting HTML tags:: Using direct HTML in Org files.
  10722. * Links in HTML export:: Inserting and formatting links.
  10723. * Tables in HTML export:: How to modify the formatting of tables.
  10724. * Images in HTML export:: How to insert figures into HTML output.
  10725. * Math formatting in HTML export:: Beautiful math also on the web.
  10726. * Text areas in HTML export:: An alternate way to show an example.
  10727. * CSS support:: Changing the appearance of the output.
  10728. * JavaScript support:: Info and folding in a web browser.
  10729. @end menu
  10730. @node HTML export commands
  10731. @subsection HTML export commands
  10732. @table @asis
  10733. @item @kbd{C-c C-e h h} (@code{org-html-export-to-html})
  10734. @kindex C-c C-e h h
  10735. @kindex C-c C-e h o
  10736. @findex org-html-export-to-html
  10737. Export as HTML file with a @samp{.html} extension. For @samp{myfile.org},
  10738. Org exports to @samp{myfile.html}, overwriting without warning.
  10739. @{@{@{kbd@{C-c C-e h o)@}@}@} exports to HTML and opens it in a web
  10740. browser.
  10741. @item @kbd{C-c C-e h H} (@code{org-html-export-as-html})
  10742. @kindex C-c C-e h H
  10743. @findex org-html-export-as-html
  10744. Exports to a temporary buffer. Does not create a file.
  10745. @end table
  10746. @node HTML specific export settings
  10747. @subsection HTML specific export settings
  10748. HTML export has a number of keywords, similar to the general options
  10749. settings described in @ref{Export Settings}.
  10750. @table @asis
  10751. @item @samp{DESCRIPTION}
  10752. @cindex @samp{DESCRIPTION}, keyword
  10753. This is the document's description, which the HTML exporter
  10754. inserts it as a HTML meta tag in the HTML file. For long
  10755. descriptions, use multiple @samp{DESCRIPTION} lines. The exporter
  10756. takes care of wrapping the lines properly.
  10757. @item @samp{HTML_DOCTYPE}
  10758. @cindex @samp{HTML_DOCTYPE}, keyword
  10759. @vindex org-html-doctype
  10760. Specify the document type, for example: HTML5
  10761. (@code{org-html-doctype}).
  10762. @item @samp{HTML_CONTAINER}
  10763. @cindex @samp{HTML_CONTAINER}, keyword
  10764. @vindex org-html-container-element
  10765. Specify the HTML container, such as @samp{div}, for wrapping sections
  10766. and elements (@code{org-html-container-element}).
  10767. @item @samp{HTML_LINK_HOME}
  10768. @cindex @samp{HTML_LINK_HOME}, keyword
  10769. @vindex org-html-link-home
  10770. The URL for home link (@code{org-html-link-home}).
  10771. @item @samp{HTML_LINK_UP}
  10772. @cindex @samp{HTML_LINK_UP}, keyword
  10773. @vindex org-html-link-up
  10774. The URL for the up link of exported HTML pages
  10775. (@code{org-html-link-up}).
  10776. @item @samp{HTML_MATHJAX}
  10777. @cindex @samp{HTML_MATHJAX}, keyword
  10778. @vindex org-html-mathjax-options
  10779. Options for MathJax (@code{org-html-mathjax-options}). MathJax is
  10780. used to typeset @LaTeX{} math in HTML documents. See @ref{Math formatting in HTML export}, for an example.
  10781. @item @samp{HTML_HEAD}
  10782. @cindex @samp{HTML_HEAD}, keyword
  10783. @vindex org-html-head
  10784. Arbitrary lines for appending to the HTML document's head
  10785. (@code{org-html-head}).
  10786. @item @samp{HTML_HEAD_EXTRA}
  10787. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  10788. @vindex org-html-head-extra
  10789. More arbitrary lines for appending to the HTML document's head
  10790. (@code{org-html-head-extra}).
  10791. @item @samp{KEYWORDS}
  10792. @cindex @samp{KEYWORDS}, keyword
  10793. Keywords to describe the document's content. HTML exporter
  10794. inserts these keywords as HTML meta tags. For long keywords, use
  10795. multiple @samp{KEYWORDS} lines.
  10796. @item @samp{LATEX_HEADER}
  10797. @cindex @samp{LATEX_HEADER}, keyword
  10798. Arbitrary lines for appending to the preamble; HTML exporter
  10799. appends when transcoding @LaTeX{} fragments to images (see @ref{Math formatting in HTML export}).
  10800. @item @samp{SUBTITLE}
  10801. @cindex @samp{SUBTITLE}, keyword
  10802. The document's subtitle. HTML exporter formats subtitle if
  10803. document type is @samp{HTML5} and the CSS has a @samp{subtitle} class.
  10804. @end table
  10805. Some of these keywords are explained in more detail in the following
  10806. sections of the manual.
  10807. @node HTML doctypes
  10808. @subsection HTML doctypes
  10809. Org can export to various (X)HTML flavors.
  10810. @vindex org-html-doctype
  10811. @vindex org-html-doctype-alist
  10812. Set the @code{org-html-doctype} variable for different (X)HTML variants.
  10813. Depending on the variant, the HTML exporter adjusts the syntax of HTML
  10814. conversion accordingly. Org includes the following ready-made
  10815. variants:
  10816. @itemize
  10817. @item
  10818. @code{"html4-strict"}
  10819. @item
  10820. @code{"html4-transitional"}
  10821. @item
  10822. @code{"html4-frameset"}
  10823. @item
  10824. @code{"xhtml-strict"}
  10825. @item
  10826. @code{"xhtml-transitional"}
  10827. @item
  10828. @code{"xhtml-frameset"}
  10829. @item
  10830. @code{"xhtml-11"}
  10831. @item
  10832. @code{"html5"}
  10833. @item
  10834. @code{"xhtml5"}
  10835. @end itemize
  10836. @noindent
  10837. See the variable @code{org-html-doctype-alist} for details. The default is
  10838. @code{"xhtml-strict"}.
  10839. @vindex org-html-html5-fancy
  10840. @cindex @samp{HTML5}, export new elements
  10841. Org's HTML exporter does not by default enable new block elements
  10842. introduced with the HTML5 standard. To enable them, set
  10843. @code{org-html-html5-fancy} to non-@code{nil}. Or use an @samp{OPTIONS} line in the
  10844. file to set @samp{html5-fancy}.
  10845. HTML5 documents can now have arbitrary @samp{#+BEGIN} @dots{} @samp{#+END} blocks.
  10846. For example:
  10847. @example
  10848. #+BEGIN_aside
  10849. Lorem ipsum
  10850. #+END_aside
  10851. @end example
  10852. @noindent
  10853. exports to:
  10854. @example
  10855. <aside>
  10856. <p>Lorem ipsum</p>
  10857. </aside>
  10858. @end example
  10859. @noindent
  10860. while this:
  10861. @example
  10862. #+ATTR_HTML: :controls controls :width 350
  10863. #+BEGIN_video
  10864. #+HTML: <source src="movie.mp4" type="video/mp4">
  10865. #+HTML: <source src="movie.ogg" type="video/ogg">
  10866. Your browser does not support the video tag.
  10867. #+END_video
  10868. @end example
  10869. @noindent
  10870. exports to:
  10871. @example
  10872. <video controls="controls" width="350">
  10873. <source src="movie.mp4" type="video/mp4">
  10874. <source src="movie.ogg" type="video/ogg">
  10875. <p>Your browser does not support the video tag.</p>
  10876. </video>
  10877. @end example
  10878. @vindex org-html-html5-elements
  10879. When special blocks do not have a corresponding HTML5 element, the
  10880. HTML exporter reverts to standard translation (see
  10881. @code{org-html-html5-elements}). For example, @samp{#+BEGIN_lederhosen} exports
  10882. to @code{<div class="lederhosen">}.
  10883. Special blocks cannot have headlines. For the HTML exporter to wrap
  10884. the headline and its contents in @code{<section>} or @code{<article>} tags, set
  10885. the @samp{HTML_CONTAINER} property for the headline.
  10886. @node HTML preamble and postamble
  10887. @subsection HTML preamble and postamble
  10888. @vindex org-html-preamble
  10889. @vindex org-html-postamble
  10890. @vindex org-html-preamble-format
  10891. @vindex org-html-postamble-format
  10892. @vindex org-html-validation-link
  10893. @vindex org-export-creator-string
  10894. @vindex org-export-time-stamp-file
  10895. The HTML exporter has delineations for preamble and postamble. The
  10896. default value for @code{org-html-preamble} is @code{t}, which makes the HTML
  10897. exporter insert the preamble. See the variable
  10898. @code{org-html-preamble-format} for the format string.
  10899. Set @code{org-html-preamble} to a string to override the default format
  10900. string. If the string is a function, the HTML exporter expects the
  10901. function to return a string upon execution. The HTML exporter inserts
  10902. this string in the preamble. The HTML exporter does not insert
  10903. a preamble if @code{org-html-preamble} is set @code{nil}.
  10904. The default value for @code{org-html-postamble} is @code{auto}, which makes the
  10905. HTML exporter build a postamble from looking up author's name, email
  10906. address, creator's name, and date. Set @code{org-html-postamble} to @code{t} to
  10907. insert the postamble in the format specified in the
  10908. @code{org-html-postamble-format} variable. The HTML exporter does not
  10909. insert a postamble if @code{org-html-postamble} is set to @code{nil}.
  10910. @node Quoting HTML tags
  10911. @subsection Quoting HTML tags
  10912. The HTML export back-end transforms @samp{<} and @samp{>} to @samp{&lt;} and @samp{&gt;}.
  10913. To include raw HTML code in the Org file so the HTML export back-end
  10914. can insert that HTML code in the output, use this inline syntax:
  10915. @samp{@@@@html:...@@@@}. For example:
  10916. @example
  10917. @@@@html:<b>@@@@bold text@@@@html:</b>@@@@
  10918. @end example
  10919. @cindex @samp{HTML}, keyword
  10920. @cindex @samp{BEGIN_EXPORT html}
  10921. For larger raw HTML code blocks, use these HTML export code blocks:
  10922. @example
  10923. #+HTML: Literal HTML code for export
  10924. #+BEGIN_EXPORT html
  10925. All lines between these markers are exported literally
  10926. #+END_EXPORT
  10927. @end example
  10928. @node Links in HTML export
  10929. @subsection Links in HTML export
  10930. @cindex links, in HTML export
  10931. @cindex internal links, in HTML export
  10932. @cindex external links, in HTML export
  10933. The HTML export back-end transforms Org's internal links (see
  10934. @ref{Internal Links}) to equivalent HTML links in the output. The back-end
  10935. similarly handles Org's automatic links created by radio targets (see
  10936. @ref{Radio Targets}) similarly. For Org links to external files, the
  10937. back-end transforms the links to @emph{relative} paths.
  10938. @vindex org-html-link-org-files-as-html
  10939. For Org links to other @samp{.org} files, the back-end automatically
  10940. changes the file extension to @samp{.html} and makes file paths relative.
  10941. If the @samp{.org} files have an equivalent @samp{.html} version at the same
  10942. location, then the converted links should work without any further
  10943. manual intervention. However, to disable this automatic path
  10944. translation, set @code{org-html-link-org-files-as-html} to @code{nil}. When
  10945. disabled, the HTML export back-end substitutes the ID-based links in
  10946. the HTML output. For more about linking files when publishing to
  10947. a directory, see @ref{Publishing links}.
  10948. Org files can also have special directives to the HTML export
  10949. back-end. For example, by using @samp{#+ATTR_HTML} lines to specify new
  10950. format attributes to @code{<a>} or @code{<img>} tags. This example shows
  10951. changing the link's title and style:
  10952. @cindex @samp{ATTR_HTML}, keyword
  10953. @example
  10954. #+ATTR_HTML: :title The Org mode homepage :style color:red;
  10955. [[https://orgmode.org]]
  10956. @end example
  10957. @node Tables in HTML export
  10958. @subsection Tables in HTML export
  10959. @cindex tables, in HTML
  10960. @vindex org-export-html-table-tag
  10961. The HTML export back-end uses @code{org-html-table-default-attributes} when
  10962. exporting Org tables to HTML. By default, the exporter does not draw
  10963. frames and cell borders. To change for this for a table, use the
  10964. following lines before the table in the Org file:
  10965. @cindex @samp{CAPTION}, keyword
  10966. @cindex @samp{ATTR_HTML}, keyword
  10967. @example
  10968. #+CAPTION: This is a table with lines around and between cells
  10969. #+ATTR_HTML: border="2" rules="all" frame="border"
  10970. @end example
  10971. The HTML export back-end preserves column groupings in Org tables (see
  10972. @ref{Column Groups}) when exporting to HTML.
  10973. Additional options for customizing tables for HTML export.
  10974. @table @asis
  10975. @item @code{org-html-table-align-individual-fields}
  10976. @vindex org-html-table-align-individual-fields
  10977. Non-@code{nil} attaches style attributes for alignment to each table
  10978. field.
  10979. @item @code{org-html-table-caption-above}
  10980. @vindex org-html-table-caption-above
  10981. Non-@code{nil} places caption string at the beginning of the table.
  10982. @item @code{org-html-table-data-tags}
  10983. @vindex org-html-table-data-tags
  10984. Opening and ending tags for table data fields.
  10985. @item @code{org-html-table-default-attributes}
  10986. @vindex org-html-table-default-attributes
  10987. Default attributes and values for table tags.
  10988. @item @code{org-html-table-header-tags}
  10989. @vindex org-html-table-header-tags
  10990. Opening and ending tags for table's header fields.
  10991. @item @code{org-html-table-row-tags}
  10992. @vindex org-html-table-row-tags
  10993. Opening and ending tags for table rows.
  10994. @item @code{org-html-table-use-header-tags-for-first-column}
  10995. @vindex org-html-table-use-header-tags-for-first-column
  10996. Non-@code{nil} formats column one in tables with header tags.
  10997. @end table
  10998. @node Images in HTML export
  10999. @subsection Images in HTML export
  11000. @cindex images, inline in HTML
  11001. @cindex inlining images in HTML
  11002. The HTML export back-end has features to convert Org image links to
  11003. HTML inline images and HTML clickable image links.
  11004. @vindex org-html-inline-images
  11005. When the link in the Org file has no description, the HTML export
  11006. back-end by default in-lines that image. For example:
  11007. @samp{[[file:myimg.jpg]]} is in-lined, while @samp{[[file:myimg.jpg][the image]]} links to the text,
  11008. @samp{the image}. For more details, see the variable
  11009. @code{org-html-inline-images}.
  11010. On the other hand, if the description part of the Org link is itself
  11011. another link, such as @samp{file:} or @samp{http:} URL pointing to an image, the
  11012. HTML export back-end in-lines this image and links to the main image.
  11013. This Org syntax enables the back-end to link low-resolution thumbnail
  11014. to the high-resolution version of the image, as shown in this example:
  11015. @example
  11016. [[file:highres.jpg][file:thumb.jpg]]
  11017. @end example
  11018. To change attributes of in-lined images, use @samp{#+ATTR_HTML} lines in
  11019. the Org file. This example shows realignment to right, and adds @code{alt}
  11020. and @code{title} attributes in support of text viewers and modern web
  11021. accessibility standards.
  11022. @cindex @samp{CAPTION}, keyword
  11023. @cindex @samp{ATTR_HTML}, keyword
  11024. @example
  11025. #+CAPTION: A black cat stalking a spider
  11026. #+ATTR_HTML: :alt cat/spider image :title Action! :align right
  11027. [[./img/a.jpg]]
  11028. @end example
  11029. @noindent
  11030. The HTML export back-end copies the @samp{http} links from the Org file as
  11031. is.
  11032. @node Math formatting in HTML export
  11033. @subsection Math formatting in HTML export
  11034. @cindex MathJax
  11035. @cindex dvipng
  11036. @cindex dvisvgm
  11037. @cindex ImageMagick
  11038. @vindex org-html-mathjax-options~
  11039. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be displayed in two
  11040. different ways on HTML pages. The default is to use the @uref{http://www.mathjax.org, MathJax},
  11041. 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
  11042. @uref{http://www.mathjax.org, MathJax}.}. Some MathJax
  11043. display options can be configured via @code{org-html-mathjax-options}, or
  11044. in the buffer. For example, with the following settings,
  11045. @example
  11046. #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
  11047. #+HTML_MATHJAX: cancel.js noErrors.js
  11048. @end example
  11049. @noindent
  11050. equation labels are displayed on the left margin and equations are
  11051. five em from the left margin. In addition, it loads the two MathJax
  11052. 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
  11053. about extensions.}.
  11054. @vindex org-html-mathjax-template
  11055. See the docstring of @code{org-html-mathjax-options} for all supported
  11056. variables. The MathJax template can be configure via
  11057. @code{org-html-mathjax-template}.
  11058. If you prefer, you can also request that @LaTeX{} fragments are processed
  11059. into small images that will be inserted into the browser page. Before
  11060. the availability of MathJax, this was the default method for Org
  11061. files. This method requires that the dvipng program, dvisvgm or
  11062. ImageMagick suite is available on your system. You can still get this
  11063. processing with
  11064. @example
  11065. #+OPTIONS: tex:dvipng
  11066. @end example
  11067. @example
  11068. #+OPTIONS: tex:dvisvgm
  11069. @end example
  11070. @noindent
  11071. or
  11072. @example
  11073. #+OPTIONS: tex:imagemagick
  11074. @end example
  11075. @node Text areas in HTML export
  11076. @subsection Text areas in HTML export
  11077. @cindex text areas, in HTML
  11078. Before Org mode's Babel, one popular approach to publishing code in
  11079. HTML was by using @samp{:textarea}. The advantage of this approach was
  11080. that copying and pasting was built into browsers with simple
  11081. JavaScript commands. Even editing before pasting was made simple.
  11082. The HTML export back-end can create such text areas. It requires an
  11083. @samp{#+ATTR_HTML} line as shown in the example below with the @samp{:textarea}
  11084. option. This must be followed by either an example or a source code
  11085. block. Other Org block types do not honor the @samp{:textarea} option.
  11086. By default, the HTML export back-end creates a text area 80 characters
  11087. wide and height just enough to fit the content. Override these
  11088. defaults with @samp{:width} and @samp{:height} options on the @samp{#+ATTR_HTML}
  11089. line.
  11090. @example
  11091. #+ATTR_HTML: :textarea t :width 40
  11092. #+BEGIN_EXAMPLE
  11093. (defun org-xor (a b)
  11094. "Exclusive or."
  11095. (if a (not b) b))
  11096. #+END_EXAMPLE
  11097. @end example
  11098. @node CSS support
  11099. @subsection CSS support
  11100. @cindex CSS, for HTML export
  11101. @cindex HTML export, CSS
  11102. @vindex org-export-html-todo-kwd-class-prefix
  11103. @vindex org-export-html-tag-class-prefix
  11104. You can modify the CSS style definitions for the exported file. The
  11105. HTML exporter assigns the following special CSS classes@footnote{If the classes on TODO keywords and tags lead to conflicts,
  11106. use the variables @code{org-html-todo-kwd-class-prefix} and
  11107. @code{org-html-tag-class-prefix} to make them unique.} to
  11108. appropriate parts of the document---your style specifications may
  11109. change these, in addition to any of the standard classes like for
  11110. headlines, tables, etc.
  11111. @multitable {aaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11112. @item @code{p.author}
  11113. @tab author information, including email
  11114. @item @code{p.date}
  11115. @tab publishing date
  11116. @item @code{p.creator}
  11117. @tab creator info, about org mode version
  11118. @item @code{.title}
  11119. @tab document title
  11120. @item @code{.subtitle}
  11121. @tab document subtitle
  11122. @item @code{.todo}
  11123. @tab TODO keywords, all not-done states
  11124. @item @code{.done}
  11125. @tab the DONE keywords, all states that count as done
  11126. @item @code{.WAITING}
  11127. @tab each TODO keyword also uses a class named after itself
  11128. @item @code{.timestamp}
  11129. @tab timestamp
  11130. @item @code{.timestamp-kwd}
  11131. @tab keyword associated with a timestamp, like @samp{SCHEDULED}
  11132. @item @code{.timestamp-wrapper}
  11133. @tab span around keyword plus timestamp
  11134. @item @code{.tag}
  11135. @tab tag in a headline
  11136. @item @code{._HOME}
  11137. @tab each tag uses itself as a class, ``@@'' replaced by ``_''
  11138. @item @code{.target}
  11139. @tab target for links
  11140. @item @code{.linenr}
  11141. @tab the line number in a code example
  11142. @item @code{.code-highlighted}
  11143. @tab for highlighting referenced code lines
  11144. @item @code{div.outline-N}
  11145. @tab div for outline level N (headline plus text)
  11146. @item @code{div.outline-text-N}
  11147. @tab extra div for text at outline level N
  11148. @item @code{.section-number-N}
  11149. @tab section number in headlines, different for each level
  11150. @item @code{.figure-number}
  11151. @tab label like ``Figure 1:''
  11152. @item @code{.table-number}
  11153. @tab label like ``Table 1:''
  11154. @item @code{.listing-number}
  11155. @tab label like ``Listing 1:''
  11156. @item @code{div.figure}
  11157. @tab how to format an in-lined image
  11158. @item @code{pre.src}
  11159. @tab formatted source code
  11160. @item @code{pre.example}
  11161. @tab normal example
  11162. @item @code{p.verse}
  11163. @tab verse paragraph
  11164. @item @code{div.footnotes}
  11165. @tab footnote section headline
  11166. @item @code{p.footnote}
  11167. @tab footnote definition paragraph, containing a footnote
  11168. @item @code{.footref}
  11169. @tab a footnote reference number (always a <sup>)
  11170. @item @code{.footnum}
  11171. @tab footnote number in footnote definition (always <sup>)
  11172. @item @code{.org-svg}
  11173. @tab default class for a linked @samp{.svg} image
  11174. @end multitable
  11175. @vindex org-html-style-default
  11176. @vindex org-html-head
  11177. @vindex org-html-head-extra
  11178. @cindex @samp{HTML_INCLUDE_STYLE}, keyword
  11179. The HTML export back-end includes a compact default style in each
  11180. exported HTML file. To override the default style with another style,
  11181. use these keywords in the Org file. They will replace the global
  11182. defaults the HTML exporter uses.
  11183. @cindex @samp{HTML_HEAD}, keyword
  11184. @cindex @samp{HTML_HEAD_EXTRA}, keyword
  11185. @example
  11186. #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" />
  11187. #+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
  11188. @end example
  11189. @vindex org-html-head-include-default-style
  11190. To just turn off the default style, customize
  11191. @code{org-html-head-include-default-style} variable, or use this option
  11192. line in the Org file.
  11193. @cindex @samp{html-style}, @samp{OPTIONS} item
  11194. @example
  11195. #+OPTIONS: html-style:nil
  11196. @end example
  11197. For longer style definitions, either use several @samp{HTML_HEAD} and
  11198. @samp{HTML_HEAD_EXTRA} keywords, or use @code{<style> ... </style>} blocks
  11199. around them. Both of these approaches can avoid referring to an
  11200. external file.
  11201. @cindex @samp{HTML_CONTAINER_CLASS}, property
  11202. In order to add styles to a sub-tree, use the @samp{HTML_CONTAINER_CLASS}
  11203. property to assign a class to the tree. In order to specify CSS
  11204. styles for a particular headline, you can use the id specified in
  11205. a @samp{CUSTOM_ID} property.
  11206. Never change the @code{org-html-style-default} constant. Instead use other
  11207. simpler ways of customizing as described above.
  11208. @node JavaScript support
  11209. @subsection JavaScript supported display of web pages
  11210. Sebastian Rose has written a JavaScript program especially designed to
  11211. enhance the web viewing experience of HTML files created with Org.
  11212. This program enhances large files in two different ways of viewing.
  11213. One is an @emph{Info}-like mode where each section is displayed separately
  11214. and navigation can be done with the @kbd{n} and @kbd{p}
  11215. keys, and some other keys as well, press @kbd{?} for an overview
  11216. of the available keys. The second one has a @emph{folding} view, much like
  11217. Org provides inside Emacs. The script is available at
  11218. @uref{https://orgmode.org/org-info.js} and the documentation at
  11219. @uref{https://orgmode.org/worg/code/org-info-js/}. The script is hosted on
  11220. @uref{https://orgmode.org}, but for reliability, prefer installing it on your
  11221. own web server.
  11222. To use this program, just add this line to the Org file:
  11223. @cindex @samp{INFOJS_OPT}, keyword
  11224. @example
  11225. #+INFOJS_OPT: view:info toc:nil
  11226. @end example
  11227. @noindent
  11228. The HTML header now has the code needed to automatically invoke the
  11229. script. For setting options, use the syntax from the above line for
  11230. options described below:
  11231. @table @asis
  11232. @item @samp{path:}
  11233. The path to the script. The default is to grab the script from
  11234. @uref{https://orgmode.org/org-info.js}, but you might want to have
  11235. a local copy and use a path like @samp{../scripts/org-info.js}.
  11236. @item @samp{view:}
  11237. Initial view when the website is first shown. Possible values are:
  11238. @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  11239. @item @samp{info}
  11240. @tab Info-like interface with one section per page
  11241. @item @samp{overview}
  11242. @tab Folding interface, initially showing only top-level
  11243. @item @samp{content}
  11244. @tab Folding interface, starting with all headlines visible
  11245. @item @samp{showall}
  11246. @tab Folding interface, all headlines and text visible
  11247. @end multitable
  11248. @item @samp{sdepth:}
  11249. Maximum headline level still considered as an independent section
  11250. for info and folding modes. The default is taken from
  11251. @code{org-export-headline-levels}, i.e., the @samp{H} switch in @samp{OPTIONS}.
  11252. If this is smaller than in @code{org-export-headline-levels}, each
  11253. info/folding section can still contain child headlines.
  11254. @item @samp{toc:}
  11255. Should the table of contents @emph{initially} be visible? Even when
  11256. @samp{nil}, you can always get to the ``toc'' with @kbd{i}.
  11257. @item @samp{tdepth:}
  11258. The depth of the table of contents. The defaults are taken from
  11259. the variables @code{org-export-headline-levels} and
  11260. @code{org-export-with-toc}.
  11261. @item @samp{ftoc:}
  11262. Does the CSS of the page specify a fixed position for the ``toc''?
  11263. If yes, the toc is displayed as a section.
  11264. @item @samp{ltoc:}
  11265. Should there be short contents (children) in each section? Make
  11266. this @samp{above} if the section should be above initial text.
  11267. @item @samp{mouse:}
  11268. Headings are highlighted when the mouse is over them. Should be
  11269. @samp{underline} (default) or a background color like @samp{#cccccc}.
  11270. @item @samp{buttons:}
  11271. Should view-toggle buttons be everywhere? When @samp{nil} (the
  11272. default), only one such button is present.
  11273. @end table
  11274. @noindent
  11275. @vindex org-infojs-options
  11276. @vindex org-export-html-use-infojs
  11277. You can choose default values for these options by customizing the
  11278. variable @code{org-infojs-options}. If you always want to apply the script
  11279. to your pages, configure the variable @code{org-export-html-use-infojs}.
  11280. @node @LaTeX{} Export
  11281. @section @LaTeX{} Export
  11282. @cindex @LaTeX{} export
  11283. @cindex PDF export
  11284. The @LaTeX{} export back-end can handle complex documents, incorporate
  11285. standard or custom @LaTeX{} document classes, generate documents using
  11286. alternate @LaTeX{} engines, and produce fully linked PDF files with
  11287. indexes, bibliographies, and tables of contents, destined for
  11288. interactive online viewing or high-quality print publication.
  11289. While the details are covered in-depth in this section, here are some
  11290. quick references to variables for the impatient: for engines, see
  11291. @code{org-latex-compiler}; for build sequences, see
  11292. @code{org-latex-pdf-process}; for packages, see
  11293. @code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}.
  11294. An important note about the @LaTeX{} export back-end: it is sensitive to
  11295. blank lines in the Org document. That's because @LaTeX{} itself depends
  11296. on blank lines to tell apart syntactical elements, such as paragraphs.
  11297. @menu
  11298. * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents.
  11299. * @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
  11300. * @LaTeX{} header and sectioning:: Setting up the export file structure.
  11301. * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code.
  11302. * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}.
  11303. * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output.
  11304. * Plain lists in @LaTeX{} export:: Attributes specific to lists.
  11305. * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
  11306. * Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
  11307. * Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
  11308. * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
  11309. @end menu
  11310. @node @LaTeX{}/PDF export commands
  11311. @subsection @LaTeX{}/PDF export commands
  11312. @table @asis
  11313. @item @kbd{C-c C-e l l} (@code{org-latex-export-to-latex})
  11314. @kindex C-c C-e l l
  11315. @findex org-latex-export-to-latex~
  11316. Export to a @LaTeX{} file with a @samp{.tex} extension. For
  11317. @samp{myfile.org}, Org exports to @samp{myfile.tex}, overwriting without
  11318. warning.
  11319. @item @kbd{C-c C-e l L} (@code{org-latex-export-as-latex})
  11320. @kindex C-c C-e l L
  11321. @findex org-latex-export-as-latex
  11322. Export to a temporary buffer. Do not create a file.
  11323. @item @kbd{C-c C-e l p} (@code{org-latex-export-to-pdf})
  11324. @kindex C-c C-e l p
  11325. @findex org-latex-export-to-pdf
  11326. Export as @LaTeX{} file and convert it to PDF file.
  11327. @item @kbd{C-c C-e l o}
  11328. @kindex C-c C-e l o
  11329. Export as @LaTeX{} file and convert it to PDF, then open the PDF
  11330. using the default viewer.
  11331. @item @kbd{M-x org-export-region-as-latex}
  11332. Convert the region to @LaTeX{} under the assumption that it was in Org
  11333. mode syntax before. This is a global command that can be invoked in
  11334. any buffer.
  11335. @end table
  11336. @vindex org-latex-compiler
  11337. @vindex org-latex-bibtex-compiler
  11338. @vindex org-latex-default-packages-alist
  11339. @cindex pdflatex
  11340. @cindex xelatex
  11341. @cindex lualatex
  11342. @cindex @samp{LATEX_COMPILER}, keyword
  11343. The @LaTeX{} export back-end can use any of these @LaTeX{} engines:
  11344. @samp{pdflatex}, @samp{xelatex}, and @samp{lualatex}. These engines compile @LaTeX{}
  11345. files with different compilers, packages, and output options. The
  11346. @LaTeX{} export back-end finds the compiler version to use from
  11347. @code{org-latex-compiler} variable or the @samp{#+LATEX_COMPILER} keyword in the
  11348. Org file. See the docstring for the
  11349. @code{org-latex-default-packages-alist} for loading packages with certain
  11350. compilers. Also see @code{org-latex-bibtex-compiler} to set the
  11351. bibliography compiler@footnote{This does not allow setting different bibliography compilers
  11352. for different files. However, ``smart'' @LaTeX{} compilation systems, such
  11353. as latexmk, can select the correct bibliography compiler.}.
  11354. @node @LaTeX{} specific export settings
  11355. @subsection @LaTeX{} specific export settings
  11356. The @LaTeX{} export back-end has several additional keywords for
  11357. customizing @LaTeX{} output. Setting these keywords works similar to the
  11358. general options (see @ref{Export Settings}).
  11359. @table @asis
  11360. @item @samp{DESCRIPTION}
  11361. @cindex @samp{DESCRIPTION}, keyword
  11362. @vindex org-latex-hyperref-template
  11363. @vindex org-latex-title-command
  11364. The document's description. The description along with author
  11365. name, keywords, and related file metadata are inserted in the
  11366. output file by the hyperref package. See
  11367. @code{org-latex-hyperref-template} for customizing metadata items.
  11368. See @code{org-latex-title-command} for typesetting description into
  11369. the document's front matter. Use multiple @samp{DESCRIPTION} keywords
  11370. for long descriptions.
  11371. @item @samp{LATEX_CLASS}
  11372. @cindex @samp{LATEX_CLASS}, keyword
  11373. @vindex org-latex-default-class
  11374. @vindex org-latex-classes
  11375. This is @LaTeX{} document class, such as @emph{article}, @emph{report},
  11376. @emph{book}, and so on, which contain predefined preamble and headline
  11377. level mapping that the @LaTeX{} export back-end needs. The back-end
  11378. reads the default class name from the @code{org-latex-default-class}
  11379. variable. Org has @emph{article} as the default class. A valid
  11380. default class must be an element of @code{org-latex-classes}.
  11381. @item @samp{LATEX_CLASS_OPTIONS}
  11382. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11383. Options the @LaTeX{} export back-end uses when calling the @LaTeX{}
  11384. document class.
  11385. @item @samp{LATEX_COMPILER}
  11386. @cindex @samp{LATEX_COMPILER}, keyword
  11387. @vindex org-latex-compiler
  11388. The compiler, such as @samp{pdflatex}, @samp{xelatex}, @samp{lualatex}, for
  11389. producing the PDF. See @code{org-latex-compiler}.
  11390. @item @samp{LATEX_HEADER}
  11391. @itemx @samp{LATEX_HEADER_EXTRA}
  11392. @cindex @samp{LATEX_HEADER}, keyword
  11393. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11394. @vindex org-latex-classes
  11395. Arbitrary lines to add to the document's preamble, before the
  11396. hyperref settings. See @code{org-latex-classes} for adjusting the
  11397. structure and order of the @LaTeX{} headers.
  11398. @item @samp{KEYWORDS}
  11399. @cindex @samp{KEYWORDS}, keyword
  11400. @vindex org-latex-hyperref-template
  11401. @vindex org-latex-title-command
  11402. The keywords for the document. The description along with author
  11403. name, keywords, and related file metadata are inserted in the
  11404. output file by the hyperref package. See
  11405. @code{org-latex-hyperref-template} for customizing metadata items.
  11406. See @code{org-latex-title-command} for typesetting description into
  11407. the document's front matter. Use multiple @samp{KEYWORDS} lines if
  11408. necessary.
  11409. @item @samp{SUBTITLE}
  11410. @cindex @samp{SUBTITLE}, keyword
  11411. @vindex org-latex-subtitle-separate
  11412. @vindex org-latex-subtitle-format
  11413. The document's subtitle. It is typeset as per
  11414. @code{org-latex-subtitle-format}. If @code{org-latex-subtitle-separate} is
  11415. non-@code{nil}, it is typed as part of the @code{\title} macro. See
  11416. @code{org-latex-hyperref-template} for customizing metadata items.
  11417. See @code{org-latex-title-command} for typesetting description
  11418. into the document's front matter.
  11419. @end table
  11420. The following sections have further details.
  11421. @node @LaTeX{} header and sectioning
  11422. @subsection @LaTeX{} header and sectioning structure
  11423. @cindex @LaTeX{} class
  11424. @cindex @LaTeX{} sectioning structure
  11425. @cindex @LaTeX{} header
  11426. @cindex header, for @LaTeX{} files
  11427. @cindex sectioning structure, for @LaTeX{} export
  11428. The @LaTeX{} export back-end converts the first three of Org's outline
  11429. levels into @LaTeX{} headlines. The remaining Org levels are exported as
  11430. lists. To change this globally for the cut-off point between levels
  11431. and lists, (see @ref{Export Settings}).
  11432. By default, the @LaTeX{} export back-end uses the @emph{article} class.
  11433. @vindex org-latex-default-class
  11434. @vindex org-latex-classes
  11435. @vindex org-latex-default-packages-alist
  11436. @vindex org-latex-packages-alist
  11437. To change the default class globally, edit @code{org-latex-default-class}.
  11438. To change the default class locally in an Org file, add option lines
  11439. @samp{#+LATEX_CLASS: myclass}. To change the default class for just a part
  11440. of the Org file, set a sub-tree property, @samp{EXPORT_LATEX_CLASS}. The
  11441. class name entered here must be valid member of @code{org-latex-classes}.
  11442. This variable defines a header template for each class into which the
  11443. exporter splices the values of @code{org-latex-default-packages-alist} and
  11444. @code{org-latex-packages-alist}. Use the same three variables to define
  11445. custom sectioning or custom classes.
  11446. @cindex @samp{LATEX_CLASS}, keyword
  11447. @cindex @samp{LATEX_CLASS_OPTIONS}, keyword
  11448. @cindex @samp{EXPORT_LATEX_CLASS}, property
  11449. @cindex @samp{EXPORT_LATEX_CLASS_OPTIONS}, property
  11450. The @LaTeX{} export back-end sends the @samp{LATEX_CLASS_OPTIONS} keyword and
  11451. @samp{EXPORT_LATEX_CLASS_OPTIONS} property as options to the @LaTeX{}
  11452. @code{\documentclass} macro. The options and the syntax for specifying
  11453. them, including enclosing them in square brackets, follow @LaTeX{}
  11454. conventions.
  11455. @example
  11456. #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
  11457. @end example
  11458. @cindex @samp{LATEX_HEADER}, keyword
  11459. @cindex @samp{LATEX_HEADER_EXTRA}, keyword
  11460. The @LaTeX{} export back-end appends values from @samp{LATEX_HEADER} and
  11461. @samp{LATEX_HEADER_EXTRA} keywords to the @LaTeX{} header. The docstring for
  11462. @code{org-latex-classes} explains in more detail. Also note that @LaTeX{}
  11463. export back-end does not append @samp{LATEX_HEADER_EXTRA} to the header
  11464. when previewing @LaTeX{} snippets (see @ref{Previewing @LaTeX{} fragments}).
  11465. A sample Org file with the above headers:
  11466. @example
  11467. #+LATEX_CLASS: article
  11468. #+LATEX_CLASS_OPTIONS: [a4paper]
  11469. #+LATEX_HEADER: \usepackage@{xyz@}
  11470. * Headline 1
  11471. some text
  11472. * Headline 2
  11473. some more text
  11474. @end example
  11475. @node Quoting @LaTeX{} code
  11476. @subsection Quoting @LaTeX{} code
  11477. The @LaTeX{} export back-end can insert any arbitrary @LaTeX{} code, see
  11478. @ref{Embedded @LaTeX{}}. There are three ways to embed such code in the Org
  11479. file and they all use different quoting syntax.
  11480. @cindex inline, in @LaTeX{} export
  11481. Inserting in-line quoted with @@ symbols:
  11482. @example
  11483. Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph.
  11484. @end example
  11485. @cindex @samp{LATEX}, keyword
  11486. Inserting as one or more keyword lines in the Org file:
  11487. @example
  11488. #+LATEX: any arbitrary LaTeX code
  11489. @end example
  11490. @cindex @samp{BEGIN_EXPORT latex}
  11491. Inserting as an export block in the Org file, where the back-end
  11492. exports any code between begin and end markers:
  11493. @example
  11494. #+BEGIN_EXPORT latex
  11495. any arbitrary LaTeX code
  11496. #+END_EXPORT
  11497. @end example
  11498. @node Tables in @LaTeX{} export
  11499. @subsection Tables in @LaTeX{} export
  11500. @cindex tables, in @LaTeX{} export
  11501. The @LaTeX{} export back-end can pass several @LaTeX{} attributes for table
  11502. contents and layout. Besides specifying label and caption (see
  11503. @ref{Images and Tables}), the other valid @LaTeX{} attributes include:
  11504. @table @asis
  11505. @item @samp{:mode}
  11506. @vindex org-latex-default-table-mode
  11507. The @LaTeX{} export back-end wraps the table differently depending
  11508. on the mode for accurate rendering of math symbols. Mode is
  11509. either @samp{table}, @samp{math}, @samp{inline-math} or @samp{verbatim}.
  11510. For @samp{math} or @samp{inline-math} mode, @LaTeX{} export back-end wraps the
  11511. table in a math environment, but every cell in it is exported
  11512. as-is. The @LaTeX{} export back-end determines the default mode
  11513. from @code{org-latex-default-table-mode}. The @LaTeX{} export back-end
  11514. merges contiguous tables in the same mode into a single
  11515. environment.
  11516. @item @samp{:environment}
  11517. @vindex org-latex-default-table-environment
  11518. Set the default @LaTeX{} table environment for the @LaTeX{} export
  11519. back-end to use when exporting Org tables. Common @LaTeX{} table
  11520. environments are provided by these packages: tabularx, longtable,
  11521. array, tabu, and bmatrix. For packages, such as tabularx and
  11522. tabu, or any newer replacements, include them in the
  11523. @code{org-latex-packages-alist} variable so the @LaTeX{} export back-end
  11524. can insert the appropriate load package headers in the converted
  11525. @LaTeX{} file. Look in the docstring for the
  11526. @code{org-latex-packages-alist} variable for configuring these
  11527. packages for @LaTeX{} snippet previews, if any.
  11528. @item @samp{:caption}
  11529. Use @samp{CAPTION} keyword to set a simple caption for a table (see
  11530. @ref{Images and Tables}). For custom captions, use @samp{:caption}
  11531. attribute, which accepts raw @LaTeX{} code. @samp{:caption} value
  11532. overrides @samp{CAPTION} value.
  11533. @item @samp{:float}
  11534. @itemx @samp{:placement}
  11535. The table environments by default are not floats in @LaTeX{}. To
  11536. make them floating objects use @samp{:float} with one of the following
  11537. options: @samp{sideways}, @samp{multicolumn}, @samp{t}, and @samp{nil}.
  11538. @LaTeX{} floats can also have additional layout @samp{:placement}
  11539. attributes. These are the usual @samp{[h t b p ! H]} permissions
  11540. specified in square brackets. Note that for @samp{:float sideways}
  11541. tables, the @LaTeX{} export back-end ignores @samp{:placement}
  11542. attributes.
  11543. @item @samp{:align}
  11544. @itemx @samp{:font}
  11545. @itemx @samp{:width}
  11546. The @LaTeX{} export back-end uses these attributes for regular
  11547. tables to set their alignments, fonts, and widths.
  11548. @item @samp{:spread}
  11549. When @samp{:spread} is non-@code{nil}, the @LaTeX{} export back-end spreads or
  11550. shrinks the table by the @samp{:width} for tabu and longtabu
  11551. environments. @samp{:spread} has no effect if @samp{:width} is not set.
  11552. @item @samp{:booktabs}
  11553. @itemx @samp{:center}
  11554. @itemx @samp{:rmlines}
  11555. @vindex org-latex-tables-booktabs
  11556. @vindex org-latex-tables-centered
  11557. All three commands are toggles. @samp{:booktabs} brings in modern
  11558. typesetting enhancements to regular tables. The booktabs package
  11559. has to be loaded through @code{org-latex-packages-alist}. @samp{:center}
  11560. is for centering the table. @samp{:rmlines} removes all but the very
  11561. first horizontal line made of ASCII characters from ``table.el''
  11562. tables only.
  11563. @item @samp{:math-prefix}
  11564. @itemx @samp{:math-suffix}
  11565. @itemx @samp{:math-arguments}
  11566. The @LaTeX{} export back-end inserts @samp{:math-prefix} string value in
  11567. a math environment before the table. The @LaTeX{} export back-end
  11568. inserts @samp{:math-suffix} string value in a math environment after
  11569. the table. The @LaTeX{} export back-end inserts @samp{:math-arguments}
  11570. string value between the macro name and the table's contents.
  11571. @samp{:math-arguments} comes in use for matrix macros that require
  11572. more than one argument, such as @samp{qbordermatrix}.
  11573. @end table
  11574. @LaTeX{} table attributes help formatting tables for a wide range of
  11575. situations, such as matrix product or spanning multiple pages:
  11576. @example
  11577. #+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l
  11578. | ... | ... |
  11579. | ... | ... |
  11580. #+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times
  11581. | a | b |
  11582. | c | d |
  11583. #+ATTR_LATEX: :mode math :environment bmatrix
  11584. | 1 | 2 |
  11585. | 3 | 4 |
  11586. @end example
  11587. Set the caption with the @LaTeX{} command
  11588. @samp{\bicaption@{HeadingA@}@{HeadingB@}}:
  11589. @example
  11590. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11591. | ... | ... |
  11592. | ... | ... |
  11593. @end example
  11594. @node Images in @LaTeX{} export
  11595. @subsection Images in @LaTeX{} export
  11596. @cindex images, inline in LaTeX
  11597. @cindex inlining images in LaTeX
  11598. @cindex @samp{ATTR_LATEX}, keyword
  11599. The @LaTeX{} export back-end processes image links in Org files that do
  11600. not have descriptions, such as these links @samp{[[file:img.jpg]]} or
  11601. @samp{[[./img.jpg]]}, as direct image insertions in the final PDF output. In
  11602. the PDF, they are no longer links but actual images embedded on the
  11603. page. The @LaTeX{} export back-end uses @samp{\includegraphics} macro to
  11604. insert the image. But for TikZ (@uref{http://sourceforge.net/projects/pgf/})
  11605. images, the back-end uses an @code{\input} macro wrapped within
  11606. a @code{tikzpicture} environment.
  11607. For specifying image @samp{:width}, @samp{:height}, and other @samp{:options}, use
  11608. this syntax:
  11609. @example
  11610. #+ATTR_LATEX: :width 5cm :options angle=90
  11611. [[./img/sed-hr4049.pdf]]
  11612. @end example
  11613. For custom commands for captions, use the @samp{:caption} attribute. It
  11614. overrides the default @samp{#+CAPTION} value:
  11615. @example
  11616. #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
  11617. [[./img/sed-hr4049.pdf]]
  11618. @end example
  11619. When captions follow the method as described in @ref{Images and Tables},
  11620. the @LaTeX{} export back-end wraps the picture in a floating @samp{figure}
  11621. environment. To float an image without specifying a caption, set the
  11622. @samp{:float} attribute to one of the following:
  11623. @table @asis
  11624. @item @samp{t}
  11625. For a standard @samp{figure} environment; used by default whenever an
  11626. image has a caption.
  11627. @item @samp{multicolumn}
  11628. To span the image across multiple columns of a page; the back-end
  11629. wraps the image in a @samp{figure*} environment.
  11630. @item @samp{wrap}
  11631. For text to flow around the image on the right; the figure
  11632. occupies the left half of the page.
  11633. @item @samp{sideways}
  11634. For a new page with the image sideways, rotated ninety degrees,
  11635. in a @samp{sidewaysfigure} environment; overrides @samp{:placement}
  11636. setting.
  11637. @item @samp{nil}
  11638. To avoid a @samp{:float} even if using a caption.
  11639. @end table
  11640. @noindent
  11641. Use the @samp{placement} attribute to modify a floating environment's
  11642. placement.
  11643. @example
  11644. #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement @{r@}@{0.4\textwidth@}
  11645. [[./img/hst.png]]
  11646. @end example
  11647. @vindex org-latex-images-centered
  11648. @cindex center image in LaTeX export
  11649. @cindex image, centering in LaTeX export
  11650. The @LaTeX{} export back-end centers all images by default. Setting
  11651. @samp{:center} to @samp{nil} disables centering. To disable centering globally,
  11652. set @code{org-latex-images-centered} to @samp{t}.
  11653. Set the @samp{:comment-include} attribute to non-@code{nil} value for the @LaTeX{}
  11654. export back-end to comment out the @samp{\includegraphics} macro.
  11655. @node Plain lists in @LaTeX{} export
  11656. @subsection Plain lists in @LaTeX{} export
  11657. @cindex plain lists, in @LaTeX{} export
  11658. @cindex @samp{ATTR_LATEX}, keyword
  11659. The @LaTeX{} export back-end accepts the @samp{environment} and @samp{options}
  11660. attributes for plain lists. Both attributes work together for
  11661. customizing lists, as shown in the examples:
  11662. @example
  11663. #+LATEX_HEADER: \usepackage[inline]@{enumitem@}
  11664. Some ways to say "Hello":
  11665. #+ATTR_LATEX: :environment itemize*
  11666. #+ATTR_LATEX: :options [label=@{@}, itemjoin=@{,@}, itemjoin*=@{, and@}]
  11667. - Hola
  11668. - Bonjour
  11669. - Guten Tag.
  11670. @end example
  11671. Since @LaTeX{} supports only four levels of nesting for lists, use an
  11672. external package, such as @samp{enumitem} in @LaTeX{}, for levels deeper than
  11673. four:
  11674. @example
  11675. #+LATEX_HEADER: \usepackage@{enumitem@}
  11676. #+LATEX_HEADER: \renewlist@{itemize@}@{itemize@}@{9@}
  11677. #+LATEX_HEADER: \setlist[itemize]@{label=$\circ$@}
  11678. - One
  11679. - Two
  11680. - Three
  11681. - Four
  11682. - Five
  11683. @end example
  11684. @node Source blocks in @LaTeX{} export
  11685. @subsection Source blocks in @LaTeX{} export
  11686. @cindex source blocks, in @LaTeX{} export
  11687. @cindex @samp{ATTR_LATEX}, keyword
  11688. The @LaTeX{} export back-end can make source code blocks into floating
  11689. objects through the attributes @samp{:float} and @samp{:options}. For @samp{:float}:
  11690. @table @asis
  11691. @item @samp{t}
  11692. Makes a source block float; by default floats any source block
  11693. with a caption.
  11694. @item @samp{multicolumn}
  11695. Spans the source block across multiple columns of a page.
  11696. @item @samp{nil}
  11697. Avoids a @samp{:float} even if using a caption; useful for source code
  11698. blocks that may not fit on a page.
  11699. @end table
  11700. @example
  11701. #+ATTR_LATEX: :float nil
  11702. #+BEGIN_SRC emacs-lisp
  11703. Lisp code that may not fit in a single page.
  11704. #+END_SRC
  11705. @end example
  11706. @vindex org-latex-listings-options
  11707. @vindex org-latex-minted-options
  11708. The @LaTeX{} export back-end passes string values in @samp{:options} to @LaTeX{}
  11709. packages for customization of that specific source block. In the
  11710. example below, the @samp{:options} are set for Minted. Minted is a source
  11711. code highlighting @LaTeX{} package with many configurable options.
  11712. @example
  11713. #+ATTR_LATEX: :options commentstyle=\bfseries
  11714. #+BEGIN_SRC emacs-lisp
  11715. (defun Fib (n)
  11716. (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
  11717. #+END_SRC
  11718. @end example
  11719. To apply similar configuration options for all source blocks in
  11720. a file, use the @code{org-latex-listings-options} and
  11721. @code{org-latex-minted-options} variables.
  11722. @node Example blocks in @LaTeX{} export
  11723. @subsection Example blocks in @LaTeX{} export
  11724. @cindex example blocks, in @LaTeX{} export
  11725. @cindex verbatim blocks, in @LaTeX{} export
  11726. @cindex @samp{ATTR_LATEX}, keyword
  11727. The @LaTeX{} export back-end wraps the contents of example blocks in
  11728. a @samp{verbatim} environment. To change this behavior to use another
  11729. environment globally, specify an appropriate export filter (see
  11730. @ref{Advanced Configuration}). To change this behavior to use another
  11731. environment for each block, use the @samp{:environment} parameter to
  11732. specify a custom environment.
  11733. @example
  11734. #+ATTR_LATEX: :environment myverbatim
  11735. #+BEGIN_EXAMPLE
  11736. This sentence is false.
  11737. #+END_EXAMPLE
  11738. @end example
  11739. @node Special blocks in @LaTeX{} export
  11740. @subsection Special blocks in @LaTeX{} export
  11741. @cindex special blocks, in @LaTeX{} export
  11742. @cindex abstract, in @LaTeX{} export
  11743. @cindex proof, in @LaTeX{} export
  11744. @cindex @samp{ATTR_LATEX}, keyword
  11745. For other special blocks in the Org file, the @LaTeX{} export back-end
  11746. makes a special environment of the same name. The back-end also takes
  11747. @samp{:options}, if any, and appends as-is to that environment's opening
  11748. string. For example:
  11749. @example
  11750. #+BEGIN_abstract
  11751. We demonstrate how to solve the Syracuse problem.
  11752. #+END_abstract
  11753. #+ATTR_LATEX: :options [Proof of important theorem]
  11754. #+BEGIN_proof
  11755. ...
  11756. Therefore, any even number greater than 2 is the sum of two primes.
  11757. #+END_proof
  11758. @end example
  11759. @noindent
  11760. exports to
  11761. @example
  11762. \begin@{abstract@}
  11763. We demonstrate how to solve the Syracuse problem.
  11764. \end@{abstract@}
  11765. \begin@{proof@}[Proof of important theorem]
  11766. ...
  11767. Therefore, any even number greater than 2 is the sum of two primes.
  11768. \end@{proof@}
  11769. @end example
  11770. If you need to insert a specific caption command, use @samp{:caption}
  11771. attribute. It overrides standard @samp{CAPTION} value, if any. For
  11772. example:
  11773. @example
  11774. #+ATTR_LATEX: :caption \MyCaption@{HeadingA@}
  11775. #+BEGIN_proof
  11776. ...
  11777. #+END_proof
  11778. @end example
  11779. @node Horizontal rules in @LaTeX{} export
  11780. @subsection Horizontal rules in @LaTeX{} export
  11781. @cindex horizontal rules, in @LaTeX{} export
  11782. @cindex @samp{ATTR_LATEX}, keyword
  11783. The @LaTeX{} export back-end converts horizontal rules by the specified
  11784. @samp{:width} and @samp{:thickness} attributes. For example:
  11785. @example
  11786. #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
  11787. -----
  11788. @end example
  11789. @node Markdown Export
  11790. @section Markdown Export
  11791. @cindex Markdown export
  11792. The Markdown export back-end, ``md'', converts an Org file to Markdown
  11793. format, as defined at @uref{http://daringfireball.net/projects/markdown/}.
  11794. Since it is built on top of the HTML back-end (see @ref{HTML Export}), it
  11795. converts every Org construct not defined in Markdown syntax, such as
  11796. tables, to HTML.
  11797. @anchor{Markdown export commands}
  11798. @subheading Markdown export commands
  11799. @table @asis
  11800. @item @kbd{C-c C-e m m} (@code{org-md-export-to-markdown})
  11801. @kindex C-c C-c m m
  11802. @findex org-md-export-to-markdown
  11803. Export to a text file with Markdown syntax. For @samp{myfile.org},
  11804. Org exports to @samp{myfile.md}, overwritten without warning.
  11805. @item @kbd{C-c C-e m M} (@code{org-md-export-as-markdown})
  11806. @kindex C-c C-c m M
  11807. @findex org-md-export-as-markdown
  11808. Export to a temporary buffer. Does not create a file.
  11809. @item @kbd{C-c C-e m o}
  11810. @kindex C-c C-e m o
  11811. Export as a text file with Markdown syntax, then open it.
  11812. @end table
  11813. @anchor{Header and sectioning structure (1)}
  11814. @subheading Header and sectioning structure
  11815. @vindex org-md-headline-style
  11816. Based on @code{org-md-headline-style}, Markdown export can generate
  11817. headlines of both @emph{atx} and @emph{setext} types. @emph{atx} limits headline
  11818. levels to two whereas @emph{setext} limits headline levels to six. Beyond
  11819. these limits, the export back-end converts headlines to lists. To set
  11820. a limit to a level before the absolute limit (see @ref{Export Settings}).
  11821. @node OpenDocument Text Export
  11822. @section OpenDocument Text Export
  11823. @cindex ODT
  11824. @cindex OpenDocument
  11825. @cindex export, OpenDocument
  11826. @cindex LibreOffice
  11827. The ODT export back-end handles creating of OpenDocument Text (ODT)
  11828. format. Documents created by this exporter use the
  11829. @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
  11830. (OpenDocument) Version 1.2}.} and are compatible
  11831. with LibreOffice 3.4.
  11832. @menu
  11833. * Pre-requisites for ODT export:: Required packages.
  11834. * ODT export commands:: Invoking export.
  11835. * ODT specific export settings:: Configuration options.
  11836. * Extending ODT export:: Producing DOC, PDF files.
  11837. * Applying custom styles:: Styling the output.
  11838. * Links in ODT export:: Handling and formatting links.
  11839. * Tables in ODT export:: Org tables conversions.
  11840. * Images in ODT export:: Inserting images.
  11841. * Math formatting in ODT export:: Formatting @LaTeX{} fragments.
  11842. * Labels and captions in ODT export:: Rendering objects.
  11843. * Literal examples in ODT export:: For source code and example blocks.
  11844. * Advanced topics in ODT export:: For power users.
  11845. @end menu
  11846. @node Pre-requisites for ODT export
  11847. @subsection Pre-requisites for ODT export
  11848. @cindex zip
  11849. The ODT export back-end relies on the zip program to create the final
  11850. compressed ODT output. Check if @samp{zip} is locally available and
  11851. executable. Without it, export cannot finish.
  11852. @node ODT export commands
  11853. @subsection ODT export commands
  11854. @table @asis
  11855. @item @kbd{C-c C-e o o} (@code{org-export-to-odt})
  11856. @kindex C-c C-e o o
  11857. @findex org-export-to-odt
  11858. Export as OpenDocument Text file.
  11859. @cindex @samp{EXPORT_FILE_NAME}, property
  11860. @vindex org-odt-preferred-output-format
  11861. If @code{org-odt-preferred-output-format} is specified, the ODT export
  11862. back-end automatically converts the exported file to that format.
  11863. For @samp{myfile.org}, Org exports to @samp{myfile.odt}, overwriting
  11864. without warning. The ODT export back-end exports a region only
  11865. if a region was active.
  11866. If the selected region is a single tree, the ODT export back-end
  11867. makes the tree head the document title. Incidentally, @kbd{C-c @@} selects the current sub-tree. If the tree head entry has,
  11868. or inherits, an @samp{EXPORT_FILE_NAME} property, the ODT export
  11869. back-end uses that for file name.
  11870. @item @kbd{C-c C-e o O}
  11871. @kindex C-c C-e o O
  11872. Export as an OpenDocument Text file and open the resulting file.
  11873. @vindex org-export-odt-preferred-output-format
  11874. If @code{org-export-odt-preferred-output-format} is specified, open
  11875. the converted file instead. See @ref{Automatically exporting to other formats}.
  11876. @end table
  11877. @node ODT specific export settings
  11878. @subsection ODT specific export settings
  11879. The ODT export back-end has several additional keywords for
  11880. customizing ODT output. Setting these keywords works similar to the
  11881. general options (see @ref{Export Settings}).
  11882. @table @asis
  11883. @item @samp{DESCRIPTION}
  11884. @cindex @samp{DESCRIPTION}, keyword
  11885. This is the document's description, which the ODT export back-end
  11886. inserts as document metadata. For long descriptions, use
  11887. multiple lines, prefixed with @samp{DESCRIPTION}.
  11888. @item @samp{KEYWORDS}
  11889. @cindex @samp{KEYWORDS}, keyword
  11890. The keywords for the document. The ODT export back-end inserts
  11891. the description along with author name, keywords, and related
  11892. file metadata as metadata in the output file. Use multiple
  11893. @samp{KEYWORDS} if necessary.
  11894. @item @samp{ODT_STYLES_FILE}
  11895. @cindex @samp{ODT_STYLES_FILE}, keyword
  11896. @vindex org-odt-styles-file
  11897. The ODT export back-end uses the @code{org-odt-styles-file} by
  11898. default. See @ref{Applying custom styles} for details.
  11899. @item @samp{SUBTITLE}
  11900. @cindex @samp{SUBTITLE}, keyword
  11901. The document subtitle.
  11902. @end table
  11903. @node Extending ODT export
  11904. @subsection Extending ODT export
  11905. The ODT export back-end can produce documents in other formats besides
  11906. ODT using a specialized ODT converter process. Its common interface
  11907. works with popular converters to produce formats such as @samp{doc}, or
  11908. convert a document from one format, say @samp{csv}, to another format, say
  11909. @samp{xls}.
  11910. @cindex @file{unoconv}
  11911. @vindex org-odt-convert-process
  11912. Customize @code{org-odt-convert-process} variable to point to @samp{unoconv},
  11913. which is the ODT's preferred converter. Working installations of
  11914. LibreOffice would already have @samp{unoconv} installed. Alternatively,
  11915. other converters may be substituted here. See @ref{Configuring a document converter}.
  11916. @anchor{Automatically exporting to other formats}
  11917. @subsubheading Automatically exporting to other formats
  11918. @vindex org-odt-preferred-output-format
  11919. If ODT format is just an intermediate step to get to other formats,
  11920. such as @samp{doc}, @samp{docx}, @samp{rtf}, or @samp{pdf}, etc., then extend the ODT
  11921. export back-end to directly produce that format. Specify the final
  11922. format in the @code{org-odt-preferred-output-format} variable. This is one
  11923. way to extend (see @ref{ODT export commands}).
  11924. @anchor{Converting between document formats}
  11925. @subsubheading Converting between document formats
  11926. The Org export back-end is made to be inter-operable with a wide range
  11927. of text document format converters. Newer generation converters, such
  11928. as LibreOffice and Pandoc, can handle hundreds of formats at once.
  11929. Org provides a consistent interaction with whatever converter is
  11930. installed. Here are some generic commands:
  11931. @table @asis
  11932. @item @kbd{M-x org-odt-convert}
  11933. @findex org-odt-convert
  11934. Convert an existing document from one format to another. With
  11935. a prefix argument, opens the newly produced file.
  11936. @end table
  11937. @node Applying custom styles
  11938. @subsection Applying custom styles
  11939. @cindex styles, custom
  11940. @cindex template, custom
  11941. The ODT export back-end comes with many OpenDocument styles (see
  11942. @ref{Working with OpenDocument style files}). To expand or further
  11943. customize these built-in style sheets, either edit the style sheets
  11944. directly or generate them using an application such as LibreOffice.
  11945. The example here shows creating a style using LibreOffice.
  11946. @anchor{Applying custom styles the easy way}
  11947. @subsubheading Applying custom styles: the easy way
  11948. @enumerate
  11949. @item
  11950. Create a sample @samp{example.org} file with settings as shown below,
  11951. and export it to ODT format.
  11952. @example
  11953. #+OPTIONS: H:10 num:t
  11954. @end example
  11955. @item
  11956. Open the above @samp{example.odt} using LibreOffice. Use the @emph{Stylist}
  11957. to locate the target styles, which typically have the ``Org'' prefix.
  11958. Open one, modify, and save as either OpenDocument Text (ODT) or
  11959. OpenDocument Template (OTT) file.
  11960. @item
  11961. @vindex org-odt-styles-file
  11962. Customize the variable @code{org-odt-styles-file} and point it to the
  11963. newly created file. For additional configuration options, see
  11964. @ref{x-overriding-factory-styles, , Overriding factory styles}.
  11965. @cindex @samp{ODT_STYLES_FILE}, keyword
  11966. To apply an ODT style to a particular file, use the
  11967. @samp{ODT_STYLES_FILE} keyword as shown in the example below:
  11968. @example
  11969. #+ODT_STYLES_FILE: "/path/to/example.ott"
  11970. @end example
  11971. @noindent
  11972. or
  11973. @example
  11974. #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png"))
  11975. @end example
  11976. @end enumerate
  11977. @anchor{Using third-party styles and templates}
  11978. @subsubheading Using third-party styles and templates
  11979. The ODT export back-end relies on many templates and style names.
  11980. Using third-party styles and templates can lead to mismatches.
  11981. Templates derived from built in ODT templates and styles seem to have
  11982. fewer problems.
  11983. @node Links in ODT export
  11984. @subsection Links in ODT export
  11985. @cindex links, in ODT export
  11986. ODT exporter creates native cross-references for internal links. It
  11987. creates Internet-style links for all other links.
  11988. A link with no description and pointing to a regular, un-itemized,
  11989. outline heading is replaced with a cross-reference and section number
  11990. of the heading.
  11991. A @samp{\ref@{label@}}-style reference to an image, table etc., is replaced
  11992. with a cross-reference and sequence number of the labeled entity. See
  11993. @ref{Labels and captions in ODT export}.
  11994. @node Tables in ODT export
  11995. @subsection Tables in ODT export
  11996. @cindex tables, in ODT export
  11997. The ODT export back-end handles native Org mode tables (see @ref{Tables})
  11998. and simple @samp{table.el} tables. Complex @samp{table.el} tables having column
  11999. or row spans are not supported. Such tables are stripped from the
  12000. exported document.
  12001. By default, the ODT export back-end exports a table with top and
  12002. bottom frames and with ruled lines separating row and column groups
  12003. (see @ref{Column Groups}). All tables are typeset to occupy the same
  12004. width. The ODT export back-end honors any table alignments and
  12005. relative widths for columns (see @ref{Column Width and Alignment}).
  12006. Note that the ODT export back-end interprets column widths as weighted
  12007. ratios, the default weight being 1.
  12008. @cindex @samp{ATTR_ODT}, keyword
  12009. Specifying @samp{:rel-width} property on an @samp{ATTR_ODT} line controls the
  12010. width of the table. For example:
  12011. @example
  12012. #+ATTR_ODT: :rel-width 50
  12013. | Area/Month | Jan | Feb | Mar | Sum |
  12014. |---------------+-------+-------+-------+-------|
  12015. | / | < | | | < |
  12016. | <l13> | <r5> | <r5> | <r5> | <r6> |
  12017. | North America | 1 | 21 | 926 | 948 |
  12018. | Middle East | 6 | 75 | 844 | 925 |
  12019. | Asia Pacific | 9 | 27 | 790 | 826 |
  12020. |---------------+-------+-------+-------+-------|
  12021. | Sum | 16 | 123 | 2560 | 2699 |
  12022. @end example
  12023. On export, the above table takes 50% of text width area. The exporter
  12024. sizes the columns in the ratio: 13:5:5:5:6. The first column is
  12025. left-aligned and rest of the columns, right-aligned. Vertical rules
  12026. separate the header and the last column. Horizontal rules separate
  12027. the header and the last row.
  12028. For even more customization, create custom table styles and associate
  12029. them with a table using the @samp{ATTR_ODT} keyword. See @ref{Customizing tables in ODT export}.
  12030. @node Images in ODT export
  12031. @subsection Images in ODT export
  12032. @cindex images, embedding in ODT
  12033. @cindex embedding images in ODT
  12034. @anchor{Embedding images}
  12035. @subsubheading Embedding images
  12036. The ODT export back-end processes image links in Org files that do not
  12037. have descriptions, such as these links @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]},
  12038. as direct image insertions in the final output. Either of these
  12039. examples works:
  12040. @example
  12041. [[file:img.png]]
  12042. @end example
  12043. @example
  12044. [[./img.png]]
  12045. @end example
  12046. @anchor{Embedding clickable images}
  12047. @subsubheading Embedding clickable images
  12048. For clickable images, provide a link whose description is another link
  12049. to an image file. For example, to embed an image
  12050. @samp{org-mode-unicorn.png} which when clicked jumps to @uref{https://orgmode.org}
  12051. website, do the following
  12052. @example
  12053. [[https://orgmode.org][./org-mode-unicorn.png]]
  12054. @end example
  12055. @anchor{Sizing and scaling of embedded images}
  12056. @subsubheading Sizing and scaling of embedded images
  12057. @cindex @samp{ATTR_ODT}, keyword
  12058. Control the size and scale of the embedded images with the @samp{ATTR_ODT}
  12059. attribute.
  12060. @cindex identify, ImageMagick
  12061. @vindex org-odt-pixels-per-inch
  12062. The ODT export back-end starts with establishing the size of the image
  12063. in the final document. The dimensions of this size are measured in
  12064. centimeters. The back-end then queries the image file for its
  12065. dimensions measured in pixels. For this measurement, the back-end
  12066. relies on ImageMagick's identify program or Emacs @code{create-image} and
  12067. @code{image-size} API. ImageMagick is the preferred choice for large file
  12068. sizes or frequent batch operations. The back-end then converts the
  12069. pixel dimensions using @code{org-odt-pixels-per-inch} into the familiar 72
  12070. dpi or 96 dpi. The default value for this is in
  12071. @code{display-pixels-per-inch}, which can be tweaked for better results
  12072. based on the capabilities of the output device. Here are some common
  12073. image scaling operations:
  12074. @table @asis
  12075. @item Explicitly size the image
  12076. To embed @samp{img.png} as a 10 cm x 10 cm image, do the following:
  12077. @example
  12078. #+ATTR_ODT: :width 10 :height 10
  12079. [[./img.png]]
  12080. @end example
  12081. @item Scale the image
  12082. To embed @samp{img.png} at half its size, do the following:
  12083. @example
  12084. #+ATTR_ODT: :scale 0.5
  12085. [[./img.png]]
  12086. @end example
  12087. @item Scale the image to a specific width
  12088. To embed @samp{img.png} with a width of 10 cm while retaining the
  12089. original height:width ratio, do the following:
  12090. @example
  12091. #+ATTR_ODT: :width 10
  12092. [[./img.png]]
  12093. @end example
  12094. @item Scale the image to a specific height
  12095. To embed @samp{img.png} with a height of 10 cm while retaining the
  12096. original height:width ratio, do the following:
  12097. @example
  12098. #+ATTR_ODT: :height 10
  12099. [[./img.png]]
  12100. @end example
  12101. @end table
  12102. @anchor{Anchoring of images}
  12103. @subsubheading Anchoring of images
  12104. @cindex @samp{ATTR_ODT}, keyword
  12105. The ODT export back-end can anchor images to @samp{"as-char"},
  12106. @samp{"paragraph"}, or @samp{"page"}. Set the preferred anchor using the
  12107. @samp{:anchor} property of the @samp{ATTR_ODT} line.
  12108. To create an image that is anchored to a page:
  12109. @example
  12110. #+ATTR_ODT: :anchor "page"
  12111. [[./img.png]]
  12112. @end example
  12113. @node Math formatting in ODT export
  12114. @subsection Math formatting in ODT export
  12115. The ODT exporter has special support for handling math.
  12116. @menu
  12117. * @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
  12118. * MathML and OpenDocument formula files:: Embedding in native format.
  12119. @end menu
  12120. @node @LaTeX{} math snippets
  12121. @subsubsection @LaTeX{} math snippets
  12122. @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be embedded in the ODT
  12123. document in one of the following ways:
  12124. @table @asis
  12125. @item MathML
  12126. @cindex MathML
  12127. Add this line to the Org file. This option is activated on
  12128. a per-file basis.
  12129. @example
  12130. #+OPTIONS: tex:t
  12131. @end example
  12132. With this option, @LaTeX{} fragments are first converted into MathML
  12133. fragments using an external @LaTeX{}-to-MathML converter program.
  12134. The resulting MathML fragments are then embedded as an
  12135. OpenDocument Formula in the exported document.
  12136. @vindex org-latex-to-mathml-convert-command
  12137. @vindex org-latex-to-mathml-jar-file
  12138. You can specify the @LaTeX{}-to-MathML converter by customizing the
  12139. variables @code{org-latex-to-mathml-convert-command} and
  12140. @code{org-latex-to-mathml-jar-file}.
  12141. If you prefer to use MathToWeb@footnote{See @uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} as your converter, you can
  12142. configure the above variables as shown below.
  12143. @lisp
  12144. (setq org-latex-to-mathml-convert-command
  12145. "java -jar %j -unicode -force -df %o %I"
  12146. org-latex-to-mathml-jar-file
  12147. "/path/to/mathtoweb.jar")
  12148. @end lisp
  12149. To use @LaTeX{}​ML@footnote{See @uref{http://dlmf.nist.gov/LaTeXML/}.} use
  12150. @lisp
  12151. (setq org-latex-to-mathml-convert-command
  12152. "latexmlmath \"%i\" --presentationmathml=%o")
  12153. @end lisp
  12154. To quickly verify the reliability of the @LaTeX{}-to-MathML
  12155. converter, use the following commands:
  12156. @table @asis
  12157. @item @kbd{M-x org-export-as-odf}
  12158. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12159. (@samp{.odf}) file.
  12160. @item @kbd{M-x org-export-as-odf-and-open}
  12161. Convert a @LaTeX{} math snippet to an OpenDocument formula
  12162. (@samp{.odf}) file and open the formula file with the
  12163. system-registered application.
  12164. @end table
  12165. @item PNG images
  12166. @cindex dvipng
  12167. @cindex dvisvgm
  12168. @cindex ImageMagick
  12169. Add this line to the Org file. This option is activated on
  12170. a per-file basis.
  12171. @example
  12172. #+OPTIONS: tex:dvipng
  12173. @end example
  12174. @example
  12175. #+OPTIONS: tex:dvisvgm
  12176. @end example
  12177. @noindent
  12178. or
  12179. @example
  12180. #+OPTIONS: tex:imagemagick
  12181. @end example
  12182. Under this option, @LaTeX{} fragments are processed into PNG or SVG
  12183. images and the resulting images are embedded in the exported
  12184. document. This method requires dvipng program, dvisvgm or
  12185. ImageMagick programs.
  12186. @end table
  12187. @node MathML and OpenDocument formula files
  12188. @subsubsection MathML and OpenDocument formula files
  12189. When embedding @LaTeX{} math snippets in ODT documents is not reliable,
  12190. there is one more option to try. Embed an equation by linking to its
  12191. MathML (@samp{.mml}) source or its OpenDocument formula (@samp{.odf}) file as
  12192. shown below:
  12193. @example
  12194. [[./equation.mml]]
  12195. @end example
  12196. @noindent
  12197. or
  12198. @example
  12199. [[./equation.odf]]
  12200. @end example
  12201. @node Labels and captions in ODT export
  12202. @subsection Labels and captions in ODT export
  12203. ODT format handles labeling and captioning of objects based on their
  12204. types. Inline images, tables, @LaTeX{} fragments, and Math formulas are
  12205. numbered and captioned separately. Each object also gets a unique
  12206. sequence number based on its order of first appearance in the Org
  12207. file. Each category has its own sequence. A caption is just a label
  12208. applied to these objects.
  12209. @example
  12210. #+CAPTION: Bell curve
  12211. #+NAME: fig:SED-HR4049
  12212. [[./img/a.png]]
  12213. @end example
  12214. When rendered, it may show as follows in the exported document:
  12215. @example
  12216. Figure 2: Bell curve
  12217. @end example
  12218. @vindex org-odt-category-map-alist
  12219. To modify the category component of the caption, customize the option
  12220. @code{org-odt-category-map-alist}. For example, to tag embedded images
  12221. with the string ``Illustration'' instead of the default string ``Figure'',
  12222. use the following setting:
  12223. @lisp
  12224. (setq org-odt-category-map-alist
  12225. '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
  12226. @end lisp
  12227. With the above modification, the previous example changes to:
  12228. @example
  12229. Illustration 2: Bell curve
  12230. @end example
  12231. @node Literal examples in ODT export
  12232. @subsection Literal examples in ODT export
  12233. The ODT export back-end supports literal examples (see @ref{Literal Examples}) with full fontification. Internally, the ODT export
  12234. back-end relies on @samp{htmlfontify.el} to generate the style definitions
  12235. needed for fancy listings. The auto-generated styles get @samp{OrgSrc}
  12236. prefix and inherit colors from the faces used by Emacs Font Lock
  12237. library for that source language.
  12238. @vindex org-odt-fontify-srcblocks
  12239. For custom fontification styles, customize the
  12240. @code{org-odt-create-custom-styles-for-srcblocks} option.
  12241. @vindex org-odt-create-custom-styles-for-srcblocks
  12242. To turn off fontification of literal examples, customize the
  12243. @code{org-odt-fontify-srcblocks} option.
  12244. @node Advanced topics in ODT export
  12245. @subsection Advanced topics in ODT export
  12246. The ODT export back-end has extensive features useful for power users
  12247. and frequent uses of ODT formats.
  12248. @anchor{Configuring a document converter}
  12249. @subsubheading Configuring a document converter
  12250. @cindex convert
  12251. @cindex doc, docx, rtf
  12252. @cindex converter
  12253. The ODT export back-end works with popular converters with little or
  12254. no extra configuration. See @ref{Extending ODT export}. The following is
  12255. for unsupported converters or tweaking existing defaults.
  12256. @table @asis
  12257. @item Register the converter
  12258. @vindex org-export-odt-convert-processes
  12259. Add the name of the converter to the @code{org-odt-convert-processes}
  12260. variable. Note that it also requires how the converter is
  12261. invoked on the command line. See the variable's docstring for
  12262. details.
  12263. @item Configure its capabilities
  12264. @vindex org-export-odt-convert-capabilities
  12265. Specify which formats the converter can handle by customizing the
  12266. variable @code{org-odt-convert-capabilities}. Use the entry for the
  12267. default values in this variable for configuring the new
  12268. converter. Also see its docstring for details.
  12269. @item Choose the converter
  12270. @vindex org-export-odt-convert-process
  12271. Select the newly added converter as the preferred one by
  12272. customizing the option @code{org-odt-convert-process}.
  12273. @end table
  12274. @anchor{Working with OpenDocument style files}
  12275. @subsubheading Working with OpenDocument style files
  12276. @cindex styles, custom
  12277. @cindex template, custom
  12278. This section explores the internals of the ODT exporter; the means by which
  12279. it produces styled documents; the use of automatic and custom OpenDocument
  12280. styles.
  12281. The ODT exporter relies on two files for generating its output. These
  12282. files are bundled with the distribution under the directory pointed to
  12283. by the variable @code{org-odt-styles-dir}. The two files are:
  12284. @table @asis
  12285. @item @samp{OrgOdtStyles.xml} @anchor{x-orgodtstyles-xml}
  12286. This file contributes to the @samp{styles.xml} file of the final ODT
  12287. document. This file gets modified for the following purposes:
  12288. @enumerate
  12289. @item
  12290. To control outline numbering based on user settings;
  12291. @item
  12292. To add styles generated by @samp{htmlfontify.el} for fontification of
  12293. code blocks.
  12294. @end enumerate
  12295. @item @samp{OrgOdtContentTemplate.xml} @anchor{x-orgodtcontenttemplate-xml}
  12296. This file contributes to the @samp{content.xml} file of the final ODT
  12297. document. The contents of the Org outline are inserted between the
  12298. @samp{<office:text>} @dots{} @samp{</office:text>} elements of this file.
  12299. Apart from serving as a template file for the final @samp{content.xml},
  12300. the file serves the following purposes:
  12301. @enumerate
  12302. @item
  12303. It contains automatic styles for formatting of tables which are
  12304. referenced by the exporter;
  12305. @item
  12306. It contains @samp{<text:sequence-decl>} @dots{} @samp{</text:sequence-decl>}
  12307. elements that control numbering of tables, images, equations, and
  12308. similar entities.
  12309. @end enumerate
  12310. @end table
  12311. @anchor{x-overriding-factory-styles} The following two variables control
  12312. the location from where the ODT exporter picks up the custom styles
  12313. and content template files. Customize these variables to override the
  12314. factory styles used by the exporter.
  12315. @table @asis
  12316. @item @code{org-odt-styles-file}
  12317. The ODT export back-end uses the file pointed to by this
  12318. variable, such as @samp{styles.xml}, for the final output. It can
  12319. take one of the following values:
  12320. @table @asis
  12321. @item @samp{FILE.xml}
  12322. Use this file instead of the default @samp{styles.xml}
  12323. @item @samp{FILE.odt} or @samp{FILE.ott}
  12324. Use the @samp{styles.xml} contained in the specified OpenDocument
  12325. Text or Template file
  12326. @item @samp{FILE.odt} or @samp{FILE.ott} and a subset of included files
  12327. Use the @samp{styles.xml} contained in the specified OpenDocument
  12328. Text or Template file. Additionally extract the specified
  12329. member files and embed those within the final ODT document.
  12330. Use this option if the @samp{styles.xml} file references additional
  12331. files like header and footer images.
  12332. @item @code{nil}
  12333. Use the default @samp{styles.xml}.
  12334. @end table
  12335. @item @code{org-odt-content-template-file}
  12336. Use this variable to specify the blank @samp{content.xml} used in the
  12337. final output.
  12338. @end table
  12339. @anchor{Creating one-off styles}
  12340. @subsubheading Creating one-off styles
  12341. The ODT export back-end can read embedded raw OpenDocument XML from
  12342. the Org file. Such direct formatting is useful for one-off instances.
  12343. @table @asis
  12344. @item Embedding ODT tags as part of regular text
  12345. Enclose OpenDocument syntax in @samp{@@@@odt:...@@@@} for inline markup.
  12346. For example, to highlight a region of text do the following:
  12347. @example
  12348. @@@@odt:<text:span text:style-name="Highlight">This is highlighted
  12349. text</text:span>@@@@. But this is regular text.
  12350. @end example
  12351. @strong{Hint:} To see the above example in action, edit the @samp{styles.xml}
  12352. (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @emph{Highlight} style as shown
  12353. below:
  12354. @example
  12355. <style:style style:name="Highlight" style:family="text">
  12356. <style:text-properties fo:background-color="#ff0000"/>
  12357. </style:style>
  12358. @end example
  12359. @item Embedding a one-line OpenDocument XML
  12360. @cindex @samp{ODT}, keyword
  12361. The ODT export back-end can read one-liner options with @samp{#+ODT:}
  12362. in the Org file. For example, to force a page break:
  12363. @example
  12364. #+ODT: <text:p text:style-name="PageBreak"/>
  12365. @end example
  12366. @strong{Hint:} To see the above example in action, edit your
  12367. @samp{styles.xml} (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @samp{PageBreak}
  12368. style as shown below.
  12369. @example
  12370. <style:style style:name="PageBreak" style:family="paragraph"
  12371. style:parent-style-name="Text_20_body">
  12372. <style:paragraph-properties fo:break-before="page"/>
  12373. </style:style>
  12374. @end example
  12375. @item Embedding a block of OpenDocument XML
  12376. The ODT export back-end can also read ODT export blocks for
  12377. OpenDocument XML. Such blocks use the @samp{#+BEGIN_EXPORT odt}
  12378. @dots{} @samp{#+END_EXPORT} constructs.
  12379. For example, to create a one-off paragraph that uses bold text,
  12380. do the following:
  12381. @example
  12382. #+BEGIN_EXPORT odt
  12383. <text:p text:style-name="Text_20_body_20_bold">
  12384. This paragraph is specially formatted and uses bold text.
  12385. </text:p>
  12386. #+END_EXPORT
  12387. @end example
  12388. @end table
  12389. @anchor{Customizing tables in ODT export}
  12390. @subsubheading Customizing tables in ODT export
  12391. @cindex tables, in ODT export
  12392. @cindex @samp{ATTR_ODT}, keyword
  12393. Override the default table format by specifying a custom table style
  12394. with the @samp{#+ATTR_ODT} line. For a discussion on default formatting of
  12395. tables, see @ref{Tables in ODT export}.
  12396. This feature closely mimics the way table templates are defined in the
  12397. OpenDocument-v1.2 specification.@footnote{@uref{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, OpenDocument-v1.2 Specification}}
  12398. @vindex org-odt-table-styles
  12399. For quick preview of this feature, install the settings below and export the
  12400. table that follows:
  12401. @lisp
  12402. (setq org-export-odt-table-styles
  12403. (append org-export-odt-table-styles
  12404. '(("TableWithHeaderRowAndColumn" "Custom"
  12405. ((use-first-row-styles . t)
  12406. (use-first-column-styles . t)))
  12407. ("TableWithFirstRowandLastRow" "Custom"
  12408. ((use-first-row-styles . t)
  12409. (use-last-row-styles . t))))))
  12410. @end lisp
  12411. @example
  12412. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12413. | Name | Phone | Age |
  12414. | Peter | 1234 | 17 |
  12415. | Anna | 4321 | 25 |
  12416. @end example
  12417. The example above used @samp{Custom} template and installed two table
  12418. styles @samp{TableWithHeaderRowAndColumn} and
  12419. @samp{TableWithFirstRowandLastRow}. @strong{Important:} The OpenDocument styles
  12420. needed for producing the above template were pre-defined. They are
  12421. available in the section marked @samp{Custom Table Template} in
  12422. @samp{OrgOdtContentTemplate.xml} (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}). For adding new
  12423. templates, define new styles there.
  12424. To use this feature proceed as follows:
  12425. @enumerate
  12426. @item
  12427. Create a table template@footnote{See the @samp{<table:table-template>} element of the
  12428. OpenDocument-v1.2 specification.}.
  12429. A table template is set of @samp{table-cell} and @samp{paragraph} styles for
  12430. each of the following table cell categories:
  12431. @itemize
  12432. @item
  12433. Body
  12434. @item
  12435. First column
  12436. @item
  12437. Last column
  12438. @item
  12439. First row
  12440. @item
  12441. Last row
  12442. @item
  12443. Even row
  12444. @item
  12445. Odd row
  12446. @item
  12447. Even column
  12448. @item
  12449. Odd Column
  12450. @end itemize
  12451. The names for the above styles must be chosen based on the name of
  12452. the table template using a well-defined convention.
  12453. The naming convention is better illustrated with an example. For
  12454. a table template with the name @samp{Custom}, the needed style names are
  12455. listed in the following table.
  12456. @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  12457. @headitem Cell type
  12458. @tab Cell style
  12459. @tab Paragraph style
  12460. @item Body
  12461. @tab @samp{CustomTableCell}
  12462. @tab @samp{CustomTableParagraph}
  12463. @item First column
  12464. @tab @samp{CustomFirstColumnTableCell}
  12465. @tab @samp{CustomFirstColumnTableParagraph}
  12466. @item Last column
  12467. @tab @samp{CustomLastColumnTableCell}
  12468. @tab @samp{CustomLastColumnTableParagraph}
  12469. @item First row
  12470. @tab @samp{CustomFirstRowTableCell}
  12471. @tab @samp{CustomFirstRowTableParagraph}
  12472. @item Last row
  12473. @tab @samp{CustomLastRowTableCell}
  12474. @tab @samp{CustomLastRowTableParagraph}
  12475. @item Even row
  12476. @tab @samp{CustomEvenRowTableCell}
  12477. @tab @samp{CustomEvenRowTableParagraph}
  12478. @item Odd row
  12479. @tab @samp{CustomOddRowTableCell}
  12480. @tab @samp{CustomOddRowTableParagraph}
  12481. @item Even column
  12482. @tab @samp{CustomEvenColumnTableCell}
  12483. @tab @samp{CustomEvenColumnTableParagraph}
  12484. @item Odd column
  12485. @tab @samp{CustomOddColumnTableCell}
  12486. @tab @samp{CustomOddColumnTableParagraph}
  12487. @end multitable
  12488. To create a table template with the name @samp{Custom}, define the above
  12489. styles in the @samp{<office:automatic-styles>} @dots{}
  12490. @samp{</office:automatic-styles>} element of the content template file
  12491. (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}).
  12492. @item
  12493. Define a table style@footnote{See the attributes @samp{table:template-name},
  12494. @samp{table:use-first-row-styles}, @samp{table:use-last-row-styles},
  12495. @samp{table:use-first-column-styles}, @samp{table:use-last-column-styles},
  12496. @samp{table:use-banding-rows-styles}, and @samp{table:use-banding-column-styles}
  12497. of the @samp{<table:table>} element in the OpenDocument-v1.2 specification.}.
  12498. @vindex org-odt-table-styles
  12499. To define a table style, create an entry for the style in the
  12500. variable @code{org-odt-table-styles} and specify the following:
  12501. @itemize
  12502. @item
  12503. the name of the table template created in step (1),
  12504. @item
  12505. the set of cell styles in that template that are to be activated.
  12506. @end itemize
  12507. For example, the entry below defines two different table styles
  12508. @samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow}
  12509. based on the same template @samp{Custom}. The styles achieve their
  12510. intended effect by selectively activating the individual cell
  12511. styles in that template.
  12512. @lisp
  12513. (setq org-export-odt-table-styles
  12514. (append org-export-odt-table-styles
  12515. '(("TableWithHeaderRowAndColumn" "Custom"
  12516. ((use-first-row-styles . t)
  12517. (use-first-column-styles . t)))
  12518. ("TableWithFirstRowandLastRow" "Custom"
  12519. ((use-first-row-styles . t)
  12520. (use-last-row-styles . t))))))
  12521. @end lisp
  12522. @item
  12523. Associate a table with the table style.
  12524. To do this, specify the table style created in step (2) as part of
  12525. the @samp{ATTR_ODT} line as shown below.
  12526. @example
  12527. #+ATTR_ODT: :style TableWithHeaderRowAndColumn
  12528. | Name | Phone | Age |
  12529. | Peter | 1234 | 17 |
  12530. | Anna | 4321 | 25 |
  12531. @end example
  12532. @end enumerate
  12533. @anchor{Validating OpenDocument XML}
  12534. @subsubheading Validating OpenDocument XML
  12535. Sometimes ODT format files may not open due to @samp{.odt} file corruption.
  12536. To verify if such a file is corrupt, validate it against the
  12537. OpenDocument Relax NG Compact (RNC) syntax schema. But first the
  12538. @samp{.odt} files have to be decompressed using @samp{zip}. Note that @samp{.odt}
  12539. files are ZIP archives: @ref{File Archives,,,emacs,}. The contents of
  12540. ODT files are in XML. For general help with validation---and
  12541. schema-sensitive editing---of XML files:
  12542. @ref{Introduction,,,nxml-mode,}.
  12543. @vindex org-export-odt-schema-dir
  12544. Customize @code{org-odt-schema-dir} to point to a directory with
  12545. OpenDocument RNC files and the needed schema-locating rules. The ODT
  12546. export back-end takes care of updating the
  12547. @code{rng-schema-locating-files}.
  12548. @node Org Export
  12549. @section Org Export
  12550. @cindex Org export
  12551. @emph{org} export back-end creates a normalized version of the Org document
  12552. in current buffer. The exporter evaluates Babel code (see @ref{Evaluating Code Blocks}) and removes content specific to other back-ends.
  12553. @anchor{Org export commands}
  12554. @subheading Org export commands
  12555. @table @asis
  12556. @item @kbd{C-c C-e O o} (@code{org-org-export-to-org})
  12557. @kindex C-c C-e O o
  12558. @findex org-org-export-to-org
  12559. Export as an Org file with a @samp{.org} extension. For @samp{myfile.org},
  12560. Org exports to @samp{myfile.org.org}, overwriting without warning.
  12561. @item @kbd{C-c C-e O v} (~~)
  12562. @kindex C-c C-e O v
  12563. Export to an Org file, then open it.
  12564. @end table
  12565. @node Texinfo Export
  12566. @section Texinfo Export
  12567. @menu
  12568. * Texinfo export commands:: Invoking commands.
  12569. * Texinfo specific export settings:: Setting the environment.
  12570. * Texinfo file header:: Generating the header.
  12571. * Texinfo title and copyright page:: Creating preamble pages.
  12572. * Info directory file:: Installing a manual in Info file hierarchy.
  12573. * Headings and sectioning structure:: Building document structure.
  12574. * Indices:: Creating indices.
  12575. * Quoting Texinfo code:: Incorporating literal Texinfo code.
  12576. * Plain lists in Texinfo export:: List attributes.
  12577. * Tables in Texinfo export:: Table attributes.
  12578. * Images in Texinfo export:: Image attributes.
  12579. * Special blocks in Texinfo export:: Special block attributes.
  12580. * A Texinfo example:: Processing Org to Texinfo.
  12581. @end menu
  12582. @node Texinfo export commands
  12583. @subsection Texinfo export commands
  12584. @table @asis
  12585. @item @kbd{C-c C-e i t} (@code{org-texinfo-export-to-texinfo})
  12586. @kindex C-c C-e i t
  12587. @findex org-texinfo-export-to-texinfo
  12588. Export as a Texinfo file with @samp{.texi} extension. For
  12589. @samp{myfile.org}, Org exports to @samp{myfile.texi}, overwriting without
  12590. warning.
  12591. @item @kbd{C-c C-e i i} (@code{org-texinfo-export-to-info})
  12592. @kindex C-c C-e i i
  12593. @findex org-texinfo-export-to-info
  12594. @vindex org-texinfo-info-process
  12595. Export to Texinfo format first and then process it to make an
  12596. Info file. To generate other formats, such as DocBook, customize
  12597. the @code{org-texinfo-info-process} variable.
  12598. @end table
  12599. @node Texinfo specific export settings
  12600. @subsection Texinfo specific export settings
  12601. The Texinfo export back-end has several additional keywords for
  12602. customizing Texinfo output. Setting these keywords works similar to
  12603. the general options (see @ref{Export Settings}).
  12604. @table @asis
  12605. @item @samp{SUBTITLE}
  12606. @cindex @samp{SUBTITLE}, keyword
  12607. The document subtitle.
  12608. @item @samp{SUBAUTHOR}
  12609. @cindex @samp{SUBAUTHOR}, keyword
  12610. Additional authors for the document.
  12611. @item @samp{TEXINFO_FILENAME}
  12612. @cindex @samp{TEXINFO_FILENAME}, keyword
  12613. The Texinfo filename.
  12614. @item @samp{TEXINFO_CLASS}
  12615. @cindex @samp{TEXINFO_CLASS}, keyword
  12616. @vindex org-texinfo-default-class
  12617. The default document class (@code{org-texinfo-default-class}), which
  12618. must be a member of @code{org-texinfo-classes}.
  12619. @item @samp{TEXINFO_HEADER}
  12620. @cindex @samp{TEXINFO_HEADER}, keyword
  12621. Arbitrary lines inserted at the end of the header.
  12622. @item @samp{TEXINFO_POST_HEADER}
  12623. @cindex @samp{TEXINFO_POST_HEADER}, keyword
  12624. Arbitrary lines inserted after the end of the header.
  12625. @item @samp{TEXINFO_DIR_CATEGORY}
  12626. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12627. The directory category of the document.
  12628. @item @samp{TEXINFO_DIR_TITLE}
  12629. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12630. The directory title of the document.
  12631. @item @samp{TEXINFO_DIR_DESC}
  12632. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12633. The directory description of the document.
  12634. @item @samp{TEXINFO_PRINTED_TITLE}
  12635. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12636. The printed title of the document.
  12637. @end table
  12638. @node Texinfo file header
  12639. @subsection Texinfo file header
  12640. @cindex @samp{TEXINFO_FILENAME}, keyword
  12641. After creating the header for a Texinfo file, the Texinfo back-end
  12642. automatically generates a name and destination path for the Info file.
  12643. To override this default with a more sensible path and name, specify
  12644. the @samp{TEXINFO_FILENAME} keyword.
  12645. @vindex org-texinfo-coding-system
  12646. @cindex @samp{TEXINFO_HEADER}, keyword
  12647. Along with the output's file name, the Texinfo header also contains
  12648. language details (see @ref{Export Settings}) and encoding system as set in
  12649. the @code{org-texinfo-coding-system} variable. Insert @samp{TEXINFO_HEADER}
  12650. keywords for each additional command in the header, for example:
  12651. @example
  12652. #+TEXINFO_HEADER: @@synindex
  12653. @end example
  12654. @cindex @samp{TEXINFO_CLASS}, keyword
  12655. @vindex org-texinfo-classes
  12656. Instead of repeatedly installing the same set of commands, define
  12657. a class in @code{org-texinfo-classes} once, and then activate it in the
  12658. document by setting the @samp{TEXINFO_CLASS} keyword to that class.
  12659. @node Texinfo title and copyright page
  12660. @subsection Texinfo title and copyright page
  12661. @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword
  12662. The default template for hard copy output has a title page with
  12663. @samp{TITLE} and @samp{AUTHOR} keywords (see @ref{Export Settings}). To replace the
  12664. regular title with something different for the printed version, use
  12665. the @samp{TEXINFO_PRINTED_TITLE} and @samp{SUBTITLE} keywords. Both expect raw
  12666. Texinfo code for setting their values.
  12667. @cindex @samp{SUBAUTHOR}, keyword
  12668. If one @samp{AUTHOR} line is not sufficient, add multiple @samp{SUBAUTHOR}
  12669. keywords. They have to be set in raw Texinfo code.
  12670. @example
  12671. #+AUTHOR: Jane Smith
  12672. #+SUBAUTHOR: John Doe
  12673. #+TEXINFO_PRINTED_TITLE: This Long Title@@@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@}
  12674. @end example
  12675. @cindex @samp{COPYING}, property
  12676. Copying material is defined in a dedicated headline with a non-@code{nil}
  12677. @samp{COPYING} property. The back-end inserts the contents within
  12678. a @samp{@@copying} command at the beginning of the document. The heading
  12679. itself does not appear in the structure of the document.
  12680. Copyright information is printed on the back of the title page.
  12681. @example
  12682. * Legalese
  12683. :PROPERTIES:
  12684. :COPYING: t
  12685. :END:
  12686. This is a short example of a complete Texinfo file, version 1.0.
  12687. Copyright \copy 2016 Free Software Foundation, Inc.
  12688. @end example
  12689. @node Info directory file
  12690. @subsection Info directory file
  12691. @cindex @samp{dir} file, in Texinfo export
  12692. @cindex Info directory file, in Texinfo export
  12693. @cindex @code{install-info}, in Texinfo export
  12694. @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword
  12695. @cindex @samp{TEXINFO_DIR_TITLE}, keyword
  12696. @cindex @samp{TEXINFO_DIR_DESC}, keyword
  12697. The end result of the Texinfo export process is the creation of an
  12698. Info file. This Info file's metadata has variables for category,
  12699. title, and description: @samp{TEXINFO_DIR_CATEGORY}, @samp{TEXINFO_DIR_TITLE},
  12700. and @samp{TEXINFO_DIR_DESC} keywords that establish where in the Info
  12701. hierarchy the file fits.
  12702. Here is an example that writes to the Info directory file:
  12703. @example
  12704. #+TEXINFO_DIR_CATEGORY: Emacs
  12705. #+TEXINFO_DIR_TITLE: Org Mode: (org)
  12706. #+TEXINFO_DIR_DESC: Outline-based notes management and organizer
  12707. @end example
  12708. @node Headings and sectioning structure
  12709. @subsection Headings and sectioning structure
  12710. @vindex org-texinfo-classes
  12711. @vindex org-texinfo-default-class
  12712. @cindex @samp{TEXINFO_CLASS}, keyword
  12713. The Texinfo export back-end uses a pre-defined scheme to convert Org
  12714. headlines to equivalent Texinfo structuring commands. A scheme like
  12715. this maps top-level headlines to numbered chapters tagged as
  12716. @code{@@chapter} and lower-level headlines to unnumbered chapters tagged as
  12717. @code{@@unnumbered}. To override such mappings to introduce @code{@@part} or
  12718. other Texinfo structuring commands, define a new class in
  12719. @code{org-texinfo-classes}. Activate the new class with the
  12720. @samp{TEXINFO_CLASS} keyword. When no new class is defined and activated,
  12721. the Texinfo export back-end defaults to the
  12722. @code{org-texinfo-default-class}.
  12723. If an Org headline's level has no associated Texinfo structuring
  12724. command, or is below a certain threshold (see @ref{Export Settings}), then
  12725. the Texinfo export back-end makes it into a list item.
  12726. @cindex @samp{APPENDIX}, property
  12727. The Texinfo export back-end makes any headline with a non-@code{nil}
  12728. @samp{APPENDIX} property into an appendix. This happens independent of the
  12729. Org headline level or the @samp{TEXINFO_CLASS} keyword.
  12730. @cindex @samp{ALT_TITLE}, property
  12731. @cindex @samp{DESCRIPTION}, property
  12732. The Texinfo export back-end creates a menu entry after the Org
  12733. headline for each regular sectioning structure. To override this with
  12734. 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
  12735. @samp{DESCRIPTION} property. Here's an example that uses both to override
  12736. the default menu entry:
  12737. @example
  12738. * Controlling Screen Display
  12739. :PROPERTIES:
  12740. :ALT_TITLE: Display
  12741. :DESCRIPTION: Controlling Screen Display
  12742. :END:
  12743. @end example
  12744. @cindex Top node, in Texinfo export
  12745. The text before the first headline belongs to the @emph{Top} node, i.e.,
  12746. the node in which a reader enters an Info manual. As such, it is
  12747. expected not to appear in printed output generated from the @samp{.texi}
  12748. file. See @ref{The Top Node,,,texinfo,}, for more information.
  12749. @node Indices
  12750. @subsection Indices
  12751. @cindex @samp{CINDEX}, keyword
  12752. @cindex concept index, in Texinfo export
  12753. @cindex @samp{FINDEX}, keyword
  12754. @cindex function index, in Texinfo export
  12755. @cindex @samp{KINDEX}, keyword
  12756. @cindex keystroke index, in Texinfo export
  12757. @cindex @samp{PINDEX}, keyword
  12758. @cindex program index, in Texinfo export
  12759. @cindex @samp{TINDEX}, keyword
  12760. @cindex data type index, in Texinfo export
  12761. @cindex @samp{VINDEX}, keyword
  12762. @cindex variable index, in Texinfo export
  12763. The Texinfo export back-end recognizes these indexing keywords if used
  12764. in the Org file: @samp{CINDEX}, @samp{FINDEX}, @samp{KINDEX}, @samp{PINDEX}, @samp{TINDEX} and
  12765. @samp{VINDEX}. Write their value as verbatim Texinfo code; in particular,
  12766. @samp{@{}, @samp{@}} and @samp{@@} characters need to be escaped with @samp{@@} if they do not
  12767. belong to a Texinfo command.
  12768. @example
  12769. #+CINDEX: Defining indexing entries
  12770. @end example
  12771. @cindex @samp{INDEX}, property
  12772. For the back-end to generate an index entry for a headline, set the
  12773. @samp{INDEX} property to @samp{cp} or @samp{vr}. These abbreviations come from
  12774. Texinfo that stand for concept index and variable index. The Texinfo
  12775. manual has abbreviations for all other kinds of indexes. The back-end
  12776. exports the headline as an unnumbered chapter or section command, and
  12777. then inserts the index after its contents.
  12778. @example
  12779. * Concept Index
  12780. :PROPERTIES:
  12781. :INDEX: cp
  12782. :END:
  12783. @end example
  12784. @node Quoting Texinfo code
  12785. @subsection Quoting Texinfo code
  12786. Use any of the following three methods to insert or escape raw Texinfo
  12787. code:
  12788. @cindex @samp{TEXINFO}, keyword
  12789. @cindex @samp{BEGIN_EXPORT texinfo}
  12790. @example
  12791. Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU.
  12792. #+TEXINFO: @@need800
  12793. This paragraph is preceded by...
  12794. #+BEGIN_EXPORT texinfo
  12795. @@auindex Johnson, Mark
  12796. @@auindex Lakoff, George
  12797. #+END_EXPORT
  12798. @end example
  12799. @node Plain lists in Texinfo export
  12800. @subsection Plain lists in Texinfo export
  12801. @cindex @samp{ATTR_TEXINFO}, keyword
  12802. @cindex two-column tables, in Texinfo export
  12803. @cindex table types, in Texinfo export
  12804. The Texinfo export back-end by default converts description lists in
  12805. the Org file using the default command @samp{@@table}, which results in
  12806. a table with two columns. To change this behavior, specify
  12807. @samp{:table-type} with @samp{ftable} or @samp{vtable} attributes. For more
  12808. information, see @ref{Two-column Tables,,,texinfo,}.
  12809. @vindex org-texinfo-table-default-markup
  12810. The Texinfo export back-end by default also applies a text highlight
  12811. based on the defaults stored in @code{org-texinfo-table-default-markup}.
  12812. To override the default highlight command, specify another one with
  12813. the @samp{:indic} attribute.
  12814. @cindex multiple items in Texinfo lists
  12815. Org syntax is limited to one entry per list item. Nevertheless, the
  12816. Texinfo export back-end can split that entry according to any text
  12817. provided through the @samp{:sep} attribute. Each part then becomes a new
  12818. entry in the first column of the table.
  12819. The following example illustrates all the attributes above:
  12820. @example
  12821. #+ATTR_TEXINFO: :table-type vtable :sep , :indic asis
  12822. - foo, bar :: This is the common text for variables foo and bar.
  12823. @end example
  12824. @noindent
  12825. becomes
  12826. @example
  12827. @@vtable @@asis
  12828. @@item foo
  12829. @@itemx bar
  12830. This is the common text for variables foo and bar.
  12831. @@end table
  12832. @end example
  12833. @node Tables in Texinfo export
  12834. @subsection Tables in Texinfo export
  12835. @cindex @samp{ATTR_TEXINFO}, keyword
  12836. When exporting tables, the Texinfo export back-end uses the widest
  12837. cell width in each column. To override this and instead specify as
  12838. fractions of line length, use the @samp{:columns} attribute. See example
  12839. below.
  12840. @example
  12841. #+ATTR_TEXINFO: :columns .5 .5
  12842. | a cell | another cell |
  12843. @end example
  12844. @node Images in Texinfo export
  12845. @subsection Images in Texinfo export
  12846. @cindex @samp{ATTR_TEXINFO}, keyword
  12847. Insert a file link to the image in the Org file, and the Texinfo
  12848. export back-end inserts the image. These links must have the usual
  12849. supported image extensions and no descriptions. To scale the image,
  12850. use @samp{:width} and @samp{:height} attributes. For alternate text, use @samp{:alt}
  12851. and specify the text using Texinfo code, as shown in the example:
  12852. @example
  12853. #+ATTR_TEXINFO: :width 1in :alt Alternate @@i@{text@}
  12854. [[ridt.pdf]]
  12855. @end example
  12856. @node Special blocks in Texinfo export
  12857. @subsection Special blocks in Texinfo export
  12858. @cindex @samp{ATTR_TEXINFO}, keyword
  12859. The Texinfo export back-end converts special blocks to commands with
  12860. the same name. It also adds any @samp{:options} attributes to the end of
  12861. the command, as shown in this example:
  12862. @example
  12863. #+ATTR_TEXINFO: :options org-org-export-to-org ...
  12864. #+BEGIN_defun
  12865. A somewhat obsessive function name.
  12866. #+END_defun
  12867. @end example
  12868. @noindent
  12869. becomes
  12870. @example
  12871. @@defun org-org-export-to-org ...
  12872. A somewhat obsessive function name.
  12873. @@end defun
  12874. @end example
  12875. @node A Texinfo example
  12876. @subsection A Texinfo example
  12877. Here is a more detailed example Org file. See
  12878. @ref{GNU Sample Texts,,,texinfo,} for an equivalent example using
  12879. Texinfo code.
  12880. @example
  12881. #+TITLE: GNU Sample @{@{@{version@}@}@}
  12882. #+SUBTITLE: for version @{@{@{version@}@}@}, @{@{@{updated@}@}@}
  12883. #+AUTHOR: A.U. Thor
  12884. #+EMAIL: bug-sample@@gnu.org
  12885. #+OPTIONS: ':t toc:t author:t email:t
  12886. #+LANGUAGE: en
  12887. #+MACRO: version 2.0
  12888. #+MACRO: updated last updated 4 March 2014
  12889. #+TEXINFO_FILENAME: sample.info
  12890. #+TEXINFO_HEADER: @@syncodeindex pg cp
  12891. #+TEXINFO_DIR_CATEGORY: Texinfo documentation system
  12892. #+TEXINFO_DIR_TITLE: sample: (sample)
  12893. #+TEXINFO_DIR_DESC: Invoking sample
  12894. #+TEXINFO_PRINTED_TITLE: GNU Sample
  12895. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12896. @{@{@{updated@}@}@}).
  12897. * Copying
  12898. :PROPERTIES:
  12899. :COPYING: t
  12900. :END:
  12901. This manual is for GNU Sample (version @{@{@{version@}@}@},
  12902. @{@{@{updated@}@}@}), which is an example in the Texinfo documentation.
  12903. Copyright \copy 2016 Free Software Foundation, Inc.
  12904. #+BEGIN_QUOTE
  12905. Permission is granted to copy, distribute and/or modify this
  12906. document under the terms of the GNU Free Documentation License,
  12907. Version 1.3 or any later version published by the Free Software
  12908. Foundation; with no Invariant Sections, with no Front-Cover Texts,
  12909. and with no Back-Cover Texts. A copy of the license is included in
  12910. the section entitled "GNU Free Documentation License".
  12911. #+END_QUOTE
  12912. * Invoking sample
  12913. #+PINDEX: sample
  12914. #+CINDEX: invoking @@command@{sample@}
  12915. This is a sample manual. There is no sample program to invoke, but
  12916. if there were, you could see its basic usage and command line
  12917. options here.
  12918. * GNU Free Documentation License
  12919. :PROPERTIES:
  12920. :APPENDIX: t
  12921. :END:
  12922. #+TEXINFO: @@include fdl.texi
  12923. * Index
  12924. :PROPERTIES:
  12925. :INDEX: cp
  12926. :END:
  12927. @end example
  12928. @node iCalendar Export
  12929. @section iCalendar Export
  12930. @cindex iCalendar export
  12931. A large part of Org mode's interoperability success is its ability to
  12932. easily export to or import from external applications. The iCalendar
  12933. export back-end takes calendar data from Org files and exports to the
  12934. standard iCalendar format.
  12935. @vindex org-icalendar-include-todo
  12936. @vindex org-icalendar-use-deadline
  12937. @vindex org-icalendar-use-scheduled
  12938. The iCalendar export back-end can also incorporate TODO entries based
  12939. on the configuration of the @code{org-icalendar-include-todo} variable.
  12940. The back-end exports plain timestamps as @samp{VEVENT}, TODO items as
  12941. @samp{VTODO}, and also create events from deadlines that are in non-TODO
  12942. items. The back-end uses the deadlines and scheduling dates in Org
  12943. TODO items for setting the start and due dates for the iCalendar TODO
  12944. entry. Consult the @code{org-icalendar-use-deadline} and
  12945. @code{org-icalendar-use-scheduled} variables for more details.
  12946. @vindex org-icalendar-categories
  12947. @vindex org-icalendar-alarm-time
  12948. For tags on the headline, the iCalendar export back-end makes them
  12949. into iCalendar categories. To tweak the inheritance of tags and TODO
  12950. states, configure the variable @code{org-icalendar-categories}. To assign
  12951. clock alarms based on time, configure the @code{org-icalendar-alarm-time}
  12952. variable.
  12953. @vindex org-icalendar-store-UID
  12954. @cindex @samp{ID}, property
  12955. The iCalendar format standard requires globally unique identifier---or
  12956. UID---for each entry. The iCalendar export back-end creates UIDs
  12957. during export. To save a copy of the UID in the Org file set the
  12958. variable @code{org-icalendar-store-UID}. The back-end looks for the @samp{ID}
  12959. property of the entry for re-using the same UID for subsequent
  12960. exports.
  12961. Since a single Org entry can result in multiple iCalendar
  12962. entries---timestamp, deadline, scheduled item, or TODO item---Org adds
  12963. prefixes to the UID, depending on which part of the Org entry
  12964. triggered the creation of the iCalendar entry. Prefixing ensures UIDs
  12965. remains unique, yet enable synchronization programs trace the
  12966. connections.
  12967. @table @asis
  12968. @item @kbd{C-c C-e c f} (@code{org-icalendar-export-to-ics})
  12969. @kindex C-c C-e c f
  12970. @findex org-icalendar-export-to-ics
  12971. Create iCalendar entries from the current Org buffer and store
  12972. them in the same directory, using a file extension @samp{.ics}.
  12973. @item @kbd{C-c C-e c a} (@code{org-icalendar-export-agenda-files})
  12974. @kindex C-c C-e c a
  12975. @findex org-icalendar-export-agenda-files
  12976. Create iCalendar entries from Org files in @code{org-agenda-files} and
  12977. store in a separate iCalendar file for each Org file.
  12978. @item @kbd{C-c C-e c c} (@code{org-icalendar-combine-agenda-files})
  12979. @kindex C-c C-e c c
  12980. @findex org-icalendar-combine-agenda-files
  12981. @vindex org-icalendar-combined-agenda-file
  12982. Create a combined iCalendar file from Org files in
  12983. @code{org-agenda-files} and write it to
  12984. @code{org-icalendar-combined-agenda-file} file name.
  12985. @end table
  12986. @cindex @samp{SUMMARY}, property
  12987. @cindex @samp{DESCRIPTION}, property
  12988. @cindex @samp{LOCATION}, property
  12989. @cindex @samp{TIMEZONE}, property
  12990. The iCalendar export back-end includes @samp{SUMMARY}, @samp{DESCRIPTION},
  12991. @samp{LOCATION} and @samp{TIMEZONE} properties from the Org entries when
  12992. exporting. To force the back-end to inherit the @samp{LOCATION} and
  12993. @samp{TIMEZONE} properties, configure the @code{org-use-property-inheritance}
  12994. variable.
  12995. @vindex org-icalendar-include-body
  12996. When Org entries do not have @samp{SUMMARY}, @samp{DESCRIPTION} and @samp{LOCATION}
  12997. properties, the iCalendar export back-end derives the summary from the
  12998. headline, and derives the description from the body of the Org item.
  12999. The @code{org-icalendar-include-body} variable limits the maximum number of
  13000. characters of the content are turned into its description.
  13001. The @samp{TIMEZONE} property can be used to specify a per-entry time zone,
  13002. and is applied to any entry with timestamp information. Time zones
  13003. should be specified as per the IANA time zone database format, e.g.,
  13004. @samp{Asia/Almaty}. Alternately, the property value can be @samp{UTC}, to force
  13005. UTC time for this entry only.
  13006. Exporting to iCalendar format depends in large part on the
  13007. capabilities of the destination application. Some are more lenient
  13008. than others. Consult the Org mode FAQ for advice on specific
  13009. applications.
  13010. @node Other Built-in Back-ends
  13011. @section Other Built-in Back-ends
  13012. Other export back-ends included with Org are:
  13013. @itemize
  13014. @item
  13015. @samp{ox-man.el}: Export to a man page.
  13016. @end itemize
  13017. To activate such back-ends, either customize @code{org-export-backends} or
  13018. load directly with @code{(require 'ox-man)}. On successful load, the
  13019. back-end adds new keys in the export dispatcher (see @ref{The Export Dispatcher}).
  13020. Follow the comment section of such files, for example, @samp{ox-man.el},
  13021. for usage and configuration details.
  13022. @node Advanced Configuration
  13023. @section Advanced Configuration
  13024. @anchor{Hooks}
  13025. @subheading Hooks
  13026. @vindex org-export-before-processing-hook
  13027. @vindex org-export-before-parsing-hook
  13028. The export process executes two hooks before the actual exporting
  13029. begins. The first hook, @code{org-export-before-processing-hook}, runs
  13030. before any expansions of macros, Babel code, and include keywords in
  13031. the buffer. The second hook, @code{org-export-before-parsing-hook}, runs
  13032. before the buffer is parsed.
  13033. Functions added to these hooks are called with a single argument: the
  13034. export back-end actually used, as a symbol. You may use them for
  13035. heavy duty structural modifications of the document. For example, you
  13036. can remove every headline in the buffer during export like this:
  13037. @lisp
  13038. (defun my-headline-removal (backend)
  13039. "Remove all headlines in the current buffer.
  13040. BACKEND is the export back-end being used, as a symbol."
  13041. (org-map-entries
  13042. (lambda () (delete-region (point) (line-beginning-position 2)))))
  13043. (add-hook 'org-export-before-parsing-hook 'my-headline-removal)
  13044. @end lisp
  13045. @anchor{Filters}
  13046. @subheading Filters
  13047. @cindex Filters, exporting
  13048. Filters are lists of functions to be applied to certain parts for
  13049. a given back-end. The output from the first function in the filter is
  13050. passed on to the next function in the filter. The final output is the
  13051. output from the final function in the filter.
  13052. The Org export process has many filter sets applicable to different
  13053. types of objects, plain text, parse trees, export options, and final
  13054. output formats. The filters are named after the element type or
  13055. object type: @code{org-export-filter-TYPE-functions}, where @var{TYPE}
  13056. is the type targeted by the filter. Valid types are:
  13057. @multitable @columnfractions 0.33 0.33 0.33
  13058. @item body
  13059. @tab bold
  13060. @tab babel-call
  13061. @item center-block
  13062. @tab clock
  13063. @tab code
  13064. @item diary-sexp
  13065. @tab drawer
  13066. @tab dynamic-block
  13067. @item entity
  13068. @tab example-block
  13069. @tab export-block
  13070. @item export-snippet
  13071. @tab final-output
  13072. @tab fixed-width
  13073. @item footnote-definition
  13074. @tab footnote-reference
  13075. @tab headline
  13076. @item horizontal-rule
  13077. @tab inline-babel-call
  13078. @tab inline-src-block
  13079. @item inlinetask
  13080. @tab italic
  13081. @tab item
  13082. @item keyword
  13083. @tab latex-environment
  13084. @tab latex-fragment
  13085. @item line-break
  13086. @tab link
  13087. @tab node-property
  13088. @item options
  13089. @tab paragraph
  13090. @tab parse-tree
  13091. @item plain-list
  13092. @tab plain-text
  13093. @tab planning
  13094. @item property-drawer
  13095. @tab quote-block
  13096. @tab radio-target
  13097. @item section
  13098. @tab special-block
  13099. @tab src-block
  13100. @item statistics-cookie
  13101. @tab strike-through
  13102. @tab subscript
  13103. @item superscript
  13104. @tab table
  13105. @tab table-cell
  13106. @item table-row
  13107. @tab target
  13108. @tab timestamp
  13109. @item underline
  13110. @tab verbatim
  13111. @tab verse-block
  13112. @end multitable
  13113. Here is an example filter that replaces non-breaking spaces @code{ } in the
  13114. Org buffer with @samp{~} for the @LaTeX{} back-end.
  13115. @lisp
  13116. (defun my-latex-filter-nobreaks (text backend info)
  13117. "Ensure \" \" are properly handled in LaTeX export."
  13118. (when (org-export-derived-backend-p backend 'latex)
  13119. (replace-regexp-in-string " " "~" text)))
  13120. (add-to-list 'org-export-filter-plain-text-functions
  13121. 'my-latex-filter-nobreaks)
  13122. @end lisp
  13123. A filter requires three arguments: the code to be transformed, the
  13124. name of the back-end, and some optional information about the export
  13125. process. The third argument can be safely ignored. Note the use of
  13126. @code{org-export-derived-backend-p} predicate that tests for @emph{latex}
  13127. back-end or any other back-end, such as @emph{beamer}, derived from
  13128. @emph{latex}.
  13129. @anchor{Defining filters for individual files}
  13130. @subheading Defining filters for individual files
  13131. The Org export can filter not just for back-ends, but also for
  13132. specific files through the @samp{BIND} keyword. Here is an example with
  13133. two filters; one removes brackets from time stamps, and the other
  13134. removes strike-through text. The filter functions are defined in
  13135. a code block in the same Org file, which is a handy location for
  13136. debugging.
  13137. @example
  13138. #+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
  13139. #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
  13140. #+BEGIN_SRC emacs-lisp :exports results :results none
  13141. (defun tmp-f-timestamp (s backend info)
  13142. (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
  13143. (defun tmp-f-strike-through (s backend info) "")
  13144. #+END_SRC
  13145. @end example
  13146. @anchor{Extending an existing back-end}
  13147. @subheading Extending an existing back-end
  13148. Some parts of the conversion process can be extended for certain
  13149. elements so as to introduce a new or revised translation. That is how
  13150. the HTML export back-end was extended to handle Markdown format. The
  13151. extensions work seamlessly so any aspect of filtering not done by the
  13152. extended back-end is handled by the original back-end. Of all the
  13153. export customization in Org, extending is very powerful as it operates
  13154. at the parser level.
  13155. For this example, make the @emph{ascii} back-end display the language used
  13156. in a source code block. Also make it display only when some attribute
  13157. is non-@code{nil}, like the following:
  13158. @example
  13159. #+ATTR_ASCII: :language t
  13160. @end example
  13161. Then extend ASCII back-end with a custom ``my-ascii'' back-end.
  13162. @lisp
  13163. (defun my-ascii-src-block (src-block contents info)
  13164. "Transcode a SRC-BLOCK element from Org to ASCII.
  13165. CONTENTS is nil. INFO is a plist used as a communication
  13166. channel."
  13167. (if (not (org-export-read-attribute :attr_ascii src-block :language))
  13168. (org-export-with-backend 'ascii src-block contents info)
  13169. (concat
  13170. (format ",--[ %s ]--\n%s`----"
  13171. (org-element-property :language src-block)
  13172. (replace-regexp-in-string
  13173. "^" "| "
  13174. (org-element-normalize-string
  13175. (org-export-format-code-default src-block info)))))))
  13176. (org-export-define-derived-backend 'my-ascii 'ascii
  13177. :translate-alist '((src-block . my-ascii-src-block)))
  13178. @end lisp
  13179. The @code{my-ascii-src-block} function looks at the attribute above the
  13180. current element. If not true, hands over to @emph{ascii} back-end. If
  13181. true, which it is in this example, it creates a box around the code
  13182. and leaves room for the inserting a string for language. The last
  13183. form creates the new back-end that springs to action only when
  13184. translating @code{src-block} type elements.
  13185. To use the newly defined back-end, evaluate the following from an Org
  13186. buffer:
  13187. @lisp
  13188. (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
  13189. @end lisp
  13190. Further steps to consider would be an interactive function,
  13191. self-installing an item in the export dispatcher menu, and other
  13192. user-friendly improvements.
  13193. @node Export in Foreign Buffers
  13194. @section Export in Foreign Buffers
  13195. The export back-ends in Org often include commands to convert selected
  13196. regions. A convenient feature of this in-place conversion is that the
  13197. exported output replaces the original source. Here are such
  13198. functions:
  13199. @table @asis
  13200. @item @code{org-html-convert-region-to-html}
  13201. @findex org-html-convert-region-to-html
  13202. Convert the selected region into HTML.
  13203. @item @code{org-latex-convert-region-to-latex}
  13204. @findex org-latex-convert-region-to-latex
  13205. Convert the selected region into @LaTeX{}.
  13206. @item @code{org-texinfo-convert-region-to-texinfo}
  13207. @findex org-texinfo-convert-region-to-texinfo
  13208. Convert the selected region into Texinfo.
  13209. @item @code{org-md-convert-region-to-md}
  13210. @findex org-md-convert-region-to-md
  13211. Convert the selected region into Markdown.
  13212. @end table
  13213. In-place conversions are particularly handy for quick conversion of
  13214. tables and lists in foreign buffers. For example, turn on the minor
  13215. mode @kbd{M-x orgstruct-mode} in an HTML buffer, then use the
  13216. convenient Org keyboard commands to create a list, select it, and
  13217. covert it to HTML with @kbd{M-x org-html-convert-region-to-html}.
  13218. @node Publishing
  13219. @chapter Publishing
  13220. @cindex publishing
  13221. Org includes a publishing management system that allows you to
  13222. configure automatic HTML conversion of @emph{projects} composed of
  13223. interlinked Org files. You can also configure Org to automatically
  13224. upload your exported HTML pages and related attachments, such as
  13225. images and source code files, to a web server.
  13226. You can also use Org to convert files into PDF, or even combine HTML
  13227. and PDF conversion so that files are available in both formats on the
  13228. server.
  13229. Publishing has been contributed to Org by David O'Toole.
  13230. @menu
  13231. * Configuration:: Defining projects.
  13232. * Uploading Files:: How to get files up on the server.
  13233. * Sample Configuration:: Example projects.
  13234. * Triggering Publication:: Publication commands.
  13235. @end menu
  13236. @node Configuration
  13237. @section Configuration
  13238. Publishing needs significant configuration to specify files,
  13239. destination and many other properties of a project.
  13240. @menu
  13241. * Project alist:: The central configuration variable.
  13242. * Sources and destinations:: From here to there.
  13243. * Selecting files:: What files are part of the project?
  13244. * Publishing action:: Setting the function doing the publishing.
  13245. * Publishing options:: Tweaking HTML/@LaTeX{} export.
  13246. * Publishing links:: Which links keep working after publishing?
  13247. * Site map:: Generating a list of all pages.
  13248. * Generating an index:: An index that reaches across pages.
  13249. @end menu
  13250. @node Project alist
  13251. @subsection The variable @code{org-publish-project-alist}
  13252. @cindex projects, for publishing
  13253. @vindex org-publish-project-alist
  13254. Publishing is configured almost entirely through setting the value of
  13255. one variable, called @code{org-publish-project-alist}. Each element of the
  13256. list configures one project, and may be in one of the two following
  13257. forms:
  13258. @lisp
  13259. ("project-name" :property value :property value ...)
  13260. @end lisp
  13261. @noindent
  13262. i.e., a well-formed property list with alternating keys and values,
  13263. or:
  13264. @lisp
  13265. ("project-name" :components ("project-name" "project-name" ...))
  13266. @end lisp
  13267. In both cases, projects are configured by specifying property values.
  13268. A project defines the set of files that are to be published, as well
  13269. as the publishing configuration to use when publishing those files.
  13270. When a project takes the second form listed above, the individual
  13271. members of the @code{:components} property are taken to be sub-projects,
  13272. which group together files requiring different publishing options.
  13273. When you publish such a ``meta-project'', all the components are also
  13274. published, in the sequence given.
  13275. @node Sources and destinations
  13276. @subsection Sources and destinations for files
  13277. @cindex directories, for publishing
  13278. Most properties are optional, but some should always be set. In
  13279. particular, Org needs to know where to look for source files, and
  13280. where to put published files.
  13281. @table @asis
  13282. @item @code{:base-directory}
  13283. Directory containing publishing source files.
  13284. @item @code{:publishing-directory}
  13285. Directory where output files are published. You can directly
  13286. publish to a webserver using a file name syntax appropriate for
  13287. the Emacs tramp package. Or you can publish to a local directory
  13288. and use external tools to upload your website (see @ref{Uploading Files}).
  13289. @item @code{:preparation-function}
  13290. Function or list of functions to be called before starting the
  13291. publishing process, for example, to run @samp{make} for updating files
  13292. to be published. Each preparation function is called with
  13293. a single argument, the project property list.
  13294. @item @code{:completion-function}
  13295. Function or list of functions called after finishing the
  13296. publishing process, for example, to change permissions of the
  13297. resulting files. Each completion function is called with
  13298. a single argument, the project property list.
  13299. @end table
  13300. @node Selecting files
  13301. @subsection Selecting files
  13302. @cindex files, selecting for publishing
  13303. By default, all files with extension @samp{.org} in the base directory are
  13304. considered part of the project. This can be modified by setting the
  13305. following properties
  13306. @table @asis
  13307. @item @code{:base-extension}
  13308. Extension---without the dot---of source files. This actually
  13309. is a regular expression. Set this to the symbol @code{any} if you
  13310. want to get all files in @code{:base-directory}, even without
  13311. extension.
  13312. @item @code{:exclude}
  13313. Regular expression to match file names that should not be published,
  13314. even though they have been selected on the basis of their extension.
  13315. @item @code{:include}
  13316. List of files to be included regardless of @code{:base-extension} and
  13317. @code{:exclude}.
  13318. @item @code{:recursive}
  13319. Non-@code{nil} means, check base-directory recursively for files to
  13320. publish.
  13321. @end table
  13322. @node Publishing action
  13323. @subsection Publishing action
  13324. @cindex action, for publishing
  13325. Publishing means that a file is copied to the destination directory
  13326. and possibly transformed in the process. The default transformation
  13327. is to export Org files as HTML files, and this is done by the function
  13328. @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
  13329. @code{org-publish-org-to-pdf}, or as ASCII, Texinfo, etc., using the
  13330. corresponding functions.
  13331. If you want to publish the Org file as an @samp{.org} file but with
  13332. @emph{archived}, @emph{commented}, and @emph{tag-excluded} trees removed, use
  13333. @code{org-publish-org-to-org}. This produces @samp{file.org} and put it in the
  13334. publishing directory. If you want a htmlized version of this file,
  13335. set the parameter @code{:htmlized-source} to @code{t}. It produces
  13336. @samp{file.org.html} in the publishing directory@footnote{If the publishing directory is the same as the source
  13337. directory, @samp{file.org} is exported as @samp{file.org.org}, so you probably
  13338. do not want to do this.}.
  13339. Other files like images only need to be copied to the publishing
  13340. destination; for this you can use @code{org-publish-attachment}. For
  13341. non-Org files, you always need to specify the publishing function:
  13342. @table @asis
  13343. @item @code{:publishing-function}
  13344. Function executing the publication of a file. This may also be
  13345. a list of functions, which are all called in turn.
  13346. @item @code{:plain-source}
  13347. Non-@code{nil} means, publish plain source.
  13348. @item @code{:htmlized-source}
  13349. Non-@code{nil} means, publish htmlized source.
  13350. @end table
  13351. The function must accept three arguments: a property list containing
  13352. at least a @code{:publishing-directory} property, the name of the file to
  13353. be published, and the path to the publishing directory of the output
  13354. file. It should take the specified file, make the necessary
  13355. transformation, if any, and place the result into the destination
  13356. folder.
  13357. @node Publishing options
  13358. @subsection Options for the exporters
  13359. @cindex options, for publishing
  13360. @cindex publishing options
  13361. The property list can be used to set many export options for the HTML
  13362. and @LaTeX{} exporters. In most cases, these properties correspond to
  13363. user variables in Org. The table below lists these properties along
  13364. with the variable they belong to. See the documentation string for
  13365. the respective variable for details.
  13366. @vindex org-publish-project-alist
  13367. When a property is given a value in @code{org-publish-project-alist}, its
  13368. setting overrides the value of the corresponding user variable, if
  13369. any, during publishing. Options set within a file (see @ref{Export Settings}), however, override everything.
  13370. @anchor{Generic properties}
  13371. @subsubheading Generic properties
  13372. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13373. @item @code{:archived-trees}
  13374. @tab @code{org-export-with-archived-trees}
  13375. @item @code{:exclude-tags}
  13376. @tab @code{org-export-exclude-tags}
  13377. @item @code{:headline-levels}
  13378. @tab @code{org-export-headline-levels}
  13379. @item @code{:language}
  13380. @tab @code{org-export-default-language}
  13381. @item @code{:preserve-breaks}
  13382. @tab @code{org-export-preserve-breaks}
  13383. @item @code{:section-numbers}
  13384. @tab @code{org-export-with-section-numbers}
  13385. @item @code{:select-tags}
  13386. @tab @code{org-export-select-tags}
  13387. @item @code{:with-author}
  13388. @tab @code{org-export-with-author}
  13389. @item @code{:with-broken-links}
  13390. @tab @code{org-export-with-broken-links}
  13391. @item @code{:with-clocks}
  13392. @tab @code{org-export-with-clocks}
  13393. @item @code{:with-creator}
  13394. @tab @code{org-export-with-creator}
  13395. @item @code{:with-date}
  13396. @tab @code{org-export-with-date}
  13397. @item @code{:with-drawers}
  13398. @tab @code{org-export-with-drawers}
  13399. @item @code{:with-email}
  13400. @tab @code{org-export-with-email}
  13401. @item @code{:with-emphasize}
  13402. @tab @code{org-export-with-emphasize}
  13403. @item @code{:with-fixed-width}
  13404. @tab @code{org-export-with-fixed-width}
  13405. @item @code{:with-footnotes}
  13406. @tab @code{org-export-with-footnotes}
  13407. @item @code{:with-latex}
  13408. @tab @code{org-export-with-latex}
  13409. @item @code{:with-planning}
  13410. @tab @code{org-export-with-planning}
  13411. @item @code{:with-priority}
  13412. @tab @code{org-export-with-priority}
  13413. @item @code{:with-properties}
  13414. @tab @code{org-export-with-properties}
  13415. @item @code{:with-special-strings}
  13416. @tab @code{org-export-with-special-strings}
  13417. @item @code{:with-sub-superscript}
  13418. @tab @code{org-export-with-sub-superscripts}
  13419. @item @code{:with-tables}
  13420. @tab @code{org-export-with-tables}
  13421. @item @code{:with-tags}
  13422. @tab @code{org-export-with-tags}
  13423. @item @code{:with-tasks}
  13424. @tab @code{org-export-with-tasks}
  13425. @item @code{:with-timestamps}
  13426. @tab @code{org-export-with-timestamps}
  13427. @item @code{:with-title}
  13428. @tab @code{org-export-with-title}
  13429. @item @code{:with-toc}
  13430. @tab @code{org-export-with-toc}
  13431. @item @code{:with-todo-keywords}
  13432. @tab @code{org-export-with-todo-keywords}
  13433. @end multitable
  13434. @anchor{ASCII specific properties}
  13435. @subsubheading ASCII specific properties
  13436. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13437. @item @code{:ascii-bullets}
  13438. @tab @code{org-ascii-bullets}
  13439. @item @code{:ascii-caption-above}
  13440. @tab @code{org-ascii-caption-above}
  13441. @item @code{:ascii-charset}
  13442. @tab @code{org-ascii-charset}
  13443. @item @code{:ascii-global-margin}
  13444. @tab @code{org-ascii-global-margin}
  13445. @item @code{:ascii-format-drawer-function}
  13446. @tab @code{org-ascii-format-drawer-function}
  13447. @item @code{:ascii-format-inlinetask-function}
  13448. @tab @code{org-ascii-format-inlinetask-function}
  13449. @item @code{:ascii-headline-spacing}
  13450. @tab @code{org-ascii-headline-spacing}
  13451. @item @code{:ascii-indented-line-width}
  13452. @tab @code{org-ascii-indented-line-width}
  13453. @item @code{:ascii-inlinetask-width}
  13454. @tab @code{org-ascii-inlinetask-width}
  13455. @item @code{:ascii-inner-margin}
  13456. @tab @code{org-ascii-inner-margin}
  13457. @item @code{:ascii-links-to-notes}
  13458. @tab @code{org-ascii-links-to-notes}
  13459. @item @code{:ascii-list-margin}
  13460. @tab @code{org-ascii-list-margin}
  13461. @item @code{:ascii-paragraph-spacing}
  13462. @tab @code{org-ascii-paragraph-spacing}
  13463. @item @code{:ascii-quote-margin}
  13464. @tab @code{org-ascii-quote-margin}
  13465. @item @code{:ascii-table-keep-all-vertical-lines}
  13466. @tab @code{org-ascii-table-keep-all-vertical-lines}
  13467. @item @code{:ascii-table-use-ascii-art}
  13468. @tab @code{org-ascii-table-use-ascii-art}
  13469. @item @code{:ascii-table-widen-columns}
  13470. @tab @code{org-ascii-table-widen-columns}
  13471. @item @code{:ascii-text-width}
  13472. @tab @code{org-ascii-text-width}
  13473. @item @code{:ascii-underline}
  13474. @tab @code{org-ascii-underline}
  13475. @item @code{:ascii-verbatim-format}
  13476. @tab @code{org-ascii-verbatim-format}
  13477. @end multitable
  13478. @anchor{Beamer specific properties}
  13479. @subsubheading Beamer specific properties
  13480. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13481. @item @code{:beamer-theme}
  13482. @tab @code{org-beamer-theme}
  13483. @item @code{:beamer-column-view-format}
  13484. @tab @code{org-beamer-column-view-format}
  13485. @item @code{:beamer-environments-extra}
  13486. @tab @code{org-beamer-environments-extra}
  13487. @item @code{:beamer-frame-default-options}
  13488. @tab @code{org-beamer-frame-default-options}
  13489. @item @code{:beamer-outline-frame-options}
  13490. @tab @code{org-beamer-outline-frame-options}
  13491. @item @code{:beamer-outline-frame-title}
  13492. @tab @code{org-beamer-outline-frame-title}
  13493. @item @code{:beamer-subtitle-format}
  13494. @tab @code{org-beamer-subtitle-format}
  13495. @end multitable
  13496. @anchor{HTML specific properties}
  13497. @subsubheading HTML specific properties
  13498. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13499. @item @code{:html-allow-name-attribute-in-anchors}
  13500. @tab @code{org-html-allow-name-attribute-in-anchors}
  13501. @item @code{:html-checkbox-type}
  13502. @tab @code{org-html-checkbox-type}
  13503. @item @code{:html-container}
  13504. @tab @code{org-html-container-element}
  13505. @item @code{:html-divs}
  13506. @tab @code{org-html-divs}
  13507. @item @code{:html-doctype}
  13508. @tab @code{org-html-doctype}
  13509. @item @code{:html-extension}
  13510. @tab @code{org-html-extension}
  13511. @item @code{:html-footnote-format}
  13512. @tab @code{org-html-footnote-format}
  13513. @item @code{:html-footnote-separator}
  13514. @tab @code{org-html-footnote-separator}
  13515. @item @code{:html-footnotes-section}
  13516. @tab @code{org-html-footnotes-section}
  13517. @item @code{:html-format-drawer-function}
  13518. @tab @code{org-html-format-drawer-function}
  13519. @item @code{:html-format-headline-function}
  13520. @tab @code{org-html-format-headline-function}
  13521. @item @code{:html-format-inlinetask-function}
  13522. @tab @code{org-html-format-inlinetask-function}
  13523. @item @code{:html-head-extra}
  13524. @tab @code{org-html-head-extra}
  13525. @item @code{:html-head-include-default-style}
  13526. @tab @code{org-html-head-include-default-style}
  13527. @item @code{:html-head-include-scripts}
  13528. @tab @code{org-html-head-include-scripts}
  13529. @item @code{:html-head}
  13530. @tab @code{org-html-head}
  13531. @item @code{:html-home/up-format}
  13532. @tab @code{org-html-home/up-format}
  13533. @item @code{:html-html5-fancy}
  13534. @tab @code{org-html-html5-fancy}
  13535. @item @code{:html-indent}
  13536. @tab @code{org-html-indent}
  13537. @item @code{:html-infojs-options}
  13538. @tab @code{org-html-infojs-options}
  13539. @item @code{:html-infojs-template}
  13540. @tab @code{org-html-infojs-template}
  13541. @item @code{:html-inline-image-rules}
  13542. @tab @code{org-html-inline-image-rules}
  13543. @item @code{:html-inline-images}
  13544. @tab @code{org-html-inline-images}
  13545. @item @code{:html-link-home}
  13546. @tab @code{org-html-link-home}
  13547. @item @code{:html-link-org-files-as-html}
  13548. @tab @code{org-html-link-org-files-as-html}
  13549. @item @code{:html-link-up}
  13550. @tab @code{org-html-link-up}
  13551. @item @code{:html-link-use-abs-url}
  13552. @tab @code{org-html-link-use-abs-url}
  13553. @item @code{:html-mathjax-options}
  13554. @tab @code{org-html-mathjax-options}
  13555. @item @code{:html-mathjax-template}
  13556. @tab @code{org-html-mathjax-template}
  13557. @item @code{:html-metadata-timestamp-format}
  13558. @tab @code{org-html-metadata-timestamp-format}
  13559. @item @code{:html-postamble-format}
  13560. @tab @code{org-html-postamble-format}
  13561. @item @code{:html-postamble}
  13562. @tab @code{org-html-postamble}
  13563. @item @code{:html-preamble-format}
  13564. @tab @code{org-html-preamble-format}
  13565. @item @code{:html-preamble}
  13566. @tab @code{org-html-preamble}
  13567. @item @code{:html-table-align-individual-field}
  13568. @tab @code{de@{org-html-table-align-individual-fields}
  13569. @item @code{:html-table-attributes}
  13570. @tab @code{org-html-table-default-attributes}
  13571. @item @code{:html-table-caption-above}
  13572. @tab @code{org-html-table-caption-above}
  13573. @item @code{:html-table-data-tags}
  13574. @tab @code{org-html-table-data-tags}
  13575. @item @code{:html-table-header-tags}
  13576. @tab @code{org-html-table-header-tags}
  13577. @item @code{:html-table-row-tags}
  13578. @tab @code{org-html-table-row-tags}
  13579. @item @code{:html-table-use-header-tags-for-first-column}
  13580. @tab @code{org-html-table-use-header-tags-for-first-column}
  13581. @item @code{:html-tag-class-prefix}
  13582. @tab @code{org-html-tag-class-prefix}
  13583. @item @code{:html-text-markup-alist}
  13584. @tab @code{org-html-text-markup-alist}
  13585. @item @code{:html-todo-kwd-class-prefix}
  13586. @tab @code{org-html-todo-kwd-class-prefix}
  13587. @item @code{:html-toplevel-hlevel}
  13588. @tab @code{org-html-toplevel-hlevel}
  13589. @item @code{:html-use-infojs}
  13590. @tab @code{org-html-use-infojs}
  13591. @item @code{:html-validation-link}
  13592. @tab @code{org-html-validation-link}
  13593. @item @code{:html-viewport}
  13594. @tab @code{org-html-viewport}
  13595. @item @code{:html-xml-declaration}
  13596. @tab @code{org-html-xml-declaration}
  13597. @end multitable
  13598. @anchor{@LaTeX{} specific properties}
  13599. @subsubheading @LaTeX{} specific properties
  13600. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13601. @item @code{:latex-active-timestamp-format}
  13602. @tab @code{org-latex-active-timestamp-format}
  13603. @item @code{:latex-caption-above}
  13604. @tab @code{org-latex-caption-above}
  13605. @item @code{:latex-classes}
  13606. @tab @code{org-latex-classes}
  13607. @item @code{:latex-class}
  13608. @tab @code{org-latex-default-class}
  13609. @item @code{:latex-compiler}
  13610. @tab @code{org-latex-compiler}
  13611. @item @code{:latex-default-figure-position}
  13612. @tab @code{org-latex-default-figure-position}
  13613. @item @code{:latex-default-table-environment}
  13614. @tab @code{org-latex-default-table-environment}
  13615. @item @code{:latex-default-table-mode}
  13616. @tab @code{org-latex-default-table-mode}
  13617. @item @code{:latex-diary-timestamp-format}
  13618. @tab @code{org-latex-diary-timestamp-format}
  13619. @item @code{:latex-footnote-defined-format}
  13620. @tab @code{org-latex-footnote-defined-format}
  13621. @item @code{:latex-footnote-separator}
  13622. @tab @code{org-latex-footnote-separator}
  13623. @item @code{:latex-format-drawer-function}
  13624. @tab @code{org-latex-format-drawer-function}
  13625. @item @code{:latex-format-headline-function}
  13626. @tab @code{org-latex-format-headline-function}
  13627. @item @code{:latex-format-inlinetask-function}
  13628. @tab @code{org-latex-format-inlinetask-function}
  13629. @item @code{:latex-hyperref-template}
  13630. @tab @code{org-latex-hyperref-template}
  13631. @item @code{:latex-image-default-height}
  13632. @tab @code{org-latex-image-default-height}
  13633. @item @code{:latex-image-default-option}
  13634. @tab @code{org-latex-image-default-option}
  13635. @item @code{:latex-image-default-width}
  13636. @tab @code{org-latex-image-default-width}
  13637. @item @code{:latex-images-centered}
  13638. @tab @code{org-latex-images-centered}
  13639. @item @code{:latex-inactive-timestamp-format}
  13640. @tab @code{org-latex-inactive-timestamp-format}
  13641. @item @code{:latex-inline-image-rules}
  13642. @tab @code{org-latex-inline-image-rules}
  13643. @item @code{:latex-link-with-unknown-path-format}
  13644. @tab @code{org-latex-link-with-unknown-path-format}
  13645. @item @code{:latex-listings-langs}
  13646. @tab @code{org-latex-listings-langs}
  13647. @item @code{:latex-listings-options}
  13648. @tab @code{org-latex-listings-options}
  13649. @item @code{:latex-listings}
  13650. @tab @code{org-latex-listings}
  13651. @item @code{:latex-minted-langs}
  13652. @tab @code{org-latex-minted-langs}
  13653. @item @code{:latex-minted-options}
  13654. @tab @code{org-latex-minted-options}
  13655. @item @code{:latex-prefer-user-labels}
  13656. @tab @code{org-latex-prefer-user-labels}
  13657. @item @code{:latex-subtitle-format}
  13658. @tab @code{org-latex-subtitle-format}
  13659. @item @code{:latex-subtitle-separate}
  13660. @tab @code{org-latex-subtitle-separate}
  13661. @item @code{:latex-table-scientific-notation}
  13662. @tab @code{org-latex-table-scientific-notation}
  13663. @item @code{:latex-tables-booktabs}
  13664. @tab @code{org-latex-tables-booktabs}
  13665. @item @code{:latex-tables-centered}
  13666. @tab @code{org-latex-tables-centered}
  13667. @item @code{:latex-text-markup-alist}
  13668. @tab @code{org-latex-text-markup-alist}
  13669. @item @code{:latex-title-command}
  13670. @tab @code{org-latex-title-command}
  13671. @item @code{:latex-toc-command}
  13672. @tab @code{org-latex-toc-command}
  13673. @end multitable
  13674. @anchor{Markdown specific properties}
  13675. @subsubheading Markdown specific properties
  13676. @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa}
  13677. @item @code{:md-footnote-format}
  13678. @tab @code{org-md-footnote-format}
  13679. @item @code{:md-footnotes-section}
  13680. @tab @code{org-md-footnotes-section}
  13681. @item @code{:md-headline-style}
  13682. @tab @code{org-md-headline-style}
  13683. @end multitable
  13684. @anchor{ODT specific properties}
  13685. @subsubheading ODT specific properties
  13686. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13687. @item @code{:odt-content-template-file}
  13688. @tab @code{org-odt-content-template-file}
  13689. @item @code{:odt-display-outline-level}
  13690. @tab @code{org-odt-display-outline-level}
  13691. @item @code{:odt-fontify-srcblocks}
  13692. @tab @code{org-odt-fontify-srcblocks}
  13693. @item @code{:odt-format-drawer-function}
  13694. @tab @code{org-odt-format-drawer-function}
  13695. @item @code{:odt-format-headline-function}
  13696. @tab @code{org-odt-format-headline-function}
  13697. @item @code{:odt-format-inlinetask-function}
  13698. @tab @code{org-odt-format-inlinetask-function}
  13699. @item @code{:odt-inline-formula-rules}
  13700. @tab @code{org-odt-inline-formula-rules}
  13701. @item @code{:odt-inline-image-rules}
  13702. @tab @code{org-odt-inline-image-rules}
  13703. @item @code{:odt-pixels-per-inch}
  13704. @tab @code{org-odt-pixels-per-inch}
  13705. @item @code{:odt-styles-file}
  13706. @tab @code{org-odt-styles-file}
  13707. @item @code{:odt-table-styles}
  13708. @tab @code{org-odt-table-styles}
  13709. @item @code{:odt-use-date-fields}
  13710. @tab @code{org-odt-use-date-fields}
  13711. @end multitable
  13712. @anchor{Texinfo specific properties}
  13713. @subsubheading Texinfo specific properties
  13714. @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  13715. @item @code{:texinfo-active-timestamp-format}
  13716. @tab @code{org-texinfo-active-timestamp-format}
  13717. @item @code{:texinfo-classes}
  13718. @tab @code{org-texinfo-classes}
  13719. @item @code{:texinfo-class}
  13720. @tab @code{org-texinfo-default-class}
  13721. @item @code{:texinfo-table-default-markup}
  13722. @tab @code{org-texinfo-table-default-markup}
  13723. @item @code{:texinfo-diary-timestamp-format}
  13724. @tab @code{org-texinfo-diary-timestamp-format}
  13725. @item @code{:texinfo-filename}
  13726. @tab @code{org-texinfo-filename}
  13727. @item @code{:texinfo-format-drawer-function}
  13728. @tab @code{org-texinfo-format-drawer-function}
  13729. @item @code{:texinfo-format-headline-function}
  13730. @tab @code{org-texinfo-format-headline-function}
  13731. @item @code{:texinfo-format-inlinetask-function}
  13732. @tab @code{org-texinfo-format-inlinetask-function}
  13733. @item @code{:texinfo-inactive-timestamp-format}
  13734. @tab @code{org-texinfo-inactive-timestamp-format}
  13735. @item @code{:texinfo-link-with-unknown-path-format}
  13736. @tab @code{org-texinfo-link-with-unknown-path-format}
  13737. @item @code{:texinfo-node-description-column}
  13738. @tab @code{org-texinfo-node-description-column}
  13739. @item @code{:texinfo-table-scientific-notation}
  13740. @tab @code{org-texinfo-table-scientific-notation}
  13741. @item @code{:texinfo-tables-verbatim}
  13742. @tab @code{org-texinfo-tables-verbatim}
  13743. @item @code{:texinfo-text-markup-alist}
  13744. @tab @code{org-texinfo-text-markup-alist}
  13745. @end multitable
  13746. @node Publishing links
  13747. @subsection Publishing links
  13748. @cindex links, publishing
  13749. To create a link from one Org file to another, you would use something
  13750. like @samp{[[file:foo.org][The foo]]} or simply @samp{[[file:foo.org]]} (see @ref{External Links}). When
  13751. published, this link becomes a link to @samp{foo.html}. You can thus
  13752. interlink the pages of your ``Org web'' project and the links will work
  13753. as expected when you publish them to HTML. If you also publish the
  13754. Org source file and want to link to it, use an @samp{http} link instead of
  13755. a @samp{file:} link, because @samp{file} links are converted to link to the
  13756. corresponding @samp{.html} file.
  13757. You may also link to related files, such as images. Provided you are
  13758. careful with relative file names, and provided you have also
  13759. configured Org to upload the related files, these links will work too.
  13760. See @ref{Complex example}, for an example of this
  13761. usage.
  13762. Eventually, links between published documents can contain some search
  13763. options (see @ref{Search Options}), which will be resolved to
  13764. the appropriate location in the linked file. For example, once
  13765. published to HTML, the following links all point to a dedicated anchor
  13766. in @samp{foo.html}.
  13767. @example
  13768. [[file:foo.org::*heading]]
  13769. [[file:foo.org::#custom-id]]
  13770. [[file:foo.org::target]]
  13771. @end example
  13772. @node Site map
  13773. @subsection Generating a sitemap
  13774. @cindex sitemap, of published pages
  13775. The following properties may be used to control publishing of
  13776. a map of files for a given project.
  13777. @table @asis
  13778. @item @code{:auto-sitemap}
  13779. When non-@code{nil}, publish a sitemap during
  13780. @code{org-publish-current-project} or @code{org-publish-all}.
  13781. @item @code{:sitemap-filename}
  13782. Filename for output of sitemap. Defaults to @samp{sitemap.org}, which
  13783. becomes @samp{sitemap.html}.
  13784. @item @code{:sitemap-title}
  13785. Title of sitemap page. Defaults to name of file.
  13786. @item @code{:sitemap-format-entry}
  13787. @findex org-publish-find-date
  13788. @findex org-publish-find-property
  13789. @findex org-publish-find-title
  13790. With this option one can tell how a site-map entry is formatted
  13791. in the site-map. It is a function called with three arguments:
  13792. the file or directory name relative to base directory of the
  13793. project, the site-map style and the current project. It is
  13794. expected to return a string. Default value turns file names into
  13795. links and use document titles as descriptions. For specific
  13796. formatting needs, one can use @code{org-publish-find-date},
  13797. @code{org-publish-find-title} and @code{org-publish-find-property}, to
  13798. retrieve additional information about published documents.
  13799. @item @code{:sitemap-function}
  13800. Plug-in function to use for generation of the sitemap. It is
  13801. called with two arguments: the title of the site-map and
  13802. a representation of the files and directories involved in the
  13803. project as a nested list, which can further be transformed using
  13804. @code{org-list-to-generic}, @code{org-list-to-subtree} and alike. Default
  13805. value generates a plain list of links to all files in the
  13806. project.
  13807. @item @code{:sitemap-sort-folders}
  13808. Where folders should appear in the sitemap. Set this to @code{first}
  13809. (default) or @code{last} to display folders first or last,
  13810. respectively. When set to @code{ignore}, folders are ignored
  13811. altogether. Any other value mixes files and folders. This
  13812. variable has no effect when site-map style is @code{tree}.
  13813. @item @code{:sitemap-sort-files}
  13814. How the files are sorted in the site map. Set this to
  13815. @code{alphabetically} (default), @code{chronologically} or
  13816. @code{anti-chronologically}. @code{chronologically} sorts the files with
  13817. older date first while @code{anti-chronologically} sorts the files
  13818. with newer date first. @code{alphabetically} sorts the files
  13819. alphabetically. The date of a file is retrieved with
  13820. @code{org-publish-find-date}.
  13821. @item @code{:sitemap-ignore-case}
  13822. Should sorting be case-sensitive? Default @code{nil}.
  13823. @item @code{:sitemap-file-entry-format}
  13824. With this option one can tell how a sitemap's entry is formatted
  13825. in the sitemap. This is a format string with some escape
  13826. sequences: @code{%t} stands for the title of the file, @code{%a} stands for
  13827. the author of the file and @code{%d} stands for the date of the file.
  13828. The date is retrieved with the @code{org-publish-find-date} function
  13829. and formatted with @code{org-publish-sitemap-date-format}. Default
  13830. @code{%t}.
  13831. @item @code{:sitemap-date-format}
  13832. Format string for the @code{format-time-string} function that tells
  13833. how a sitemap entry's date is to be formatted. This property
  13834. bypasses @code{org-publish-sitemap-date-format} which defaults to
  13835. @code{%Y-%m-%d}.
  13836. @end table
  13837. @node Generating an index
  13838. @subsection Generating an index
  13839. @cindex index, in a publishing project
  13840. Org mode can generate an index across the files of a publishing project.
  13841. @table @asis
  13842. @item @code{:makeindex}
  13843. When non-@code{nil}, generate in index in the file @samp{theindex.org} and
  13844. publish it as @samp{theindex.html}.
  13845. @end table
  13846. The file is created when first publishing a project with the
  13847. @code{:makeindex} set. The file only contains a statement @samp{#+INCLUDE:
  13848. "theindex.inc"}. You can then build around this include statement by
  13849. adding a title, style information, etc.
  13850. @cindex @samp{INDEX}, keyword
  13851. Index entries are specified with @samp{INDEX} keyword. An entry that
  13852. contains an exclamation mark creates a sub item.
  13853. @example
  13854. *** Curriculum Vitae
  13855. #+INDEX: CV
  13856. #+INDEX: Application!CV
  13857. @end example
  13858. @node Uploading Files
  13859. @section Uploading Files
  13860. @cindex rsync
  13861. @cindex unison
  13862. For those people already utilizing third party sync tools such as
  13863. Rsync or Unison, it might be preferable not to use the built-in remote
  13864. publishing facilities of Org mode which rely heavily on Tramp. Tramp,
  13865. while very useful and powerful, tends not to be so efficient for
  13866. multiple file transfer and has been known to cause problems under
  13867. heavy usage.
  13868. Specialized synchronization utilities offer several advantages. In
  13869. addition to timestamp comparison, they also do content and
  13870. permissions/attribute checks. For this reason you might prefer to
  13871. publish your web to a local directory---possibly even @emph{in place} with
  13872. your Org files---and then use Unison or Rsync to do the
  13873. synchronization with the remote host.
  13874. Since Unison, for example, can be configured as to which files to
  13875. transfer to a certain remote destination, it can greatly simplify the
  13876. project publishing definition. Simply keep all files in the correct
  13877. location, process your Org files with @code{org-publish} and let the
  13878. synchronization tool do the rest. You do not need, in this scenario,
  13879. to include attachments such as JPG, CSS or PNG files in the project
  13880. definition since the third-party tool syncs them.
  13881. Publishing to a local directory is also much faster than to a remote
  13882. one, so that you can afford more easily to republish entire projects.
  13883. If you set @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the
  13884. main benefit of re-including any changed external files such as source
  13885. example files you might include with @samp{INCLUDE} keyword. The timestamp
  13886. mechanism in Org is not smart enough to detect if included files have
  13887. been modified.
  13888. @node Sample Configuration
  13889. @section Sample Configuration
  13890. Below we provide two example configurations. The first one is
  13891. a simple project publishing only a set of Org files. The second
  13892. example is more complex, with a multi-component project.
  13893. @menu
  13894. * Simple example:: One-component publishing.
  13895. * Complex example:: A multi-component publishing example.
  13896. @end menu
  13897. @node Simple example
  13898. @subsection Example: simple publishing configuration
  13899. This example publishes a set of Org files to the @samp{public_html}
  13900. directory on the local machine.
  13901. @lisp
  13902. (setq org-publish-project-alist
  13903. '(("org"
  13904. :base-directory "~/org/"
  13905. :publishing-directory "~/public_html"
  13906. :section-numbers nil
  13907. :table-of-contents nil
  13908. :style "<link rel=\"stylesheet\"
  13909. href=\"../other/mystyle.css\"
  13910. type=\"text/css\"/>")))
  13911. @end lisp
  13912. @node Complex example
  13913. @subsection Example: complex publishing configuration
  13914. This more complicated example publishes an entire website, including
  13915. Org files converted to HTML, image files, Emacs Lisp source code, and
  13916. style sheets. The publishing directory is remote and private files
  13917. are excluded.
  13918. To ensure that links are preserved, care should be taken to replicate
  13919. your directory structure on the web server, and to use relative file
  13920. paths. For example, if your Org files are kept in @samp{~/org/} and your
  13921. publishable images in @samp{~/images/}, you would link to an image with
  13922. @example
  13923. file:../images/myimage.png
  13924. @end example
  13925. On the web server, the relative path to the image should be the same.
  13926. You can accomplish this by setting up an @samp{images/} folder in the right
  13927. place on the web server, and publishing images to it.
  13928. @lisp
  13929. (setq org-publish-project-alist
  13930. '(("orgfiles"
  13931. :base-directory "~/org/"
  13932. :base-extension "org"
  13933. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  13934. :publishing-function org-html-publish-to-html
  13935. :exclude "PrivatePage.org" ;; regexp
  13936. :headline-levels 3
  13937. :section-numbers nil
  13938. :with-toc nil
  13939. :html-head "<link rel=\"stylesheet\"
  13940. href=\"../other/mystyle.css\" type=\"text/css\"/>"
  13941. :html-preamble t)
  13942. ("images"
  13943. :base-directory "~/images/"
  13944. :base-extension "jpg\\|gif\\|png"
  13945. :publishing-directory "/ssh:user@@host:~/html/images/"
  13946. :publishing-function org-publish-attachment)
  13947. ("other"
  13948. :base-directory "~/other/"
  13949. :base-extension "css\\|el"
  13950. :publishing-directory "/ssh:user@@host:~/html/other/"
  13951. :publishing-function org-publish-attachment)
  13952. ("website" :components ("orgfiles" "images" "other"))))
  13953. @end lisp
  13954. @node Triggering Publication
  13955. @section Triggering Publication
  13956. Once properly configured, Org can publish with the following commands:
  13957. @table @asis
  13958. @item @kbd{C-c C-e X} (@code{org-publish})
  13959. @kindex C-c C-e X
  13960. @findex org-publish
  13961. Prompt for a specific project and publish all files that belong
  13962. to it.
  13963. @item @kbd{C-c C-e P} (@code{org-publish-current-project})
  13964. @kindex C-c C-e P
  13965. @findex org-publish-current-project
  13966. Publish the project containing the current file.
  13967. @item @kbd{C-c C-e F} (@code{org-publish-current-file})
  13968. @kindex C-c C-e F
  13969. @findex org-publish-current-file
  13970. Publish only the current file.
  13971. @item @kbd{C-c C-e E} (@code{org-publish-all})
  13972. @kindex C-c C-e E
  13973. @findex org-publish-all
  13974. Publish every project.
  13975. @end table
  13976. @vindex org-publish-use-timestamps-flag
  13977. Org uses timestamps to track when a file has changed. The above
  13978. functions normally only publish changed files. You can override this
  13979. and force publishing of all files by giving a prefix argument to any
  13980. of the commands above, or by customizing the variable
  13981. @code{org-publish-use-timestamps-flag}. This may be necessary in
  13982. particular if files include other files via @samp{SETUPFILE} or @samp{INCLUDE}
  13983. keywords.
  13984. @node Working with Source Code
  13985. @chapter Working with Source Code
  13986. @cindex source code, working with
  13987. Source code here refers to any plain text collection of computer
  13988. instructions, possibly with comments, written using a human-readable
  13989. programming language. Org can manage source code in an Org document
  13990. when the source code is identified with begin and end markers.
  13991. Working with source code begins with identifying source code blocks.
  13992. A source code block can be placed almost anywhere in an Org document;
  13993. it is not restricted to the preamble or the end of the document.
  13994. However, Org cannot manage a source code block if it is placed inside
  13995. an Org comment or within a fixed width section.
  13996. Here is an example source code block in the Emacs Lisp language:
  13997. @example
  13998. #+BEGIN_SRC emacs-lisp
  13999. (defun org-xor (a b)
  14000. "Exclusive or."
  14001. (if a (not b) b))
  14002. #+END_SRC
  14003. @end example
  14004. Org can manage the source code in the block delimited by @samp{#+BEGIN_SRC}
  14005. @dots{} @samp{#+END_SRC} in several ways that can simplify housekeeping tasks
  14006. essential to modern source code maintenance. Org can edit, format,
  14007. extract, export, and publish source code blocks. Org can also compile
  14008. and execute a source code block, then capture the results. The Org
  14009. mode literature sometimes refers to source code blocks as @emph{live code}
  14010. blocks because they can alter the content of the Org document or the
  14011. material that it exports. Users can control how live they want each
  14012. source code block by tweaking the header arguments (see @ref{Using Header Arguments}) for compiling, execution, extraction, and
  14013. exporting.
  14014. Source code blocks are one of many Org block types, which also include
  14015. @samp{quote}, @samp{export}, @samp{verse}, @samp{latex}, @samp{example}, and @samp{verbatim}. This
  14016. section pertains to blocks between @samp{#+BEGIN_SRC} and @samp{#+END_SRC}.
  14017. For editing and formatting a source code block, Org uses an
  14018. appropriate Emacs major mode that includes features specifically
  14019. designed for source code in that language.
  14020. Org can extract one or more source code blocks and write them to one
  14021. or more source files---a process known as @emph{tangling} in literate
  14022. programming terminology.
  14023. For exporting and publishing, Org's back-ends can format a source code
  14024. block appropriately, often with native syntax highlighting.
  14025. For executing and compiling a source code block, the user can
  14026. configure Org to select the appropriate compiler. Org provides
  14027. facilities to collect the result of the execution or compiler output,
  14028. insert it into the Org document, and/or export it. In addition to
  14029. text results, Org can insert links to other data types, including
  14030. audio, video, and graphics. Org can also link a compiler error
  14031. message to the appropriate line in the source code block.
  14032. An important feature of Org's management of source code blocks is the
  14033. ability to pass variables, functions, and results to one another using
  14034. a common syntax for source code blocks in any language. Although most
  14035. literate programming facilities are restricted to one language or
  14036. another, Org's language-agnostic approach lets the literate programmer
  14037. match each programming task with the appropriate computer language and
  14038. to mix them all together in a single Org document. This
  14039. interoperability among languages explains why Org's source code
  14040. management facility was named @emph{Org Babel} by its originators, Eric
  14041. Schulte and Dan Davison.
  14042. Org mode fulfills the promise of easy verification and maintenance of
  14043. publishing reproducible research by keeping text, data, code,
  14044. configuration settings of the execution environment, the results of
  14045. the execution, and associated narratives, claims, references, and
  14046. internal and external links in a single Org document.
  14047. Details of Org's facilities for working with source code are described
  14048. in the following sections.
  14049. @menu
  14050. * Structure of Code Blocks:: Code block syntax described.
  14051. * Using Header Arguments:: Different ways to set header arguments.
  14052. * Environment of a Code Block:: Arguments, sessions, working directory...
  14053. * Evaluating Code Blocks:: Place results of evaluation in the Org buffer.
  14054. * Results of Evaluation:: Choosing a results type, post-processing...
  14055. * Exporting Code Blocks:: Export contents and/or results.
  14056. * Extracting Source Code:: Create pure source code files.
  14057. * Languages:: List of supported code block languages.
  14058. * Editing Source Code:: Language major-mode editing.
  14059. * Noweb Reference Syntax:: Literate programming in Org mode.
  14060. * Library of Babel:: Use and contribute to a library of useful code blocks.
  14061. * Key bindings and Useful Functions:: Work quickly with code blocks.
  14062. * Batch Execution:: Call functions from the command line.
  14063. @end menu
  14064. @node Structure of Code Blocks
  14065. @section Structure of Code Blocks
  14066. @cindex code block, structure
  14067. @cindex source code, block structure
  14068. @cindex @samp{NAME} keyword, in source blocks
  14069. @cindex @samp{BEGIN_SRC}
  14070. Org offers two ways to structure source code in Org documents: in
  14071. a source code block, and directly inline. Both specifications are
  14072. shown below.
  14073. A source code block conforms to this structure:
  14074. @example
  14075. #+NAME: <name>
  14076. #+BEGIN_SRC <language> <switches> <header arguments>
  14077. <body>
  14078. #+END_SRC
  14079. @end example
  14080. Do not be put-off by having to remember the source block syntax. Org
  14081. mode offers a command for wrapping existing text in a block (see
  14082. @ref{Structure Templates}). Org also works with other completion systems
  14083. in Emacs, some of which predate Org and have custom domain-specific
  14084. languages for defining templates. Regular use of templates reduces
  14085. errors, increases accuracy, and maintains consistency.
  14086. @cindex source code, inline
  14087. An inline code block conforms to this structure:
  14088. @example
  14089. src_<language>@{<body>@}
  14090. @end example
  14091. @noindent
  14092. or
  14093. @example
  14094. src_<language>[<header arguments>]@{<body>@}
  14095. @end example
  14096. @table @asis
  14097. @item @samp{#+NAME: <name>}
  14098. Optional. Names the source block so it can be called, like
  14099. a function, from other source blocks or inline code to evaluate
  14100. or to capture the results. Code from other blocks, other files,
  14101. and from table formulas (see @ref{The spreadsheet}) can use the name
  14102. to reference a source block. This naming serves the same purpose
  14103. as naming Org tables. Org mode requires unique names. For
  14104. duplicate names, Org mode's behavior is undefined.
  14105. @item @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  14106. Mandatory. They mark the start and end of a block that Org
  14107. requires. The @samp{#+BEGIN_SRC} line takes additional arguments, as
  14108. described next.
  14109. @item @samp{<language>}
  14110. @cindex language, in code blocks
  14111. Mandatory. It is the identifier of the source code language in
  14112. the block. See @ref{Languages}, for identifiers of supported
  14113. languages.
  14114. @item @samp{<switches>}
  14115. @cindex switches, in code blocks
  14116. Optional. Switches provide finer control of the code execution,
  14117. export, and format (see the discussion of switches in @ref{Literal Examples}).
  14118. @item @samp{<header arguments>}
  14119. @cindex header arguments, in code blocks
  14120. Optional. Heading arguments control many aspects of evaluation,
  14121. export and tangling of code blocks (see @ref{Using Header Arguments}).
  14122. Using Org's properties feature, header arguments can be
  14123. selectively applied to the entire buffer or specific sub-trees of
  14124. the Org document.
  14125. @item @samp{<body>}
  14126. Source code in the dialect of the specified language identifier.
  14127. @end table
  14128. @node Using Header Arguments
  14129. @section Using Header Arguments
  14130. Org comes with many header arguments common to all languages. New
  14131. header arguments are added for specific languages as they become
  14132. available for use in source code blocks. A header argument is
  14133. specified with an initial colon followed by the argument's name in
  14134. lowercase.
  14135. Since header arguments can be set in several ways, Org prioritizes
  14136. them in case of overlaps or conflicts by giving local settings
  14137. a higher priority. Header values in function calls, for example,
  14138. override header values from global defaults.
  14139. @anchor{System-wide header arguments}
  14140. @subheading System-wide header arguments
  14141. @vindex org-babel-default-header-args
  14142. @vindex org-babel-default-header-args
  14143. System-wide values of header arguments can be specified by customizing
  14144. the @code{org-babel-default-header-args} variable, which defaults to the
  14145. following values:
  14146. @example
  14147. :session => "none"
  14148. :results => "replace"
  14149. :exports => "code"
  14150. :cache => "no"
  14151. :noweb => "no"
  14152. @end example
  14153. The example below sets @samp{:noweb} header arguments to @samp{yes}, which makes
  14154. Org expand @samp{:noweb} references by default.
  14155. @lisp
  14156. (setq org-babel-default-header-args
  14157. (cons '(:noweb . "yes")
  14158. (assq-delete-all :noweb org-babel-default-header-args)))
  14159. @end lisp
  14160. @cindex language specific default header arguments
  14161. @cindex default header arguments per language
  14162. Each language can have separate default header arguments by
  14163. customizing the variable @code{org-babel-default-header-args:<LANG>}, where
  14164. @var{<LANG>} is the name of the language. For details, see the
  14165. language-specific online documentation at
  14166. @uref{https://orgmode.org/worg/org-contrib/babel/}.
  14167. @anchor{Header arguments in Org mode properties}
  14168. @subheading Header arguments in Org mode properties
  14169. For header arguments applicable to the buffer, use @samp{PROPERTY} keyword
  14170. anywhere in the Org file (see @ref{Property Syntax}).
  14171. The following example makes all the R code blocks execute in the same
  14172. session. Setting @samp{:results} to @samp{silent} ignores the results of
  14173. executions for all blocks, not just R code blocks; no results inserted
  14174. for any block.
  14175. @example
  14176. #+PROPERTY: header-args:R :session *R*
  14177. #+PROPERTY: header-args :results silent
  14178. @end example
  14179. @vindex org-use-property-inheritance
  14180. Header arguments set through Org's property drawers (see @ref{Property Syntax}) apply at the sub-tree level on down. Since these property
  14181. drawers can appear anywhere in the file hierarchy, Org uses outermost
  14182. call or source block to resolve the values. Org ignores
  14183. @code{org-use-property-inheritance} setting.
  14184. In this example, @samp{:cache} defaults to @samp{yes} for all code blocks in the
  14185. sub-tree.
  14186. @example
  14187. * sample header
  14188. :PROPERTIES:
  14189. :header-args: :cache yes
  14190. :END:
  14191. @end example
  14192. @kindex C-c C-x p
  14193. @findex org-set-property
  14194. Properties defined through @code{org-set-property} function, bound to
  14195. @kbd{C-c C-x p}, apply to all active languages. They override
  14196. properties set in @code{org-babel-default-header-args}.
  14197. @cindex language specific header arguments properties
  14198. @cindex header arguments per language
  14199. Language-specific header arguments are also read from properties
  14200. @samp{header-args:<LANG>} where @var{<LANG>} is the language
  14201. identifier. For example,
  14202. @example
  14203. * Heading
  14204. :PROPERTIES:
  14205. :header-args:clojure: :session *clojure-1*
  14206. :header-args:R: :session *R*
  14207. :END:
  14208. ** Subheading
  14209. :PROPERTIES:
  14210. :header-args:clojure: :session *clojure-2*
  14211. :END:
  14212. @end example
  14213. @noindent
  14214. would force separate sessions for Clojure blocks in @samp{Heading} and
  14215. @samp{Subheading}, but use the same session for all R blocks. Blocks in
  14216. @samp{Subheading} inherit settings from @samp{Heading}.
  14217. @anchor{Code block specific header arguments}
  14218. @subheading Code block specific header arguments
  14219. Header arguments are most commonly set at the source code block level,
  14220. on the @samp{#+BEGIN_SRC} line. Arguments set at this level take
  14221. precedence over those set in the @code{org-babel-default-header-args}
  14222. variable, and also those set as header properties.
  14223. In the following example, setting @samp{:results} to @samp{silent} makes it
  14224. ignore results of the code execution. Setting @samp{:exports} to @samp{code}
  14225. exports only the body of the code block to HTML or @LaTeX{}.
  14226. @example
  14227. #+NAME: factorial
  14228. #+BEGIN_SRC haskell :results silent :exports code :var n=0
  14229. fac 0 = 1
  14230. fac n = n * fac (n-1)
  14231. #+END_SRC
  14232. @end example
  14233. The same header arguments in an inline code block:
  14234. @example
  14235. src_haskell[:exports both]@{fac 5@}
  14236. @end example
  14237. @cindex @samp{HEADER}, keyword
  14238. Code block header arguments can span multiple lines using @samp{#+HEADER:}
  14239. on each line. Note that Org currently accepts the plural spelling of
  14240. @samp{#+HEADER:} only as a convenience for backward-compatibility. It may
  14241. be removed at some point.
  14242. Multi-line header arguments on an unnamed code block:
  14243. @example
  14244. #+HEADER: :var data1=1
  14245. #+BEGIN_SRC emacs-lisp :var data2=2
  14246. (message "data1:%S, data2:%S" data1 data2)
  14247. #+END_SRC
  14248. #+RESULTS:
  14249. : data1:1, data2:2
  14250. @end example
  14251. Multi-line header arguments on a named code block:
  14252. @example
  14253. #+NAME: named-block
  14254. #+HEADER: :var data=2
  14255. #+BEGIN_SRC emacs-lisp
  14256. (message "data:%S" data)
  14257. #+END_SRC
  14258. #+RESULTS: named-block
  14259. : data:2
  14260. @end example
  14261. @anchor{Header arguments in function calls}
  14262. @subheading Header arguments in function calls
  14263. Header arguments in function calls are the most specific and override
  14264. all other settings in case of an overlap. They get the highest
  14265. priority. Two @samp{#+CALL:} examples are shown below. For the complete
  14266. syntax of @samp{CALL} keyword, see @ref{Evaluating Code Blocks}.
  14267. In this example, @samp{:exports results} header argument is applied to the
  14268. evaluation of the @samp{#+CALL:} line.
  14269. @example
  14270. #+CALL: factorial(n=5) :exports results
  14271. @end example
  14272. In this example, @samp{:session special} header argument is applied to the
  14273. evaluation of @samp{factorial} code block.
  14274. @example
  14275. #+CALL: factorial[:session special](n=5)
  14276. @end example
  14277. @node Environment of a Code Block
  14278. @section Environment of a Code Block
  14279. @anchor{Passing arguments}
  14280. @subheading Passing arguments
  14281. @cindex passing arguments to code blocks
  14282. @cindex arguments, in code blocks
  14283. @cindex @samp{var}, header argument
  14284. Use @samp{var} for passing arguments to source code blocks. The specifics
  14285. of variables in code blocks vary by the source language and are
  14286. covered in the language-specific documentation. The syntax for @samp{var},
  14287. however, is the same for all languages. This includes declaring
  14288. a variable, and assigning a default value.
  14289. The following syntax is used to pass arguments to code blocks using
  14290. the @samp{var} header argument.
  14291. @example
  14292. :var NAME=ASSIGN
  14293. @end example
  14294. @noindent
  14295. @var{NAME} is the name of the variable bound in the code block
  14296. body. @var{ASSIGN} is a literal value, such as a string,
  14297. a number, a reference to a table, a list, a literal example, another
  14298. code block---with or without arguments---or the results of evaluating
  14299. a code block.
  14300. Here are examples of passing values by reference:
  14301. @table @asis
  14302. @item table
  14303. A table named with a @samp{NAME} keyword.
  14304. @example
  14305. #+NAME: example-table
  14306. | 1 |
  14307. | 2 |
  14308. | 3 |
  14309. | 4 |
  14310. #+NAME: table-length
  14311. #+BEGIN_SRC emacs-lisp :var table=example-table
  14312. (length table)
  14313. #+END_SRC
  14314. #+RESULTS: table-length
  14315. : 4
  14316. @end example
  14317. When passing a table, you can treat specially the row, or the
  14318. column, containing labels for the columns, or the rows, in the
  14319. table.
  14320. @cindex @samp{colnames}, header argument
  14321. The @samp{colnames} header argument accepts @samp{yes}, @samp{no}, or @samp{nil}
  14322. values. The default value is @samp{nil}: if an input table has column
  14323. names---because the second row is a horizontal rule---then Org
  14324. removes the column names, processes the table, puts back the
  14325. column names, and then writes the table to the results block.
  14326. Using @samp{yes}, Org does the same to the first row, even if the
  14327. initial table does not contain any horizontal rule. When set to
  14328. @samp{no}, Org does not pre-process column names at all.
  14329. @example
  14330. #+NAME: less-cols
  14331. | a |
  14332. |---|
  14333. | b |
  14334. | c |
  14335. #+BEGIN_SRC python :var tab=less-cols :colnames nil
  14336. return [[val + '*' for val in row] for row in tab]
  14337. #+END_SRC
  14338. #+RESULTS:
  14339. | a |
  14340. |----|
  14341. | b* |
  14342. | c* |
  14343. @end example
  14344. @cindex @samp{rownames}, header argument
  14345. Similarly, the @samp{rownames} header argument can take two values:
  14346. @samp{yes} or @samp{no}. When set to @samp{yes}, Org removes the first column,
  14347. processes the table, puts back the first column, and then writes
  14348. the table to the results block. The default is @samp{no}, which means
  14349. Org does not pre-process the first column. Note that Emacs Lisp
  14350. code blocks ignore @samp{rownames} header argument because of the ease
  14351. of table-handling in Emacs.
  14352. @example
  14353. #+NAME: with-rownames
  14354. | one | 1 | 2 | 3 | 4 | 5 |
  14355. | two | 6 | 7 | 8 | 9 | 10 |
  14356. #+BEGIN_SRC python :var tab=with-rownames :rownames yes
  14357. return [[val + 10 for val in row] for row in tab]
  14358. #+END_SRC
  14359. #+RESULTS:
  14360. | one | 11 | 12 | 13 | 14 | 15 |
  14361. | two | 16 | 17 | 18 | 19 | 20 |
  14362. @end example
  14363. @item list
  14364. A simple named list.
  14365. @example
  14366. #+NAME: example-list
  14367. - simple
  14368. - not
  14369. - nested
  14370. - list
  14371. #+BEGIN_SRC emacs-lisp :var x=example-list
  14372. (print x)
  14373. #+END_SRC
  14374. #+RESULTS:
  14375. | simple | list |
  14376. @end example
  14377. Note that only the top level list items are passed along. Nested
  14378. list items are ignored.
  14379. @item code block without arguments
  14380. A code block name, as assigned by @samp{NAME} keyword from the example
  14381. above, optionally followed by parentheses.
  14382. @example
  14383. #+BEGIN_SRC emacs-lisp :var length=table-length()
  14384. (* 2 length)
  14385. #+END_SRC
  14386. #+RESULTS:
  14387. : 8
  14388. @end example
  14389. @item code block with arguments
  14390. A code block name, as assigned by @samp{NAME} keyword, followed by
  14391. parentheses and optional arguments passed within the parentheses.
  14392. @example
  14393. #+NAME: double
  14394. #+BEGIN_SRC emacs-lisp :var input=8
  14395. (* 2 input)
  14396. #+END_SRC
  14397. #+RESULTS: double
  14398. : 16
  14399. #+NAME: squared
  14400. #+BEGIN_SRC emacs-lisp :var input=double(input=1)
  14401. (* input input)
  14402. #+END_SRC
  14403. #+RESULTS: squared
  14404. : 4
  14405. @end example
  14406. @item literal example
  14407. A literal example block named with a @samp{NAME} keyword.
  14408. @example
  14409. #+NAME: literal-example
  14410. #+BEGIN_EXAMPLE
  14411. A literal example
  14412. on two lines
  14413. #+END_EXAMPLE
  14414. #+NAME: read-literal-example
  14415. #+BEGIN_SRC emacs-lisp :var x=literal-example
  14416. (concatenate #'string x " for you.")
  14417. #+END_SRC
  14418. #+RESULTS: read-literal-example
  14419. : A literal example
  14420. : on two lines for you.
  14421. @end example
  14422. @end table
  14423. Indexing variable values enables referencing portions of a variable.
  14424. Indexes are 0 based with negative values counting backwards from the
  14425. end. If an index is separated by commas then each subsequent section
  14426. indexes as the next dimension. Note that this indexing occurs
  14427. @emph{before} other table-related header arguments are applied, such as
  14428. @samp{hlines}, @samp{colnames} and @samp{rownames}. The following example assigns
  14429. the last cell of the first row the table @samp{example-table} to the
  14430. variable @samp{data}:
  14431. @example
  14432. #+NAME: example-table
  14433. | 1 | a |
  14434. | 2 | b |
  14435. | 3 | c |
  14436. | 4 | d |
  14437. #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1]
  14438. data
  14439. #+END_SRC
  14440. #+RESULTS:
  14441. : a
  14442. @end example
  14443. Two integers separated by a colon reference a range of variable
  14444. values. In that case the entire inclusive range is referenced. For
  14445. example the following assigns the middle three rows of @samp{example-table}
  14446. to @samp{data}.
  14447. @example
  14448. #+NAME: example-table
  14449. | 1 | a |
  14450. | 2 | b |
  14451. | 3 | c |
  14452. | 4 | d |
  14453. | 5 | 3 |
  14454. #+BEGIN_SRC emacs-lisp :var data=example-table[1:3]
  14455. data
  14456. #+END_SRC
  14457. #+RESULTS:
  14458. | 2 | b |
  14459. | 3 | c |
  14460. | 4 | d |
  14461. @end example
  14462. To pick the entire range, use an empty index, or the single character
  14463. @samp{*}. @samp{0:-1} does the same thing. Example below shows how to
  14464. reference the first column only.
  14465. @example
  14466. #+NAME: example-table
  14467. | 1 | a |
  14468. | 2 | b |
  14469. | 3 | c |
  14470. | 4 | d |
  14471. #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
  14472. data
  14473. #+END_SRC
  14474. #+RESULTS:
  14475. | 1 | 2 | 3 | 4 |
  14476. @end example
  14477. Index referencing can be used for tables and code blocks. Index
  14478. referencing can handle any number of dimensions. Commas delimit
  14479. multiple dimensions, as shown below.
  14480. @example
  14481. #+NAME: 3D
  14482. #+BEGIN_SRC emacs-lisp
  14483. '(((1 2 3) (4 5 6) (7 8 9))
  14484. ((10 11 12) (13 14 15) (16 17 18))
  14485. ((19 20 21) (22 23 24) (25 26 27)))
  14486. #+END_SRC
  14487. #+BEGIN_SRC emacs-lisp :var data=3D[1,,1]
  14488. data
  14489. #+END_SRC
  14490. #+RESULTS:
  14491. | 11 | 14 | 17 |
  14492. @end example
  14493. Note that row names and column names are not removed prior to variable
  14494. indexing. You need to take them into account, even when @samp{colnames} or
  14495. @samp{rownames} header arguments remove them.
  14496. Emacs lisp code can also set the values for variables. To
  14497. differentiate a value from Lisp code, Org interprets any value
  14498. starting with @samp{(}, @samp{[}, @samp{'} or @samp{`} as Emacs Lisp code. The result of
  14499. evaluating that code is then assigned to the value of that variable.
  14500. The following example shows how to reliably query and pass the file
  14501. name of the Org mode buffer to a code block using headers. We need
  14502. reliability here because the file's name could change once the code in
  14503. the block starts executing.
  14504. @example
  14505. #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
  14506. wc -w $filename
  14507. #+END_SRC
  14508. @end example
  14509. Note that values read from tables and lists are not mistakenly
  14510. evaluated as Emacs Lisp code, as illustrated in the following example.
  14511. @example
  14512. #+NAME: table
  14513. | (a b c) |
  14514. #+HEADER: :var data=table[0,0]
  14515. #+BEGIN_SRC perl
  14516. $data
  14517. #+END_SRC
  14518. #+RESULTS:
  14519. : (a b c)
  14520. @end example
  14521. @anchor{Using sessions}
  14522. @subheading Using sessions
  14523. @cindex using sessions in code blocks
  14524. @cindex @samp{session}, header argument
  14525. Two code blocks can share the same environment. The @samp{session} header
  14526. argument is for running multiple source code blocks under one session.
  14527. Org runs code blocks with the same session name in the same
  14528. interpreter process.
  14529. @table @asis
  14530. @item @samp{none}
  14531. Default. Each code block gets a new interpreter process to
  14532. execute. The process terminates once the block is evaluated.
  14533. @item @var{STRING}
  14534. Any string besides @samp{none} turns that string into the name of that
  14535. session. For example, @samp{:session STRING} names it @samp{STRING}. If
  14536. @samp{session} has no value, then the session name is derived from the
  14537. source language identifier. Subsequent blocks with the same
  14538. source code language use the same session. Depending on the
  14539. language, state variables, code from other blocks, and the
  14540. overall interpreted environment may be shared. Some interpreted
  14541. languages support concurrent sessions when subsequent source code
  14542. language blocks change session names.
  14543. @end table
  14544. Only languages that provide interactive evaluation can have session
  14545. support. Not all languages provide this support, such as C and ditaa.
  14546. Even languages, such as Python and Haskell, that do support
  14547. interactive evaluation impose limitations on allowable language
  14548. constructs that can run interactively. Org inherits those limitations
  14549. for those code blocks running in a session.
  14550. @anchor{Choosing a working directory}
  14551. @subheading Choosing a working directory
  14552. @cindex working directory, in a code block
  14553. @cindex @samp{dir}, header argument
  14554. The @samp{dir} header argument specifies the default directory during code
  14555. block execution. If it is absent, then the directory associated with
  14556. the current buffer is used. In other words, supplying @samp{:dir PATH}
  14557. temporarily has the same effect as changing the current directory with
  14558. @kbd{M-x cd PATH}, and then not setting @samp{dir}. Under the
  14559. surface, @samp{dir} simply sets the value of the Emacs variable
  14560. @code{default-directory}.
  14561. For example, to save the plot file in the @samp{Work/} folder of the home
  14562. directory---notice tilde is expanded:
  14563. @example
  14564. #+BEGIN_SRC R :file myplot.png :dir ~/Work
  14565. matplot(matrix(rnorm(100), 10), type="l")
  14566. #+END_SRC
  14567. @end example
  14568. To evaluate the code block on a remote machine, supply a remote
  14569. directory name using Tramp syntax. For example:
  14570. @example
  14571. #+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu:
  14572. plot(1:10, main=system("hostname", intern=TRUE))
  14573. #+END_SRC
  14574. @end example
  14575. Org first captures the text results as usual for insertion in the Org
  14576. file. Then Org also inserts a link to the remote file, thanks to
  14577. Emacs Tramp. Org constructs the remote path to the file name from
  14578. @samp{dir} and @code{default-directory}, as illustrated here:
  14579. @example
  14580. [[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
  14581. @end example
  14582. When @samp{dir} is used with @samp{session}, Org sets the starting directory for
  14583. a new session. But Org does not alter the directory of an already
  14584. existing session.
  14585. Do not use @samp{dir} with @samp{:exports results} or with @samp{:exports both} to
  14586. avoid Org inserting incorrect links to remote files. That is because
  14587. Org does not expand @code{default directory} to avoid some underlying
  14588. portability issues.
  14589. @anchor{Inserting headers and footers}
  14590. @subheading Inserting headers and footers
  14591. @cindex headers, in code blocks
  14592. @cindex footers, in code blocks
  14593. @cindex @samp{prologue}, header argument
  14594. The @samp{prologue} header argument is for appending to the top of the code
  14595. block for execution, like a reset instruction. For example, you may
  14596. use @samp{:prologue "reset"} in a Gnuplot code block or, for every such
  14597. block:
  14598. @lisp
  14599. (add-to-list 'org-babel-default-header-args:gnuplot
  14600. '((:prologue . "reset")))
  14601. @end lisp
  14602. @cindex @samp{epilogue}, header argument
  14603. Likewise, the value of the @samp{epilogue} header argument is for appending
  14604. to the end of the code block for execution.
  14605. @node Evaluating Code Blocks
  14606. @section Evaluating Code Blocks
  14607. @cindex code block, evaluating
  14608. @cindex source code, evaluating
  14609. @cindex @samp{RESULTS}, keyword
  14610. A note about security: With code evaluation comes the risk of harm.
  14611. Org safeguards by prompting for user's permission before executing any
  14612. code in the source block. To customize this safeguard, or disable it,
  14613. see @ref{Code Evaluation Security}.
  14614. @anchor{How to evaluate source code}
  14615. @subheading How to evaluate source code
  14616. Org captures the results of the code block evaluation and inserts them
  14617. in the Org file, right after the code block. The insertion point is
  14618. after a newline and the @samp{RESULTS} keyword. Org creates the @samp{RESULTS}
  14619. keyword if one is not already there.
  14620. By default, Org enables only Emacs Lisp code blocks for execution.
  14621. See @ref{Languages} to enable other languages.
  14622. @kindex C-c C-c
  14623. @kindex C-c C-v e
  14624. @findex org-babel-execute-src-block
  14625. Org provides many ways to execute code blocks. @kbd{C-c C-c} or
  14626. @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
  14627. to remove code evaluation from the @kbd{C-c C-c} key binding.} calls the
  14628. @code{org-babel-execute-src-block} function, which executes the code in the
  14629. block, collects the results, and inserts them in the buffer.
  14630. @cindex @samp{CALL}, keyword
  14631. @vindex org-babel-inline-result-wrap
  14632. By calling a named code block@footnote{Actually, the constructs @samp{call_<name>()} and @samp{src_<lang>@{@}}
  14633. are not evaluated when they appear in a keyword line---i.e. lines
  14634. starting with @samp{#+KEYWORD:}, see @ref{In-buffer Settings}.} from an Org mode buffer or
  14635. a table. Org can call the named code blocks from the current Org mode
  14636. buffer or from the ``Library of Babel'' (see @ref{Library of Babel}).
  14637. The syntax for @samp{CALL} keyword is:
  14638. @example
  14639. #+CALL: <name>(<arguments>)
  14640. #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
  14641. @end example
  14642. The syntax for inline named code blocks is:
  14643. @example
  14644. ... call_<name>(<arguments>) ...
  14645. ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ...
  14646. @end example
  14647. When inline syntax is used, the result is wrapped based on the
  14648. variable @code{org-babel-inline-result-wrap}, which by default is set to
  14649. @code{"=%s="} to produce verbatim text suitable for markup.
  14650. @table @asis
  14651. @item @samp{<name>}
  14652. 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
  14653. located in another file, start @samp{<name>} with the file name
  14654. followed by a colon. For example, in order to execute a block
  14655. named @samp{clear-data} in @samp{file.org}, you can write the following:
  14656. @example
  14657. #+CALL: file.org:clear-data()
  14658. @end example
  14659. @item @samp{<arguments>}
  14660. Org passes arguments to the code block using standard function
  14661. call syntax. For example, a @samp{#+CALL:} line that passes @samp{4} to
  14662. a code block named @samp{double}, which declares the header argument
  14663. @samp{:var n=2}, would be written as:
  14664. @example
  14665. #+CALL: double(n=4)
  14666. @end example
  14667. @noindent
  14668. Note how this function call syntax is different from the header
  14669. argument syntax.
  14670. @item @samp{<inside header arguments>}
  14671. Org passes inside header arguments to the named code block using
  14672. the header argument syntax. Inside header arguments apply to
  14673. code block evaluation. For example, @samp{[:results output]} collects
  14674. results printed to stdout during code execution of that block.
  14675. Note how this header argument syntax is different from the
  14676. function call syntax.
  14677. @item @samp{<end header arguments>}
  14678. End header arguments affect the results returned by the code
  14679. block. For example, @samp{:results html} wraps the results in
  14680. a @samp{#+BEGIN_EXPORT html} block before inserting the results in the
  14681. Org buffer.
  14682. @end table
  14683. @anchor{Limit code block evaluation}
  14684. @subheading Limit code block evaluation
  14685. @cindex @samp{eval}, header argument
  14686. @cindex control code block evaluation
  14687. The @samp{eval} header argument can limit evaluation of specific code
  14688. blocks and @samp{CALL} keyword. It is useful for protection against
  14689. evaluating untrusted code blocks by prompting for a confirmation.
  14690. @table @asis
  14691. @item @samp{never} or @samp{no}
  14692. Org never evaluates the source code.
  14693. @item @samp{query}
  14694. Org prompts the user for permission to evaluate the source code.
  14695. @item @samp{never-export} or @samp{no-export}
  14696. Org does not evaluate the source code when exporting, yet the
  14697. user can evaluate it interactively.
  14698. @item @samp{query-export}
  14699. Org prompts the user for permission to evaluate the source code
  14700. during export.
  14701. @end table
  14702. If @samp{eval} header argument is not set, then Org determines whether to
  14703. evaluate the source code from the @code{org-confirm-babel-evaluate}
  14704. variable (see @ref{Code Evaluation Security}).
  14705. @anchor{Cache results of evaluation}
  14706. @subheading Cache results of evaluation
  14707. @cindex @samp{cache}, header argument
  14708. @cindex cache results of code evaluation
  14709. The @samp{cache} header argument is for caching results of evaluating code
  14710. blocks. Caching results can avoid re-evaluating a code block that
  14711. have not changed since the previous run. To benefit from the cache
  14712. and avoid redundant evaluations, the source block must have a result
  14713. already present in the buffer, and neither the header
  14714. arguments---including the value of @samp{var} references---nor the text of
  14715. the block itself has changed since the result was last computed. This
  14716. feature greatly helps avoid long-running calculations. For some edge
  14717. cases, however, the cached results may not be reliable.
  14718. The caching feature is best for when code blocks are pure functions,
  14719. that is functions that return the same value for the same input
  14720. arguments (see @ref{Environment of a Code Block}), and that do not have
  14721. side effects, and do not rely on external variables other than the
  14722. input arguments. Functions that depend on a timer, file system
  14723. objects, and random number generators are clearly unsuitable for
  14724. caching.
  14725. A note of warning: when @samp{cache} is used in a session, caching may
  14726. cause unexpected results.
  14727. When the caching mechanism tests for any source code changes, it does
  14728. not expand Noweb style references (see @ref{Noweb Reference Syntax}). For
  14729. reasons why, see @uref{http://thread.gmane.org/gmane.emacs.orgmode/79046}.
  14730. The @samp{cache} header argument can have one of two values: @samp{yes} or @samp{no}.
  14731. @table @asis
  14732. @item @samp{no}
  14733. Default. No caching of results; code block evaluated every
  14734. time.
  14735. @item @samp{yes}
  14736. Whether to run the code or return the cached results is
  14737. determined by comparing the SHA1 hash value of the combined code
  14738. block and arguments passed to it. This hash value is packed on
  14739. the @samp{#+RESULTS:} line from previous evaluation. When hash values
  14740. match, Org does not evaluate the code block. When hash values
  14741. mismatch, Org evaluates the code block, inserts the results,
  14742. recalculates the hash value, and updates @samp{#+RESULTS:} line.
  14743. @end table
  14744. In this example, both functions are cached. But @samp{caller} runs only if
  14745. the result from @samp{random} has changed since the last run.
  14746. @example
  14747. #+NAME: random
  14748. #+BEGIN_SRC R :cache yes
  14749. runif(1)
  14750. #+END_SRC
  14751. #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random
  14752. 0.4659510825295
  14753. #+NAME: caller
  14754. #+BEGIN_SRC emacs-lisp :var x=random :cache yes
  14755. x
  14756. #+END_SRC
  14757. #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller
  14758. 0.254227238707244
  14759. @end example
  14760. @node Results of Evaluation
  14761. @section Results of Evaluation
  14762. @cindex code block, results of evaluation
  14763. @cindex source code, results of evaluation
  14764. @cindex @samp{results}, header argument
  14765. How Org handles results of a code block execution depends on many
  14766. header arguments working together. The primary determinant, however,
  14767. is the @samp{results} header argument. It accepts four classes of options.
  14768. Each code block can take only one option per class:
  14769. @table @asis
  14770. @item collection
  14771. For how the results should be collected from the code block;
  14772. @item type
  14773. For which type of result the code block will return; affects how
  14774. Org processes and inserts results in the Org buffer;
  14775. @item format
  14776. For the result; affects how Org processes and inserts results in
  14777. the Org buffer;
  14778. @item handling
  14779. For processing results after evaluation of the code block;
  14780. @end table
  14781. @anchor{Collection}
  14782. @subheading Collection
  14783. Collection options specify the results. Choose one of the options;
  14784. they are mutually exclusive.
  14785. @table @asis
  14786. @item @samp{value}
  14787. Default. Functional mode. Org gets the value by wrapping the
  14788. code in a function definition in the language of the source
  14789. block. That is why when using @samp{:results value}, code should
  14790. execute like a function and return a value. For languages like
  14791. Python, an explicit @code{return} statement is mandatory when using
  14792. @samp{:results value}. Result is the value returned by the last
  14793. statement in the code block.
  14794. When evaluating the code block in a session (see @ref{Environment of a Code Block}), Org passes the code to an interpreter running as
  14795. an interactive Emacs inferior process. Org gets the value from
  14796. the source code interpreter's last statement output. Org has to
  14797. use language-specific methods to obtain the value. For example,
  14798. from the variable @code{_} in Python and Ruby, and the value of
  14799. @code{.Last.value} in R.
  14800. @item @samp{output}
  14801. Scripting mode. Org passes the code to an external process
  14802. running the interpreter. Org returns the contents of the
  14803. standard output stream as text results.
  14804. When using a session, Org passes the code to the interpreter
  14805. running as an interactive Emacs inferior process. Org
  14806. concatenates any text output from the interpreter and returns the
  14807. collection as a result.
  14808. Note that this collection is not the same as that would be
  14809. collected from stdout of a non-interactive interpreter running as
  14810. an external process. Compare for example these two blocks:
  14811. @example
  14812. #+BEGIN_SRC python :results output
  14813. print "hello"
  14814. 2
  14815. print "bye"
  14816. #+END_SRC
  14817. #+RESULTS:
  14818. : hello
  14819. : bye
  14820. @end example
  14821. In the above non-session mode, the ``2'' is not printed; so it does
  14822. not appear in results.
  14823. @example
  14824. #+BEGIN_SRC python :results output :session
  14825. print "hello"
  14826. 2
  14827. print "bye"
  14828. #+END_SRC
  14829. #+RESULTS:
  14830. : hello
  14831. : 2
  14832. : bye
  14833. @end example
  14834. In the above session, the interactive interpreter receives and
  14835. prints ``2''. Results show that.
  14836. @end table
  14837. @anchor{Type}
  14838. @subheading Type
  14839. Type tells what result types to expect from the execution of the code
  14840. block. Choose one of the options; they are mutually exclusive. The
  14841. default behavior is to automatically determine the result type.
  14842. @table @asis
  14843. @item @samp{table}
  14844. @itemx @samp{vector}
  14845. Interpret the results as an Org table. If the result is a single
  14846. value, create a table with one row and one column. Usage
  14847. example: @samp{:results value table}.
  14848. @cindex @samp{hlines}, header argument
  14849. In-between each table row or below the table headings, sometimes
  14850. results have horizontal lines, which are also known as ``hlines''.
  14851. The @samp{hlines} argument with the default @samp{no} value strips such
  14852. lines from the input table. For most code, this is desirable, or
  14853. else those @samp{hline} symbols raise unbound variable errors.
  14854. A @samp{yes} accepts such lines, as demonstrated in the following
  14855. example.
  14856. @example
  14857. #+NAME: many-cols
  14858. | a | b | c |
  14859. |---+---+---|
  14860. | d | e | f |
  14861. |---+---+---|
  14862. | g | h | i |
  14863. #+NAME: no-hline
  14864. #+BEGIN_SRC python :var tab=many-cols :hlines no
  14865. return tab
  14866. #+END_SRC
  14867. #+RESULTS: no-hline
  14868. | a | b | c |
  14869. | d | e | f |
  14870. | g | h | i |
  14871. #+NAME: hlines
  14872. #+BEGIN_SRC python :var tab=many-cols :hlines yes
  14873. return tab
  14874. #+END_SRC
  14875. #+RESULTS: hlines
  14876. | a | b | c |
  14877. |---+---+---|
  14878. | d | e | f |
  14879. |---+---+---|
  14880. | g | h | i |
  14881. @end example
  14882. @item @samp{list}
  14883. Interpret the results as an Org list. If the result is a single
  14884. value, create a list of one element.
  14885. @item @samp{scalar}
  14886. @itemx @samp{verbatim}
  14887. Interpret literally and insert as quoted text. Do not create
  14888. a table. Usage example: @samp{:results value verbatim}.
  14889. @item @samp{file}
  14890. Interpret as a filename. Save the results of execution of the
  14891. code block to that file, then insert a link to it. You can
  14892. control both the filename and the description associated to the
  14893. link.
  14894. @cindex @samp{file}, header argument
  14895. @cindex @samp{output-dir}, header argument
  14896. Org first tries to generate the filename from the value of the
  14897. @samp{file} header argument and the directory specified using the
  14898. @samp{output-dir} header arguments. If @samp{output-dir} is not specified,
  14899. Org assumes it is the current directory.
  14900. @example
  14901. #+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/
  14902. size(2cm);
  14903. draw(unitcircle);
  14904. #+END_SRC
  14905. @end example
  14906. @cindex @samp{file-ext}, header argument
  14907. If @samp{file} is missing, Org generates the base name of the output
  14908. file from the name of the code block, and its extension from the
  14909. @samp{file-ext} header argument. In that case, both the name and the
  14910. extension are mandatory.
  14911. @example
  14912. #+name: circle
  14913. #+BEGIN_SRC asymptote :results value file :file-ext pdf
  14914. size(2cm);
  14915. draw(unitcircle);
  14916. #+END_SRC
  14917. @end example
  14918. @cindex @samp{file-desc}, header argument
  14919. The @samp{file-desc} header argument defines the description (see
  14920. @ref{Link Format}) for the link. If @samp{file-desc} has no value, Org
  14921. uses the generated file name for both the ``link'' and
  14922. ``description'' parts of the link.
  14923. @end table
  14924. @anchor{Format}
  14925. @subheading Format
  14926. Format pertains to the type of the result returned by the code block.
  14927. Choose one of the options; they are mutually exclusive. The default
  14928. follows from the type specified above.
  14929. @table @asis
  14930. @item @samp{code}
  14931. Result enclosed in a code block. Useful for parsing. Usage
  14932. example: @samp{:results value code}.
  14933. @item @samp{drawer}
  14934. Result wrapped in a @samp{RESULTS} drawer. Useful for containing
  14935. @samp{raw} or @samp{org} results for later scripting and automated
  14936. processing. Usage example: @samp{:results value drawer}.
  14937. @item @samp{html}
  14938. Results enclosed in a @samp{BEGIN_EXPORT html} block. Usage example:
  14939. @samp{:results value html}.
  14940. @item @samp{latex}
  14941. Results enclosed in a @samp{BEGIN_EXPORT latex} block. Usage example:
  14942. @samp{:results value latex}.
  14943. @item @samp{link}
  14944. @itemx @samp{graphics}
  14945. Result is a link to the file specified in @samp{:file} header
  14946. argument. However, unlike plain @samp{:file}, nothing is written to
  14947. the disk. The block is used for its side-effects only, as in the
  14948. following example:
  14949. @example
  14950. #+begin_src shell :results link :file "download.tar.gz"
  14951. wget -c "http://example.com/download.tar.gz"
  14952. #+end_src
  14953. @end example
  14954. @item @samp{org}
  14955. Results enclosed in a @samp{BEGIN_SRC org} block. For comma-escape,
  14956. either @kbd{@key{TAB}} in the block, or export the file. Usage
  14957. example: @samp{:results value org}.
  14958. @item @samp{pp}
  14959. Result converted to pretty-print source code. Enclosed in a code
  14960. block. Languages supported: Emacs Lisp, Python, and Ruby. Usage
  14961. example: @samp{:results value pp}.
  14962. @item @samp{raw}
  14963. Interpreted as raw Org mode. Inserted directly into the buffer.
  14964. Aligned if it is a table. Usage example: @samp{:results value raw}.
  14965. @end table
  14966. @anchor{Handling}
  14967. @subheading Handling
  14968. Handling options after collecting the results.
  14969. @table @asis
  14970. @item @samp{silent}
  14971. Do not insert results in the Org mode buffer, but echo them in
  14972. the minibuffer. Usage example: @samp{:results output silent}.
  14973. @item @samp{replace}
  14974. Default. Insert results in the Org buffer. Remove previous
  14975. results. Usage example: @samp{:results output replace}.
  14976. @item @samp{append}
  14977. Append results to the Org buffer. Latest results are at the
  14978. bottom. Does not remove previous results. Usage example:
  14979. @samp{:results output append}.
  14980. @item @samp{prepend}
  14981. Prepend results to the Org buffer. Latest results are at the
  14982. top. Does not remove previous results. Usage example: @samp{:results
  14983. output prepend}.
  14984. @end table
  14985. @anchor{Post-processing}
  14986. @subheading Post-processing
  14987. @cindex @samp{post}, header argument
  14988. @cindex @samp{*this*}, in @samp{post} header argument
  14989. The @samp{post} header argument is for post-processing results from block
  14990. evaluation. When @samp{post} has any value, Org binds the results to
  14991. @code{*this*} variable for easy passing to @samp{var} header argument
  14992. specifications (see @ref{Environment of a Code Block}). That makes results
  14993. available to other code blocks, or even for direct Emacs Lisp code
  14994. execution.
  14995. The following two examples illustrate @samp{post} header argument in
  14996. action. The first one shows how to attach an @samp{ATTR_LATEX} keyword
  14997. using @samp{post}.
  14998. @example
  14999. #+NAME: attr_wrap
  15000. #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output
  15001. echo "#+ATTR_LATEX: :width $width"
  15002. echo "$data"
  15003. #+END_SRC
  15004. #+HEADER: :file /tmp/it.png
  15005. #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer
  15006. digraph@{
  15007. a -> b;
  15008. b -> c;
  15009. c -> a;
  15010. @}
  15011. #+end_src
  15012. #+RESULTS:
  15013. :RESULTS:
  15014. #+ATTR_LATEX :width 5cm
  15015. [[file:/tmp/it.png]]
  15016. :END:
  15017. @end example
  15018. The second example shows use of @samp{colnames} header argument in @samp{post}
  15019. to pass data between code blocks.
  15020. @example
  15021. #+NAME: round-tbl
  15022. #+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f"
  15023. (mapcar (lambda (row)
  15024. (mapcar (lambda (cell)
  15025. (if (numberp cell)
  15026. (format fmt cell)
  15027. cell))
  15028. row))
  15029. tbl)
  15030. #+end_src
  15031. #+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*)
  15032. set.seed(42)
  15033. data.frame(foo=rnorm(1))
  15034. #+END_SRC
  15035. #+RESULTS:
  15036. | foo |
  15037. |-------|
  15038. | 1.371 |
  15039. @end example
  15040. @node Exporting Code Blocks
  15041. @section Exporting Code Blocks
  15042. @cindex code block, exporting
  15043. @cindex source code, exporting
  15044. It is possible to export the @emph{code} of code blocks, the @emph{results} of
  15045. code block evaluation, @emph{both} the code and the results of code block
  15046. evaluation, or @emph{none}. Org defaults to exporting @emph{code} for most
  15047. languages. For some languages, such as ditaa, Org defaults to
  15048. @emph{results}. To export just the body of code blocks, see @ref{Literal Examples}. To selectively export sub-trees of an Org document, see
  15049. @ref{Exporting}.
  15050. @cindex @samp{export}, header argument
  15051. The @samp{exports} header argument is to specify if that part of the Org
  15052. file is exported to, say, HTML or @LaTeX{} formats.
  15053. @table @asis
  15054. @item @samp{code}
  15055. The default. The body of code is included into the exported
  15056. file. Example: @samp{:exports code}.
  15057. @item @samp{results}
  15058. The results of evaluation of the code is included in the exported
  15059. file. Example: @samp{:exports results}.
  15060. @item @samp{both}
  15061. Both the code and results of evaluation are included in the
  15062. exported file. Example: @samp{:exports both}.
  15063. @item @samp{none}
  15064. Neither the code nor the results of evaluation is included in the
  15065. exported file. Whether the code is evaluated at all depends on
  15066. other options. Example: @samp{:exports none}.
  15067. @end table
  15068. @vindex org-export-use-babel
  15069. To stop Org from evaluating code blocks to speed exports, use the
  15070. header argument @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15071. To stop Org from evaluating code blocks for greater security, set the
  15072. @code{org-export-use-babel} variable to @code{nil}, but understand that header
  15073. arguments will have no effect.
  15074. Turning off evaluation comes in handy when batch processing. For
  15075. example, markup languages for wikis, which have a high risk of
  15076. untrusted code. Stopping code block evaluation also stops evaluation
  15077. of all header arguments of the code block. This may not be desirable
  15078. in some circumstances. So during export, to allow evaluation of just
  15079. the header arguments but not any code evaluation in the source block,
  15080. set @samp{:eval never-export} (see @ref{Evaluating Code Blocks}).
  15081. Org never evaluates code blocks in commented sub-trees when exporting
  15082. (see @ref{Comment Lines}). On the other hand, Org does evaluate code
  15083. blocks in sub-trees excluded from export (see @ref{Export Settings}).
  15084. @node Extracting Source Code
  15085. @section Extracting Source Code
  15086. @cindex tangling
  15087. @cindex source code, extracting
  15088. @cindex code block, extracting source code
  15089. Extracting source code from code blocks is a basic task in literate
  15090. programming. Org has features to make this easy. In literate
  15091. programming parlance, documents on creation are @emph{woven} with code and
  15092. documentation, and on export, the code is tangled for execution by
  15093. a computer. Org facilitates weaving and tangling for producing,
  15094. maintaining, sharing, and exporting literate programming documents.
  15095. Org provides extensive customization options for extracting source
  15096. code.
  15097. When Org tangles code blocks, it expands, merges, and transforms them.
  15098. Then Org recomposes them into one or more separate files, as
  15099. configured through the options. During this tangling process, Org
  15100. expands variables in the source code, and resolves any Noweb style
  15101. references (see @ref{Noweb Reference Syntax}).
  15102. @anchor{Header arguments}
  15103. @subheading Header arguments
  15104. @cindex @samp{tangle}, header argument
  15105. The @samp{tangle} header argument specifies if the code block is exported
  15106. to source file(s).
  15107. @table @asis
  15108. @item @samp{yes}
  15109. Export the code block to source file. The file name for the
  15110. source file is derived from the name of the Org file, and the
  15111. file extension is derived from the source code language
  15112. identifier. Example: @samp{:tangle yes}.
  15113. @item @samp{no}
  15114. The default. Do not extract the code in a source code file.
  15115. Example: @samp{:tangle no}.
  15116. @item @var{FILENAME}
  15117. Export the code block to source file whose file name is derived
  15118. from any string passed to the @samp{tangle} header argument. Org
  15119. derives the file name as being relative to the directory of the
  15120. Org file's location. Example: @samp{:tangle FILENAME}.
  15121. @end table
  15122. @cindex @samp{mkdirp}, header argument
  15123. The @samp{mkdirp} header argument creates parent directories for tangled
  15124. files if the directory does not exist. @samp{yes} enables directory
  15125. creation and @samp{no} inhibits directory creation.
  15126. @cindex @samp{comments}, header argument
  15127. The @samp{comments} header argument controls inserting comments into
  15128. tangled files. These are above and beyond whatever comments may
  15129. already exist in the code block.
  15130. @table @asis
  15131. @item @samp{no}
  15132. The default. Do not insert any extra comments during tangling.
  15133. @item @samp{link}
  15134. Wrap the code block in comments. Include links pointing back to
  15135. the place in the Org file from where the code was tangled.
  15136. @item @samp{yes}
  15137. Kept for backward compatibility; same as @samp{link}.
  15138. @item @samp{org}
  15139. Nearest headline text from Org file is inserted as comment. The
  15140. exact text that is inserted is picked from the leading context of
  15141. the source block.
  15142. @item @samp{both}
  15143. Includes both @samp{link} and @samp{org} options.
  15144. @item @samp{noweb}
  15145. Includes @samp{link} option, expands Noweb references (see @ref{Noweb Reference Syntax}), and wraps them in link comments inside the
  15146. body of the code block.
  15147. @end table
  15148. @cindex @samp{padline}, header argument
  15149. The @samp{padline} header argument controls insertion of newlines to pad
  15150. source code in the tangled file.
  15151. @table @asis
  15152. @item @samp{yes}
  15153. Default. Insert a newline before and after each code block in
  15154. the tangled file.
  15155. @item @samp{no}
  15156. Do not insert newlines to pad the tangled code blocks.
  15157. @end table
  15158. @cindex @samp{shebang}, header argument
  15159. The @samp{shebang} header argument can turn results into executable script
  15160. files. By setting it to a string value---for example, @samp{:shebang
  15161. "#!/bin/bash"}---Org inserts that string as the first line of the
  15162. tangled file that the code block is extracted to. Org then turns on
  15163. the tangled file's executable permission.
  15164. @cindex @samp{no-expand}, header argument
  15165. By default Org expands code blocks during tangling. The @samp{no-expand}
  15166. header argument turns off such expansions. Note that one side-effect
  15167. of expansion by @code{org-babel-expand-src-block} also assigns values (see
  15168. @ref{Environment of a Code Block}) to variables. Expansions also replace
  15169. Noweb references with their targets (see @ref{Noweb Reference Syntax}).
  15170. Some of these expansions may cause premature assignment, hence this
  15171. option. This option makes a difference only for tangling. It has no
  15172. effect when exporting since code blocks for execution have to be
  15173. expanded anyway.
  15174. @anchor{Functions}
  15175. @subheading Functions
  15176. @table @asis
  15177. @item @code{org-babel-tangle}
  15178. @findex org-babel-tangle
  15179. @kindex C-c C-v t
  15180. Tangle the current file. Bound to @kbd{C-c C-v t}.
  15181. With prefix argument only tangle the current code block.
  15182. @item @code{org-babel-tangle-file}
  15183. @findex org-babel-tangle-file
  15184. @kindex C-c C-v f
  15185. Choose a file to tangle. Bound to @kbd{C-c C-v f}.
  15186. @end table
  15187. @anchor{Hooks (1)}
  15188. @subheading Hooks
  15189. @table @asis
  15190. @item @code{org-babel-post-tangle-hook}
  15191. @vindex org-babel-post-tangle-hook
  15192. This hook is run from within code files tangled by
  15193. @code{org-babel-tangle}, making it suitable for post-processing,
  15194. compilation, and evaluation of code in the tangled files.
  15195. @end table
  15196. @anchor{Jumping between code and Org}
  15197. @subheading Jumping between code and Org
  15198. @findex org-babel-tangle-jump-to-org
  15199. Debuggers normally link errors and messages back to the source code.
  15200. But for tangled files, we want to link back to the Org file, not to
  15201. the tangled source file. To make this extra jump, Org uses
  15202. @code{org-babel-tangle-jump-to-org} function with two additional source
  15203. code block header arguments:
  15204. @enumerate
  15205. @item
  15206. Set @samp{padline} to true---this is the default setting.
  15207. @item
  15208. Set @samp{comments} to @samp{link}, which makes Org insert links to the Org
  15209. file.
  15210. @end enumerate
  15211. @node Languages
  15212. @section Languages
  15213. @cindex babel, languages
  15214. @cindex source code, languages
  15215. @cindex code block, languages
  15216. Code blocks in the following languages are supported.
  15217. @multitable {aaaaaaaaaa} {aaaaaaaaaaaa} {aaaaaaaaaaaaaa} {aaaaaaaaaaaa}
  15218. @headitem Language
  15219. @tab Identifier
  15220. @tab Language
  15221. @tab Identifier
  15222. @item Asymptote
  15223. @tab @samp{asymptote}
  15224. @tab Lua
  15225. @tab @samp{lua}
  15226. @item Awk
  15227. @tab @samp{awk}
  15228. @tab MATLAB
  15229. @tab @samp{matlab}
  15230. @item C
  15231. @tab @samp{C}
  15232. @tab Mscgen
  15233. @tab @samp{mscgen}
  15234. @item C++
  15235. @tab @samp{C++}
  15236. @tab Objective Caml
  15237. @tab @samp{ocaml}
  15238. @item Clojure
  15239. @tab @samp{clojure}
  15240. @tab Octave
  15241. @tab @samp{octave}
  15242. @item CSS
  15243. @tab @samp{css}
  15244. @tab Org mode
  15245. @tab @samp{org}
  15246. @item D
  15247. @tab @samp{d}
  15248. @tab Oz
  15249. @tab @samp{oz}
  15250. @item ditaa
  15251. @tab @samp{ditaa}
  15252. @tab Perl
  15253. @tab @samp{perl}
  15254. @item Emacs Calc
  15255. @tab @samp{calc}
  15256. @tab Plantuml
  15257. @tab @samp{plantuml}
  15258. @item Emacs Lisp
  15259. @tab @samp{emacs-lisp}
  15260. @tab Processing.js
  15261. @tab @samp{processing}
  15262. @item Fortran
  15263. @tab @samp{fortran}
  15264. @tab Python
  15265. @tab @samp{python}
  15266. @item Gnuplot
  15267. @tab @samp{gnuplot}
  15268. @tab R
  15269. @tab @samp{R}
  15270. @item GNU Screen
  15271. @tab @samp{screen}
  15272. @tab Ruby
  15273. @tab @samp{ruby}
  15274. @item Graphviz
  15275. @tab @samp{dot}
  15276. @tab Sass
  15277. @tab @samp{sass}
  15278. @item Haskell
  15279. @tab @samp{haskell}
  15280. @tab Scheme
  15281. @tab @samp{scheme}
  15282. @item Java
  15283. @tab @samp{java}
  15284. @tab Sed
  15285. @tab @samp{sed}
  15286. @item Javascript
  15287. @tab @samp{js}
  15288. @tab shell
  15289. @tab @samp{sh}
  15290. @item @LaTeX{}
  15291. @tab @samp{latex}
  15292. @tab SQL
  15293. @tab @samp{sql}
  15294. @item Ledger
  15295. @tab @samp{ledger}
  15296. @tab SQLite
  15297. @tab @samp{sqlite}
  15298. @item Lilypond
  15299. @tab @samp{lilypond}
  15300. @tab Vala
  15301. @tab @samp{vala}
  15302. @item Lisp
  15303. @tab @samp{lisp}
  15304. @tab
  15305. @tab
  15306. @end multitable
  15307. Additional documentation for some languages is at
  15308. @uref{https://orgmode.org/worg/org-contrib/babel/languages.html}.
  15309. @vindex org-babel-load-languages
  15310. By default, only Emacs Lisp is enabled for evaluation. To enable or
  15311. disable other languages, customize the @code{org-babel-load-languages}
  15312. variable either through the Emacs customization interface, or by
  15313. adding code to the init file as shown next.
  15314. In this example, evaluation is disabled for Emacs Lisp, and enabled
  15315. for R.
  15316. @lisp
  15317. (org-babel-do-load-languages
  15318. 'org-babel-load-languages
  15319. '((emacs-lisp . nil)
  15320. (R . t)))
  15321. @end lisp
  15322. Note that this is not the only way to enable a language. Org also
  15323. enables languages when loaded with @code{require} statement. For example,
  15324. the following enables execution of Clojure code blocks:
  15325. @lisp
  15326. (require 'ob-clojure)
  15327. @end lisp
  15328. @node Editing Source Code
  15329. @section Editing Source Code
  15330. @cindex code block, editing
  15331. @cindex source code, editing
  15332. @kindex C-c '
  15333. Use @kbd{C-c '} to edit the current code block. It opens a new
  15334. major-mode edit buffer containing the body of the source code block,
  15335. ready for any edits. Use @kbd{C-c '} again to close the buffer
  15336. and return to the Org buffer.
  15337. @kindex C-x C-s
  15338. @vindex org-edit-src-auto-save-idle-delay
  15339. @cindex auto-save, in code block editing
  15340. @kbd{C-x C-s} saves the buffer and updates the contents of the
  15341. Org buffer. Set @code{org-edit-src-auto-save-idle-delay} to save the base
  15342. buffer after a certain idle delay time. Set
  15343. @code{org-edit-src-turn-on-auto-save} to auto-save this buffer into
  15344. a separate file using Auto-save mode.
  15345. While editing the source code in the major mode, the Org Src minor
  15346. mode remains active. It provides these customization variables as
  15347. described below. For even more variables, look in the customization
  15348. group @code{org-edit-structure}.
  15349. @table @asis
  15350. @item @code{org-src-lang-modes}
  15351. @vindex org-src-lang-modes
  15352. If an Emacs major-mode named @code{<LANG>-mode} exists, where
  15353. @var{<LANG>} is the language identifier from code block's
  15354. header line, then the edit buffer uses that major mode. Use this
  15355. variable to arbitrarily map language identifiers to major modes.
  15356. @item @code{org-src-window-setup}
  15357. @vindex org-src-window-setup
  15358. For specifying Emacs window arrangement when the new edit buffer
  15359. is created.
  15360. @item @code{org-src-preserve-indentation}
  15361. @cindex indentation, in code blocks
  15362. @vindex org-src-preserve-indentation
  15363. Default is @code{nil}. Source code is indented. This indentation
  15364. applies during export or tangling, and depending on the context,
  15365. may alter leading spaces and tabs. When non-@code{nil}, source code
  15366. is aligned with the leftmost column. No lines are modified
  15367. during export or tangling, which is very useful for white-space
  15368. sensitive languages, such as Python.
  15369. @item @code{org-src-ask-before-returning-to-edit-buffer}
  15370. @vindex org-src-ask-before-returning-to-edit-buffer
  15371. When @code{nil}, Org returns to the edit buffer without further
  15372. prompts. The default prompts for a confirmation.
  15373. @end table
  15374. @vindex org-src-fontify-natively
  15375. @vindex org-src-block-faces
  15376. Set @code{org-src-fontify-natively} to non-@code{nil} to turn on native code
  15377. fontification in the @emph{Org} buffer. Fontification of code blocks can
  15378. give visual separation of text and code on the display page. To
  15379. further customize the appearance of @code{org-block} for specific
  15380. languages, customize @code{org-src-block-faces}. The following example
  15381. shades the background of regular blocks, and colors source blocks only
  15382. for Python and Emacs Lisp languages.
  15383. @lisp
  15384. (require 'color)
  15385. (set-face-attribute 'org-block nil :background
  15386. (color-darken-name
  15387. (face-attribute 'default :background) 3))
  15388. (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
  15389. ("python" (:background "#E5FFB8"))))
  15390. @end lisp
  15391. @node Noweb Reference Syntax
  15392. @section Noweb Reference Syntax
  15393. @cindex code block, Noweb reference
  15394. @cindex syntax, Noweb
  15395. @cindex source code, Noweb reference
  15396. Org supports named blocks in Noweb@footnote{For Noweb literate programming details, see
  15397. @uref{http://www.cs.tufts.edu/~nr/noweb/}.} style syntax:
  15398. @example
  15399. <<CODE-BLOCK-ID>>
  15400. @end example
  15401. Org can replace the construct with the source code, or the results of
  15402. evaluation, of the code block identified as @var{CODE-BLOCK-ID}.
  15403. @cindex @samp{noweb}, header argument
  15404. The @samp{noweb} header argument controls expansion of Noweb syntax
  15405. references. Expansions occur when source code blocks are evaluated,
  15406. tangled, or exported.
  15407. @table @asis
  15408. @item @samp{no}
  15409. Default. No expansion of Noweb syntax references in the body of
  15410. the code when evaluating, tangling, or exporting.
  15411. @item @samp{yes}
  15412. Expansion of Noweb syntax references in the body of the code
  15413. block when evaluating, tangling, or exporting.
  15414. @item @samp{tangle}
  15415. Expansion of Noweb syntax references in the body of the code
  15416. block when tangling. No expansion when evaluating or exporting.
  15417. @item @samp{no-export}
  15418. Expansion of Noweb syntax references in the body of the code
  15419. block when evaluating or tangling. No expansion when exporting.
  15420. @item @samp{strip-export}
  15421. Expansion of Noweb syntax references in the body of the code
  15422. block when expanding prior to evaluating or tangling. Removes
  15423. Noweb syntax references when exporting.
  15424. @item @samp{eval}
  15425. Expansion of Noweb syntax references in the body of the code
  15426. block only before evaluating.
  15427. @end table
  15428. In the following example,
  15429. @example
  15430. #+NAME: initialization
  15431. #+BEGIN_SRC emacs-lisp
  15432. (setq sentence "Never a foot too far, even.")
  15433. #+END_SRC
  15434. #+BEGIN_SRC emacs-lisp :noweb yes
  15435. <<initialization>>
  15436. (reverse sentence)
  15437. #+END_SRC
  15438. @end example
  15439. @noindent
  15440. the second code block is expanded as
  15441. @example
  15442. #+BEGIN_SRC emacs-lisp :noweb yes
  15443. (setq sentence "Never a foot too far, even.")
  15444. (reverse sentence)
  15445. #+END_SRC
  15446. @end example
  15447. Noweb insertions honor prefix characters that appear before the Noweb
  15448. syntax reference. This behavior is illustrated in the following
  15449. example. Because the @samp{<<example>>} Noweb reference appears behind the
  15450. SQL comment syntax, each line of the expanded Noweb reference is
  15451. commented. With:
  15452. @example
  15453. #+NAME: example
  15454. #+BEGIN_SRC text
  15455. this is the
  15456. multi-line body of example
  15457. #+END_SRC
  15458. @end example
  15459. @noindent
  15460. this code block:
  15461. @example
  15462. #+BEGIN_SRC sql :noweb yes
  15463. ---<<example>>
  15464. #+END_SRC
  15465. @end example
  15466. @noindent
  15467. expands to:
  15468. @example
  15469. #+BEGIN_SRC sql :noweb yes
  15470. ---this is the
  15471. ---multi-line body of example
  15472. #+END_SRC
  15473. @end example
  15474. Since this change does not affect Noweb replacement text without
  15475. newlines in them, inline Noweb references are acceptable.
  15476. This feature can also be used for management of indentation in
  15477. exported code snippets. With:
  15478. @example
  15479. #+NAME: if-true
  15480. #+BEGIN_SRC python :exports none
  15481. print('do things when true')
  15482. #+end_src
  15483. #+name: if-false
  15484. #+begin_src python :exports none
  15485. print('do things when false')
  15486. #+end_src
  15487. @end example
  15488. @noindent
  15489. this code block:
  15490. @example
  15491. #+begin_src python :noweb yes :results output
  15492. if true:
  15493. <<if-true>>
  15494. else:
  15495. <<if-false>>
  15496. #+end_src
  15497. @end example
  15498. @noindent
  15499. expands to:
  15500. @example
  15501. if true:
  15502. print('do things when true')
  15503. else:
  15504. print('do things when false')
  15505. @end example
  15506. @cindex @samp{noweb-ref}, header argument
  15507. When expanding Noweb style references, Org concatenates code blocks by
  15508. matching the reference name to either the code block name or, if none
  15509. is found, to the @samp{noweb-ref} header argument.
  15510. For simple concatenation, set this @samp{noweb-ref} header argument at the
  15511. sub-tree or file level. In the example Org file shown next, the body
  15512. of the source code in each block is extracted for concatenation to
  15513. a pure code file when tangled.
  15514. @example
  15515. #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
  15516. <<fullest-disk>>
  15517. #+END_SRC
  15518. * the mount point of the fullest disk
  15519. :PROPERTIES:
  15520. :header-args: :noweb-ref fullest-disk
  15521. :END:
  15522. ** query all mounted disks
  15523. #+BEGIN_SRC sh
  15524. df \
  15525. #+END_SRC
  15526. ** strip the header row
  15527. #+BEGIN_SRC sh
  15528. |sed '1d' \
  15529. #+END_SRC
  15530. ** output mount point of fullest disk
  15531. #+BEGIN_SRC sh
  15532. |awk '@{if (u < +$5) @{u = +$5; m = $6@}@} END @{print m@}'
  15533. #+END_SRC
  15534. @end example
  15535. @cindex @samp{noweb-sep}, header argument
  15536. By default a newline separates each noweb reference concatenation. To
  15537. change this newline separator, edit the @samp{noweb-sep} header argument.
  15538. Eventually, Org can include the results of a code block rather than
  15539. its body. To that effect, append parentheses, possibly including
  15540. arguments, to the code block name, as shown below.
  15541. @example
  15542. <<code-block-name(optional arguments)>>
  15543. @end example
  15544. Note that when using the above approach to a code block's results, the
  15545. code block name set by @samp{NAME} keyword is required; the reference set
  15546. by @samp{noweb-ref} does not work in that case.
  15547. Here is an example that demonstrates how the exported content changes
  15548. when Noweb style references are used with parentheses versus without.
  15549. With:
  15550. @example
  15551. #+NAME: some-code
  15552. #+BEGIN_SRC python :var num=0 :results output :exports none
  15553. print(num*10)
  15554. #+END_SRC
  15555. @end example
  15556. @noindent
  15557. this code block:
  15558. @example
  15559. #+BEGIN_SRC text :noweb yes
  15560. <<some-code>>
  15561. #+END_SRC
  15562. @end example
  15563. @noindent
  15564. expands to:
  15565. @example
  15566. print(num*10)
  15567. @end example
  15568. Below, a similar Noweb style reference is used, but with parentheses,
  15569. while setting a variable @samp{num} to 10:
  15570. @example
  15571. #+BEGIN_SRC text :noweb yes
  15572. <<some-code(num=10)>>
  15573. #+END_SRC
  15574. @end example
  15575. @noindent
  15576. Note that now the expansion contains the results of the code block
  15577. @samp{some-code}, not the code block itself:
  15578. @example
  15579. 100
  15580. @end example
  15581. @node Library of Babel
  15582. @section Library of Babel
  15583. @cindex babel, library of
  15584. @cindex source code, library
  15585. @cindex code block, library
  15586. The ``Library of Babel'' is a collection of code blocks. Like
  15587. a function library, these code blocks can be called from other Org
  15588. files. A collection of useful code blocks is available on @uref{https://orgmode.org/worg/library-of-babel.html, Worg}. For
  15589. remote code block evaluation syntax, see @ref{Evaluating Code Blocks}.
  15590. @kindex C-c C-v i
  15591. @findex org-babel-lob-ingest
  15592. For any user to add code to the library, first save the code in
  15593. regular code blocks of an Org file, and then load the Org file with
  15594. @code{org-babel-lob-ingest}, which is bound to @kbd{C-c C-v i}.
  15595. @node Key bindings and Useful Functions
  15596. @section Key bindings and Useful Functions
  15597. @cindex code block, key bindings
  15598. Many common Org mode key sequences are re-bound depending on
  15599. the context.
  15600. Active key bindings in code blocks:
  15601. @kindex C-c C-c
  15602. @findex org-babel-execute-src-block
  15603. @kindex C-c C-o
  15604. @findex org-babel-open-src-block-result
  15605. @kindex M-UP
  15606. @findex org-babel-load-in-session
  15607. @kindex M-DOWN
  15608. @findex org-babel-pop-to-session
  15609. @multitable @columnfractions 0.2 0.55
  15610. @headitem Key binding
  15611. @tab Function
  15612. @item @kbd{C-c C-c}
  15613. @tab @code{org-babel-execute-src-block}
  15614. @item @kbd{C-c C-o}
  15615. @tab @code{org-babel-open-src-block-result}
  15616. @item @kbd{M-@key{UP}}
  15617. @tab @code{org-babel-load-in-session}
  15618. @item @kbd{M-@key{DOWN}}
  15619. @tab @code{org-babel-pop-to-session}
  15620. @end multitable
  15621. Active key bindings in Org mode buffer:
  15622. @kindex C-c C-v p
  15623. @kindex C-c C-v C-p
  15624. @kindex C-c C-v n
  15625. @kindex C-c C-v C-n
  15626. @kindex C-c C-v e
  15627. @kindex C-c C-v C-e
  15628. @kindex C-c C-v o
  15629. @kindex C-c C-v C-o
  15630. @kindex C-c C-v v
  15631. @kindex C-c C-v C-v
  15632. @kindex C-c C-v u
  15633. @kindex C-c C-v C-u
  15634. @kindex C-c C-v g
  15635. @kindex C-c C-v C-g
  15636. @kindex C-c C-v r
  15637. @kindex C-c C-v C-r
  15638. @kindex C-c C-v b
  15639. @kindex C-c C-v C-b
  15640. @kindex C-c C-v s
  15641. @kindex C-c C-v C-s
  15642. @kindex C-c C-v d
  15643. @kindex C-c C-v C-d
  15644. @kindex C-c C-v t
  15645. @kindex C-c C-v C-t
  15646. @kindex C-c C-v f
  15647. @kindex C-c C-v C-f
  15648. @kindex C-c C-v c
  15649. @kindex C-c C-v C-c
  15650. @kindex C-c C-v j
  15651. @kindex C-c C-v C-j
  15652. @kindex C-c C-v l
  15653. @kindex C-c C-v C-l
  15654. @kindex C-c C-v i
  15655. @kindex C-c C-v C-i
  15656. @kindex C-c C-v I
  15657. @kindex C-c C-v C-I
  15658. @kindex C-c C-v z
  15659. @kindex C-c C-v C-z
  15660. @kindex C-c C-v a
  15661. @kindex C-c C-v C-a
  15662. @kindex C-c C-v h
  15663. @kindex C-c C-v C-h
  15664. @kindex C-c C-v x
  15665. @kindex C-c C-v C-x
  15666. @findex org-babel-previous-src-block
  15667. @findex org-babel-next-src-block
  15668. @findex org-babel-execute-maybe
  15669. @findex org-babel-open-src-block-result
  15670. @findex org-babel-expand-src-block
  15671. @findex org-babel-goto-src-block-head
  15672. @findex org-babel-goto-named-src-block
  15673. @findex org-babel-goto-named-result
  15674. @findex org-babel-execute-buffer
  15675. @findex org-babel-execute-subtree
  15676. @findex org-babel-demarcate-block
  15677. @findex org-babel-tangle
  15678. @findex org-babel-tangle-file
  15679. @findex org-babel-check-src-block
  15680. @findex org-babel-insert-header-arg
  15681. @findex org-babel-load-in-session
  15682. @findex org-babel-lob-ingest
  15683. @findex org-babel-view-src-block-info
  15684. @findex org-babel-switch-to-session-with-code
  15685. @findex org-babel-sha1-hash
  15686. @findex org-babel-describe-bindings
  15687. @findex org-babel-do-key-sequence-in-edit-buffer
  15688. @multitable @columnfractions 0.45 0.55
  15689. @headitem Key binding
  15690. @tab Function
  15691. @item @kbd{C-c C-v p} or @kbd{C-c C-v C-p}
  15692. @tab @code{org-babel-previous-src-block}
  15693. @item @kbd{C-c C-v n} or @kbd{C-c C-v C-n}
  15694. @tab @code{org-babel-next-src-block}
  15695. @item @kbd{C-c C-v e} or @kbd{C-c C-v C-e}
  15696. @tab @code{org-babel-execute-maybe}
  15697. @item @kbd{C-c C-v o} or @kbd{C-c C-v C-o}
  15698. @tab @code{org-babel-open-src-block-result}
  15699. @item @kbd{C-c C-v v} or @kbd{C-c C-v C-v}
  15700. @tab @code{org-babel-expand-src-block}
  15701. @item @kbd{C-c C-v u} or @kbd{C-c C-v C-u}
  15702. @tab @code{org-babel-goto-src-block-head}
  15703. @item @kbd{C-c C-v g} or @kbd{C-c C-v C-g}
  15704. @tab @code{org-babel-goto-named-src-block}
  15705. @item @kbd{C-c C-v r} or @kbd{C-c C-v C-r}
  15706. @tab @code{org-babel-goto-named-result}
  15707. @item @kbd{C-c C-v b} or @kbd{C-c C-v C-b}
  15708. @tab @code{org-babel-execute-buffer}
  15709. @item @kbd{C-c C-v s} or @kbd{C-c C-v C-s}
  15710. @tab @code{org-babel-execute-subtree}
  15711. @item @kbd{C-c C-v d} or @kbd{C-c C-v C-d}
  15712. @tab @code{org-babel-demarcate-block}
  15713. @item @kbd{C-c C-v t} or @kbd{C-c C-v C-t}
  15714. @tab @code{org-babel-tangle}
  15715. @item @kbd{C-c C-v f} or @kbd{C-c C-v C-f}
  15716. @tab @code{org-babel-tangle-file}
  15717. @item @kbd{C-c C-v c} or @kbd{C-c C-v C-c}
  15718. @tab @code{org-babel-check-src-block}
  15719. @item @kbd{C-c C-v j} or @kbd{C-c C-v C-j}
  15720. @tab @code{org-babel-insert-header-arg}
  15721. @item @kbd{C-c C-v l} or @kbd{C-c C-v C-l}
  15722. @tab @code{org-babel-load-in-session}
  15723. @item @kbd{C-c C-v i} or @kbd{C-c C-v C-i}
  15724. @tab @code{org-babel-lob-ingest}
  15725. @item @kbd{C-c C-v I} or @kbd{C-c C-v C-I}
  15726. @tab @code{org-babel-view-src-block-info}
  15727. @item @kbd{C-c C-v z} or @kbd{C-c C-v C-z}
  15728. @tab @code{org-babel-switch-to-session-with-code}
  15729. @item @kbd{C-c C-v a} or @kbd{C-c C-v C-a}
  15730. @tab @code{org-babel-sha1-hash}
  15731. @item @kbd{C-c C-v h} or @kbd{C-c C-v C-h}
  15732. @tab @code{org-babel-describe-bindings}
  15733. @item @kbd{C-c C-v x} or @kbd{C-c C-v C-x}
  15734. @tab @code{org-babel-do-key-sequence-in-edit-buffer}
  15735. @end multitable
  15736. @node Batch Execution
  15737. @section Batch Execution
  15738. @cindex code block, batch execution
  15739. @cindex source code, batch execution
  15740. Org mode features, including working with source code facilities can
  15741. be invoked from the command line. This enables building shell scripts
  15742. for batch processing, running automated system tasks, and expanding
  15743. Org mode's usefulness.
  15744. The sample script shows batch processing of multiple files using
  15745. @code{org-babel-tangle}.
  15746. @example
  15747. #!/bin/sh
  15748. # Tangle files with Org mode
  15749. #
  15750. emacs -Q --batch --eval "
  15751. (progn
  15752. (require 'ob-tangle)
  15753. (dolist (file command-line-args-left)
  15754. (with-current-buffer (find-file-noselect file)
  15755. (org-babel-tangle))))
  15756. " "$@@"
  15757. @end example
  15758. @node Miscellaneous
  15759. @chapter Miscellaneous
  15760. @menu
  15761. * Completion:: M-@key{TAB} guesses completions.
  15762. * Structure Templates:: Quick insertion of structural elements.
  15763. * Speed Keys:: Electric commands at the beginning of a headline.
  15764. * Code Evaluation Security:: Org files evaluate in-line code.
  15765. * Customization:: Adapting Org to your taste.
  15766. * In-buffer Settings:: Overview of keywords.
  15767. * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}.
  15768. * Clean View:: Getting rid of leading stars in the outline.
  15769. * TTY Keys:: Using Org on a tty.
  15770. * Interaction:: With other Emacs packages.
  15771. * Org Crypt:: Encrypting Org files.
  15772. @end menu
  15773. @node Completion
  15774. @section Completion
  15775. @cindex completion, of @TeX{} symbols
  15776. @cindex completion, of TODO keywords
  15777. @cindex completion, of dictionary words
  15778. @cindex completion, of option keywords
  15779. @cindex completion, of tags
  15780. @cindex completion, of property keys
  15781. @cindex completion, of link abbreviations
  15782. @cindex @TeX{} symbol completion
  15783. @cindex TODO keywords completion
  15784. @cindex dictionary word completion
  15785. @cindex option keyword completion
  15786. @cindex tag completion
  15787. @cindex link abbreviations, completion of
  15788. Org has in-buffer completions. Unlike minibuffer completions, which
  15789. are useful for quick command interactions, Org's in-buffer completions
  15790. are more suitable for content creation in Org documents. Type one or
  15791. more letters and invoke the hot key to complete the text in-place.
  15792. Depending on the context and the keys, Org offers different types of
  15793. completions. No minibuffer is involved. Such mode-specific hot keys
  15794. have become an integral part of Emacs and Org provides several
  15795. shortcuts.
  15796. @table @asis
  15797. @item @kbd{M-@key{TAB}}
  15798. @kindex M-TAB
  15799. Complete word at point.
  15800. @itemize
  15801. @item
  15802. At the beginning of a headline, complete TODO keywords.
  15803. @item
  15804. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  15805. @item
  15806. After @samp{*}, complete headlines in the current buffer so that
  15807. they can be used in search links like:
  15808. @example
  15809. [[*find this headline]]
  15810. @end example
  15811. @item
  15812. After @samp{:} in a headline, complete tags. Org deduces the list
  15813. of tags from the @samp{TAGS} in-buffer option (see @ref{Setting Tags}),
  15814. the variable @code{org-tag-alist}, or from all tags used in the
  15815. current buffer.
  15816. @item
  15817. After @samp{:} and not in a headline, complete property keys. The
  15818. list of keys is constructed dynamically from all keys used in
  15819. the current buffer.
  15820. @item
  15821. After @samp{[}, complete link abbreviations (see @ref{Link Abbreviations}).
  15822. @item
  15823. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  15824. file-specific @samp{OPTIONS}. After option keyword is complete,
  15825. pressing @kbd{M-@key{TAB}} again inserts example settings for
  15826. this keyword.
  15827. @item
  15828. After @samp{STARTUP} keyword, complete startup items.
  15829. @item
  15830. When point is anywhere else, complete dictionary words using
  15831. Ispell.
  15832. @end itemize
  15833. @end table
  15834. @node Structure Templates
  15835. @section Structure Templates
  15836. @cindex template insertion
  15837. @cindex insertion, of templates
  15838. With just a few keystrokes, it is possible to insert empty structural
  15839. blocks, such as @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}, or to wrap existing
  15840. text in such a block.
  15841. @table @asis
  15842. @item @kbd{C-c C-,} (@code{org-insert-structure-template})
  15843. @findex org-insert-structure-template
  15844. @kindex C-c C-,
  15845. Prompt for a type of block structure, and insert the block at
  15846. point. If the region is active, it is wrapped in the block.
  15847. First prompts the user for keys, which are used to look up
  15848. a structure type from the variable below. If the key is
  15849. @kbd{@key{TAB}}, @kbd{@key{RET}}, or @kbd{@key{SPC}}, the user is
  15850. prompted to enter a block type.
  15851. @end table
  15852. @vindex org-structure-template-alist
  15853. Available structure types are defined in
  15854. @code{org-structure-template-alist}, see the docstring for adding or
  15855. changing values.
  15856. @cindex Tempo
  15857. @cindex template expansion
  15858. @cindex insertion, of templates
  15859. @vindex org-tempo-keywords-alist
  15860. Org Tempo expands snippets to structures defined in
  15861. @code{org-structure-template-alist} and @code{org-tempo-keywords-alist}. For
  15862. example, @kbd{< s @key{TAB}} creates a code block. Enable it by
  15863. customizing @code{org-modules} or add @code{(require 'org-tempo)} to your Emacs
  15864. init file@footnote{For more information, please refer to the commentary section
  15865. in @samp{org-tempo.el}.}.
  15866. @multitable @columnfractions 0.1 0.9
  15867. @item @kbd{a}
  15868. @tab @samp{#+BEGIN_EXPORT ascii} @dots{} @samp{#+END_EXPORT}
  15869. @item @kbd{c}
  15870. @tab @samp{#+BEGIN_CENTER} @dots{} @samp{#+END_CENTER}
  15871. @item @kbd{C}
  15872. @tab @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT}
  15873. @item @kbd{e}
  15874. @tab @samp{#+BEGIN_EXAMPLE} @dots{} @samp{#+END_EXAMPLE}
  15875. @item @kbd{h}
  15876. @tab @samp{#+BEGIN_EXPORT html} @dots{} @samp{#+END_EXPORT}
  15877. @item @kbd{l}
  15878. @tab @samp{#+BEGIN_EXPORT latex} @dots{} @samp{#+END_EXPORT}
  15879. @item @kbd{q}
  15880. @tab @samp{#+BEGIN_QUOTE} @dots{} @samp{#+END_QUOTE}
  15881. @item @kbd{s}
  15882. @tab @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}
  15883. @item @kbd{v}
  15884. @tab @samp{#+BEGIN_VERSE} @dots{} @samp{#+END_VERSE}
  15885. @end multitable
  15886. @node Speed Keys
  15887. @section Speed Keys
  15888. @cindex speed keys
  15889. Single keystrokes can execute custom commands in an Org file when the
  15890. cursor is on a headline. Without the extra burden of a meta or
  15891. modifier key, Speed Keys can speed navigation or execute custom
  15892. commands. Besides faster navigation, Speed Keys may come in handy on
  15893. small mobile devices that do not have full keyboards. Speed Keys may
  15894. also work on TTY devices known for their problems when entering Emacs
  15895. key chords.
  15896. @vindex org-use-speed-commands
  15897. By default, Org has Speed Keys disabled. To activate Speed Keys, set
  15898. the variable @code{org-use-speed-commands} to a non-@code{nil} value. To
  15899. trigger a Speed Key, the cursor must be at the beginning of an Org
  15900. headline, before any of the stars.
  15901. @vindex org-speed-commands-user
  15902. @findex org-speed-command-help
  15903. Org comes with a pre-defined list of Speed Keys. To add or modify
  15904. Speed Keys, customize the variable, @code{org-speed-commands-user}. For
  15905. more details, see the variable's docstring. With Speed Keys
  15906. activated, @kbd{M-x org-speed-command-help}, or @kbd{?} when
  15907. cursor is at the beginning of an Org headline, shows currently active
  15908. Speed Keys, including the user-defined ones.
  15909. @node Code Evaluation Security
  15910. @section Code Evaluation and Security Issues
  15911. Unlike plain text, running code comes with risk. Each @samp{src} code
  15912. block, in terms of risk, is equivalent to an executable file. Org
  15913. therefore puts a few confirmation prompts by default. This is to
  15914. alert the casual user from accidentally running untrusted code.
  15915. For users who do not run code blocks or write code regularly, Org's
  15916. default settings should suffice. However, some users may want to
  15917. tweak the prompts for fewer interruptions. To weigh the risks of
  15918. automatic execution of code blocks, here are some details about code
  15919. evaluation.
  15920. Org evaluates code in the following circumstances:
  15921. @table @asis
  15922. @item @emph{Source code blocks}
  15923. Org evaluates @samp{src} code blocks in an Org file during export.
  15924. Org also evaluates a @samp{src} code block with the @kbd{C-c C-c}
  15925. key chord. Users exporting or running code blocks must load
  15926. files only from trusted sources. Be wary of customizing
  15927. variables that remove or alter default security measures.
  15928. @defopt org-confirm-babel-evaluate
  15929. When @code{t}, Org prompts the user for confirmation before executing
  15930. each code block. When @code{nil}, Org executes code blocks without
  15931. prompting the user for confirmation. When this option is set to
  15932. a custom function, Org invokes the function with these two
  15933. arguments: the source code language and the body of the code
  15934. block. The custom function must return either a @code{t} or @code{nil},
  15935. which determines if the user is prompted. Each source code
  15936. language can be handled separately through this function
  15937. argument.
  15938. @end defopt
  15939. For example, here is how to execute ditaa code blocks without
  15940. prompting:
  15941. @lisp
  15942. (defun my-org-confirm-babel-evaluate (lang body)
  15943. (not (string= lang "ditaa"))) ;don't ask for ditaa
  15944. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  15945. @end lisp
  15946. @item @emph{Following @samp{shell} and @samp{elisp} links}
  15947. Org has two link types that can directly evaluate code (see
  15948. @ref{External Links}). Because such code is not visible, these links
  15949. have a potential risk. Org therefore prompts the user when it
  15950. encounters such links. The customization variables are:
  15951. @defopt org-confirm-shell-link-function
  15952. Function that prompts the user before executing a shell link.
  15953. @end defopt
  15954. @defopt org-confirm-elisp-link-function
  15955. Function that prompts the user before executing an Emacs Lisp link.
  15956. @end defopt
  15957. @item @emph{Formulas in tables}
  15958. Formulas in tables (see @ref{The spreadsheet}) are code that is
  15959. evaluated either by the Calc interpreter, or by the Emacs Lisp
  15960. interpreter.
  15961. @end table
  15962. @node Customization
  15963. @section Customization
  15964. @cindex customization
  15965. @cindex options, for customization
  15966. @cindex variables, for customization
  15967. Org has more than 500 variables for customization. They can be
  15968. accessed through the usual @kbd{M-x org-customize} command. Or
  15969. through the Org menu: Org @arrow{} Customization @arrow{} Browse Org Group.
  15970. Org also has per-file settings for some variables (see @ref{In-buffer Settings}).
  15971. @node In-buffer Settings
  15972. @section Summary of In-Buffer Settings
  15973. @cindex in-buffer settings
  15974. @cindex special keywords
  15975. In-buffer settings start with @samp{#+}, followed by a keyword, a colon,
  15976. and then a word for each setting. Org accepts multiple settings on
  15977. the same line. Org also accepts multiple lines for a keyword. This
  15978. manual describes these settings throughout. A summary follows here.
  15979. @cindex refresh set-up
  15980. @kbd{C-c C-c} activates any changes to the in-buffer settings.
  15981. Closing and reopening the Org file in Emacs also activates the
  15982. changes.
  15983. @table @asis
  15984. @item @samp{#+ARCHIVE: %s_done}
  15985. @cindex @samp{ARCHIVE}, keyword
  15986. @vindex org-archive-location
  15987. Sets the archive location of the agenda file. The corresponding
  15988. variable is @code{org-archive-location}.
  15989. @item @samp{#+CATEGORY}
  15990. @cindex @samp{CATEGORY}, keyword
  15991. Sets the category of the agenda file, which applies to the entire
  15992. document.
  15993. @item @samp{#+COLUMNS: %25ITEM ...}
  15994. @cindex @samp{COLUMNS}, property
  15995. Set the default format for columns view. This format applies
  15996. when columns view is invoked in locations where no @samp{COLUMNS}
  15997. property applies.
  15998. @item @samp{#+CONSTANTS: name1=value1 ...}
  15999. @cindex @samp{CONSTANTS}, keyword
  16000. @vindex org-table-formula-constants
  16001. @vindex org-table-formula
  16002. Set file-local values for constants that table formulas can use.
  16003. This line sets the local variable
  16004. @code{org-table-formula-constants-local}. The global version of this
  16005. variable is @code{org-table-formula-constants}.
  16006. @item @samp{#+FILETAGS: :tag1:tag2:tag3:}
  16007. @cindex @samp{FILETAGS}, keyword
  16008. Set tags that all entries in the file inherit from, including the
  16009. top-level entries.
  16010. @item @samp{#+LINK: linkword replace}
  16011. @cindex @samp{LINK}, keyword
  16012. @vindex org-link-abbrev-alist
  16013. Each line specifies one abbreviation for one link. Use multiple
  16014. @samp{LINK} keywords for more, see @ref{Link Abbreviations}. The
  16015. corresponding variable is @code{org-link-abbrev-alist}.
  16016. @item @samp{#+PRIORITIES: highest lowest default}
  16017. @cindex @samp{PRIORITIES}, keyword
  16018. @vindex org-highest-priority
  16019. @vindex org-lowest-priority
  16020. @vindex org-default-priority
  16021. This line sets the limits and the default for the priorities.
  16022. All three must be either letters A--Z or numbers 0--9. The
  16023. highest priority must have a lower ASCII number than the lowest
  16024. priority.
  16025. @item @samp{#+PROPERTY: Property_Name Value}
  16026. @cindex @samp{PROPERTY}, keyword
  16027. This line sets a default inheritance value for entries in the
  16028. current buffer, most useful for specifying the allowed values of
  16029. a property.
  16030. @item @samp{#+SETUPFILE: file}
  16031. @cindex @samp{SETUPFILE}, keyword
  16032. The setup file or a URL pointing to such file is for additional
  16033. in-buffer settings. Org loads this file and parses it for any
  16034. settings in it only when Org opens the main file. If URL is
  16035. specified, the contents are downloaded and stored in a temporary
  16036. file cache. @kbd{C-c C-c} on the settings line parses and
  16037. loads the file, and also resets the temporary file cache. Org
  16038. also parses and loads the document during normal exporting
  16039. process. Org parses the contents of this document as if it was
  16040. included in the buffer. It can be another Org file. To visit
  16041. the file---not a URL---use @kbd{C-c '} while the cursor is
  16042. on the line with the file name.
  16043. @item @samp{#+STARTUP:}
  16044. @cindex @samp{STARTUP}, keyword
  16045. Startup options Org uses when first visiting a file.
  16046. @vindex org-startup-folded
  16047. The first set of options deals with the initial visibility of the
  16048. outline tree. The corresponding variable for global default
  16049. settings is @code{org-startup-folded} with a default value of @code{t},
  16050. which is the same as @code{overview}.
  16051. @table @asis
  16052. @item @samp{overview}
  16053. Top-level headlines only.
  16054. @item @samp{content}
  16055. All headlines.
  16056. @item @samp{showall}
  16057. No folding on any entry.
  16058. @item @samp{showeverything}
  16059. Show even drawer contents.
  16060. @end table
  16061. @vindex org-startup-indented
  16062. Dynamic virtual indentation is controlled by the variable
  16063. @code{org-startup-indented}.@footnote{Note that @code{org-indent-mode} also sets the @code{wrap-prefix}
  16064. property, such that @code{visual-line-mode} (or purely setting @code{word-wrap})
  16065. wraps long lines (including headlines) correctly indented.}
  16066. @table @asis
  16067. @item @samp{indent}
  16068. Start with @code{org-indent-mode} turned on.
  16069. @item @samp{noindent}
  16070. Start with @code{org-indent-mode} turned off.
  16071. @end table
  16072. @vindex org-startup-align-all-tables
  16073. Aligns tables consistently upon visiting a file. The corresponding
  16074. variable is @code{org-startup-align-all-tables} with @code{nil} as default
  16075. value.
  16076. @table @asis
  16077. @item @samp{align}
  16078. Align all tables.
  16079. @item @samp{noalign}
  16080. Do not align tables on startup.
  16081. @end table
  16082. @vindex org-startup-shrink-all-tables
  16083. Shrink table columns with a width cookie. The corresponding
  16084. variable is @code{org-startup-shrink-all-tables} with @code{nil} as default
  16085. value.
  16086. @vindex org-startup-with-inline-images
  16087. When visiting a file, inline images can be automatically displayed.
  16088. The corresponding variable is @code{org-startup-with-inline-images},
  16089. with a default value @code{nil} to avoid delays when visiting a file.
  16090. @table @asis
  16091. @item @samp{inlineimages}
  16092. Show inline images.
  16093. @item @samp{noinlineimages}
  16094. Do not show inline images on startup.
  16095. @end table
  16096. @vindex org-log-done
  16097. @vindex org-log-note-clock-out
  16098. @vindex org-log-repeat
  16099. Logging the closing and reopening of TODO items and clock
  16100. intervals can be configured using these options (see variables
  16101. @code{org-log-done}, @code{org-log-note-clock-out}, and @code{org-log-repeat}).
  16102. @table @asis
  16103. @item @samp{logdone}
  16104. Record a timestamp when an item is marked DONE.
  16105. @item @samp{lognotedone}
  16106. Record timestamp and a note when DONE.
  16107. @item @samp{nologdone}
  16108. Do not record when items are marked DONE.
  16109. @item @samp{logrepeat}
  16110. Record a time when reinstating a repeating item.
  16111. @item @samp{lognoterepeat}
  16112. Record a note when reinstating a repeating item.
  16113. @item @samp{nologrepeat}
  16114. Do not record when reinstating repeating item.
  16115. @item @samp{lognoteclock-out}
  16116. Record a note when clocking out.
  16117. @item @samp{nolognoteclock-out}
  16118. Do not record a note when clocking out.
  16119. @item @samp{logreschedule}
  16120. Record a timestamp when scheduling time changes.
  16121. @item @samp{lognotereschedule}
  16122. Record a note when scheduling time changes.
  16123. @item @samp{nologreschedule}
  16124. Do not record when a scheduling date changes.
  16125. @item @samp{logredeadline}
  16126. Record a timestamp when deadline changes.
  16127. @item @samp{lognoteredeadline}
  16128. Record a note when deadline changes.
  16129. @item @samp{nologredeadline}
  16130. Do not record when a deadline date changes.
  16131. @item @samp{logrefile}
  16132. Record a timestamp when refiling.
  16133. @item @samp{lognoterefile}
  16134. Record a note when refiling.
  16135. @item @samp{nologrefile}
  16136. Do not record when refiling.
  16137. @end table
  16138. @vindex org-hide-leading-stars
  16139. @vindex org-odd-levels-only
  16140. Here are the options for hiding leading stars in outline headings,
  16141. and for indenting outlines. The corresponding variables are
  16142. @code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with
  16143. a default setting @code{nil} (meaning @samp{showstars} and @samp{oddeven}).
  16144. @table @asis
  16145. @item @samp{hidestars}
  16146. Make all but one of the stars starting a headline invisible.
  16147. @item @samp{showstars}
  16148. Show all stars starting a headline.
  16149. @item @samp{indent}
  16150. Virtual indentation according to outline level.
  16151. @item @samp{noindent}
  16152. No virtual indentation according to outline level.
  16153. @item @samp{odd}
  16154. Allow only odd outline levels (1, 3, @dots{}).
  16155. @item @samp{oddeven}
  16156. Allow all outline levels.
  16157. @end table
  16158. @vindex org-put-time-stamp-overlays
  16159. @vindex org-time-stamp-overlay-formats
  16160. To turn on custom format overlays over timestamps (variables
  16161. @code{org-put-time-stamp-overlays} and @code{org-time-stamp-overlay-formats}),
  16162. use:
  16163. @table @asis
  16164. @item @samp{customtime}
  16165. Overlay custom time format.
  16166. @end table
  16167. @vindex constants-unit-system
  16168. The following options influence the table spreadsheet (variable
  16169. @code{constants-unit-system}).
  16170. @table @asis
  16171. @item @samp{constcgs}
  16172. @samp{constants.el} should use the c-g-s unit system.
  16173. @item @samp{constSI}
  16174. @samp{constants.el} should use the SI unit system.
  16175. @end table
  16176. @vindex org-footnote-define-inline
  16177. @vindex org-footnote-auto-label
  16178. @vindex org-footnote-auto-adjust
  16179. To influence footnote settings, use the following keywords. The
  16180. corresponding variables are @code{org-footnote-define-inline},
  16181. @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
  16182. @table @asis
  16183. @item @samp{fninline}
  16184. Define footnotes inline.
  16185. @item @samp{fnnoinline}
  16186. Define footnotes in separate section.
  16187. @item @samp{fnlocal}
  16188. Define footnotes near first reference, but not inline.
  16189. @item @samp{fnprompt}
  16190. Prompt for footnote labels.
  16191. @item @samp{fnauto}
  16192. Create @samp{[fn:1]}-like labels automatically (default).
  16193. @item @samp{fnconfirm}
  16194. Offer automatic label for editing or confirmation.
  16195. @item @samp{fnadjust}
  16196. Automatically renumber and sort footnotes.
  16197. @item @samp{nofnadjust}
  16198. Do not renumber and sort automatically.
  16199. @end table
  16200. @vindex org-hide-block-startup
  16201. To hide blocks on startup, use these keywords. The corresponding
  16202. variable is @code{org-hide-block-startup}.
  16203. @table @asis
  16204. @item @samp{hideblocks}
  16205. Hide all begin/end blocks on startup.
  16206. @item @samp{nohideblocks}
  16207. Do not hide blocks on startup.
  16208. @end table
  16209. @vindex org-pretty-entities
  16210. The display of entities as UTF-8 characters is governed by the
  16211. variable @code{org-pretty-entities} and the keywords
  16212. @table @asis
  16213. @item @samp{entitiespretty}
  16214. Show entities as UTF-8 characters where possible.
  16215. @item @samp{entitiesplain}
  16216. Leave entities plain.
  16217. @end table
  16218. @item @samp{#+TAGS: TAG1(c1) TAG2(c2)}
  16219. @cindex @samp{TAGS}, keyword
  16220. @vindex org-tag-alist
  16221. These lines (several such lines are allowed) specify the valid
  16222. tags in this file, and (potentially) the corresponding @emph{fast tag
  16223. selection} keys. The corresponding variable is @code{org-tag-alist}.
  16224. @item @samp{#+TODO:}
  16225. @itemx @samp{#+SEQ_TODO:}
  16226. @itemx @samp{#+TYP_TODO:}
  16227. @cindex @samp{SEQ_TODO}, keyword
  16228. @cindex @samp{TODO}, keyword
  16229. @cindex @samp{TYP_TODO}, keyword
  16230. @vindex org-todo-keywords
  16231. These lines set the TODO keywords and their interpretation in the
  16232. current file. The corresponding variable is @code{org-todo-keywords}.
  16233. @end table
  16234. @node The Very Busy @kbd{C-c C-c} Key
  16235. @section The Very Busy @kbd{C-c C-c} Key
  16236. @kindex C-c C-c
  16237. @cindex @kbd{C-c C-c}, overview
  16238. The @kbd{C-c C-c} key in Org serves many purposes depending on
  16239. the context. It is probably the most over-worked, multi-purpose key
  16240. combination in Org. Its uses are well documented throughout this
  16241. manual, but here is a consolidated list for easy reference.
  16242. @itemize
  16243. @item
  16244. If any highlights shown in the buffer from the creation of a sparse
  16245. tree, or from clock display, remove such highlights.
  16246. @item
  16247. If the cursor is in one of the special @samp{KEYWORD} lines, scan the
  16248. buffer for these lines and update the information. Also reset the
  16249. Org file cache used to temporary store the contents of URLs used as
  16250. values for keywords like @samp{SETUPFILE}.
  16251. @item
  16252. If the cursor is inside a table, realign the table. The table
  16253. realigns even if automatic table editor is turned off.
  16254. @item
  16255. If the cursor is on a @samp{TBLFM} keyword, re-apply the formulas to the
  16256. entire table.
  16257. @item
  16258. If the current buffer is a capture buffer, close the note and file
  16259. it. With a prefix argument, also jump to the target location after
  16260. saving the note.
  16261. @item
  16262. If the cursor is on a @samp{<<<target>>>}, update radio targets and
  16263. corresponding links in this buffer.
  16264. @item
  16265. If the cursor is on a property line or at the start or end of
  16266. a property drawer, offer property commands.
  16267. @item
  16268. If the cursor is at a footnote reference, go to the corresponding
  16269. definition, and @emph{vice versa}.
  16270. @item
  16271. If the cursor is on a statistics cookie, update it.
  16272. @item
  16273. If the cursor is in a plain list item with a checkbox, toggle the
  16274. status of the checkbox.
  16275. @item
  16276. If the cursor is on a numbered item in a plain list, renumber the
  16277. ordered list.
  16278. @item
  16279. If the cursor is on the @samp{#+BEGIN} line of a dynamic block, the block
  16280. is updated.
  16281. @item
  16282. If the cursor is at a timestamp, fix the day name in the timestamp.
  16283. @end itemize
  16284. @node Clean View
  16285. @section A Cleaner Outline View
  16286. @cindex hiding leading stars
  16287. @cindex dynamic indentation
  16288. @cindex odd-levels-only outlines
  16289. @cindex clean outline view
  16290. Org's default outline with stars and no indents can become too
  16291. cluttered for short documents. For @emph{book-like} long documents, the
  16292. effect is not as noticeable. Org provides an alternate stars and
  16293. indentation scheme, as shown on the right in the following table. It
  16294. uses only one star and indents text to line with the heading:
  16295. @example
  16296. * Top level headline | * Top level headline
  16297. ** Second level | * Second level
  16298. *** Third level | * Third level
  16299. some text | some text
  16300. *** Third level | * Third level
  16301. more text | more text
  16302. * Another top level headline | * Another top level headline
  16303. @end example
  16304. @noindent
  16305. @cindex Indent mode
  16306. @findex org-indent-mode
  16307. To turn this mode on, use the minor mode, @code{org-indent-mode}. Text
  16308. lines that are not headlines are prefixed with spaces to vertically
  16309. align with the headline text@footnote{The @code{org-indent-mode} also sets the @code{wrap-prefix} correctly
  16310. for indenting and wrapping long lines of headlines or text. This
  16311. minor mode handles @code{visual-line-mode} and directly applied settings
  16312. through @code{word-wrap}.}.
  16313. @vindex org-indent-indentation-per-level
  16314. To make more horizontal space, the headlines are shifted by two stars.
  16315. This can be configured by the @code{org-indent-indentation-per-level}
  16316. variable. Only one star on each headline is visible, the rest are
  16317. masked with the same font color as the background.
  16318. Note that turning on @code{org-indent-mode} sets @code{org-hide-leading-stars}
  16319. to @code{t} and @code{org-adapt-indentation} to @code{nil}.
  16320. @vindex org-startup-indented
  16321. To globally turn on @code{org-indent-mode} for all files, customize the
  16322. variable @code{org-startup-indented}.
  16323. To turn on indenting for individual files, use @samp{STARTUP} keyword as
  16324. follows:
  16325. @example
  16326. #+STARTUP: indent
  16327. @end example
  16328. Indent on startup makes Org use hard spaces to align text with
  16329. headings as shown in examples below.
  16330. @table @asis
  16331. @item @emph{Indentation of text below headlines}
  16332. Indent text to align with the headline.
  16333. @example
  16334. *** Third level
  16335. more text, now indented
  16336. @end example
  16337. @vindex org-adapt-indentation
  16338. Org supports this with paragraph filling, line wrapping, and
  16339. structure editing, preserving or adapting the indentation as
  16340. appropriate@footnote{Also see the variable @code{org-adapt-indentation}.}.
  16341. @item @emph{Hiding leading stars}
  16342. @vindex org-hide-leading-stars
  16343. Org can make leading stars invisible. For global preference,
  16344. configure the variable @code{org-hide-leading-stars}. For per-file
  16345. preference, use these file @samp{STARTUP} options:
  16346. @example
  16347. #+STARTUP: hidestars
  16348. #+STARTUP: showstars
  16349. @end example
  16350. With stars hidden, the tree is shown as:
  16351. @example
  16352. * Top level headline
  16353. * Second level
  16354. * Third level
  16355. ...
  16356. @end example
  16357. @noindent
  16358. @vindex org-hide, face
  16359. Because Org makes the font color the same as the background color
  16360. to hide to stars, sometimes @code{org-hide} face may need tweaking to
  16361. get the effect right. For some black and white combinations,
  16362. @code{grey90} on a white background might mask the stars better.
  16363. @item @emph{Odd levels}
  16364. @vindex org-odd-levels-only
  16365. Using stars for only odd levels, 1, 3, 5, @dots{}, can also clean up
  16366. 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
  16367. on.}.
  16368. For Org to properly handle this cleaner structure during edits
  16369. and exports, configure the variable @code{org-odd-levels-only}. To
  16370. set this per-file, use either one of the following lines:
  16371. @example
  16372. #+STARTUP: odd
  16373. #+STARTUP: oddeven
  16374. @end example
  16375. 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}.
  16376. @end table
  16377. @node TTY Keys
  16378. @section Using Org on a TTY
  16379. @cindex tty key bindings
  16380. Org provides alternative key bindings for TTY and modern mobile
  16381. devices that cannot handle cursor keys and complex modifier key
  16382. chords. Some of these workarounds may be more cumbersome than
  16383. necessary. Users should look into customizing these further based on
  16384. their usage needs. For example, the normal @kbd{S-<cursor>} for
  16385. editing timestamp might be better with @kbd{C-c .} chord.
  16386. @multitable @columnfractions 0.2 0.28 0.15 0.21
  16387. @headitem Default
  16388. @tab Alternative 1
  16389. @tab Speed key
  16390. @tab Alternative 2
  16391. @item @kbd{S-@key{TAB}}
  16392. @tab @kbd{C-u @key{TAB}}
  16393. @tab @kbd{C}
  16394. @tab
  16395. @item @kbd{M-@key{LEFT}}
  16396. @tab @kbd{C-c C-x l}
  16397. @tab @kbd{l}
  16398. @tab @kbd{Esc @key{LEFT}}
  16399. @item @kbd{M-S-@key{LEFT}}
  16400. @tab @kbd{C-c C-x L}
  16401. @tab @kbd{L}
  16402. @tab
  16403. @item @kbd{M-@key{RIGHT}}
  16404. @tab @kbd{C-c C-x r}
  16405. @tab @kbd{r}
  16406. @tab @kbd{Esc @key{RIGHT}}
  16407. @item @kbd{M-S-@key{RIGHT}}
  16408. @tab @kbd{C-c C-x R}
  16409. @tab @kbd{R}
  16410. @tab
  16411. @item @kbd{M-@key{UP}}
  16412. @tab @kbd{C-c C-x u}
  16413. @tab
  16414. @tab @kbd{Esc @key{UP}}
  16415. @item @kbd{M-S-@key{UP}}
  16416. @tab @kbd{C-c C-x U}
  16417. @tab @kbd{U}
  16418. @tab
  16419. @item @kbd{M-@key{DOWN}}
  16420. @tab @kbd{C-c C-x d}
  16421. @tab
  16422. @tab @kbd{Esc @key{DOWN}}
  16423. @item @kbd{M-S-@key{DOWN}}
  16424. @tab @kbd{C-c C-x D}
  16425. @tab @kbd{D}
  16426. @tab
  16427. @item @kbd{S-@key{RET}}
  16428. @tab @kbd{C-c C-x c}
  16429. @tab
  16430. @tab
  16431. @item @kbd{M-@key{RET}}
  16432. @tab @kbd{C-c C-x m}
  16433. @tab
  16434. @tab @kbd{Esc @key{RET}}
  16435. @item @kbd{M-S-@key{RET}}
  16436. @tab @kbd{C-c C-x M}
  16437. @tab
  16438. @tab
  16439. @item @kbd{S-@key{LEFT}}
  16440. @tab @kbd{C-c @key{LEFT}}
  16441. @tab
  16442. @tab
  16443. @item @kbd{S-@key{RIGHT}}
  16444. @tab @kbd{C-c @key{RIGHT}}
  16445. @tab
  16446. @tab
  16447. @item @kbd{S-@key{UP}}
  16448. @tab @kbd{C-c @key{UP}}
  16449. @tab
  16450. @tab
  16451. @item @kbd{S-@key{DOWN}}
  16452. @tab @kbd{C-c @key{DOWN}}
  16453. @tab
  16454. @tab
  16455. @item @kbd{C-S-@key{LEFT}}
  16456. @tab @kbd{C-c C-x @key{LEFT}}
  16457. @tab
  16458. @tab
  16459. @item @kbd{C-S-@key{RIGHT}}
  16460. @tab @kbd{C-c C-x @key{RIGHT}}
  16461. @tab
  16462. @tab
  16463. @end multitable
  16464. @node Interaction
  16465. @section Interaction with Other Packages
  16466. @cindex packages, interaction with other
  16467. Org's compatibility and the level of interaction with other Emacs
  16468. packages are documented here.
  16469. @menu
  16470. * Cooperation:: Packages Org cooperates with.
  16471. * Conflicts:: Packages that lead to conflicts.
  16472. @end menu
  16473. @node Cooperation
  16474. @subsection Packages that Org cooperates with
  16475. @table @asis
  16476. @item @samp{calc.el} by Dave Gillespie
  16477. @cindex @file{calc.el}
  16478. Org uses the Calc package for implementing spreadsheet
  16479. functionality in its tables (see @ref{The spreadsheet}). Org also
  16480. uses Calc for embedded calculations. See @ref{Embedded Mode,GNU Emacs Calc Manual,,calc,}.
  16481. @item @samp{constants.el} by Carsten Dominik
  16482. @cindex @file{constants.el}
  16483. @vindex org-table-formula-constants
  16484. Org can use names for constants in formulas in tables. Org can
  16485. also use calculation suffixes for units, such as @samp{M} for @samp{Mega}.
  16486. For a standard collection of such constants, install the
  16487. @samp{constants} package. Install version 2.0 of this package,
  16488. available at @uref{http://www.astro.uva.nl/~dominik/Tools}. Org checks
  16489. if the function @code{constants-get} has been autoloaded.
  16490. Installation instructions are in the file @samp{constants.el}.
  16491. @item @samp{cdlatex.el} by Carsten Dominik
  16492. @cindex @file{cdlatex.el}
  16493. Org mode can make use of the CD@LaTeX{} package to efficiently enter
  16494. @LaTeX{} fragments into Org files. See @ref{CD@LaTeX{} mode}.
  16495. @item @samp{imenu.el} by Ake Stenhoff and Lars Lindberg
  16496. @cindex @file{imenu.el}
  16497. Imenu creates dynamic menus based on an index of items in a file.
  16498. Org mode supports Imenu menus. Enable it with a mode hook as
  16499. follows:
  16500. @lisp
  16501. (add-hook 'org-mode-hook
  16502. (lambda () (imenu-add-to-menubar "Imenu")))
  16503. @end lisp
  16504. @vindex org-imenu-depth
  16505. By default the index is two levels deep---you can modify the
  16506. depth using the option @code{org-imenu-depth}.
  16507. @item @samp{speedbar.el} by Eric M. Ludlam
  16508. @cindex @file{speedbar.el}
  16509. Speedbar package creates a special Emacs frame for displaying
  16510. files and index items in files. Org mode supports Speedbar;
  16511. users can drill into Org files directly from the Speedbar. The
  16512. @kbd{<} in the Speedbar frame tweaks the agenda commands to
  16513. that file or to a subtree.
  16514. @item @samp{table.el} by Takaaki Ota
  16515. @cindex table editor, @file{table.el}
  16516. @cindex @file{table.el}
  16517. Complex ASCII tables with automatic line wrapping, column- and
  16518. row-spanning, and alignment can be created using the Emacs table
  16519. package by Takaaki Ota. Org mode recognizes such tables and
  16520. exports them properly. @kbd{C-c '} to edit these tables in
  16521. a special buffer, much like Org's code blocks. Because of
  16522. interference with other Org mode functionality, Takaaki Ota
  16523. tables cannot be edited directly in the Org buffer.
  16524. @table @asis
  16525. @item @kbd{C-c '} (@code{org-edit-special})
  16526. @kindex C-c '
  16527. @findex org-edit-special
  16528. Edit a @samp{table.el} table. Works when the cursor is in
  16529. a @samp{table.el} table.
  16530. @item @kbd{C-c ~​} (@code{org-table-create-with-table.el})
  16531. @kindex C-c ~
  16532. @findex org-table-create-with-table.el
  16533. Insert a @samp{table.el} table. If there is already a table at
  16534. point, this command converts it between the @samp{table.el}
  16535. format and the Org mode format. See the documentation
  16536. string of the command @code{org-convert-table} for the
  16537. restrictions under which this is possible.
  16538. @end table
  16539. @end table
  16540. @node Conflicts
  16541. @subsection Packages that conflict with Org mode
  16542. @cindex shift-selection-mode
  16543. @vindex org-support-shift-select
  16544. In Emacs, @code{shift-selection-mode} combines cursor motions with shift
  16545. key to enlarge regions. Emacs sets this mode by default. This
  16546. conflicts with Org's use of @kbd{S-<cursor>} commands to change
  16547. timestamps, TODO keywords, priorities, and item bullet types, etc.
  16548. Since @kbd{S-<cursor>} commands outside of specific contexts do
  16549. not do anything, Org offers the variable @code{org-support-shift-select}
  16550. for customization. Org mode accommodates shift selection by (i)
  16551. making it available outside of the special contexts where special
  16552. commands apply, and (ii) extending an existing active region even if
  16553. the cursor moves across a special context.
  16554. @table @asis
  16555. @item @samp{cua.el} by Kim. F. Storm
  16556. @cindex @file{cua.el}
  16557. @vindex org-replace-disputed-keys
  16558. Org key bindings conflict with @kbd{S-<cursor>} keys used by
  16559. CUA mode. For Org to relinquish these bindings to CUA mode,
  16560. configure the variable @code{org-replace-disputed-keys}. When set,
  16561. Org moves the following key bindings in Org files, and in the
  16562. agenda buffer---but not during date selection.
  16563. @multitable @columnfractions 0.4 0.4
  16564. @item @kbd{S-@key{UP}} @result{} @kbd{M-p}
  16565. @tab @kbd{S-@key{DOWN}} @result{} @kbd{M-n}
  16566. @item @kbd{S-@key{LEFT}} @result{} @kbd{M--}
  16567. @tab @kbd{S-@key{RIGHT}} @result{} @kbd{M-+}
  16568. @item @kbd{C-S-@key{LEFT}} @result{} @kbd{M-S--}
  16569. @tab @kbd{C-S-@key{RIGHT}} @result{} @kbd{M-S-+}
  16570. @end multitable
  16571. @vindex org-disputed-keys
  16572. Yes, these are unfortunately more difficult to remember. If you
  16573. want to have other replacement keys, look at the variable
  16574. @code{org-disputed-keys}.
  16575. @item @samp{ecomplete.el} by Lars Magne Ingebrigtsen
  16576. @cindex @file{ecomplete.el}
  16577. Ecomplete provides ``electric'' address completion in address
  16578. header lines in message buffers. Sadly Orgtbl mode cuts
  16579. Ecomplete's power supply: no completion happens when Orgtbl mode
  16580. is enabled in message buffers while entering text in address
  16581. header lines. If one wants to use ecomplete one should @emph{not}
  16582. follow the advice to automagically turn on Orgtbl mode in message
  16583. buffers (see @ref{Orgtbl Mode}), but instead---after
  16584. filling in the message headers---turn on Orgtbl mode manually
  16585. when needed in the messages body.
  16586. @item @samp{filladapt.el} by Kyle Jones
  16587. @cindex @file{filladapt.el}
  16588. Org mode tries to do the right thing when filling paragraphs,
  16589. list items and other elements. Many users reported problems
  16590. using both @samp{filladapt.el} and Org mode, so a safe thing to do is
  16591. to disable filladapt like this:
  16592. @lisp
  16593. (add-hook 'org-mode-hook 'turn-off-filladapt-mode)
  16594. @end lisp
  16595. @item @samp{viper.el} by Michael Kifer
  16596. @cindex @file{viper.el}
  16597. @kindex C-c /
  16598. Viper uses @kbd{C-c /} and therefore makes this key not
  16599. access the corresponding Org mode command @code{org-sparse-tree}. You
  16600. need to find another key for this command, or override the key in
  16601. @code{viper-vi-global-user-map} with
  16602. @lisp
  16603. (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree)
  16604. @end lisp
  16605. @item @samp{windmove.el} by Hovav Shacham
  16606. @cindex @file{windmove.el}
  16607. This package also uses the @kbd{S-<cursor>} keys, so
  16608. everything written in the paragraph above about CUA mode also
  16609. applies here. If you want to make the windmove function active
  16610. in locations where Org mode does not have special functionality
  16611. on @kbd{S-<cursor>}, add this to your configuration:
  16612. @lisp
  16613. ;; Make windmove work in Org mode:
  16614. (add-hook 'org-shiftup-final-hook 'windmove-up)
  16615. (add-hook 'org-shiftleft-final-hook 'windmove-left)
  16616. (add-hook 'org-shiftdown-final-hook 'windmove-down)
  16617. (add-hook 'org-shiftright-final-hook 'windmove-right)
  16618. @end lisp
  16619. @item @samp{yasnippet.el}
  16620. @cindex @file{yasnippet.el}
  16621. The way Org mode binds the @kbd{@key{TAB}} key (binding to @code{[tab]}
  16622. instead of @code{"\t"}) overrules YASnippet's access to this key. The
  16623. following code fixed this problem:
  16624. @lisp
  16625. (add-hook 'org-mode-hook
  16626. (lambda ()
  16627. (setq-local yas/trigger-key [tab])
  16628. (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  16629. @end lisp
  16630. The latest version of YASnippet does not play well with Org mode.
  16631. If the above code does not fix the conflict, start by defining
  16632. the following function:
  16633. @lisp
  16634. (defun yas/org-very-safe-expand ()
  16635. (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
  16636. @end lisp
  16637. Then, tell Org mode to use that function:
  16638. @lisp
  16639. (add-hook 'org-mode-hook
  16640. (lambda ()
  16641. (make-variable-buffer-local 'yas/trigger-key)
  16642. (setq yas/trigger-key [tab])
  16643. (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
  16644. (define-key yas/keymap [tab] 'yas/next-field)))
  16645. @end lisp
  16646. @end table
  16647. @node Org Crypt
  16648. @section Org Crypt
  16649. Org Crypt encrypts the text of an entry, but not the headline, or
  16650. properties. Behind the scene, it uses the Emacs EasyPG library to
  16651. encrypt and decrypt files.
  16652. @vindex org-crypt-tag-matcher
  16653. Any text below a headline that has a @samp{crypt} tag is automatically
  16654. encrypted when the file is saved. To use a different tag, customize
  16655. the @code{org-crypt-tag-matcher} setting.
  16656. Here is a suggestion for Org Crypt settings in Emacs init file:
  16657. @lisp
  16658. (require 'org-crypt)
  16659. (org-crypt-use-before-save-magic)
  16660. (setq org-tags-exclude-from-inheritance '("crypt"))
  16661. (setq org-crypt-key nil)
  16662. ;; GPG key to use for encryption
  16663. ;; Either the Key ID or set to nil to use symmetric encryption.
  16664. (setq auto-save-default nil)
  16665. ;; Auto-saving does not cooperate with org-crypt.el: so you need to
  16666. ;; turn it off if you plan to use org-crypt.el quite often. Otherwise,
  16667. ;; you'll get an (annoying) message each time you start Org.
  16668. ;; To turn it off only locally, you can insert this:
  16669. ;;
  16670. ;; # -*- buffer-auto-save-file-name: nil; -*-
  16671. @end lisp
  16672. Excluding the @samp{crypt} tag from inheritance prevents already encrypted
  16673. text from being encrypted again.
  16674. @node Hacking
  16675. @appendix Hacking
  16676. @cindex hacking
  16677. This appendix describes some ways a user can extend the functionality
  16678. of Org.
  16679. @menu
  16680. * Hooks: Hooks (2). How to reach into Org's internals.
  16681. * Add-on Packages:: Available extensions.
  16682. * Adding Hyperlink Types:: New custom link types.
  16683. * Adding Export Back-ends:: How to write new export back-ends.
  16684. * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs.
  16685. * Dynamic Blocks:: Automatically filled blocks.
  16686. * Special Agenda Views:: Customized views.
  16687. * Speeding Up Your Agendas:: Tips on how to speed up your agendas.
  16688. * Extracting Agenda Information:: Post-processing agenda information.
  16689. * Using the Property API:: Writing programs that use entry properties.
  16690. * Using the Mapping API:: Mapping over all or selected entries.
  16691. @end menu
  16692. @node Hooks (2)
  16693. @appendixsec Hooks
  16694. @cindex hooks
  16695. Org has a large number of hook variables for adding functionality.
  16696. This appendix illustrates using a few. A complete list of hooks with
  16697. documentation is maintained by the Worg project at
  16698. @uref{https://orgmode.org/worg/doc.html#hooks}.
  16699. @node Add-on Packages
  16700. @appendixsec Add-on Packages
  16701. @cindex add-on packages
  16702. Various authors wrote a large number of add-on packages for Org.
  16703. These packages are not part of Emacs, but they are distributed as
  16704. contributed packages with the separate release available at
  16705. @uref{https://orgmode.org}. See the @samp{contrib/README} file in the source code
  16706. directory for a list of contributed files. Worg page with more
  16707. information is at: @uref{https://orgmode.org/worg/org-contrib/}.
  16708. @node Adding Hyperlink Types
  16709. @appendixsec Adding Hyperlink Types
  16710. @cindex hyperlinks, adding new types
  16711. Org has many built-in hyperlink types (see @ref{Hyperlinks}), and an
  16712. interface for adding new link types. The following example shows the
  16713. process of adding Org links to Unix man pages, which look like this
  16714. @example
  16715. [[man:printf][The printf manual]]
  16716. @end example
  16717. @noindent
  16718. The following @samp{org-man.el} file implements it
  16719. @lisp
  16720. ;;; org-man.el - Support for links to man pages in Org mode
  16721. (require 'org)
  16722. (org-link-set-parameters "man"
  16723. :follow org-man-command
  16724. :export #'org-man-export
  16725. :store #'org-man-store-link)
  16726. (defcustom org-man-command 'man
  16727. "The Emacs command to be used to display a man page."
  16728. :group 'org-link
  16729. :type '(choice (const man) (const woman)))
  16730. (defun org-man-store-link ()
  16731. "Store a link to a man page."
  16732. (when (memq major-mode '(Man-mode woman-mode))
  16733. ;; This is a man page, we do make this link.
  16734. (let* ((page (org-man-get-page-name))
  16735. (link (concat "man:" page))
  16736. (description (format "Man page for %s" page)))
  16737. (org-store-link-props
  16738. :type "man"
  16739. :link link
  16740. :description description))))
  16741. (defun org-man-get-page-name ()
  16742. "Extract the page name from the buffer name."
  16743. ;; This works for both `Man-mode' and `woman-mode'.
  16744. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  16745. (match-string 1 (buffer-name))
  16746. (error "Cannot create link to this man page")))
  16747. (defun org-man-export (link description format)
  16748. "Export a man page link from Org files."
  16749. (let ((path (format "http://man.he.net/?topic=%s&section=all" link))
  16750. (desc (or description link)))
  16751. (pcase format
  16752. (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc))
  16753. (`latex (format "\\href@{%s@}@{%s@}" path desc))
  16754. (`texinfo (format "@@uref@{%s,%s@}" path desc))
  16755. (`ascii (format "%s (%s)" desc path))
  16756. (t path))))
  16757. (provide 'org-man)
  16758. ;;; org-man.el ends here
  16759. @end lisp
  16760. @noindent
  16761. To activate links to man pages in Org, enter this in the Emacs init
  16762. file:
  16763. @lisp
  16764. (require 'org-man)
  16765. @end lisp
  16766. @noindent
  16767. A review of @samp{org-man.el}:
  16768. @enumerate
  16769. @item
  16770. First, @code{(require 'org)} ensures @samp{org.el} is loaded.
  16771. @item
  16772. @findex org-link-set-parameters
  16773. @vindex org-link-parameters
  16774. Then @code{org-link-set-parameters} defines a new link type with @samp{man}
  16775. prefix and associates functions for following, exporting and
  16776. storing such links. See the variable @code{org-link-parameters} for
  16777. a complete list of possible associations.
  16778. @item
  16779. The rest of the file implements necessary variables and functions.
  16780. For example, @code{org-man-store-link} is responsible for storing a link
  16781. when @code{org-store-link} (see @ref{Handling Links}) is called from a buffer
  16782. displaying a man page. It first checks if the @code{major-mode} is
  16783. appropriate. If check fails, the function returns @code{nil}, which
  16784. means it isn't responsible for creating a link to the current
  16785. buffer. Otherwise the function makes a link string by combining
  16786. the @samp{man:} prefix with the man topic. It also provides a default
  16787. description. The function @code{org-insert-link} can insert it back
  16788. into an Org buffer later on.
  16789. @end enumerate
  16790. @node Adding Export Back-ends
  16791. @appendixsec Adding Export Back-ends
  16792. @cindex Export, writing back-ends
  16793. Org's export engine makes it easy for writing new back-ends. The
  16794. framework on which the engine was built makes it easy to derive new
  16795. back-ends from existing ones.
  16796. @findex org-export-define-backend
  16797. @findex org-export-define-derived-backend
  16798. The two main entry points to the export engine are:
  16799. @code{org-export-define-backend} and @code{org-export-define-derived-backend}.
  16800. To grok these functions, see @samp{ox-latex.el} for an example of defining
  16801. a new back-end from scratch, and @samp{ox-beamer.el} for an example of
  16802. deriving from an existing engine.
  16803. For creating a new back-end from scratch, first set its name as
  16804. a symbol in an alist consisting of elements and export functions. To
  16805. make the back-end visible to the export dispatcher, set @code{:menu-entry}
  16806. keyword. For export options specific to this back-end, set the
  16807. @code{:options-alist}.
  16808. For creating a new back-end from an existing one, set
  16809. @code{:translate-alist} to an alist of export functions. This alist
  16810. replaces the parent back-end functions.
  16811. For complete documentation, see @uref{https://orgmode.org/worg/dev/org-export-reference.html, the Org Export Reference on Worg}.
  16812. @node Tables in Arbitrary Syntax
  16813. @appendixsec Tables in Arbitrary Syntax
  16814. @cindex tables, in other modes
  16815. @cindex lists, in other modes
  16816. @cindex Orgtbl mode
  16817. Due to Org's success in handling tables with Orgtbl, a frequently
  16818. requested feature is the use of Org's table functions in other modes,
  16819. e.g., @LaTeX{}. This would be hard to do in a general way without
  16820. complicated customization nightmares. Moreover, that would take Org
  16821. away from its simplicity roots that Orgtbl has proven. There is,
  16822. however, an alternate approach to accomplishing the same.
  16823. This approach involves implementing a custom @emph{translate} function that
  16824. operates on a native Org @emph{source table} to produce a table in another
  16825. format. This strategy would keep the excellently working Orgtbl
  16826. simple and isolate complications, if any, confined to the translate
  16827. function. To add more alien table formats, we just add more translate
  16828. functions. Also the burden of developing custom translate functions
  16829. for new table formats is in the hands of those who know those formats
  16830. best.
  16831. @menu
  16832. * Radio tables:: Sending and receiving radio tables.
  16833. * A @LaTeX{} example:: Step by step, almost a tutorial.
  16834. * Translator functions:: Copy and modify.
  16835. @end menu
  16836. @node Radio tables
  16837. @appendixsubsec Radio tables
  16838. @cindex radio tables
  16839. Radio tables are target locations for translated tables that are not near
  16840. their source. Org finds the target location and inserts the translated
  16841. table.
  16842. The key to finding the target location is the magic words @samp{BEGIN/END
  16843. RECEIVE ORGTBL}. They have to appear as comments in the current mode.
  16844. If the mode is C, then:
  16845. @example
  16846. /* BEGIN RECEIVE ORGTBL table_name */
  16847. /* END RECEIVE ORGTBL table_name */
  16848. @end example
  16849. @noindent
  16850. At the location of source, Org needs a special line to direct Orgtbl
  16851. to translate and to find the target for inserting the translated
  16852. table. For example:
  16853. @cindex @samp{ORGTBL}, keyword
  16854. @example
  16855. #+ORGTBL: SEND table_name translation_function arguments ...
  16856. @end example
  16857. @noindent
  16858. @samp{table_name} is the table's reference name, which is also used in the
  16859. receiver lines, and the @samp{translation_function} is the Lisp function
  16860. that translates. This line, in addition, may also contain alternating
  16861. key and value arguments at the end. The translation function gets
  16862. these values as a property list. A few standard parameters are
  16863. already recognized and acted upon before the translation function is
  16864. called:
  16865. @table @asis
  16866. @item @samp{:skip N}
  16867. Skip the first N lines of the table. Hlines do count; include
  16868. them if they are to be skipped.
  16869. @item @samp{:skipcols (n1 n2 ...)}
  16870. List of columns to be skipped. First Org automatically discards
  16871. columns with calculation marks and then sends the table to the
  16872. translator function, which then skips columns as specified in
  16873. @samp{skipcols}.
  16874. @end table
  16875. @noindent
  16876. To keep the source table intact in the buffer without being disturbed
  16877. when the source file is compiled or otherwise being worked on, use one
  16878. of these strategies:
  16879. @itemize
  16880. @item
  16881. Place the table in a block comment. For example, in C mode you
  16882. could wrap the table between @samp{/*} and @samp{*/} lines.
  16883. @item
  16884. Put the table after an ``end'' statement. For example @code{\bye} in @TeX{}
  16885. and @code{\end@{document@}} in @LaTeX{}.
  16886. @item
  16887. Comment and un-comment each line of the table during edits. The
  16888. @kbd{M-x orgtbl-toggle-comment} command makes toggling easy.
  16889. @end itemize
  16890. @node A @LaTeX{} example
  16891. @appendixsubsec A @LaTeX{} example of radio tables
  16892. @cindex @LaTeX{}, and Orgtbl mode
  16893. To wrap a source table in @LaTeX{}, use the @samp{comment} environment
  16894. provided by @samp{comment.sty}@footnote{@uref{https://ctan.org/tex-archive/macros/latex/contrib/comment?lang=en}}. To activate it, put
  16895. @code{\usepackage@{comment@}} in the document header. Orgtbl mode inserts
  16896. a radio table skeleton@footnote{Because @samp{LEVEL=2} has 3 stars, @samp{LEVEL=3} has 4 stars, and so
  16897. on.} with the command @kbd{M-x orgtbl-insert-radio-table}, which prompts for a table name. For
  16898. example, if @samp{salesfigures} is the name, the template inserts:
  16899. @example
  16900. % BEGIN RECEIVE ORGTBL salesfigures
  16901. % END RECEIVE ORGTBL salesfigures
  16902. \begin@{comment@}
  16903. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16904. | | |
  16905. \end@{comment@}
  16906. @end example
  16907. @vindex LaTeX-verbatim-environments
  16908. @noindent
  16909. The line @samp{#+ORGTBL: SEND} tells Orgtbl mode to use the function
  16910. @code{orgtbl-to-latex} to convert the table to @LaTeX{} format, then insert
  16911. the table at the target (receive) location named @samp{salesfigures}. Now
  16912. the table is ready for data entry. It can even use spreadsheet
  16913. features@footnote{If the @samp{TBLFM} keyword contains an odd number of dollar
  16914. characters, this may cause problems with Font Lock in @LaTeX{} mode. As
  16915. shown in the example you can fix this by adding an extra line inside
  16916. the @samp{comment} environment that is used to balance the dollar
  16917. expressions. If you are using AUC@TeX{} with the font-latex library,
  16918. a much better solution is to add the @samp{comment} environment to the
  16919. variable @code{LaTeX-verbatim-environments}.}:
  16920. @example
  16921. % BEGIN RECEIVE ORGTBL salesfigures
  16922. % END RECEIVE ORGTBL salesfigures
  16923. \begin@{comment@}
  16924. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  16925. | Month | Days | Nr sold | per day |
  16926. |-------+------+---------+---------|
  16927. | Jan | 23 | 55 | 2.4 |
  16928. | Feb | 21 | 16 | 0.8 |
  16929. | March | 22 | 278 | 12.6 |
  16930. #+TBLFM: $4=$3/$2;%.1f
  16931. % $ (optional extra dollar to keep Font Lock happy, see footnote)
  16932. \end@{comment@}
  16933. @end example
  16934. @noindent
  16935. After editing, @kbd{C-c C-c} inserts the translated table at the
  16936. target location, between the two marker lines.
  16937. For hand-made custom tables, note that the translator needs to skip
  16938. the first two lines of the source table. Also the command has to
  16939. @emph{splice} out the target table without the header and footer.
  16940. @example
  16941. \begin@{tabular@}@{lrrr@}
  16942. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  16943. % BEGIN RECEIVE ORGTBL salesfigures
  16944. % END RECEIVE ORGTBL salesfigures
  16945. \end@{tabular@}
  16946. %
  16947. \begin@{comment@}
  16948. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  16949. | Month | Days | Nr sold | per day |
  16950. |-------+------+---------+---------|
  16951. | Jan | 23 | 55 | 2.4 |
  16952. | Feb | 21 | 16 | 0.8 |
  16953. | March | 22 | 278 | 12.6 |
  16954. #+TBLFM: $4=$3/$2;%.1f
  16955. \end@{comment@}
  16956. @end example
  16957. The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of
  16958. Orgtbl mode and uses a @samp{tabular} environment to typeset the table and
  16959. marks horizontal lines with @code{\hline}. For additional parameters to
  16960. control output, see @ref{Translator functions}:
  16961. @table @asis
  16962. @item @code{:splice nil/t}
  16963. When non-@code{nil}, return only table body lines; not wrapped in
  16964. tabular environment. Default is @code{nil}.
  16965. @item @code{:fmt FMT}
  16966. Format to warp each field. It should contain @samp{%s} for the
  16967. original field value. For example, to wrap each field value in
  16968. dollar symbol, you could use @samp{:fmt "$%s$"}. Format can also wrap
  16969. a property list with column numbers and formats, for example
  16970. @samp{:fmt (2 "$%s$" 4 "%s\\%%")}. In place of a string, a function
  16971. of one argument can be used; the function must return a formatted
  16972. string.
  16973. @item @code{:efmt EFMT}
  16974. Format numbers as exponentials. The spec should have @samp{%s} twice
  16975. for inserting mantissa and exponent, for example
  16976. @samp{"%s\\times10^@{%s@}"}. This may also be a property list with
  16977. column numbers and formats, for example @samp{:efmt (2
  16978. "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  16979. @var{EFMT} has been applied to a value, @var{FMT}---see
  16980. above---is also be applied. Functions with two arguments can be
  16981. supplied instead of strings. By default, no special formatting
  16982. is applied.
  16983. @end table
  16984. @node Translator functions
  16985. @appendixsubsec Translator functions
  16986. @cindex HTML, and Orgtbl mode
  16987. @cindex translator function
  16988. @findex orgtbl-to-csv
  16989. @findex orgtbl-to-tsv
  16990. @findex orgtbl-to-latex
  16991. @findex orgtbl-to-html
  16992. @findex orgtbl-to-texinfo
  16993. @findex orgtbl-to-unicode
  16994. @findex orgtbl-to-orgtbl
  16995. @findex orgtbl-to-generic
  16996. Orgtbl mode has built-in translator functions: @code{orgtbl-to-csv}
  16997. (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values),
  16998. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, @code{orgtbl-to-texinfo},
  16999. @code{orgtbl-to-unicode} and @code{orgtbl-to-orgtbl}. They use the generic
  17000. translator, @code{orgtbl-to-generic}, which delegates translations to
  17001. various export back-ends.
  17002. Properties passed to the function through the @samp{ORGTBL SEND} line take
  17003. precedence over properties defined inside the function. For example,
  17004. this overrides the default @LaTeX{} line endings, @code{\\}, with @code{\\[2mm]}:
  17005. @example
  17006. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  17007. @end example
  17008. For a new language translator, define a converter function. It can be
  17009. a generic function, such as shown in this example. It marks
  17010. a beginning and ending of a table with @samp{!BTBL!} and @samp{!ETBL!};
  17011. a beginning and ending of lines with @samp{!BL!} and @samp{!EL!}; and uses a TAB
  17012. for a field separator:
  17013. @lisp
  17014. (defun orgtbl-to-language (table params)
  17015. "Convert the orgtbl-mode TABLE to language."
  17016. (orgtbl-to-generic
  17017. table
  17018. (org-combine-plists
  17019. '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
  17020. params)))
  17021. @end lisp
  17022. @noindent
  17023. The documentation for the @code{orgtbl-to-generic} function shows
  17024. a complete list of parameters, each of which can be passed through to
  17025. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function using
  17026. that generic function.
  17027. For complicated translations the generic translator function could be
  17028. replaced by a custom translator function. Such a custom function must
  17029. take two arguments and return a single string containing the formatted
  17030. table. The first argument is the table whose lines are a list of
  17031. fields or the symbol @code{hline}. The second argument is the property
  17032. list consisting of parameters specified in the @samp{#+ORGTBL: SEND} line.
  17033. Please share your translator functions by posting them to the Org
  17034. users mailing list, at @email{emacs-orgmode@@gnu.org}.
  17035. @node Dynamic Blocks
  17036. @appendixsec Dynamic Blocks
  17037. @cindex dynamic blocks
  17038. Org supports @emph{dynamic blocks} in Org documents. They are inserted
  17039. with begin and end markers like any other code block, but the contents
  17040. 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
  17041. @ref{Clocking Work Time}).
  17042. Dynamic blocks can have names and function parameters. The syntax is
  17043. similar to source code block specifications:
  17044. @example
  17045. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  17046. ...
  17047. #+END:
  17048. @end example
  17049. These commands update dynamic blocks:
  17050. @table @asis
  17051. @item @kbd{C-c C-x C-u} (@code{org-dblock-update})
  17052. @kindex C-c C-x C-u
  17053. @findex org-dblock-update
  17054. Update dynamic block at point.
  17055. @item @kbd{C-u C-c C-x C-u}
  17056. @kindex C-u C-c C-x C-u
  17057. Update all dynamic blocks in the current file.
  17058. @end table
  17059. Before updating a dynamic block, Org removes content between the
  17060. @samp{BEGIN} and @samp{END} markers. Org then reads the parameters on the
  17061. @samp{BEGIN} line for passing to the writer function. If the function
  17062. expects to access the removed content, then Org expects an extra
  17063. parameter, @samp{:content}, on the @samp{BEGIN} line.
  17064. The syntax for naming a writer function with a dynamic block labelled
  17065. @samp{myblock} is: @code{org-dblock-write:myblock}. Parameters come from the
  17066. @samp{BEGIN} line.
  17067. The following is an example of a dynamic block and a block writer function
  17068. that updates the time when the function was last run:
  17069. @example
  17070. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  17071. ...
  17072. #+END:
  17073. @end example
  17074. @noindent
  17075. The dynamic block's writer function:
  17076. @lisp
  17077. (defun org-dblock-write:block-update-time (params)
  17078. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  17079. (insert "Last block update at: "
  17080. (format-time-string fmt))))
  17081. @end lisp
  17082. To keep dynamic blocks up-to-date in an Org file, use the function,
  17083. @code{org-update-all-dblocks} in hook, such as @code{before-save-hook}. The
  17084. @code{org-update-all-dblocks} function does not run if the file is not in
  17085. Org mode.
  17086. @findex org-narrow-to-block
  17087. Dynamic blocks, like any other block, can be narrowed with
  17088. @code{org-narrow-to-block}.
  17089. @node Special Agenda Views
  17090. @appendixsec Special Agenda Views
  17091. @cindex agenda views, user-defined
  17092. @vindex org-agenda-skip-function
  17093. @vindex org-agenda-skip-function-global
  17094. Org provides a special hook to further limit items in agenda views:
  17095. @code{agenda}, @code{agenda*}@footnote{The @code{agenda*} view is the same as @code{agenda} except that it
  17096. only considers @emph{appointments}, i.e., scheduled and deadline items that
  17097. have a time specification @samp{[h]h:mm} in their time-stamps.}, @code{todo}, @code{alltodo}, @code{tags}, @code{tags-todo},
  17098. @code{tags-tree}. Specify a custom function that tests inclusion of every
  17099. matched item in the view. This function can also skip as much as is
  17100. needed.
  17101. For a global condition applicable to agenda views, use the
  17102. @code{org-agenda-skip-function-global} variable. Org uses a global
  17103. condition with @code{org-agenda-skip-function} for custom searching.
  17104. This example defines a function for a custom view showing TODO items
  17105. with @samp{waiting} status. Manually this is a multi-step search process,
  17106. but with a custom view, this can be automated as follows:
  17107. The custom function searches the subtree for the @samp{waiting} tag and
  17108. returns @code{nil} on match. Otherwise it gives the location from where
  17109. the search continues.
  17110. @lisp
  17111. (defun my-skip-unless-waiting ()
  17112. "Skip trees that are not waiting"
  17113. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  17114. (if (re-search-forward ":waiting:" subtree-end t)
  17115. nil ; tag found, do not skip
  17116. subtree-end))) ; tag not found, continue after end of subtree
  17117. @end lisp
  17118. To use this custom function in a custom agenda command:
  17119. @lisp
  17120. (org-add-agenda-custom-command
  17121. '("b" todo "PROJECT"
  17122. ((org-agenda-skip-function 'my-skip-unless-waiting)
  17123. (org-agenda-overriding-header "Projects waiting for something: "))))
  17124. @end lisp
  17125. @vindex org-agenda-overriding-header
  17126. Note that this also binds @code{org-agenda-overriding-header} to a more
  17127. meaningful string suitable for the agenda view.
  17128. @vindex org-odd-levels-only
  17129. @vindex org-agenda-skip-function
  17130. Search for entries with a limit set on levels for the custom search.
  17131. This is a general approach to creating custom searches in Org. To
  17132. include all levels, use @samp{LEVEL>0}@footnote{Note that, for @code{org-odd-levels-only}, a level number
  17133. corresponds to order in the hierarchy, not to the number of stars.}. Then to selectively pick
  17134. the matched entries, use @code{org-agenda-skip-function}, which also
  17135. accepts Lisp forms, such as @code{org-agenda-skip-entry-if} and
  17136. @code{org-agenda-skip-subtree-if}. For example:
  17137. @table @asis
  17138. @item @code{(org-agenda-skip-entry-if 'scheduled)}
  17139. Skip current entry if it has been scheduled.
  17140. @item @code{(org-agenda-skip-entry-if 'notscheduled)}
  17141. Skip current entry if it has not been scheduled.
  17142. @item @code{(org-agenda-skip-entry-if 'deadline)}
  17143. Skip current entry if it has a deadline.
  17144. @item @code{(org-agenda-skip-entry-if 'scheduled 'deadline)}
  17145. Skip current entry if it has a deadline, or if it is scheduled.
  17146. @item @code{(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))}
  17147. Skip current entry if the TODO keyword is TODO or WAITING.
  17148. @item @code{(org-agenda-skip-entry-if 'todo 'done)}
  17149. Skip current entry if the TODO keyword marks a DONE state.
  17150. @item @code{(org-agenda-skip-entry-if 'timestamp)}
  17151. Skip current entry if it has any timestamp, may also be deadline
  17152. or scheduled.
  17153. @item @code{(org-agenda-skip-entry-if 'regexp "regular expression")}
  17154. Skip current entry if the regular expression matches in the
  17155. entry.
  17156. @item @code{(org-agenda-skip-entry-if 'notregexp "regular expression")}
  17157. Skip current entry unless the regular expression matches.
  17158. @item @code{(org-agenda-skip-subtree-if 'regexp "regular expression")}
  17159. Same as above, but check and skip the entire subtree.
  17160. @end table
  17161. The following is an example of a search for @samp{waiting} without the
  17162. special function:
  17163. @lisp
  17164. (org-add-agenda-custom-command
  17165. '("b" todo "PROJECT"
  17166. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  17167. 'regexp ":waiting:"))
  17168. (org-agenda-overriding-header "Projects waiting for something: "))))
  17169. @end lisp
  17170. @node Speeding Up Your Agendas
  17171. @appendixsec Speeding Up Your Agendas
  17172. @cindex agenda views, optimization
  17173. Some agenda commands slow down when the Org files grow in size or
  17174. number. Here are tips to speed up:
  17175. @itemize
  17176. @item
  17177. Reduce the number of Org agenda files to avoid slowdowns due to hard drive
  17178. accesses.
  17179. @item
  17180. Reduce the number of DONE and archived headlines so agenda
  17181. operations that skip over these can finish faster.
  17182. @item
  17183. Do not dim blocked tasks:
  17184. @vindex org-agenda-dim-blocked-tasks
  17185. @lisp
  17186. (setq org-agenda-dim-blocked-tasks nil)
  17187. @end lisp
  17188. @item
  17189. Stop preparing agenda buffers on startup:
  17190. @vindex org-startup-folded
  17191. @vindex org-agenda-inhibit-startup
  17192. @lisp
  17193. (setq org-agenda-inhibit-startup nil)
  17194. @end lisp
  17195. @item
  17196. Disable tag inheritance for agendas:
  17197. @vindex org-agenda-show-inherited-tags
  17198. @vindex org-agenda-use-tag-inheritance
  17199. @lisp
  17200. (setq org-agenda-use-tag-inheritance nil)
  17201. @end lisp
  17202. @end itemize
  17203. These options can be applied to selected agenda views. For more
  17204. details about generation of agenda views, see the docstrings for the
  17205. relevant variables, and this @uref{https://orgmode.org/worg/agenda-optimization.html, dedicated Worg page} for agenda
  17206. optimization.
  17207. @node Extracting Agenda Information
  17208. @appendixsec Extracting Agenda Information
  17209. @cindex agenda, pipe
  17210. @cindex scripts, for agenda processing
  17211. Org provides commands to access agendas through Emacs batch mode.
  17212. Through this command-line interface, agendas are automated for further
  17213. processing or printing.
  17214. @vindex org-agenda-custom-commands
  17215. @findex org-batch-agenda
  17216. @code{org-batch-agenda} creates an agenda view in ASCII and outputs to
  17217. standard output. This command takes one string parameter. When
  17218. string consists of a single character, Org uses it as a key to
  17219. @code{org-agenda-custom-commands}. These are the same ones available
  17220. through the agenda dispatcher (see @ref{Agenda Dispatcher}).
  17221. This example command line directly prints the TODO list to the printer:
  17222. @example
  17223. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  17224. @end example
  17225. When the string parameter length is two or more characters, Org
  17226. matches it with tags/TODO strings. For example, this example command
  17227. line prints items tagged with @samp{shop}, but excludes items tagged with
  17228. @samp{NewYork}:
  17229. @example
  17230. emacs -batch -l ~/.emacs \
  17231. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  17232. @end example
  17233. @noindent
  17234. An example showing on-the-fly parameter modifications:
  17235. @example
  17236. emacs -batch -l ~/.emacs \
  17237. -eval '(org-batch-agenda "a" \
  17238. org-agenda-span (quote month) \
  17239. org-agenda-include-diary nil \
  17240. org-agenda-files (quote ("~/org/project.org")))' \
  17241. | lpr
  17242. @end example
  17243. @noindent
  17244. which produces an agenda for the next 30 days from just the
  17245. @samp{~/org/projects.org} file.
  17246. @findex org-batch-agenda-csv
  17247. For structured processing of agenda output, use @code{org-batch-agenda-csv}
  17248. with the following fields:
  17249. @table @asis
  17250. @item category
  17251. The category of the item
  17252. @item head
  17253. The headline, without TODO keyword, TAGS and PRIORITY
  17254. @item type
  17255. The type of the agenda entry, can be
  17256. @multitable {aaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
  17257. @item @code{todo}
  17258. @tab selected in TODO match
  17259. @item @code{tagsmatch}
  17260. @tab selected in tags match
  17261. @item @code{diary}
  17262. @tab imported from diary
  17263. @item @code{deadline}
  17264. @tab a deadline
  17265. @item @code{scheduled}
  17266. @tab scheduled
  17267. @item @code{timestamp}
  17268. @tab appointment, selected by timestamp
  17269. @item @code{closed}
  17270. @tab entry was closed on date
  17271. @item @code{upcoming-deadline}
  17272. @tab warning about nearing deadline
  17273. @item @code{past-scheduled}
  17274. @tab forwarded scheduled item
  17275. @item @code{block}
  17276. @tab entry has date block including date
  17277. @end multitable
  17278. @item todo
  17279. The TODO keyword, if any
  17280. @item tags
  17281. All tags including inherited ones, separated by colons
  17282. @item date
  17283. The relevant date, like @samp{2007-2-14}
  17284. @item time
  17285. The time, like @samp{15:00-16:50}
  17286. @item extra
  17287. String with extra planning info
  17288. @item priority-l
  17289. The priority letter if any was given
  17290. @item priority-n
  17291. The computed numerical priority
  17292. @end table
  17293. @noindent
  17294. If the selection of the agenda item was based on a timestamp,
  17295. including those items with @samp{DEADLINE} and @samp{SCHEDULED} keywords, then
  17296. Org includes date and time in the output.
  17297. If the selection of the agenda item was based on a timestamp (or
  17298. deadline/scheduled), then Org includes date and time in the output.
  17299. Here is an example of a post-processing script in Perl. It takes the
  17300. CSV output from Emacs and prints with a checkbox:
  17301. @example
  17302. #!/usr/bin/perl
  17303. # define the Emacs command to run
  17304. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  17305. # run it and capture the output
  17306. $agenda = qx@{$cmd 2>/dev/null@};
  17307. # loop over all lines
  17308. foreach $line (split(/\n/,$agenda)) @{
  17309. # get the individual values
  17310. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  17311. $priority_l,$priority_n) = split(/,/,$line);
  17312. # process and print
  17313. print "[ ] $head\n";
  17314. @}
  17315. @end example
  17316. @node Using the Property API
  17317. @appendixsec Using the Property API
  17318. @cindex API, for properties
  17319. @cindex properties, API
  17320. Here is a description of the functions that can be used to work with
  17321. properties.
  17322. @defun org-entry-properties &optional pom which
  17323. Get all properties of the entry at point-or-marker @var{POM}.
  17324. This includes the TODO keyword, the tags, time strings for deadline,
  17325. scheduled, and clocking, and any additional properties defined in the
  17326. entry. The return value is an alist. Keys may occur multiple times
  17327. if the property key was used several times. @var{POM} may also
  17328. be @code{nil}, in which case the current entry is used. If
  17329. @var{WHICH} is @code{nil} or @code{all}, get all properties. If
  17330. @var{WHICH} is @code{special} or @code{standard}, only get that subclass.
  17331. @end defun
  17332. @vindex org-use-property-inheritance
  17333. @findex org-insert-property-drawer
  17334. @defun org-entry-get pom property &optional inherit
  17335. Get value of @var{PROPERTY} for entry at point-or-marker
  17336. @var{POM}. By default, this only looks at properties defined
  17337. locally in the entry. If @var{INHERIT} is non-@code{nil} and the
  17338. entry does not have the property, then also check higher levels of the
  17339. hierarchy. If @var{INHERIT} is the symbol @code{selective}, use
  17340. inheritance if and only if the setting of
  17341. @code{org-use-property-inheritance} selects @var{PROPERTY} for
  17342. inheritance.
  17343. @end defun
  17344. @defun org-entry-delete pom property
  17345. Delete the property @var{PROPERTY} from entry at point-or-marker
  17346. @var{POM}.
  17347. @end defun
  17348. @defun org-entry-put pom property value
  17349. Set @var{PROPERTY} to @var{VALUES} for entry at
  17350. point-or-marker POM.
  17351. @end defun
  17352. @defun org-buffer-property-keys &optional include-specials
  17353. Get all property keys in the current buffer.
  17354. @end defun
  17355. @defun org-insert-property-drawer
  17356. Insert a property drawer for the current entry. Also
  17357. @end defun
  17358. @defun org-entry-put-multivalued-property pom property &rest values
  17359. Set @var{PROPERTY} at point-or-marker @var{POM} to
  17360. @var{VALUES}. @var{VALUES} should be a list of strings.
  17361. They are concatenated, with spaces as separators.
  17362. @end defun
  17363. @defun org-entry-get-multivalued-property pom property
  17364. Treat the value of the property @var{PROPERTY} as
  17365. a whitespace-separated list of values and return the values as a list
  17366. of strings.
  17367. @end defun
  17368. @defun org-entry-add-to-multivalued-property pom property value
  17369. Treat the value of the property @var{PROPERTY} as
  17370. a whitespace-separated list of values and make sure that
  17371. @var{VALUE} is in this list.
  17372. @end defun
  17373. @defun org-entry-remove-from-multivalued-property pom property value
  17374. Treat the value of the property @var{PROPERTY} as
  17375. a whitespace-separated list of values and make sure that
  17376. @var{VALUE} is @emph{not} in this list.
  17377. @end defun
  17378. @defun org-entry-member-in-multivalued-property pom property value
  17379. Treat the value of the property @var{PROPERTY} as
  17380. a whitespace-separated list of values and check if @var{VALUE} is
  17381. in this list.
  17382. @end defun
  17383. @defopt org-property-allowed-value-functions
  17384. Hook for functions supplying allowed values for a specific property.
  17385. The functions must take a single argument, the name of the property,
  17386. and return a flat list of allowed values. If @samp{:ETC} is one of the
  17387. values, use the values as completion help, but allow also other values
  17388. to be entered. The functions must return @code{nil} if they are not
  17389. responsible for this property.
  17390. @end defopt
  17391. @node Using the Mapping API
  17392. @appendixsec Using the Mapping API
  17393. @cindex API, for mapping
  17394. @cindex mapping entries, API
  17395. Org has sophisticated mapping capabilities to find all entries
  17396. satisfying certain criteria. Internally, this functionality is used
  17397. to produce agenda views, but there is also an API that can be used to
  17398. execute arbitrary functions for each or selected entries. The main
  17399. entry point for this API is:
  17400. @defun org-map-entries func &optional match scope &rest skip
  17401. Call @{@{@{(var(FUNC))@}@}@} at each headline selected by @var{MATCH}
  17402. in @var{SCOPE}.
  17403. @var{FUNC} is a function or a Lisp form. With the cursor
  17404. positioned at the beginning of the headline, call the function without
  17405. arguments. Org returns an alist of return values of calls to the
  17406. function.
  17407. To avoid preserving point, Org wraps the call to @var{FUNC} in
  17408. save-excursion form. After evaluation, Org moves the cursor to the
  17409. end of the line that was just processed. Search continues from that
  17410. point forward. This may not always work as expected under some
  17411. conditions, such as if the current sub-tree was removed by a previous
  17412. archiving operation. In such rare circumstances, Org skips the next
  17413. entry entirely when it should not. To stop Org from such skips, make
  17414. @var{FUNC} set the variable @code{org-map-continue-from} to a specific
  17415. buffer position.
  17416. @var{MATCH} is a tags/property/TODO match. Org iterates only
  17417. matched headlines. Org iterates over all headlines when
  17418. @var{MATCH} is @code{nil} or @code{t}.
  17419. @var{SCOPE} determines the scope of this command. It can be any
  17420. of:
  17421. @table @asis
  17422. @item @code{nil}
  17423. The current buffer, respecting the restriction, if any.
  17424. @item @code{tree}
  17425. The subtree started with the entry at point.
  17426. @item @code{region}
  17427. The entries within the active region, if any.
  17428. @item @code{file}
  17429. The current buffer, without restriction.
  17430. @item @code{file-with-archives}
  17431. The current buffer, and any archives associated with it.
  17432. @item @code{agenda}
  17433. All agenda files.
  17434. @item @code{agenda-with-archives}
  17435. All agenda files with any archive files associated with them.
  17436. @item @code{(file1 file2 ...)}
  17437. If this is a list, all files in the list are scanned.
  17438. @end table
  17439. @noindent
  17440. The remaining arguments are treated as settings for the scanner's
  17441. skipping facilities. Valid arguments are:
  17442. @table @asis
  17443. @item @code{archive}
  17444. Skip trees with the archive tag.
  17445. @item @code{comment}
  17446. Skip trees with the COMMENT keyword.
  17447. @item function or Lisp form
  17448. @vindex org-agenda-skip-function
  17449. Used as value for @code{org-agenda-skip-function}, so whenever the
  17450. function returns @code{t}, @var{FUNC} is called for that entry
  17451. and search continues from the point where the function leaves it.
  17452. @end table
  17453. @end defun
  17454. The mapping routine can call any arbitrary function, even functions
  17455. that change meta data or query the property API (see @ref{Using the Property API}). Here are some handy functions:
  17456. @defun org-todo &optional arg
  17457. Change the TODO state of the entry. See the docstring of the
  17458. functions for the many possible values for the argument
  17459. @var{ARG}.
  17460. @end defun
  17461. @defun org-priority &optional action
  17462. Change the priority of the entry. See the docstring of this function
  17463. for the possible values for @var{ACTION}.
  17464. @end defun
  17465. @defun org-toggle-tag tag &optional onoff
  17466. Toggle the tag @var{TAG} in the current entry. Setting
  17467. @var{ONOFF} to either @code{on} or @code{off} does not toggle tag, but
  17468. ensure that it is either on or off.
  17469. @end defun
  17470. @defun org-promote
  17471. Promote the current entry.
  17472. @end defun
  17473. @defun org-demote
  17474. Demote the current entry.
  17475. @end defun
  17476. This example turns all entries tagged with @samp{TOMORROW} into TODO
  17477. entries with keyword @samp{UPCOMING}. Org ignores entries in comment trees
  17478. and archive trees.
  17479. @lisp
  17480. (org-map-entries '(org-todo "UPCOMING")
  17481. "+TOMORROW" 'file 'archive 'comment)
  17482. @end lisp
  17483. The following example counts the number of entries with TODO keyword
  17484. @samp{WAITING}, in all agenda files.
  17485. @lisp
  17486. (length (org-map-entries t "/+WAITING" 'agenda))
  17487. @end lisp
  17488. @node MobileOrg
  17489. @appendix MobileOrg
  17490. @cindex iPhone
  17491. @cindex smartphone
  17492. @cindex android
  17493. @cindex MobileOrg
  17494. MobileOrg is a companion mobile app that runs on iOS and Android
  17495. devices. MobileOrg enables offline-views and capture support for an
  17496. Org mode system that is rooted on a ``real'' computer. MobileOrg can
  17497. record changes to existing entries.
  17498. The @uref{https://github.com/MobileOrg/, iOS implementation} for the @emph{iPhone/iPod Touch/iPad} series of
  17499. devices, was started by Richard Moreland and is now in the hands of
  17500. Sean Escriva. Android users should check out @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android} by
  17501. Matt Jones. Though the two implementations are not identical, they
  17502. offer similar features.
  17503. This appendix describes Org's support for agenda view formats
  17504. compatible with MobileOrg. It also describes synchronizing changes,
  17505. such as to notes, between MobileOrg and the computer.
  17506. To change tags and TODO states in MobileOrg, first customize the
  17507. variables @code{org-todo-keywords} and @code{org-tag-alist}. These should cover
  17508. all the important tags and TODO keywords, even if Org files use only
  17509. some of them. Though MobileOrg has in-buffer settings, it understands
  17510. TODO states @emph{sets} (see @ref{Per-file keywords}) and
  17511. @emph{mutually exclusive} tags (see @ref{Setting Tags}) only for those set in
  17512. these variables.
  17513. @menu
  17514. * Setting Up the Staging Area:: For the mobile device.
  17515. * Pushing to MobileOrg:: Uploading Org files and agendas.
  17516. * Pulling from MobileOrg:: Integrating captured and flagged items.
  17517. @end menu
  17518. @node Setting Up the Staging Area
  17519. @appendixsec Setting Up the Staging Area
  17520. MobileOrg needs access to a file directory on a server to interact
  17521. with Emacs. With a public server, consider encrypting the files.
  17522. MobileOrg version 1.5 supports encryption for the iPhone. Org also
  17523. requires @samp{openssl} installed on the local computer. To turn on
  17524. encryption, set the same password in MobileOrg and in Emacs. Set the
  17525. password in the variable @code{org-mobile-use-encryption}@footnote{If Emacs is configured for safe storing of passwords, then
  17526. configure the variable, @code{org-mobile-encryption-password}; please read
  17527. the docstring of that variable.}. Note
  17528. that even after MobileOrg encrypts the file contents, the file name
  17529. remains visible on the file systems of the local computer, the server,
  17530. and the mobile device.
  17531. For a server to host files, consider options like @uref{http://dropbox.com, Dropbox.com}
  17532. account@footnote{An alternative is to use a WebDAV server. MobileOrg
  17533. documentation has details of WebDAV server configuration. Additional
  17534. help is at this @uref{https://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.}. On first connection, MobileOrg creates a directory
  17535. @samp{MobileOrg} on Dropbox. Pass its location to Emacs through an
  17536. initialisation file variable as follows:
  17537. @lisp
  17538. (setq org-mobile-directory "~/Dropbox/MobileOrg")
  17539. @end lisp
  17540. Org copies files to the above directory for MobileOrg. Org also uses
  17541. the same directory for sharing notes between Org and MobileOrg.
  17542. @node Pushing to MobileOrg
  17543. @appendixsec Pushing to MobileOrg
  17544. @vindex org-mobile-files
  17545. @vindex org-directory
  17546. Org pushes files listed in @code{org-mobile-files} to
  17547. @code{org-mobile-directory}. Files include agenda files (as listed in
  17548. @code{org-agenda-files}). Customize @code{org-mobile-files} to add other files.
  17549. File names are staged with paths relative to @code{org-directory}, so all
  17550. files should be inside this directory@footnote{Symbolic links in @code{org-directory} need to have the same name
  17551. as their targets.}.
  17552. Push creates a special Org file @samp{agendas.org} with custom agenda views
  17553. defined by the user@footnote{While creating the agendas, Org mode forces ID properties on
  17554. all referenced entries, so that these entries can be uniquely
  17555. identified if MobileOrg flags them for further action. To avoid
  17556. setting properties configure the variable
  17557. @code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode then relies
  17558. on outline paths, assuming they are unique.}.
  17559. Finally, Org writes the file @samp{index.org}, containing links to other
  17560. files. MobileOrg reads this file first from the server to determine
  17561. what other files to download for agendas. For faster downloads,
  17562. MobileOrg only reads files whose checksums@footnote{Checksums are stored automatically in the file
  17563. @samp{checksums.dat}.} have changed.
  17564. @node Pulling from MobileOrg
  17565. @appendixsec Pulling from MobileOrg
  17566. When MobileOrg synchronizes with the server, it pulls the Org files
  17567. for viewing. It then appends to the file @samp{mobileorg.org} on the
  17568. server the captured entries, pointers to flagged and changed entries.
  17569. Org integrates its data in an inbox file format.
  17570. @enumerate
  17571. @item
  17572. @vindex org-mobile-inbox-for-pull
  17573. Org moves all entries found in @samp{mobileorg.org}@footnote{The file will be empty after this operation.} and appends
  17574. them to the file pointed to by the variable
  17575. @code{org-mobile-inbox-for-pull}. Each captured entry and each editing
  17576. event is a top-level entry in the inbox file.
  17577. @item
  17578. After moving the entries, Org attempts changes to MobileOrg. Some
  17579. changes are applied directly and without user interaction.
  17580. Examples include changes to tags, TODO state, headline and body
  17581. text. Entries for further action are tagged as @samp{FLAGGED}. Org
  17582. marks entries with problems with an error message in the inbox.
  17583. They have to be resolved manually.
  17584. @item
  17585. Org generates an agenda view for flagged entries for user
  17586. intervention to clean up. For notes stored in flagged entries,
  17587. MobileOrg displays them in the echo area when the cursor is on the
  17588. corresponding agenda item.
  17589. @table @asis
  17590. @item @kbd{?}
  17591. @kindex ?
  17592. Pressing @kbd{?} displays the entire flagged note in
  17593. another window. Org also pushes it to the kill ring. To
  17594. store flagged note as a normal note, use @kbd{? z C-y C-c C-c}. Pressing@kbd{?} twice does these things: first
  17595. it removes the @samp{FLAGGED} tag; second, it removes the flagged
  17596. note from the property drawer; third, it signals that manual
  17597. editing of the flagged entry is now finished.
  17598. @end table
  17599. @end enumerate
  17600. @kindex ? @r{(Agenda dispatcher)}
  17601. From the agenda dispatcher, @kbd{?} returns to the view to finish
  17602. processing flagged entries. Note that these entries may not be the
  17603. most recent since MobileOrg searches files that were last pulled. To
  17604. get an updated agenda view with changes since the last pull, pull
  17605. again.
  17606. @node History and Acknowledgments
  17607. @appendix History and Acknowledgments
  17608. @anchor{From Carsten}
  17609. @appendixsec From Carsten
  17610. Org was born in 2003, out of frustration over the user interface of
  17611. the Emacs Outline mode. I was trying to organize my notes and
  17612. projects, and using Emacs seemed to be the natural way to go.
  17613. However, having to remember eleven different commands with two or
  17614. three keys per command, only to hide and show parts of the outline
  17615. tree, that seemed entirely unacceptable to me. Also, when using
  17616. outlines to take notes, I constantly wanted to restructure the tree,
  17617. organizing it parallel to my thoughts and plans. @emph{Visibility cycling}
  17618. and @emph{structure editing} were originally implemented in the package
  17619. @samp{outline-magic.el}, but quickly moved to the more general @samp{org.el}.
  17620. As this environment became comfortable for project planning, the next
  17621. step was adding @emph{TODO entries}, basic @emph{timestamps}, and @emph{table
  17622. support}. These areas highlighted the two main goals that Org still
  17623. has today: to be a new, outline-based, plain text mode with innovative
  17624. and intuitive editing features, and to incorporate project planning
  17625. functionality directly into a notes file.
  17626. Since the first release, literally thousands of emails to me or to the
  17627. @email{emacs-orgmode@@gnu.org, mailing list} have provided a constant stream of bug reports, feedback,
  17628. new ideas, and sometimes patches and add-on code. Many thanks to
  17629. everyone who has helped to improve this package. I am trying to keep
  17630. here a list of the people who had significant influence in shaping one
  17631. or more aspects of Org. The list may not be complete, if I have
  17632. forgotten someone, please accept my apologies and let me know.
  17633. Before I get to this list, a few special mentions are in order:
  17634. @table @asis
  17635. @item Bastien Guerry
  17636. Bastien has written a large number of extensions to Org (most of
  17637. them integrated into the core by now), including the @LaTeX{}
  17638. exporter and the plain list parser. His support during the early
  17639. days was central to the success of this project. Bastien also
  17640. invented Worg, helped establishing the Web presence of Org, and
  17641. sponsored hosting costs for the orgmode.org website. Bastien
  17642. stepped in as maintainer of Org between 2011 and 2013, at a time
  17643. when I desperately needed a break.
  17644. @item Eric Schulte and Dan Davison
  17645. Eric and Dan are jointly responsible for the Org Babel system,
  17646. which turns Org into a multi-language environment for evaluating
  17647. code and doing literate programming and reproducible research.
  17648. This has become one of Org's killer features that define what Org
  17649. is today.
  17650. @item John Wiegley
  17651. John has contributed a number of great ideas and patches directly
  17652. to Org, including the attachment system (@samp{org-attach.el}),
  17653. integration with Apple Mail (@samp{org-mac-message.el}), hierarchical
  17654. dependencies of TODO items, habit tracking (@samp{org-habits.el}), and
  17655. encryption (@samp{org-crypt.el}). Also, the capture system is really
  17656. an extended copy of his great @samp{remember.el}.
  17657. @item Sebastian Rose
  17658. Without Sebastian, the HTML/XHTML publishing of Org would be the
  17659. pitiful work of an ignorant amateur. Sebastian has pushed this
  17660. part of Org onto a much higher level. He also wrote
  17661. @samp{org-info.js}, a Java script for displaying webpages derived from
  17662. Org using an Info-like or a folding interface with single-key
  17663. navigation.
  17664. @end table
  17665. @noindent
  17666. See below for the full list of contributions! Again, please let me
  17667. know what I am missing here!
  17668. @anchor{From Bastien}
  17669. @appendixsec From Bastien
  17670. I (Bastien) have been maintaining Org between 2011 and 2013. This
  17671. appendix would not be complete without adding a few more
  17672. acknowledgments and thanks.
  17673. I am first grateful to Carsten for his trust while handing me over the
  17674. maintainership of Org. His unremitting support is what really helped
  17675. me getting more confident over time, with both the community and the
  17676. code.
  17677. When I took over maintainership, I knew I would have to make Org more
  17678. collaborative than ever, as I would have to rely on people that are
  17679. more knowledgeable than I am on many parts of the code. Here is
  17680. a list of the persons I could rely on, they should really be
  17681. considered co-maintainers, either of the code or the community:
  17682. @table @asis
  17683. @item Eric Schulte
  17684. Eric is maintaining the Babel parts of Org. His reactivity here
  17685. kept me away from worrying about possible bugs here and let me
  17686. focus on other parts.
  17687. @item Nicolas Goaziou
  17688. Nicolas is maintaining the consistency of the deepest parts of
  17689. Org. His work on @samp{org-element.el} and @samp{ox.el} has been
  17690. outstanding, and it opened the doors for many new ideas and
  17691. features. He rewrote many of the old exporters to use the new
  17692. export engine, and helped with documenting this major change.
  17693. More importantly (if that's possible), he has been more than
  17694. reliable during all the work done for Org 8.0, and always very
  17695. reactive on the mailing list.
  17696. @item Achim Gratz
  17697. Achim rewrote the building process of Org, turning some @emph{ad hoc}
  17698. tools into a flexible and conceptually clean process. He
  17699. patiently coped with the many hiccups that such a change can
  17700. create for users.
  17701. @item Nick Dokos
  17702. The Org mode mailing list would not be such a nice place without
  17703. Nick, who patiently helped users so many times. It is impossible
  17704. to overestimate such a great help, and the list would not be so
  17705. active without him.
  17706. @end table
  17707. I received support from so many users that it is clearly impossible to
  17708. be fair when shortlisting a few of them, but Org's history would not
  17709. be complete if the ones above were not mentioned in this manual.
  17710. @anchor{List of Contributions}
  17711. @appendixsec List of Contributions
  17712. @itemize
  17713. @item
  17714. Russel Adams came up with the idea for drawers.
  17715. @item
  17716. Thomas Baumann wrote @samp{org-bbdb.el} and @samp{org-mhe.el}.
  17717. @item
  17718. Christophe Bataillon created the great unicorn logo that we use on
  17719. the Org mode website.
  17720. @item
  17721. Alex Bochannek provided a patch for rounding timestamps.
  17722. @item
  17723. Jan Böcker wrote @samp{org-docview.el}.
  17724. @item
  17725. Brad Bozarth showed how to pull RSS feed data into Org files.
  17726. @item
  17727. Tom Breton wrote @samp{org-choose.el}.
  17728. @item
  17729. Charles Cave's suggestion sparked the implementation of templates
  17730. for Remember, which are now templates for capture.
  17731. @item
  17732. Pavel Chalmoviansky influenced the agenda treatment of items with
  17733. specified time.
  17734. @item
  17735. Gregory Chernov patched support for Lisp forms into table
  17736. calculations and improved XEmacs compatibility, in particular by
  17737. porting @samp{nouline.el} to XEmacs.
  17738. @item
  17739. Sacha Chua suggested copying some linking code from Planner.
  17740. @item
  17741. Baoqiu Cui contributed the DocBook exporter.
  17742. @item
  17743. Eddward DeVilla proposed and tested checkbox statistics. He also
  17744. came up with the idea of properties, and that there should be an API
  17745. for them.
  17746. @item
  17747. Nick Dokos tracked down several nasty bugs.
  17748. @item
  17749. Kees Dullemond used to edit projects lists directly in HTML and so
  17750. inspired some of the early development, including HTML export. He
  17751. also asked for a way to narrow wide table columns.
  17752. @item
  17753. Thomas S. Dye contributed documentation on Worg and helped
  17754. integrating the Org Babel documentation into the manual.
  17755. @item
  17756. Christian Egli converted the documentation into Texinfo format,
  17757. inspired the agenda, patched CSS formatting into the HTML exporter,
  17758. and wrote @samp{org-taskjuggler.el}.
  17759. @item
  17760. David Emery provided a patch for custom CSS support in exported HTML
  17761. agendas.
  17762. @item
  17763. Nic Ferrier contributed mailcap and XOXO support.
  17764. @item
  17765. Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes.
  17766. @item
  17767. John Foerch figured out how to make incremental search show context
  17768. around a match in a hidden outline tree.
  17769. @item
  17770. Raimar Finken wrote @samp{org-git-line.el}.
  17771. @item
  17772. Mikael Fornius works as a mailing list moderator.
  17773. @item
  17774. Austin Frank works as a mailing list moderator.
  17775. @item
  17776. Eric Fraga drove the development of Beamer export with ideas and
  17777. testing.
  17778. @item
  17779. Barry Gidden did proofreading the manual in preparation for the book
  17780. publication through Network Theory Ltd.
  17781. @item
  17782. Niels Giesen had the idea to automatically archive DONE trees.
  17783. @item
  17784. Nicolas Goaziou rewrote much of the plain list code.
  17785. @item
  17786. Kai Grossjohann pointed out key-binding conflicts with other
  17787. packages.
  17788. @item
  17789. Brian Gough of Network Theory Ltd publishes the Org mode manual as
  17790. a book.
  17791. @item
  17792. Bernt Hansen has driven much of the support for auto-repeating
  17793. tasks, task state change logging, and the clocktable. His clear
  17794. explanations have been critical when we started to adopt the Git
  17795. version control system.
  17796. @item
  17797. Manuel Hermenegildo has contributed various ideas, small fixes and
  17798. patches.
  17799. @item
  17800. Phil Jackson wrote @samp{org-irc.el}.
  17801. @item
  17802. Scott Jaderholm proposed footnotes, control over whitespace between
  17803. folded entries, and column view for properties.
  17804. @item
  17805. Matt Jones wrote MobileOrg Android.
  17806. @item
  17807. Tokuya Kameshima wrote @samp{org-wl.el} and @samp{org-mew.el}.
  17808. @item
  17809. Shidai Liu (``Leo'') asked for embedded @LaTeX{} and tested it. He also
  17810. provided frequent feedback and some patches.
  17811. @item
  17812. Matt Lundin has proposed last-row references for table formulas and
  17813. named invisible anchors. He has also worked a lot on the FAQ.
  17814. @item
  17815. David Maus wrote @samp{org-atom.el}, maintains the issues file for Org,
  17816. and is a prolific contributor on the mailing list with competent
  17817. replies, small fixes and patches.
  17818. @item
  17819. Jason F. McBrayer suggested agenda export to CSV format.
  17820. @item
  17821. Max Mikhanosha came up with the idea of refiling.
  17822. @item
  17823. Dmitri Minaev sent a patch to set priority limits on a per-file
  17824. basis.
  17825. @item
  17826. Stefan Monnier provided a patch to keep the Emacs Lisp compiler
  17827. happy.
  17828. @item
  17829. Richard Moreland wrote MobileOrg for the iPhone.
  17830. @item
  17831. Rick Moynihan proposed allowing multiple TODO sequences in a file
  17832. and being able to quickly restrict the agenda to a subtree.
  17833. @item
  17834. Todd Neal provided patches for links to Info files and Elisp forms.
  17835. @item
  17836. Greg Newman refreshed the unicorn logo into its current form.
  17837. @item
  17838. Tim O'Callaghan suggested in-file links, search options for general
  17839. file links, and tags.
  17840. @item
  17841. Osamu Okano wrote @samp{orgcard2ref.pl}, a Perl program to create a text
  17842. version of the reference card.
  17843. @item
  17844. Takeshi Okano translated the manual and David O'Toole's tutorial
  17845. into Japanese.
  17846. @item
  17847. Oliver Oppitz suggested multi-state TODO items.
  17848. @item
  17849. Scott Otterson sparked the introduction of descriptive text for
  17850. links, among other things.
  17851. @item
  17852. Pete Phillips helped during the development of the TAGS feature,
  17853. and provided frequent feedback.
  17854. @item
  17855. Martin Pohlack provided the code snippet to bundle character
  17856. insertion into bundles of 20 for undo.
  17857. @item
  17858. T.V. Raman reported bugs and suggested improvements.
  17859. @item
  17860. Matthias Rempe (Oelde) provided ideas, Windows support, and quality
  17861. control.
  17862. @item
  17863. Paul Rivier provided the basic implementation of named footnotes.
  17864. He also acted as mailing list moderator for some time.
  17865. @item
  17866. Kevin Rogers contributed code to access VM files on remote hosts.
  17867. @item
  17868. Frank Ruell solved the mystery of the @samp{keymapp nil} bug, a conflict
  17869. with @samp{allout.el}.
  17870. @item
  17871. Jason Riedy generalized the send-receive mechanism for Orgtbl
  17872. tables with extensive patches.
  17873. @item
  17874. Philip Rooke created the Org reference card, provided lots of
  17875. feedback, developed and applied standards to the Org documentation.
  17876. @item
  17877. Christian Schlauer proposed angular brackets around links, among
  17878. other things.
  17879. @item
  17880. Paul Sexton wrote @samp{org-ctags.el}.
  17881. @item
  17882. Tom Shannon's @samp{organizer-mode.el} inspired linking to VM/BBDB/Gnus.
  17883. @item
  17884. Ilya Shlyakhter proposed the Archive Sibling, line numbering in
  17885. literal examples, and remote highlighting for referenced code lines.
  17886. @item
  17887. Stathis Sideris wrote the @samp{ditaa.jar} ASCII to PNG converter that is
  17888. now packaged into Org's @samp{contrib/} directory.
  17889. @item
  17890. Daniel Sinder came up with the idea of internal archiving by locking
  17891. subtrees.
  17892. @item
  17893. Dale Smith proposed link abbreviations.
  17894. @item
  17895. James TD Smith has contributed a large number of patches for
  17896. useful tweaks and features.
  17897. @item
  17898. Adam Spiers asked for global linking commands, inspired the link
  17899. extension system, added support for Mairix, and proposed the mapping
  17900. API.
  17901. @item
  17902. Ulf Stegemann created the table to translate special symbols to
  17903. HTML, @LaTeX{}, UTF-8, Latin-1 and ASCII.
  17904. @item
  17905. Andy Stewart contributed code to @samp{org-w3m.el}, to copy
  17906. HTML content with links transformation to Org syntax.
  17907. @item
  17908. David O'Toole wrote @samp{org-publish.el} and drafted the
  17909. manual chapter about publishing.
  17910. @item
  17911. Jambunathan K. contributed the ODT exporter.
  17912. @item
  17913. Sebastien Vauban reported many issues with @LaTeX{} and Beamer export
  17914. and enabled source code highlighting in Gnus.
  17915. @item
  17916. Stefan Vollmar organized a video-recorded talk at the
  17917. Max-Planck-Institute for Neurology. He also inspired the creation
  17918. of a concept index for HTML export.
  17919. @item
  17920. Jürgen Vollmer contributed code generating the table of contents in
  17921. HTML output.
  17922. @item
  17923. Samuel Wales has provided important feedback and bug reports.
  17924. @item
  17925. Chris Wallace provided a patch implementing the @samp{QUOTE} block.
  17926. @item
  17927. David Wainberg suggested archiving, and improvements to the
  17928. linking system.
  17929. @item
  17930. Carsten Wimmer suggested some changes and helped fix a bug in
  17931. linking to Gnus.
  17932. @item
  17933. Roland Winkler requested additional key bindings to make Org work on
  17934. a TTY.
  17935. @item
  17936. Piotr Zielinski wrote @samp{org-mouse.el}, proposed agenda
  17937. blocks and contributed various ideas and code snippets.
  17938. @item
  17939. Marco Wahl wrote @samp{org-eww.el}.
  17940. @end itemize
  17941. @node GNU Free Documentation License
  17942. @appendix GNU Free Documentation License
  17943. @include doclicense.texi
  17944. @node Main Index
  17945. @chapter Main Index
  17946. @printindex cp
  17947. @node Key Index
  17948. @chapter Key Index
  17949. @printindex ky
  17950. @node Command and Function Index
  17951. @chapter Command and Function Index
  17952. @printindex fn
  17953. @node Variable Index
  17954. @chapter Variable Index
  17955. This is not a complete index of variables and faces, only the ones
  17956. that are mentioned in the manual. For a more complete list, use
  17957. @kbd{M-x org-customize} and then click yourself through the tree.
  17958. @printindex vr
  17959. @bye