org.texi 304 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename ../info/org
  4. @settitle Org Mode Manual
  5. @set VERSION 5.06
  6. @set DATE August 2007
  7. @dircategory Emacs
  8. @direntry
  9. * Org Mode: (org). Outline-based notes management and organizer
  10. @end direntry
  11. @c Version and Contact Info
  12. @set MAINTAINERSITE @uref{http://www.astro.uva.nl/~dominik/Tools/org/,maintainers webpage}
  13. @set AUTHOR Carsten Dominik
  14. @set MAINTAINER Carsten Dominik
  15. @set MAINTAINEREMAIL @email{dominik at science dot uva dot nl}
  16. @set MAINTAINERCONTACT @uref{mailto:dominik at science dot uva dot nl,contact the maintainer}
  17. @c %**end of header
  18. @finalout
  19. @c Macro definitions
  20. @c Subheadings inside a table.
  21. @macro tsubheading{text}
  22. @ifinfo
  23. @subsubheading \text\
  24. @end ifinfo
  25. @ifnotinfo
  26. @item @b{\text\}
  27. @end ifnotinfo
  28. @end macro
  29. @copying
  30. This manual is for Org-mode (version @value{VERSION}).
  31. Copyright @copyright{} 2004, 2005, 2006, 2007 Free Software Foundation
  32. @quotation
  33. Permission is granted to copy, distribute and/or modify this document
  34. under the terms of the GNU Free Documentation License, Version 1.1 or
  35. any later version published by the Free Software Foundation; with no
  36. Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
  37. and with the Back-Cover Texts as in (a) below. A copy of the
  38. license is included in the section entitled ``GNU Free Documentation
  39. License.''
  40. (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
  41. this GNU Manual, like GNU software. Copies published by the Free
  42. Software Foundation raise funds for GNU development.''
  43. @end quotation
  44. @end copying
  45. @titlepage
  46. @title Org Mode Manual
  47. @subtitle Release @value{VERSION}
  48. @author by Carsten Dominik
  49. @c The following two commands start the copyright page.
  50. @page
  51. @vskip 0pt plus 1filll
  52. @insertcopying
  53. @end titlepage
  54. @c Output the table of contents at the beginning.
  55. @contents
  56. @ifnottex
  57. @node Top, Introduction, (dir), (dir)
  58. @top Org Mode Manual
  59. @insertcopying
  60. @end ifnottex
  61. @menu
  62. * Introduction:: Getting started
  63. * Document structure:: A tree works like your brain
  64. * Tables:: Pure magic for quick formatting
  65. * Hyperlinks:: Notes in context
  66. * TODO items:: Every tree branch can be a TODO item
  67. * Tags:: Tagging headlines and matching sets of tags
  68. * Properties and columns::
  69. * Timestamps:: Assign date and time to items
  70. * Agenda views:: Collecting information into views
  71. * Embedded LaTeX:: LaTeX fragments and formulas
  72. * Exporting:: Sharing and publishing of notes
  73. * Publishing:: Create a web site of linked Org-mode files
  74. * Miscellaneous:: All the rest which did not fit elsewhere
  75. * Extensions and Hacking:: It is possible to write add-on code
  76. * History and Acknowledgments:: How Org-mode came into being
  77. * Index:: The fast road to specific information
  78. * Key Index:: Key bindings and where they are described
  79. @detailmenu
  80. --- The Detailed Node Listing ---
  81. Introduction
  82. * Summary:: Brief summary of what Org-mode does
  83. * Installation:: How to install a downloaded version of Org-mode
  84. * Activation:: How to activate Org-mode for certain buffers.
  85. * Feedback:: Bug reports, ideas, patches etc.
  86. Document Structure
  87. * Outlines:: Org-mode is based on outline-mode
  88. * Headlines:: How to typeset org-tree headlines
  89. * Visibility cycling:: Show and hide, much simplified
  90. * Motion:: Jumping to other headlines
  91. * Structure editing:: Changing sequence and level of headlines
  92. * Archiving:: Move done task trees to a different place
  93. * Sparse trees:: Matches embedded in context
  94. * Plain lists:: Additional structure within an entry
  95. * Drawers:: Tucking stuff away
  96. * orgstruct-mode:: Structure editing outside Org-mode
  97. Archiving
  98. * ARCHIVE tag:: Marking a tree as inactive
  99. * Moving subtrees:: Moving a tree to an archive file
  100. Tables
  101. * Built-in table editor:: Simple tables
  102. * Narrow columns:: Stop wasting space in tables
  103. * Column groups:: Grouping to trigger vertical lines
  104. * orgtbl-mode:: The table editor as minor mode
  105. * The spreadsheet:: The table editor has spreadsheet capabilities.
  106. The spreadsheet
  107. * References:: How to refer to another field or range
  108. * Formula syntax for Calc:: Using Calc to compute stuff
  109. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  110. * Field formulas:: Formulas valid for a single field
  111. * Column formulas:: Formulas valid for an entire column
  112. * Editing and debugging formulas:: Fixing formulas
  113. * Updating the table:: Recomputing all dependent fields
  114. * Advanced features:: Field names, parameters and automatic recalc
  115. Hyperlinks
  116. * Link format:: How links in Org-mode are formatted
  117. * Internal links:: Links to other places in the current file
  118. * External links:: URL-like links to the world
  119. * Handling links:: Creating, inserting and following
  120. * Using links outside Org-mode:: 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. * Remember:: Org-trees store quick notes
  125. Internal links
  126. * Radio targets:: Make targets trigger links in plain text.
  127. Remember
  128. * Setting up remember:: Some code for .emacs to get things going
  129. * Remember templates:: Define the outline of different note types
  130. * Storing notes:: Directly get the note to where it belongs
  131. TODO items
  132. * TODO basics:: Marking and displaying TODO entries
  133. * TODO extensions:: Workflow and assignments
  134. * Priorities:: Some things are more important than others
  135. * Breaking down tasks:: Splitting a task into manageable pieces
  136. * Checkboxes:: Tick-off lists
  137. Extended use of TODO keywords
  138. * Workflow states:: From TODO to DONE in steps
  139. * TODO types:: I do this, Fred the rest
  140. * Multiple sets in one file:: Mixing it all, and still finding your way
  141. * Per file keywords:: Different files, different requirements
  142. Tags
  143. * Tag inheritance:: Tags use the tree structure of the outline
  144. * Setting tags:: How to assign tags to a headline
  145. * Tag searches:: Searching for combinations of tags
  146. Properties and Columns
  147. * Property syntax:: How properties are spelled out
  148. * Special properties:: Access to other Org-mode features
  149. * Property searches:: Matching property values
  150. * Column view:: Tabular viewing and editing
  151. * Property API:: Properties for Lisp programmers
  152. Column View
  153. * Defining columns:: The COLUMNS format property
  154. * Using column view:: How to create and use column view
  155. Defining Columns
  156. * Scope of column definitions:: Where defined, where valid?
  157. * Column attributes:: Appearance and content of a column
  158. Timestamps
  159. * Time stamps:: Assigning a time to a tree entry
  160. * Creating timestamps:: Commands which insert timestamps
  161. * Deadlines and scheduling:: Planning your work
  162. * Progress logging:: Documenting when what work was done.
  163. Creating timestamps
  164. * The date/time prompt:: How org-mode helps you entering date and time
  165. * Custom time format:: Making dates look differently
  166. Deadlines and Scheduling
  167. * Inserting deadline/schedule:: Planning items
  168. * Repeated tasks:: Items that show up again and again
  169. Progress Logging
  170. * Closing items:: When was this entry marked DONE?
  171. * Tracking TODO state changes:: When did the status change?
  172. * Clocking work time:: When exactly did you work on this item?
  173. Agenda Views
  174. * Agenda files:: Files being searched for agenda information
  175. * Agenda dispatcher:: Keyboard access to agenda views
  176. * Built-in agenda views:: What is available out of the box?
  177. * Presentation and sorting:: How agenda items are prepared for display
  178. * Agenda commands:: Remote editing of org trees
  179. * Custom agenda views:: Defining special searches and views
  180. The built-in agenda views
  181. * Weekly/Daily agenda:: The calendar page with current tasks
  182. * Global TODO list:: All unfinished action items
  183. * Matching tags and properties:: Structured information with fine-tuned search
  184. * Timeline:: Time-sorted view for single file
  185. * Stuck projects:: Find projects you need to review
  186. Presentation and sorting
  187. * Categories:: Not all tasks are equal
  188. * Time-of-day specifications:: How the agenda knows the time
  189. * Sorting of agenda items:: The order of things
  190. Custom agenda views
  191. * Storing searches:: Type once, use often
  192. * Block agenda:: All the stuff you need in a single buffer
  193. * Setting Options:: Changing the rules
  194. * Exporting Agenda Views:: Writing agendas to files.
  195. * Extracting Agenda Information for other programs::
  196. Embedded LaTeX
  197. * Math symbols:: TeX macros for symbols and Greek letters
  198. * Subscripts and Superscripts:: Simple syntax for raising/lowering text
  199. * LaTeX fragments:: Complex formulas made easy
  200. * Processing LaTeX fragments:: Previewing LaTeX processing
  201. * CDLaTeX mode:: Speed up entering of formulas
  202. Exporting
  203. * ASCII export:: Exporting to plain ASCII
  204. * HTML export:: Exporting to HTML
  205. * LaTeX export:: Exporting to LaTeX
  206. * XOXO export:: Exporting to XOXO
  207. * iCalendar export:: Exporting in iCalendar format
  208. * Text interpretation:: How the exporter looks at the file
  209. HTML export
  210. * HTML Export commands:: How to invoke LaTeX export
  211. * Quoting HTML tags:: Using direct HTML in Org-mode
  212. * Links:: Transformation of links for HTML
  213. * Images:: How to include images
  214. * CSS support:: Changing the appearence of the output
  215. LaTeX export
  216. * LaTeX export commands:: How to invoke LaTeX export
  217. * Quoting LaTeX code:: Incorporating literal LaTeX code
  218. Text interpretation by the exporter
  219. * Comment lines:: Some lines will not be exported
  220. * Initial text:: Text before the first headline
  221. * Footnotes:: Numbers like [1]
  222. * Enhancing text:: Subscripts, symbols and more
  223. * Export options:: How to influence the export settings
  224. Publishing
  225. * Configuration:: Defining projects
  226. * Sample configuration:: Example projects
  227. * Triggering publication:: Publication commands
  228. Configuration
  229. * Project alist:: The central configuration variable
  230. * Sources and destinations:: From here to there
  231. * Selecting files:: What files are part of the project?
  232. * Publishing action:: Setting the function doing the publishing
  233. * Publishing options:: Tweaking HTML export
  234. * Publishing links:: Which links keep working after publishing?
  235. * Project page index:: Publishing a list of project files
  236. Sample configuration
  237. * Simple example:: One-component publishing
  238. * Complex example:: A multi-component publishing example
  239. Miscellaneous
  240. * Completion:: M-TAB knows what you need
  241. * Customization:: Adapting Org-mode to your taste
  242. * In-buffer settings:: Overview of the #+KEYWORDS
  243. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  244. * Clean view:: Getting rid of leading stars in the outline
  245. * TTY keys:: Using Org-mode on a tty
  246. * Interaction:: Other Emacs packages
  247. * Bugs:: Things which do not work perfectly
  248. Interaction with other packages
  249. * Cooperation:: Packages Org-mode cooperates with
  250. * Conflicts:: Packages that lead to conflicts
  251. Extensions, Hooks and Hacking
  252. * Extensions:: Existing 3rd-part extensions
  253. * Adding hyperlink types:: New custom link types
  254. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  255. * Dynamic blocks:: Automatically filled blocks
  256. * Special agenda views:: Customized views
  257. * Using the property API:: Writing programs that use entry properties
  258. Tables in arbitrary syntax
  259. * Radio tables:: Sending and receiving
  260. * A LaTeX example:: Step by step, almost a tutorial
  261. * Translator functions:: Copy and modify
  262. @end detailmenu
  263. @end menu
  264. @node Introduction, Document structure, Top, Top
  265. @chapter Introduction
  266. @cindex introduction
  267. @menu
  268. * Summary:: Brief summary of what Org-mode does
  269. * Installation:: How to install a downloaded version of Org-mode
  270. * Activation:: How to activate Org-mode for certain buffers.
  271. * Feedback:: Bug reports, ideas, patches etc.
  272. @end menu
  273. @node Summary, Installation, Introduction, Introduction
  274. @section Summary
  275. @cindex summary
  276. Org-mode is a mode for keeping notes, maintaining TODO lists, and doing
  277. project planning with a fast and effective plain-text system.
  278. Org-mode develops organizational tasks around NOTES files that contain
  279. lists or information about projects as plain text. Org-mode is
  280. implemented on top of outline-mode, which makes it possible to keep the
  281. content of large files well structured. Visibility cycling and
  282. structure editing help to work with the tree. Tables are easily created
  283. with a built-in table editor. Org-mode supports TODO items, deadlines,
  284. time stamps, and scheduling. It dynamically compiles entries into an
  285. agenda that utilizes and smoothly integrates much of the Emacs calendar
  286. and diary. Plain text URL-like links connect to websites, emails,
  287. Usenet messages, BBDB entries, and any files related to the projects.
  288. For printing and sharing of notes, an Org-mode file can be exported as a
  289. structured ASCII file, as HTML, or (todo and agenda items only) as an
  290. iCalendar file. It can also serve as a publishing tool for a set of
  291. linked webpages.
  292. An important design aspect that distinguishes Org-mode from for example
  293. Planner/Muse is that it encourages to store every piece of information
  294. only once. In Planner, you have project pages, day pages and possibly
  295. other files, duplicating some information such as tasks. In Org-mode,
  296. you only have notes files. In your notes you mark entries as tasks,
  297. label them with tags and timestamps. All necessary lists like a
  298. schedule for the day, the agenda for a meeting, tasks lists selected by
  299. tags etc are created dynamically when you need them.
  300. Org-mode keeps simple things simple. When first fired up, it should
  301. feel like a straightforward, easy to use outliner. Complexity is not
  302. imposed, but a large amount of functionality is available when you need
  303. it. Org-mode is a toolbox and can be used in different ways, for
  304. example as:
  305. @example
  306. @r{@bullet{} outline extension with visibility cycling and structure editing}
  307. @r{@bullet{} ASCII system and table editor for taking structured notes}
  308. @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
  309. @r{@bullet{} TODO list editor}
  310. @r{@bullet{} full agenda and planner with deadlines and work scheduling}
  311. @r{@bullet{} environment to implement David Allen's GTD system}
  312. @r{@bullet{} a basic database application}
  313. @r{@bullet{} simple hypertext system, with HTML export}
  314. @r{@bullet{} publishing tool to create a set of interlinked webpages}
  315. @end example
  316. Org-mode's automatic, context sensitive table editor with spreadsheet
  317. capabilities can be integrated into any major mode by activating the
  318. minor Orgtbl-mode. Using a translation step, it can be used to maintain
  319. tables in arbitrary file types, for example in La@TeX{}. The structure
  320. editing and list creation capabilities can be used outside Org-mode with
  321. the minor Orgstruct-mode.
  322. @cindex FAQ
  323. There is a website for Org-mode which provides links to the newest
  324. version of Org-mode, as well as additional information, frequently asked
  325. questions (FAQ), links to tutorials etc. This page is located at
  326. @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
  327. @page
  328. @node Installation, Activation, Summary, Introduction
  329. @section Installation
  330. @cindex installation
  331. @cindex XEmacs
  332. @b{Important:} @i{If Org-mode is part of the Emacs distribution or an
  333. XEmacs package, please skip this section and go directly to
  334. @ref{Activation}.}
  335. If you have downloaded Org-mode from the Web, you must take the
  336. following steps to install it: Go into the Org-mode distribution
  337. directory and edit the top section of the file @file{Makefile}. You
  338. must set the name of the Emacs binary (likely either @file{emacs} or
  339. @file{xemacs}), and the paths to the directories where local Lisp and
  340. Info files are kept. If you don't have access to the system-wide
  341. directories, create your own two directories for these files, enter them
  342. into the Makefile, and make sure Emacs finds the Lisp files by adding
  343. the following line to @file{.emacs}:
  344. @example
  345. (setq load-path (cons "~/path/to/lispdir" load-path))
  346. @end example
  347. @b{XEmacs users now need to install the file @file{noutline.el} from
  348. the @file{xemacs} subdirectory of the Org-mode distribution. Use the
  349. command:}
  350. @example
  351. @b{make install-noutline}
  352. @end example
  353. @noindent Now byte-compile and install the Lisp files with the shell
  354. commands:
  355. @example
  356. make
  357. make install
  358. @end example
  359. @noindent If you want to install the info documentation, use this command:
  360. @example
  361. make install-info
  362. @end example
  363. @noindent Then add to @file{.emacs}:
  364. @lisp
  365. ;; This line only if org-mode is not part of the X/Emacs distribution.
  366. (require 'org-install)
  367. @end lisp
  368. @node Activation, Feedback, Installation, Introduction
  369. @section Activation
  370. @cindex activation
  371. @cindex autoload
  372. @cindex global keybindings
  373. @cindex keybindings, global
  374. @iftex
  375. @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
  376. PDF documentation as viewed by Acrobat reader to your .emacs file, the
  377. single quote character comes out incorrectly and the code will not work.
  378. You need to fix the single quotes by hand, or copy from Info
  379. documentation.}
  380. @end iftex
  381. Add the following lines to your @file{.emacs} file. The last two lines
  382. define @emph{global} keys for the commands @command{org-store-link} and
  383. @command{org-agenda} - please choose suitable keys yourself.
  384. @lisp
  385. ;; The following lines are always needed. Choose your own keys.
  386. (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  387. (define-key global-map "\C-cl" 'org-store-link)
  388. (define-key global-map "\C-ca" 'org-agenda)
  389. @end lisp
  390. Furthermore, you must activate @code{font-lock-mode} in org-mode
  391. buffers, because significant functionality depends on font-locking being
  392. active. You can do this with either one of the following two lines
  393. (XEmacs user must use the second option):
  394. @lisp
  395. (global-font-lock-mode 1) ; for all buffers
  396. (add-hook 'org-mode-hook 'turn-on-font-lock) ; org-mode buffers only
  397. @end lisp
  398. @cindex org-mode, turning on
  399. With this setup, all files with extension @samp{.org} will be put
  400. into Org-mode. As an alternative, make the first line of a file look
  401. like this:
  402. @example
  403. MY PROJECTS -*- mode: org; -*-
  404. @end example
  405. @noindent which will select Org-mode for this buffer no matter what
  406. the file's name is. See also the variable
  407. @code{org-insert-mode-line-in-empty-file}.
  408. @node Feedback, , Activation, Introduction
  409. @section Feedback
  410. @cindex feedback
  411. @cindex bug reports
  412. @cindex maintainer
  413. @cindex author
  414. If you find problems with Org-mode, or if you have questions, remarks,
  415. or ideas about it, please contact the maintainer @value{MAINTAINER} at
  416. @value{MAINTAINEREMAIL}.
  417. For bug reports, please provide as much information as possible,
  418. including the version information of Emacs (@kbd{C-h v emacs-version
  419. @key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
  420. the Org-mode related setup in @file{.emacs}. If an error occurs, a
  421. backtrace can be very useful (see below on how to create one). Often a
  422. small example file helps, along with clear information about:
  423. @enumerate
  424. @item What exactly did you do?
  425. @item What did you expect to happen?
  426. @item What happened instead?
  427. @end enumerate
  428. @noindent Thank you for helping to improve this mode.
  429. @subsubheading How to create a useful backtrace
  430. @cindex backtrace of an error
  431. If working with Org-mode produces an error with a message you don't
  432. understand, you may have hit a bug. The best way to report this is by
  433. providing, in addition to what was mentioned above, a @emph{Backtrace}.
  434. This is information from the built-in debugger about where and how the
  435. error occurred. Here is how to produce a useful backtrace:
  436. @enumerate
  437. @item
  438. Start a fresh Emacs or XEmacs, and make sure that it will load the
  439. original Lisp code in @file{org.el} instead of the compiled version in
  440. @file{org.elc}. The backtrace contains much more information if it is
  441. produced with uncompiled code. To do this, either rename @file{org.elc}
  442. to something else before starting Emacs, or ask Emacs explicitly to load
  443. @file{org.el} by using the command line
  444. @example
  445. emacs -l /path/to/org.el
  446. @end example
  447. @item
  448. Go to the @code{Options} menu and select @code{Enter Debugger on Error}
  449. (XEmacs has this option in the @code{Troubleshooting} sub-menu).
  450. @item
  451. Do whatever you have to do to hit the error. Don't forget to
  452. document the steps you take.
  453. @item
  454. When you hit the error, a @file{*Backtrace*} buffer will appear on the
  455. screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
  456. attach it to your bug report.
  457. @end enumerate
  458. @node Document structure, Tables, Introduction, Top
  459. @chapter Document Structure
  460. @cindex document structure
  461. @cindex structure of document
  462. Org-mode is based on outline mode and provides flexible commands to
  463. edit the structure of the document.
  464. @menu
  465. * Outlines:: Org-mode is based on outline-mode
  466. * Headlines:: How to typeset org-tree headlines
  467. * Visibility cycling:: Show and hide, much simplified
  468. * Motion:: Jumping to other headlines
  469. * Structure editing:: Changing sequence and level of headlines
  470. * Archiving:: Move done task trees to a different place
  471. * Sparse trees:: Matches embedded in context
  472. * Plain lists:: Additional structure within an entry
  473. * Drawers:: Tucking stuff away
  474. * orgstruct-mode:: Structure editing outside Org-mode
  475. @end menu
  476. @node Outlines, Headlines, Document structure, Document structure
  477. @section Outlines
  478. @cindex outlines
  479. @cindex outline-mode
  480. Org-mode is implemented on top of outline-mode. Outlines allow a
  481. document to be organized in a hierarchical structure, which (at least
  482. for me) is the best representation of notes and thoughts. An overview
  483. of this structure is achieved by folding (hiding) large parts of the
  484. document to show only the general document structure and the parts
  485. currently being worked on. Org-mode greatly simplifies the use of
  486. outlines by compressing the entire show/hide functionality into a single
  487. command @command{org-cycle}, which is bound to the @key{TAB} key.
  488. @node Headlines, Visibility cycling, Outlines, Document structure
  489. @section Headlines
  490. @cindex headlines
  491. @cindex outline tree
  492. Headlines define the structure of an outline tree. The headlines in
  493. Org-mode start with one or more stars, on the left margin@footnote{See
  494. the variable @code{org-special-ctrl-a/e} to configure special behavior
  495. of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
  496. @example
  497. * Top level headline
  498. ** Second level
  499. *** 3rd level
  500. some text
  501. *** 3rd level
  502. more text
  503. * Another top level headline
  504. @end example
  505. @noindent Some people find the many stars too noisy and would prefer an
  506. outline that has whitespace followed by a single star as headline
  507. starters. @ref{Clean view} describes a setup to realize this.
  508. An empty line after the end of a subtree is considered part of it and
  509. will be hidden when the subtree is folded. However, if you leave at
  510. least two empty lines, one empty line will remain visible after folding
  511. the subtree, in order to structure the collapsed view. See the
  512. variable @code{org-cycle-separator-lines} to modify this behavior.
  513. @node Visibility cycling, Motion, Headlines, Document structure
  514. @section Visibility cycling
  515. @cindex cycling, visibility
  516. @cindex visibility cycling
  517. @cindex trees, visibility
  518. @cindex show hidden text
  519. @cindex hide text
  520. Outlines make it possible to hide parts of the text in the buffer.
  521. Org-mode uses just two commands, bound to @key{TAB} and
  522. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  523. @cindex subtree visibility states
  524. @cindex subtree cycling
  525. @cindex folded, subtree visibility state
  526. @cindex children, subtree visibility state
  527. @cindex subtree, subtree visibility state
  528. @table @kbd
  529. @kindex @key{TAB}
  530. @item @key{TAB}
  531. @emph{Subtree cycling}: Rotate current subtree among the states
  532. @example
  533. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  534. '-----------------------------------'
  535. @end example
  536. The cursor must be on a headline for this to work@footnote{see, however,
  537. the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
  538. beginning of the buffer and the first line is not a headline, then
  539. @key{TAB} actually runs global cycling (see below)@footnote{see the
  540. option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
  541. argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
  542. @cindex global visibility states
  543. @cindex global cycling
  544. @cindex overview, global visibility state
  545. @cindex contents, global visibility state
  546. @cindex show all, global visibility state
  547. @kindex S-@key{TAB}
  548. @item S-@key{TAB}
  549. @itemx C-u @key{TAB}
  550. @emph{Global cycling}: Rotate the entire buffer among the states
  551. @example
  552. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  553. '--------------------------------------'
  554. @end example
  555. When @kbd{S-@key{TAB}} is called with a numerical prefix N, the CONTENTS
  556. view up to headlines of level N will be shown.
  557. Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
  558. @cindex show all, command
  559. @kindex C-c C-a
  560. @item C-c C-a
  561. Show all.
  562. @kindex C-c C-r
  563. @item C-c C-r
  564. Reveal context around point, showing the current entry, the following
  565. heading and the hierarchy above. Useful for working near a location
  566. exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda
  567. command (@pxref{Agenda commands}). With prefix arg show, on each
  568. level, all sibling headings.
  569. @kindex C-c C-x b
  570. @item C-c C-x b
  571. Show the current subtree in an indirect buffer@footnote{The indirect
  572. buffer
  573. @ifinfo
  574. (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
  575. @end ifinfo
  576. @ifnotinfo
  577. (see the Emacs manual for more information about indirect buffers)
  578. @end ifnotinfo
  579. will contain the entire buffer, but will be narrowed to the current
  580. tree. Editing the indirect buffer will also change the original buffer,
  581. but without affecting visibility in that buffer.}. With numerical
  582. prefix ARG, go up to this level and then take that tree. If ARG is
  583. negative, go up that many levels. With @kbd{C-u} prefix, do not remove
  584. the previously used indirect buffer.
  585. @end table
  586. When Emacs first visits an Org-mode file, the global state is set to
  587. OVERVIEW, i.e. only the top level headlines are visible. This can be
  588. configured through the variable @code{org-startup-folded}, or on a
  589. per-file basis by adding one of the following lines anywhere in the
  590. buffer:
  591. @example
  592. #+STARTUP: overview
  593. #+STARTUP: content
  594. #+STARTUP: showall
  595. @end example
  596. @node Motion, Structure editing, Visibility cycling, Document structure
  597. @section Motion
  598. @cindex motion, between headlines
  599. @cindex jumping, to headlines
  600. @cindex headline navigation
  601. The following commands jump to other headlines in the buffer.
  602. @table @kbd
  603. @kindex C-c C-n
  604. @item C-c C-n
  605. Next heading.
  606. @kindex C-c C-p
  607. @item C-c C-p
  608. Previous heading.
  609. @kindex C-c C-f
  610. @item C-c C-f
  611. Next heading same level.
  612. @kindex C-c C-b
  613. @item C-c C-b
  614. Previous heading same level.
  615. @kindex C-c C-u
  616. @item C-c C-u
  617. Backward to higher level heading.
  618. @kindex C-c C-j
  619. @item C-c C-j
  620. Jump to a different place without changing the current outline
  621. visibility. Shows the document structure in a temporary buffer, where
  622. you can use the following keys to find your destination:
  623. @example
  624. @key{TAB} @r{Cycle visibility.}
  625. @key{down} / @key{up} @r{Next/previous visible headline.}
  626. n / p @r{Next/previous visible headline.}
  627. f / b @r{Next/previous headline same level.}
  628. u @r{One level up.}
  629. 0-9 @r{Digit argument.}
  630. @key{RET} @r{Select this location.}
  631. @end example
  632. @end table
  633. @node Structure editing, Archiving, Motion, Document structure
  634. @section Structure editing
  635. @cindex structure editing
  636. @cindex headline, promotion and demotion
  637. @cindex promotion, of subtrees
  638. @cindex demotion, of subtrees
  639. @cindex subtree, cut and paste
  640. @cindex pasting, of subtrees
  641. @cindex cutting, of subtrees
  642. @cindex copying, of subtrees
  643. @cindex subtrees, cut and paste
  644. @table @kbd
  645. @kindex M-@key{RET}
  646. @item M-@key{RET}
  647. Insert new heading with same level as current. If the cursor is in a
  648. plain list item, a new item is created (@pxref{Plain lists}). To force
  649. creation of a new headline, use a prefix arg, or first press @key{RET}
  650. to get to the beginning of the next line. When this command is used in
  651. the middle of a line, the line is split and the rest of the line becomes
  652. the new headline. If the command is used at the beginning of a
  653. headline, the new headline is created before the current line. If at
  654. the beginning of any other line, the content of that line is made the
  655. new heading. If the command is used at the end of a folded subtree
  656. (i.e. behind the ellipses at the end of a headline), then a headline
  657. like the current one will be inserted after the end of the subtree.
  658. @kindex M-S-@key{RET}
  659. @item M-S-@key{RET}
  660. Insert new TODO entry with same level as current heading.
  661. @kindex M-@key{left}
  662. @item M-@key{left}
  663. Promote current heading by one level.
  664. @kindex M-@key{right}
  665. @item M-@key{right}
  666. Demote current heading by one level.
  667. @kindex M-S-@key{left}
  668. @item M-S-@key{left}
  669. Promote the current subtree by one level.
  670. @kindex M-S-@key{right}
  671. @item M-S-@key{right}
  672. Demote the current subtree by one level.
  673. @kindex M-S-@key{up}
  674. @item M-S-@key{up}
  675. Move subtree up (swap with previous subtree of same
  676. level).
  677. @kindex M-S-@key{down}
  678. @item M-S-@key{down}
  679. Move subtree down (swap with next subtree of same level).
  680. @kindex C-c C-x C-w
  681. @kindex C-c C-x C-k
  682. @item C-c C-x C-w
  683. @itemx C-c C-x C-k
  684. Kill subtree, i.e. remove it from buffer but save in kill ring.
  685. @kindex C-c C-x M-w
  686. @item C-c C-x M-w
  687. Copy subtree to kill ring.
  688. @kindex C-c C-x C-y
  689. @item C-c C-x C-y
  690. Yank subtree from kill ring. This does modify the level of the subtree to
  691. make sure the tree fits in nicely at the yank position. The yank
  692. level can also be specified with a prefix arg, or by yanking after a
  693. headline marker like @samp{****}.
  694. @kindex C-c ^
  695. @item C-c ^
  696. Sort same-level entries. When there is an active region, all entries in
  697. the region will be sorted. Otherwise the children of the current
  698. headline are sorted. The command prompts for the sorting method, which
  699. can be alphabetically, numerically, by time (using the first time stamp
  700. in each entry), and each of these in reverse order. With a @kbd{C-u}
  701. prefix, sorting will be case-sensitive. With two @kbd{C-u C-u}
  702. prefixes, duplicate entries will also be removed.
  703. @end table
  704. @cindex region, active
  705. @cindex active region
  706. @cindex transient-mark-mode
  707. When there is an active region (transient-mark-mode), promotion and
  708. demotion work on all headlines in the region. To select a region of
  709. headlines, it is best to place both point and mark at the beginning of a
  710. line, mark at the beginning of the first headline, and point at the line
  711. just after the last headline to change. Note that when the cursor is
  712. inside a table (@pxref{Tables}), the Meta-Cursor keys have different
  713. functionality.
  714. @node Archiving, Sparse trees, Structure editing, Document structure
  715. @section Archiving
  716. @cindex archiving
  717. When a project represented by a (sub)tree is finished, you may want
  718. to move the tree out of the way and to stop it from contributing to the
  719. agenda. Org-mode knows two ways of archiving. You can mark a tree with
  720. the ARCHIVE tag, or you can move an entire (sub)tree to a different
  721. location.
  722. @menu
  723. * ARCHIVE tag:: Marking a tree as inactive
  724. * Moving subtrees:: Moving a tree to an archive file
  725. @end menu
  726. @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
  727. @subsection The ARCHIVE tag
  728. @cindex internal archiving
  729. A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
  730. its location in the outline tree, but behaves in the following way:
  731. @itemize @minus
  732. @item
  733. It does not open when you attempt to do so with a visibility cycling
  734. command (@pxref{Visibility cycling}). You can force cycling archived
  735. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  736. @code{org-cycle-open-archived-trees}. Also normal outline commands like
  737. @code{show-all} will open archived subtrees.
  738. @item
  739. During sparse tree construction (@pxref{Sparse trees}), matches in
  740. archived subtrees are not exposed, unless you configure the option
  741. @code{org-sparse-tree-open-archived-trees}.
  742. @item
  743. During agenda view construction (@pxref{Agenda views}), the content of
  744. archived trees is ignored unless you configure the option
  745. @code{org-agenda-skip-archived-trees}.
  746. @item
  747. Archived trees are not exported (@pxref{Exporting}), only the headline
  748. is. Configure the details using the variable
  749. @code{org-export-with-archived-trees}.
  750. @end itemize
  751. The following commands help managing the ARCHIVE tag:
  752. @table @kbd
  753. @kindex C-c C-x C-a
  754. @item C-c C-x C-a
  755. Toggle the ARCHIVE tag for the current headline. When the tag is set,
  756. the headline changes to a shadowish face, and the subtree below it is
  757. hidden.
  758. @kindex C-u C-c C-x C-a
  759. @item C-u C-c C-x C-a
  760. Check if any direct children of the current headline should be archived.
  761. To do this, each subtree is checked for open TODO entries. If none are
  762. found, the command offers to set the ARCHIVE tag for the child. If the
  763. cursor is @emph{not} on a headline when this command is invoked, the
  764. level 1 trees will be checked.
  765. @kindex C-@kbd{TAB}
  766. @item C-@kbd{TAB}
  767. Cycle a tree even if it is tagged with ARCHIVE.
  768. @end table
  769. @node Moving subtrees, , ARCHIVE tag, Archiving
  770. @subsection Moving subtrees
  771. @cindex external archiving
  772. Once an entire project is finished, you may want to move it to a
  773. different location, either in the current file, or even in a different
  774. file, the archive file.
  775. @table @kbd
  776. @kindex C-c C-x C-s
  777. @item C-c C-x C-s
  778. Archive the subtree starting at the cursor position to the location
  779. given by @code{org-archive-location}.
  780. @kindex C-u C-c C-x C-s
  781. @item C-u C-c C-x C-s
  782. Check if any direct children of the current headline could be moved to
  783. the archive. To do this, each subtree is checked for open TODO entries.
  784. If none are found, the command offers to move it to the archive
  785. location. If the cursor is @emph{not} on a headline when this command
  786. is invoked, the level 1 trees will be checked.
  787. @end table
  788. @cindex archive locations
  789. The default archive location is a file in the same directory as the
  790. current file, with the name derived by appending @file{_archive} to the
  791. current file name. For information and examples on how to change this,
  792. see the documentation string of the variable
  793. @code{org-archive-location}. There is also an in-buffer option for
  794. setting this variable, for example
  795. @example
  796. #+ARCHIVE: %s_done::
  797. @end example
  798. @noindent
  799. You may have several such lines in the buffer, they will then be valid
  800. for the entries following the line (the first will also apply to any
  801. text before it).
  802. @node Sparse trees, Plain lists, Archiving, Document structure
  803. @section Sparse trees
  804. @cindex sparse trees
  805. @cindex trees, sparse
  806. @cindex folding, sparse trees
  807. @cindex occur, command
  808. An important feature of Org-mode is the ability to construct
  809. @emph{sparse trees} for selected information in an outline tree. A
  810. sparse tree means that the entire document is folded as much as
  811. possible, but the selected information is made visible along with the
  812. headline structure above it@footnote{See also the variables
  813. @code{org-show-hierarchy-above}, @code{org-show-following-heading}, and
  814. @code{org-show-siblings} for detailed control on how much context is
  815. shown around each match.}. Just try it out and you will see immediately
  816. how it works.
  817. Org-mode contains several commands creating such trees. The most
  818. basic one is @command{org-occur}:
  819. @table @kbd
  820. @kindex C-c /
  821. @item C-c /
  822. Occur. Prompts for a regexp and shows a sparse tree with all matches.
  823. If the match is in a headline, the headline is made visible. If the
  824. match is in the body of an entry, headline and body are made visible.
  825. In order to provide minimal context, also the full hierarchy of
  826. headlines above the match is shown, as well as the headline following
  827. the match. Each match is also highlighted; the highlights disappear
  828. when the buffer is changed an editing command, or by pressing @kbd{C-c
  829. C-c}. When called with a @kbd{C-u} prefix argument, previous highlights
  830. are kept, so several calls to this command can be stacked.
  831. @end table
  832. @noindent
  833. For frequently used sparse trees of specific search strings, you can
  834. use the variable @code{org-agenda-custom-commands} to define fast
  835. keyboard access to specific sparse trees. These commands will then be
  836. accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
  837. For example:
  838. @lisp
  839. (setq org-agenda-custom-commands
  840. '(("f" occur-tree "FIXME")))
  841. @end lisp
  842. @noindent will define the key @kbd{C-c a f} as a shortcut for creating
  843. a sparse tree matching the string @samp{FIXME}.
  844. Other commands use sparse trees as well. For example @kbd{C-c
  845. C-v} creates a sparse TODO tree (@pxref{TODO basics}).
  846. @kindex C-c C-e v
  847. @cindex printing sparse trees
  848. @cindex visible text, printing
  849. To print a sparse tree, you can use the Emacs command
  850. @code{ps-print-buffer-with-faces} which does not print invisible parts
  851. of the document @footnote{This does not work under XEmacs, because
  852. XEmacs uses selective display for outlining, not text properties.}.
  853. Or you can use the command @kbd{C-c C-e v} to export only the visible
  854. part of the document and print the resulting file.
  855. @node Plain lists, Drawers, Sparse trees, Document structure
  856. @section Plain lists
  857. @cindex plain lists
  858. @cindex lists, plain
  859. @cindex lists, ordered
  860. @cindex ordered lists
  861. Within an entry of the outline tree, hand-formatted lists can provide
  862. additional structure. They also provide a way to create lists of
  863. checkboxes (@pxref{Checkboxes}). Org-mode supports editing such lists,
  864. and the HTML exporter (@pxref{Exporting}) does parse and format them.
  865. Org-mode knows ordered and unordered lists. Unordered list items start
  866. with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
  867. bullet, lines must be indented or they will be seen as top-level
  868. headlines. Also, when you are hiding leading stars to get a clean
  869. outline view, plain list items starting with a star are visually
  870. indistinguishable from true headlines. In short: even though @samp{*}
  871. is supported, it may be better not to use it for plain list items.} as
  872. bullets. Ordered list items start with @samp{1.} or @samp{1)}. Items
  873. belonging to the same list must have the same indentation on the first
  874. line. In particular, if an ordered list reaches number @samp{10.}, then
  875. the 2--digit numbers must be written left-aligned with the other numbers
  876. in the list. Indentation also determines the end of a list item. It
  877. ends before the next line that is indented like the bullet/number, or
  878. less. Empty lines are part of the previous item, so you can have
  879. several paragraphs in one item. If you would like an empty line to
  880. terminate all currently open plain lists, configure the variable
  881. @code{org-empty-line-terminates-plain-lists}. Here is an example:
  882. @example
  883. @group
  884. ** Lord of the Rings
  885. My favorite scenes are (in this order)
  886. 1. The attack of the Rohirrim
  887. 2. Eowyns fight with the witch king
  888. + this was already my favorite scene in the book
  889. + I really like Miranda Otto.
  890. 3. Peter Jackson being shot by Legolas
  891. - on DVD only
  892. He makes a really funny face when it happens.
  893. But in the end, not individual scenes matter but the film as a whole.
  894. @end group
  895. @end example
  896. Org-mode supports these lists by tuning filling and wrapping commands to
  897. deal with them correctly@footnote{Org-mode only changes the filling
  898. settings for Emacs. For XEmacs, you should use Kyle E. Jones'
  899. @file{filladapt.el}. To turn this on, put into @file{.emacs}:
  900. @code{(require 'filladapt)}}.
  901. The following commands act on items when the cursor is in the first line
  902. of an item (the line with the bullet or number).
  903. @table @kbd
  904. @kindex @key{TAB}
  905. @item @key{TAB}
  906. Items can be folded just like headline levels if you set the variable
  907. @code{org-cycle-include-plain-lists}. The level of an item is then
  908. given by the indentation of the bullet/number. Items are always
  909. subordinate to real headlines, however; the hierarchies remain
  910. completely separated.
  911. If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
  912. fixes the indentation of the curent line in a heuristic way.
  913. @kindex M-@key{RET}
  914. @item M-@key{RET}
  915. Insert new item at current level. With prefix arg, force a new heading
  916. (@pxref{Structure editing}). If this command is used in the middle of a
  917. line, the line is @emph{split} and the rest of the line becomes the new
  918. item. If this command is executed in the @emph{whitespace before a bullet or
  919. number}, the new item is created @emph{before} the current item. If the
  920. command is executed in the white space before the text that is part of
  921. an item but does not contain the bullet, a bullet is added to the
  922. current line.
  923. @kindex M-S-@key{RET}
  924. @item M-S-@key{RET}
  925. Insert a new item with a checkbox (@pxref{Checkboxes}).
  926. @kindex S-@key{up}
  927. @kindex S-@key{down}
  928. @item S-@key{up}
  929. @itemx S-@key{down}
  930. Jump to the previous/next item in the current list.
  931. @kindex M-S-@key{up}
  932. @kindex M-S-@key{down}
  933. @item M-S-@key{up}
  934. @itemx M-S-@key{down}
  935. Move the item including subitems up/down (swap with previous/next item
  936. of same indentation). If the list is ordered, renumbering is
  937. automatic.
  938. @kindex M-S-@key{left}
  939. @kindex M-S-@key{right}
  940. @item M-S-@key{left}
  941. @itemx M-S-@key{right}
  942. Decrease/increase the indentation of the item, including subitems.
  943. Initially, the item tree is selected based on current indentation.
  944. When these commands are executed several times in direct succession,
  945. the initially selected region is used, even if the new indentation
  946. would imply a different hierarchy. To use the new hierarchy, break
  947. the command chain with a cursor motion or so.
  948. @kindex C-c C-c
  949. @item C-c C-c
  950. If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
  951. state of the checkbox. If not, make this command makes sure that all
  952. the items on this list level use the same bullet. Furthermore, if this
  953. is an ordered list, make sure the numbering is ok.
  954. @kindex C-c -
  955. @item C-c -
  956. Cycle the entire list level through the different itemize/enumerate
  957. bullets (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).
  958. With prefix arg, select the nth bullet from this list.
  959. @end table
  960. @node Drawers, orgstruct-mode, Plain lists, Document structure
  961. @section Drawers
  962. @cindex drawers
  963. @cindex visibility cycling, drawers
  964. Sometimes you want to keep information associated with an entry, but you
  965. normally don't want to see it. For this, Org-mode has @emph{drawers}.
  966. Drawers need to be configured with the variable @code{org-drawers}, and
  967. look like this:
  968. @example
  969. ** This is a headline
  970. Still outside the drawer
  971. :DRAWERNAME:
  972. This is inside the drawer.
  973. :END:
  974. After the drawer.
  975. @end example
  976. Visibility cycling (@pxref{Visibility cycling}) on the headline will
  977. hide and show the entry, but keep the drawer collapsed to a single line.
  978. In order to look inside the drawer, you need to move the cursor to the
  979. drawer line and press @key{TAB} there. Org-mode uses a drawer for
  980. storing properties (@pxref{Properties and columns}).
  981. @node orgstruct-mode, , Drawers, Document structure
  982. @section The Orgstruct minor mode
  983. @cindex orgstruct-mode
  984. @cindex minor mode for structure editing
  985. If you like the intuitive way the Org-mode structure editing and list
  986. formatting works, you might want to use these commands in other modes
  987. like text-mode or mail-mode as well. The minor mode Orgstruct-mode
  988. makes this possible. You can always toggle the mode with @kbd{M-x
  989. orgstruct-mode}. To turn it on by default, for example in mail mode,
  990. use
  991. @lisp
  992. (add-hook 'mail-mode-hook 'turn-on-orgstruct)
  993. @end lisp
  994. When this mode is active and the cursor is on a line that looks to
  995. Org-mode like a headline of the first line of a list item, most
  996. structure editing commands will work, even if the same keys normally
  997. have different functionality in the major mode you are using. If the
  998. cursor is not in one of those special lines, Orgstruct-mode lurks
  999. silently in the shadow.
  1000. @node Tables, Hyperlinks, Document structure, Top
  1001. @chapter Tables
  1002. @cindex tables
  1003. @cindex editing tables
  1004. Org-mode has a very fast and intuitive table editor built-in.
  1005. Spreadsheet-like calculations are supported in connection with the
  1006. Emacs @file{calc} package.
  1007. @menu
  1008. * Built-in table editor:: Simple tables
  1009. * Narrow columns:: Stop wasting space in tables
  1010. * Column groups:: Grouping to trigger vertical lines
  1011. * orgtbl-mode:: The table editor as minor mode
  1012. * The spreadsheet:: The table editor has spreadsheet capabilities.
  1013. @end menu
  1014. @node Built-in table editor, Narrow columns, Tables, Tables
  1015. @section The built-in table editor
  1016. @cindex table editor, built-in
  1017. Org-mode makes it easy to format tables in plain ASCII. Any line with
  1018. @samp{|} as the first non-whitespace character is considered part of a
  1019. table. @samp{|} is also the column separator. A table might look like
  1020. this:
  1021. @example
  1022. | Name | Phone | Age |
  1023. |-------+-------+-----|
  1024. | Peter | 1234 | 17 |
  1025. | Anna | 4321 | 25 |
  1026. @end example
  1027. A table is re-aligned automatically each time you press @key{TAB} or
  1028. @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
  1029. the next field (@key{RET} to the next row) and creates new table rows
  1030. at the end of the table or before horizontal lines. The indentation
  1031. of the table is set by the first line. Any line starting with
  1032. @samp{|-} is considered as a horizontal separator line and will be
  1033. expanded on the next re-align to span the whole table width. So, to
  1034. create the above table, you would only type
  1035. @example
  1036. |Name|Phone|Age|
  1037. |-
  1038. @end example
  1039. @noindent and then press @key{TAB} to align the table and start filling in
  1040. fields.
  1041. When typing text into a field, Org-mode treats @key{DEL},
  1042. @key{Backspace}, and all character keys in a special way, so that
  1043. inserting and deleting avoids shifting other fields. Also, when
  1044. typing @emph{immediately after the cursor was moved into a new field
  1045. with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
  1046. field is automatically made blank. If this behavior is too
  1047. unpredictable for you, configure the variables
  1048. @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
  1049. @table @kbd
  1050. @tsubheading{Creation and conversion}
  1051. @kindex C-c |
  1052. @item C-c |
  1053. Convert the active region to table. If every line contains at least one
  1054. TAB character, the function assumes that the material is tab separated.
  1055. If not, lines are split at whitespace into fields. You can use a prefix
  1056. argument to indicate the minimum number of consecutive spaces required
  1057. to identify a field separator (default: just one).@*
  1058. If there is no active region, this command creates an empty Org-mode
  1059. table. But it's easier just to start typing, like
  1060. @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
  1061. @tsubheading{Re-aligning and field motion}
  1062. @kindex C-c C-c
  1063. @item C-c C-c
  1064. Re-align the table without moving the cursor.
  1065. @c
  1066. @kindex @key{TAB}
  1067. @item @key{TAB}
  1068. Re-align the table, move to the next field. Creates a new row if
  1069. necessary.
  1070. @c
  1071. @kindex S-@key{TAB}
  1072. @item S-@key{TAB}
  1073. Re-align, move to previous field.
  1074. @c
  1075. @kindex @key{RET}
  1076. @item @key{RET}
  1077. Re-align the table and move down to next row. Creates a new row if
  1078. necessary. At the beginning or end of a line, @key{RET} still does
  1079. NEWLINE, so it can be used to split a table.
  1080. @tsubheading{Column and row editing}
  1081. @kindex M-@key{left}
  1082. @kindex M-@key{right}
  1083. @item M-@key{left}
  1084. @itemx M-@key{right}
  1085. Move the current column left/right.
  1086. @c
  1087. @kindex M-S-@key{left}
  1088. @item M-S-@key{left}
  1089. Kill the current column.
  1090. @c
  1091. @kindex M-S-@key{right}
  1092. @item M-S-@key{right}
  1093. Insert a new column to the left of the cursor position.
  1094. @c
  1095. @kindex M-@key{up}
  1096. @kindex M-@key{down}
  1097. @item M-@key{up}
  1098. @itemx M-@key{down}
  1099. Move the current row up/down.
  1100. @c
  1101. @kindex M-S-@key{up}
  1102. @item M-S-@key{up}
  1103. Kill the current row or horizontal line.
  1104. @c
  1105. @kindex M-S-@key{down}
  1106. @item M-S-@key{down}
  1107. Insert a new row above (with arg: below) the current row.
  1108. @c
  1109. @kindex C-c -
  1110. @item C-c -
  1111. Insert a horizontal line below current row. With prefix arg, the line
  1112. is created above the current line.
  1113. @c
  1114. @kindex C-c ^
  1115. @item C-c ^
  1116. Sort the table lines in the region. The position of point indicates the
  1117. column to be used for sorting, and the range of lines is the range
  1118. between the nearest horizontal separator lines, or the entire table. If
  1119. point is before the first column, you will be prompted for the sorting
  1120. column. If there is an active region, the mark specifies the first line
  1121. and the sorting column, while point should be in the last line to be
  1122. included into the sorting. The command prompts for the sorting type
  1123. (alphabetically, numerically, or by time). When called with a prefix
  1124. argument, alphabetic sorting will be case-sensitive.
  1125. @tsubheading{Regions}
  1126. @kindex C-c C-x M-w
  1127. @item C-c C-x M-w
  1128. Copy a rectangular region from a table to a special clipboard. Point
  1129. and mark determine edge fields of the rectangle. The process ignores
  1130. horizontal separator lines.
  1131. @c
  1132. @kindex C-c C-x C-w
  1133. @item C-c C-x C-w
  1134. Copy a rectangular region from a table to a special clipboard, and
  1135. blank all fields in the rectangle. So this is the ``cut'' operation.
  1136. @c
  1137. @kindex C-c C-x C-y
  1138. @item C-c C-x C-y
  1139. Paste a rectangular region into a table.
  1140. The upper right corner ends up in the current field. All involved fields
  1141. will be overwritten. If the rectangle does not fit into the present table,
  1142. the table is enlarged as needed. The process ignores horizontal separator
  1143. lines.
  1144. @c
  1145. @kindex C-c C-q
  1146. @item C-c C-q
  1147. Wrap several fields in a column like a paragraph. If there is an active
  1148. region, and both point and mark are in the same column, the text in the
  1149. column is wrapped to minimum width for the given number of lines. A
  1150. prefix ARG may be used to change the number of desired lines. If there
  1151. is no region, the current field is split at the cursor position and the
  1152. text fragment to the right of the cursor is prepended to the field one
  1153. line down. If there is no region, but you specify a prefix ARG, the
  1154. current field is made blank, and the content is appended to the field
  1155. above.
  1156. @tsubheading{Calculations}
  1157. @cindex formula, in tables
  1158. @cindex calculations, in tables
  1159. @cindex region, active
  1160. @cindex active region
  1161. @cindex transient-mark-mode
  1162. @kindex C-c +
  1163. @item C-c +
  1164. Sum the numbers in the current column, or in the rectangle defined by
  1165. the active region. The result is shown in the echo area and can
  1166. be inserted with @kbd{C-y}.
  1167. @c
  1168. @kindex S-@key{RET}
  1169. @item S-@key{RET}
  1170. When current field is empty, copy from first non-empty field above.
  1171. When not empty, copy current field down to next row and move cursor
  1172. along with it. Depending on the variable
  1173. @code{org-table-copy-increment}, integer field values will be
  1174. incremented during copy. This key is also used by CUA-mode
  1175. (@pxref{Cooperation}).
  1176. @tsubheading{Miscellaneous}
  1177. @kindex C-c `
  1178. @item C-c `
  1179. Edit the current field in a separate window. This is useful for fields
  1180. that are not fully visible (@pxref{Narrow columns}). When called with a
  1181. @kbd{C-u} prefix, just make the full field visible, so that it can be
  1182. edited in place.
  1183. @c
  1184. @kindex C-c @key{TAB}
  1185. @item C-c @key{TAB}
  1186. This is an alias for @kbd{C-u C-c `} to make the current field fully
  1187. visible.
  1188. @c
  1189. @item M-x org-table-import
  1190. Import a file as a table. The table should be TAB- or whitespace
  1191. separated. Useful, for example, to import an Excel table or data from a
  1192. database, because these programs generally can write TAB-separated text
  1193. files. This command works by inserting the file into the buffer and
  1194. then converting the region to a table. Any prefix argument is passed on
  1195. to the converter, which uses it to determine the separator.
  1196. @item C-c |
  1197. Tables can also be imported by pasting tabular text into the org-mode
  1198. buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
  1199. @kbd{C-c |} command (see above under @i{Creation and conversion}.
  1200. @c
  1201. @item M-x org-table-export
  1202. Export the table as a TAB-separated file. Useful for data exchange with,
  1203. for example, Excel or database programs.
  1204. @end table
  1205. If you don't like the automatic table editor because it gets in your
  1206. way on lines which you would like to start with @samp{|}, you can turn
  1207. it off with
  1208. @lisp
  1209. (setq org-enable-table-editor nil)
  1210. @end lisp
  1211. @noindent Then the only table command that still works is
  1212. @kbd{C-c C-c} to do a manual re-align.
  1213. @node Narrow columns, Column groups, Built-in table editor, Tables
  1214. @section Narrow columns
  1215. @cindex narrow columns in tables
  1216. The width of columns is automatically determined by the table editor.
  1217. Sometimes a single field or a few fields need to carry more text,
  1218. leading to inconveniently wide columns. To limit@footnote{This feature
  1219. does not work on XEmacs.} the width of a column, one field anywhere in
  1220. the column may contain just the string @samp{<N>} where @samp{N} is an
  1221. integer specifying the width of the column in characters. The next
  1222. re-align will then set the width of this column to no more than this
  1223. value.
  1224. @example
  1225. @group
  1226. |---+------------------------------| |---+--------|
  1227. | | | | | <6> |
  1228. | 1 | one | | 1 | one |
  1229. | 2 | two | ----\ | 2 | two |
  1230. | 3 | This is a long chunk of text | ----/ | 3 | This=> |
  1231. | 4 | four | | 4 | four |
  1232. |---+------------------------------| |---+--------|
  1233. @end group
  1234. @end example
  1235. @noindent
  1236. Fields that are wider become clipped and end in the string @samp{=>}.
  1237. Note that the full text is still in the buffer, it is only invisible.
  1238. To see the full text, hold the mouse over the field - a tool-tip window
  1239. will show the full content. To edit such a field, use the command
  1240. @kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
  1241. open a new window with the full field. Edit it and finish with @kbd{C-c
  1242. C-c}.
  1243. When visiting a file containing a table with narrowed columns, the
  1244. necessary character hiding has not yet happened, and the table needs to
  1245. be aligned before it looks nice. Setting the option
  1246. @code{org-startup-align-all-tables} will realign all tables in a file
  1247. upon visiting, but also slow down startup. You can also set this option
  1248. on a per-file basis with:
  1249. @example
  1250. #+STARTUP: align
  1251. #+STARTUP: noalign
  1252. @end example
  1253. @node Column groups, orgtbl-mode, Narrow columns, Tables
  1254. @section Column groups
  1255. @cindex grouping columns in tables
  1256. When Org-mode exports tables, it does so by default without vertical
  1257. lines because that is visually more satisfying in general. Occasionally
  1258. however, vertical lines can be useful to structure a table into groups
  1259. of columns, much like horizontal lines can do for groups of rows. In
  1260. order to specify column groups, you can use a special row where the
  1261. first field contains only @samp{/}. The further fields can either
  1262. contain @samp{<} to indicate that this column should start a group,
  1263. @samp{>} to indicate the end of a column, or @samp{<>} to make a column
  1264. a group of its own. Boundaries between colum groups will upon export be
  1265. marked with vertical lines. Here is an example:
  1266. @example
  1267. | | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1268. |---+----+-----+-----+-----+---------+------------|
  1269. | / | <> | < | | > | < | > |
  1270. | # | 1 | 1 | 1 | 1 | 1 | 1 |
  1271. | # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1272. | # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1273. |---+----+-----+-----+-----+---------+------------|
  1274. #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
  1275. @end example
  1276. It is also sufficient to just insert the colum group starters after
  1277. every vertical line you'd like to have:
  1278. @example
  1279. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1280. |----+-----+-----+-----+---------+------------|
  1281. | / | < | | | < | |
  1282. @end example
  1283. @node orgtbl-mode, The spreadsheet, Column groups, Tables
  1284. @section The Orgtbl minor mode
  1285. @cindex orgtbl-mode
  1286. @cindex minor mode for tables
  1287. If you like the intuitive way the Org-mode table editor works, you
  1288. might also want to use it in other modes like text-mode or mail-mode.
  1289. The minor mode Orgtbl-mode makes this possible. You can always toggle
  1290. the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1291. example in mail mode, use
  1292. @lisp
  1293. (add-hook 'mail-mode-hook 'turn-on-orgtbl)
  1294. @end lisp
  1295. Furthermore, with some special setup, it is possible to maintain tables
  1296. in arbitrary syntax with Orgtbl-mode. For example, it is possible to
  1297. construct La@TeX{} tables with the underlying ease and power of
  1298. Orgtbl-mode, including spreadsheet capabilities. For details, see
  1299. @ref{Tables in arbitrary syntax}.
  1300. @node The spreadsheet, , orgtbl-mode, Tables
  1301. @section The spreadsheet
  1302. @cindex calculations, in tables
  1303. @cindex spreadsheet capabilities
  1304. @cindex @file{calc} package
  1305. The table editor makes use of the Emacs @file{calc} package to implement
  1306. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
  1307. derive fields from other fields. While fully featured, Org-mode's
  1308. implementation is not identical to other spreadsheets. For example,
  1309. Org-mode knows the concept of a @emph{column formula} that will be
  1310. applied to all non-header fields in a column without having to copy the
  1311. formula to each relevant field.
  1312. @menu
  1313. * References:: How to refer to another field or range
  1314. * Formula syntax for Calc:: Using Calc to compute stuff
  1315. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  1316. * Field formulas:: Formulas valid for a single field
  1317. * Column formulas:: Formulas valid for an entire column
  1318. * Editing and debugging formulas:: Fixing formulas
  1319. * Updating the table:: Recomputing all dependent fields
  1320. * Advanced features:: Field names, parameters and automatic recalc
  1321. @end menu
  1322. @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
  1323. @subsection References
  1324. @cindex references
  1325. To compute fields in the table from other fields, formulas must
  1326. reference other fields or ranges. In Org-mode, fields can be referenced
  1327. by name, by absolute coordinates, and by relative coordinates. To find
  1328. out what the coordinates of a field are, press @kbd{C-c ?} in that
  1329. field, or press @kbd{C-c @}} to toggle the display of a grid.
  1330. @subsubheading Field references
  1331. @cindex field references
  1332. @cindex references, to fields
  1333. Formulas can reference the value of another field in two ways. Like in
  1334. any other spreadsheet, you may reference fields with a letter/number
  1335. combination like @code{B3}, meaning the 2nd field in the 3rd row.
  1336. @c Such references are always fixed to that field, they don't change
  1337. @c when you copy and paste a formula to a different field. So
  1338. @c Org-mode's @code{B3} behaves like @code{$B$3} in other spreadsheets.
  1339. @noindent
  1340. Org-mode also uses another, more general operator that looks like this:
  1341. @example
  1342. @@row$column
  1343. @end example
  1344. @noindent
  1345. Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
  1346. or relative to the current column like @samp{+1} or @samp{-2}.
  1347. The row specification only counts data lines and ignores horizontal
  1348. separator lines (hlines). You can use absolute row numbers
  1349. @samp{1}...@samp{N}, and row numbers relative to the current row like
  1350. @samp{+3} or @samp{-1}. Or specify the row relative to one of the
  1351. hlines: @samp{I} refers to the first hline, @samp{II} to the second etc.
  1352. @samp{-I} refers to the first such line above the current line,
  1353. @samp{+I} to the first such line below the current line. You can also
  1354. write @samp{III+2} which is the second data line after the third hline
  1355. in the table. Relative row numbers like @samp{-3} will not cross hlines
  1356. if the current line is too close to the hline. Instead, the value
  1357. directly at the hline is used.
  1358. @samp{0} refers to the current row and column. Also, if you omit
  1359. either the column or the row part of the reference, the current
  1360. row/column is implied.
  1361. Org-mode's references with @emph{unsigned} numbers are fixed references
  1362. in the sense that if you use the same reference in the formula for two
  1363. different fields, the same field will be referenced each time.
  1364. Org-mode's references with @emph{signed} numbers are floating
  1365. references because the same reference operator can reference different
  1366. fields depending on the field being calculated by the formula.
  1367. Here are a few examples:
  1368. @example
  1369. @@2$3 @r{2nd row, 3rd column}
  1370. C2 @r{same as previous}
  1371. $5 @r{column 5 in the current row}
  1372. E& @r{same as previous}
  1373. @@2 @r{current column, row 2}
  1374. @@-1$-3 @r{the field one row up, three columns to the left}
  1375. @@-I$2 @r{field just under hline above current row, column 2}
  1376. @end example
  1377. @subsubheading Range references
  1378. @cindex range references
  1379. @cindex references, to ranges
  1380. You may reference a rectangular range of fields by specifying two field
  1381. references connected by two dots @samp{..}. If both fields are in the
  1382. current row, you may simply use @samp{$2..$7}, but if at least one field
  1383. is in a different row, you need to use the general @code{@@row$column}
  1384. format at least for the first field (i.e the reference must start with
  1385. @samp{@@} in order to be interpreted correctly). Examples:
  1386. @example
  1387. $1..$3 @r{First three fields in the current row.}
  1388. $P..$Q @r{Range, using column names (see under Advanced)}
  1389. @@2$1..@@4$3 @r{6 fields between these two fields.}
  1390. A2..C4 @r{Same as above.}
  1391. @@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
  1392. @end example
  1393. @noindent Range references return a vector of values that can be fed
  1394. into Calc vector functions. Empty fields in ranges are normally
  1395. suppressed, so that the vector contains only the non-empty fields (but
  1396. see the @samp{E} mode switch below). If there are no non-empty fields,
  1397. @samp{[0]} is returned to avoid syntax errors in formulas.
  1398. @subsubheading Named references
  1399. @cindex named references
  1400. @cindex references, named
  1401. @cindex name, of column or field
  1402. @cindex constants, in calculations
  1403. @samp{$name} is interpreted as the name of a column, parameter or
  1404. constant. Constants are defined globally through the variable
  1405. @code{org-table-formula-constants}, and locally (for the file) through a
  1406. line like
  1407. @example
  1408. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  1409. @end example
  1410. @noindent
  1411. Also properties (@pxref{Properties and columns}) can be used as
  1412. constants in table formulas: For a property @samp{:XYZ:} use the name
  1413. @samp{$PROP_XYZ}, and the property will be searched in the current
  1414. outline entry and in the hierarchy above it. If you have the
  1415. @file{constants.el} package, it will also be used to resolve constants,
  1416. including natural constants like @samp{$h} for Planck's constant, and
  1417. units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
  1418. supply the values of constants in two different unit systems, @code{SI}
  1419. and @code{cgs}. Which one is used depends on the value of the variable
  1420. @code{constants-unit-system}. You can use the @code{#+STARTUP} options
  1421. @code{constSI} and @code{constcgs} to set this value for the current
  1422. buffer.}. Column names and parameters can be specified in special table
  1423. lines. These are described below, see @ref{Advanced features}. All
  1424. names must start with a letter, and further consist of letters and
  1425. numbers.
  1426. @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
  1427. @subsection Formula syntax for Calc
  1428. @cindex formula syntax, Calc
  1429. @cindex syntax, of formulas
  1430. A formula can be any algebraic expression understood by the Emacs
  1431. @file{Calc} package. @b{Note that @file{calc} has the
  1432. non-standard convention that @samp{/} has lower precedence than
  1433. @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
  1434. evaluation by @code{calc-eval} (@pxref{Calling Calc from
  1435. Your Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU
  1436. Emacs Calc Manual}),
  1437. @c FIXME: The link to the calc manual in HTML does not work.
  1438. variable substitution takes place according to the rules described above.
  1439. @cindex vectors, in table calculations
  1440. The range vectors can be directly fed into the calc vector functions
  1441. like @samp{vmean} and @samp{vsum}.
  1442. @cindex format specifier
  1443. @cindex mode, for @file{calc}
  1444. A formula can contain an optional mode string after a semicolon. This
  1445. string consists of flags to influence Calc and other modes during
  1446. execution. By default, Org-mode uses the standard calc modes (precision
  1447. 12, angular units degrees, fraction and symbolic modes off. The display
  1448. format, however, has been changed to @code{(float 5)} to keep tables
  1449. compact. The default settings can be configured using the variable
  1450. @code{org-calc-default-modes}.
  1451. @example
  1452. p20 @r{switch the internal precision to 20 digits}
  1453. n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
  1454. D R @r{angle modes: degrees, radians}
  1455. F S @r{fraction and symbolic modes}
  1456. N @r{interpret all fields as numbers, use 0 for non-numbers}
  1457. T @r{force text interpretation}
  1458. E @r{keep empty fields in ranges}
  1459. @end example
  1460. @noindent
  1461. In addition, you may provide a @code{printf} format specifier to
  1462. reformat the final result. A few examples:
  1463. @example
  1464. $1+$2 @r{Sum of first and second field}
  1465. $1+$2;%.2f @r{Same, format result to two decimals}
  1466. exp($2)+exp($1) @r{Math functions can be used}
  1467. $0;%.1f @r{Reformat current cell to 1 decimal}
  1468. ($3-32)*5/9 @r{Degrees F -> C conversion}
  1469. $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
  1470. tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
  1471. sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
  1472. vmean($2..$7) @r{Compute column range mean, using vector function}
  1473. vmean($2..$7);EN @r{Same, but treat empty fields as 0}
  1474. taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
  1475. @end example
  1476. Calc also contains a complete set of logical operations. For example
  1477. @example
  1478. if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
  1479. @end example
  1480. @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
  1481. @subsection Emacs Lisp forms as formulas
  1482. @cindex Lisp forms, as table formulas
  1483. It is also possible to write a formula in Emacs Lisp; this can be useful
  1484. for string manipulation and control structures, if the Calc's
  1485. functionality is not enough. If a formula starts with a single quote
  1486. followed by an opening parenthesis, then it is evaluated as a lisp form.
  1487. The evaluation should return either a string or a number. Just as with
  1488. @file{calc} formulas, you can specify modes and a printf format after a
  1489. semicolon. With Emacs Lisp forms, you need to be concious about the way
  1490. field references are interpolated into the form. By default, a
  1491. reference will be interpolated as a Lisp string (in double quotes)
  1492. containing the field. If you provide the @samp{N} mode switch, all
  1493. referenced elements will be numbers (non-number fields will be zero) and
  1494. interpolated as Lisp numbers, without quotes. If you provide the
  1495. @samp{L} flag, all fields will be interpolated literally, without quotes.
  1496. I.e., if you want a reference to be interpreted as a string by the Lisp
  1497. form, enclode the reference operator itself in double quotes, like
  1498. @code{"$3"}. Ranges are inserted as space-separated fields, so you can
  1499. embed them in list or vector syntax. A few examples, note how the
  1500. @samp{N} mode is used when we do computations in lisp.
  1501. @example
  1502. @r{Swap the first two characters of the content of column 1}
  1503. '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
  1504. @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
  1505. '(+ $1 $2);N
  1506. @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
  1507. '(apply '+ '($1..$4));N
  1508. @end example
  1509. @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
  1510. @subsection Field formulas
  1511. @cindex field formula
  1512. @cindex formula, for individual table field
  1513. To assign a formula to a particular field, type it directly into the
  1514. field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
  1515. press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
  1516. the field, the formula will be stored as the formula for this field,
  1517. evaluated, and the current field replaced with the result.
  1518. Formulas are stored in a special line starting with @samp{#+TBLFM:}
  1519. directly below the table. If you typed the equation in the 4th field of
  1520. the 3rd data line in the table, the formula will look like
  1521. @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
  1522. with the appropriate commands, @i{absolute references} (but not relative
  1523. ones) in stored formulas are modified in order to still reference the
  1524. same field. Of cause this is not true if you edit the table structure
  1525. with normal editing commands - then you must fix the equations yourself.
  1526. Instead of typing an equation into the field, you may also use the
  1527. following command
  1528. @table @kbd
  1529. @kindex C-u C-c =
  1530. @item C-u C-c =
  1531. Install a new formula for the current field. The command prompts for a
  1532. formula, with default taken from the @samp{#+TBLFM:} line, applies
  1533. it to the current field and stores it.
  1534. @end table
  1535. @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
  1536. @subsection Column formulas
  1537. @cindex column formula
  1538. @cindex formula, for table column
  1539. Often in a table, the same formula should be used for all fields in a
  1540. particular column. Instead of having to copy the formula to all fields
  1541. in that column, org-mode allows to assign a single formula to an entire
  1542. column. If the table contains horizontal separator hlines, everything
  1543. before the first such line is considered part of the table @emph{header}
  1544. and will not be modified by column formulas.
  1545. To assign a formula to a column, type it directly into any field in the
  1546. column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  1547. @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
  1548. field, the formula will be stored as the formula for the current column,
  1549. evaluated and the current field replaced with the result. If the field
  1550. contains only @samp{=}, the previously stored formula for this column is
  1551. used. For each column, Org-mode will only remember the most recently
  1552. used formula. In the @samp{TBLFM:} line, column formulas will look like
  1553. @samp{$4=$1+$2}.
  1554. Instead of typing an equation into the field, you may also use the
  1555. following command:
  1556. @table @kbd
  1557. @kindex C-c =
  1558. @item C-c =
  1559. Install a new formula for the current column and replace current field
  1560. with the result of the formula. The command prompts for a formula, with
  1561. default taken from the @samp{#+TBLFM} line, applies it to the current
  1562. field and stores it. With a numerical prefix (e.g. @kbd{C-5 C-c =})
  1563. will apply it to that many consecutive fields in the current column.
  1564. @end table
  1565. @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
  1566. @subsection Editing and Debugging formulas
  1567. @cindex formula editing
  1568. @cindex editing, of table formulas
  1569. You can edit individual formulas in the minibuffer or directly in the
  1570. field. Org-mode can also prepare a special buffer with all active
  1571. formulas of a table. When offering a formula for editing, Org-mode
  1572. converts references to the standard format (like @code{B3} or @code{D&})
  1573. if possible. If you prefer to only work with the internal format (like
  1574. @code{@@3$2} or @code{$4}), configure the variable
  1575. @code{org-table-use-standard-references}.
  1576. @table @kbd
  1577. @kindex C-c =
  1578. @kindex C-u C-c =
  1579. @item C-c =
  1580. @itemx C-u C-c =
  1581. Edit the formula associated with the current column/field in the
  1582. minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
  1583. @kindex C-u C-u C-c =
  1584. @item C-u C-u C-c =
  1585. Re-insert the active formula (either a
  1586. field formula, or a column formula) into the current field, so that you
  1587. can edit it directly in the field. The advantage over editing in the
  1588. minibuffer is that you can use the command @kbd{C-c ?}.
  1589. @kindex C-c ?
  1590. @item C-c ?
  1591. While editing a formula in a table field, highlight the field(s)
  1592. referenced by the reference at the cursor position in the formula.
  1593. @kindex C-c @}
  1594. @item C-c @}
  1595. Toggle the display of row and column numbers for a table, using
  1596. overlays. These are updated each time the table is aligned, you can
  1597. force it with @kbd{C-c C-c}.
  1598. @kindex C-c @{
  1599. @item C-c @{
  1600. Toggle the formula debugger on and off. See below.
  1601. @kindex C-c '
  1602. @item C-c '
  1603. Edit all formulas for the current table in a special buffer, where the
  1604. formulas will be displayed one per line. If the current field has an
  1605. active formula, the cursor in the formula editor will mark it.
  1606. While inside the special buffer, Org-mode will automatically highlight
  1607. any field or range reference at the cursor position. You may edit,
  1608. remove and add formulas, and use the following commands:
  1609. @table @kbd
  1610. @kindex C-c C-c
  1611. @kindex C-x C-s
  1612. @item C-c C-c
  1613. @itemx C-x C-s
  1614. Exit the formula editor and store the modified formulas. With @kbd{C-u}
  1615. prefix, also apply the new formulas to the entire table.
  1616. @kindex C-c C-q
  1617. @item C-c C-q
  1618. Exit the formula editor without installing changes.
  1619. @kindex C-c C-r
  1620. @item C-c C-r
  1621. Toggle all references in the formula editor between standard (like
  1622. @code{B3}) and internal (like @code{@@3$2}).
  1623. @kindex @key{TAB}
  1624. @item @key{TAB}
  1625. Pretty-print or indent lisp formula at point. When in a line containing
  1626. a lisp formula, format the formula according to Emacs Lisp rules.
  1627. Another @key{TAB} collapses the formula back again. In the open
  1628. formula, @key{TAB} re-indents just like in Emacs-lisp-mode.
  1629. @kindex M-@key{TAB}
  1630. @item M-@key{TAB}
  1631. Complete Lisp symbols, just like in Emacs-lisp-mode.
  1632. @kindex S-@key{up}
  1633. @kindex S-@key{down}
  1634. @kindex S-@key{left}
  1635. @kindex S-@key{right}
  1636. @item S-@key{up}/@key{down}/@key{left}/@key{right}
  1637. Shift the reference at point. For example, if the reference is
  1638. @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
  1639. This also works for relative references, and for hline references.
  1640. @kindex M-S-@key{up}
  1641. @kindex M-S-@key{down}
  1642. @item M-S-@key{up}/@key{down}
  1643. Move the test line for column formulas in the Org-mode buffer up and
  1644. down.
  1645. @kindex M-@key{up}
  1646. @kindex M-@key{down}
  1647. @item M-@key{up}/@key{down}
  1648. Scroll the window displaying the table.
  1649. @kindex C-c @}
  1650. @item C-c @}
  1651. Turn the coordinate grid in the table on and off.
  1652. @end table
  1653. @end table
  1654. Making a table field blank does not remove the formula associated with
  1655. the field, because that is stored in a different line (the @samp{TBLFM}
  1656. line) - during the next recalculation the field will be filled again.
  1657. To remove a formula from a field, you have to give an empty reply when
  1658. prompted for the formula, or to edit the @samp{#+TBLFM} line.
  1659. @kindex C-c C-c
  1660. You may edit the @samp{#+TBLFM} directly and re-apply the changed
  1661. equations with @kbd{C-c C-c} in that line, or with the normal
  1662. recalculation commands in the table.
  1663. @subsubheading Debugging formulas
  1664. @cindex formula debugging
  1665. @cindex debugging, of table formulas
  1666. When the evaluation of a formula leads to an error, the field content
  1667. becomes the string @samp{#ERROR}. If you would like see what is going
  1668. on during variable substitution and calculation in order to find a bug,
  1669. turn on formula debugging in the @code{Tbl} menu and repeat the
  1670. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
  1671. field. Detailed information will be displayed.
  1672. @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
  1673. @subsection Updating the Table
  1674. @cindex recomputing table fields
  1675. @cindex updating, table
  1676. Recalculation of a table is normally not automatic, but needs to be
  1677. triggered by a command. See @ref{Advanced features} for a way to make
  1678. recalculation at least semi-automatically.
  1679. In order to recalculate a line of a table or the entire table, use the
  1680. following commands:
  1681. @table @kbd
  1682. @kindex C-c *
  1683. @item C-c *
  1684. Recalculate the current row by first applying the stored column formulas
  1685. from left to right, and all field formulas in the current row.
  1686. @c
  1687. @kindex C-u C-c *
  1688. @item C-u C-c *
  1689. @kindex C-u C-c C-c
  1690. @itemx C-u C-c C-c
  1691. Recompute the entire table, line by line. Any lines before the first
  1692. hline are left alone, assuming that these are part of the table header.
  1693. @c
  1694. @kindex C-u C-u C-c *
  1695. @item C-u C-u C-c *
  1696. Iterate the table by recomputing it until no further changes occur.
  1697. This may be necessary if some computed fields use the value of other
  1698. fields that are computed @i{later} in the calculation sequence.
  1699. @end table
  1700. @node Advanced features, , Updating the table, The spreadsheet
  1701. @subsection Advanced features
  1702. If you want the recalculation of fields to happen automatically, or if
  1703. you want to be able to assign @i{names} to fields and columns, you need
  1704. to reserve the first column of the table for special marking characters.
  1705. @table @kbd
  1706. @kindex C-#
  1707. @item C-#
  1708. Rotate the calculation mark in first column through the states @samp{},
  1709. @samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
  1710. is discussed below. When there is an active region, change all marks in
  1711. the region.
  1712. @end table
  1713. Here is an example of a table that collects exam results of students and
  1714. makes use of these features:
  1715. @example
  1716. @group
  1717. |---+---------+--------+--------+--------+-------+------|
  1718. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  1719. |---+---------+--------+--------+--------+-------+------|
  1720. | ! | | P1 | P2 | P3 | Tot | |
  1721. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  1722. | ^ | | m1 | m2 | m3 | mt | |
  1723. |---+---------+--------+--------+--------+-------+------|
  1724. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  1725. | # | Sara | 6 | 14 | 19 | 39 | 7.8 |
  1726. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  1727. |---+---------+--------+--------+--------+-------+------|
  1728. | | Average | | | | 29.7 | |
  1729. | ^ | | | | | at | |
  1730. | $ | max=50 | | | | | |
  1731. |---+---------+--------+--------+--------+-------+------|
  1732. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  1733. @end group
  1734. @end example
  1735. @noindent @b{Important}: Please note that for these special tables,
  1736. recalculating the table with @kbd{C-u C-c *} will only affect rows that
  1737. are marked @samp{#} or @samp{*}, and fields that have a formula assigned
  1738. to the field itself. The column formulas are not applied in rows with
  1739. empty first field.
  1740. @cindex marking characters, tables
  1741. The marking characters have the following meaning:
  1742. @table @samp
  1743. @item !
  1744. The fields in this line define names for the columns, so that you may
  1745. refer to a column as @samp{$Tot} instead of @samp{$6}.
  1746. @item ^
  1747. This row defines names for the fields @emph{above} the row. With such
  1748. a definition, any formula in the table may use @samp{$m1} to refer to
  1749. the value @samp{10}. Also, if you assign a formula to a names field, it
  1750. will be stored as @samp{$name=...}.
  1751. @item _
  1752. Similar to @samp{^}, but defines names for the fields in the row
  1753. @emph{below}.
  1754. @item $
  1755. Fields in this row can define @emph{parameters} for formulas. For
  1756. example, if a field in a @samp{$} row contains @samp{max=50}, then
  1757. formulas in this table can refer to the value 50 using @samp{$max}.
  1758. Parameters work exactly like constants, only that they can be defined on
  1759. a per-table basis.
  1760. @item #
  1761. Fields in this row are automatically recalculated when pressing
  1762. @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
  1763. is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
  1764. lines will be left alone by this command.
  1765. @item *
  1766. Selects this line for global recalculation with @kbd{C-u C-c *}, but
  1767. not for automatic recalculation. Use this when automatic
  1768. recalculation slows down editing too much.
  1769. @item
  1770. Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
  1771. All lines that should be recalculated should be marked with @samp{#}
  1772. or @samp{*}.
  1773. @item /
  1774. Do not export this line. Useful for lines that contain the narrowing
  1775. @samp{<N>} markers.
  1776. @end table
  1777. Finally, just to whet your appetite on what can be done with the
  1778. fantastic @file{calc} package, here is a table that computes the Taylor
  1779. series of degree @code{n} at location @code{x} for a couple of functions
  1780. (homework: try that with Excel :-)
  1781. @example
  1782. @group
  1783. |---+-------------+---+-----+--------------------------------------|
  1784. | | Func | n | x | Result |
  1785. |---+-------------+---+-----+--------------------------------------|
  1786. | # | exp(x) | 1 | x | 1 + x |
  1787. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  1788. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  1789. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  1790. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  1791. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  1792. |---+-------------+---+-----+--------------------------------------|
  1793. #+TBLFM: $5=taylor($2,$4,$3);n3
  1794. @end group
  1795. @end example
  1796. @node Hyperlinks, TODO items, Tables, Top
  1797. @chapter Hyperlinks
  1798. @cindex hyperlinks
  1799. Just like HTML, Org-mode provides links inside a file, and external
  1800. links to other files, Usenet articles, emails, and much more.
  1801. @menu
  1802. * Link format:: How links in Org-mode are formatted
  1803. * Internal links:: Links to other places in the current file
  1804. * External links:: URL-like links to the world
  1805. * Handling links:: Creating, inserting and following
  1806. * Using links outside Org-mode:: Linking from my C source code?
  1807. * Link abbreviations:: Shortcuts for writing complex links
  1808. * Search options:: Linking to a specific location
  1809. * Custom searches:: When the default search is not enough
  1810. * Remember:: Org-trees store quick notes
  1811. @end menu
  1812. @node Link format, Internal links, Hyperlinks, Hyperlinks
  1813. @section Link format
  1814. @cindex link format
  1815. @cindex format, of links
  1816. Org-mode will recognize plain URL-like links and activate them as
  1817. clickable links. The general link format, however, looks like this:
  1818. @example
  1819. [[link][description]] @r{or alternatively} [[link]]
  1820. @end example
  1821. Once a link in the buffer is complete (all brackets present), Org-mode
  1822. will change the display so that @samp{description} is displayed instead
  1823. of @samp{[[link][description]]} and @samp{link} is displayed instead of
  1824. @samp{[[link]]}. Links will be highlighted in the face @code{org-link},
  1825. which by default is an underlined face. You can directly edit the
  1826. visible part of a link. Note that this can be either the @samp{link}
  1827. part (if there is no description) or the @samp{description} part. To
  1828. edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
  1829. cursor on the link.
  1830. If you place the cursor at the beginning or just behind the end of the
  1831. displayed text and press @key{BACKSPACE}, you will remove the
  1832. (invisible) bracket at that location. This makes the link incomplete
  1833. and the internals are again displayed as plain text. Inserting the
  1834. missing bracket hides the link internals again. To show the
  1835. internal structure of all links, use the menu entry
  1836. @code{Org->Hyperlinks->Literal links}.
  1837. @node Internal links, External links, Link format, Hyperlinks
  1838. @section Internal links
  1839. @cindex internal links
  1840. @cindex links, internal
  1841. @cindex targets, for links
  1842. If the link does not look like a URL, it is considered to be internal in
  1843. the current file. Links such as @samp{[[My Target]]} or @samp{[[My
  1844. Target][Find my target]]} lead to a text search in the current file.
  1845. The link can be followed with @kbd{C-c C-o} when the cursor is on the
  1846. link, or with a mouse click (@pxref{Handling links}). The preferred
  1847. match for such a link is a dedicated target: the same string in double
  1848. angular brackets. Targets may be located anywhere; sometimes it is
  1849. convenient to put them into a comment line. For example
  1850. @example
  1851. # <<My Target>>
  1852. @end example
  1853. @noindent In HTML export (@pxref{HTML export}), such targets will become
  1854. named anchors for direct access through @samp{http} links@footnote{Note
  1855. that text before the first headline is usually not exported, so the
  1856. first such target should be after the first headline.}.
  1857. If no dedicated target exists, Org-mode will search for the words in the
  1858. link. In the above example the search would be for @samp{my target}.
  1859. Links starting with a star like @samp{*My Target} restrict the search to
  1860. headlines. When searching, Org-mode will first try an exact match, but
  1861. then move on to more and more lenient searches. For example, the link
  1862. @samp{[[*My Targets]]} will find any of the following:
  1863. @example
  1864. ** My targets
  1865. ** TODO my targets are bright
  1866. ** my 20 targets are
  1867. @end example
  1868. To insert a link targeting a headline, in-buffer completion can be used.
  1869. Just type a star followed by a few optional letters into the buffer and
  1870. press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
  1871. offered as completions. @xref{Handling links}, for more commands
  1872. creating links.
  1873. Following a link pushes a mark onto Org-mode's own mark ring. You can
  1874. return to the previous position with @kbd{C-c &}. Using this command
  1875. several times in direct succession goes back to positions recorded
  1876. earlier.
  1877. @menu
  1878. * Radio targets:: Make targets trigger links in plain text.
  1879. @end menu
  1880. @node Radio targets, , Internal links, Internal links
  1881. @subsection Radio targets
  1882. @cindex radio targets
  1883. @cindex targets, radio
  1884. @cindex links, radio targets
  1885. Org-mode can automatically turn any occurrences of certain target names
  1886. in normal text into a link. So without explicitly creating a link, the
  1887. text connects to the target radioing its position. Radio targets are
  1888. enclosed by triple angular brackets. For example, a target @samp{<<<My
  1889. Target>>>} causes each occurrence of @samp{my target} in normal text to
  1890. become activated as a link. The Org-mode file is scanned automatically
  1891. for radio targets only when the file is first loaded into Emacs. To
  1892. update the target list during editing, press @kbd{C-c C-c} with the
  1893. cursor on or at a target.
  1894. @node External links, Handling links, Internal links, Hyperlinks
  1895. @section External links
  1896. @cindex links, external
  1897. @cindex external links
  1898. @cindex links, external
  1899. @cindex GNUS links
  1900. @cindex BBDB links
  1901. @cindex URL links
  1902. @cindex file links
  1903. @cindex VM links
  1904. @cindex RMAIL links
  1905. @cindex WANDERLUST links
  1906. @cindex MH-E links
  1907. @cindex USENET links
  1908. @cindex SHELL links
  1909. @cindex Info links
  1910. @cindex elisp links
  1911. Org-mode supports links to files, websites, Usenet and email messages,
  1912. and BBDB database entries. External links are URL-like locators. They
  1913. start with a short identifying string followed by a colon. There can be
  1914. no space after the colon. The following list shows examples for each
  1915. link type.
  1916. @example
  1917. http://www.astro.uva.nl/~dominik @r{on the web}
  1918. file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
  1919. file:papers/last.pdf @r{file, relative path}
  1920. news:comp.emacs @r{Usenet link}
  1921. mailto:adent@@galaxy.net @r{Mail link}
  1922. vm:folder @r{VM folder link}
  1923. vm:folder#id @r{VM message link}
  1924. vm://myself@@some.where.org/folder#id @r{VM on remote machine}
  1925. wl:folder @r{WANDERLUST folder link}
  1926. wl:folder#id @r{WANDERLUST message link}
  1927. mhe:folder @r{MH-E folder link}
  1928. mhe:folder#id @r{MH-E message link}
  1929. rmail:folder @r{RMAIL folder link}
  1930. rmail:folder#id @r{RMAIL message link}
  1931. gnus:group @r{GNUS group link}
  1932. gnus:group#id @r{GNUS article link}
  1933. bbdb:Richard Stallman @r{BBDB link}
  1934. shell:ls *.org @r{A shell command}
  1935. elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
  1936. @end example
  1937. A link should be enclosed in double brackets and may contain a
  1938. descriptive text to be displayed instead of the url (@pxref{Link
  1939. format}), for example:
  1940. @example
  1941. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  1942. @end example
  1943. @noindent
  1944. If the description is a file name or URL that points to an image, HTML
  1945. export (@pxref{HTML export}) will inline the image as a clickable
  1946. button. If there is no description at all and the link points to an
  1947. image,
  1948. that image will be inlined into the exported HTML file.
  1949. @cindex angular brackets, around links
  1950. @cindex plain text external links
  1951. Org-mode also finds external links in the normal text and activates them
  1952. as links. If spaces must be part of the link (for example in
  1953. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
  1954. about the end of the link, enclose them in angular brackets.
  1955. @node Handling links, Using links outside Org-mode, External links, Hyperlinks
  1956. @section Handling links
  1957. @cindex links, handling
  1958. Org-mode provides methods to create a link in the correct syntax, to
  1959. insert it into an org-mode file, and to follow the link.
  1960. @table @kbd
  1961. @kindex C-c l
  1962. @cindex storing links
  1963. @item C-c l
  1964. Store a link to the current location. This is a @emph{global} command
  1965. which can be used in any buffer to create a link. The link will be
  1966. stored for later insertion into an Org-mode buffer (see below). For
  1967. Org-mode files, if there is a @samp{<<target>>} at the cursor, the link
  1968. points to the target. Otherwise it points to the current headline. For
  1969. VM, RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will
  1970. indicate the current article/entry. For W3 and W3M buffers, the link
  1971. goes to the current URL. For any other files, the link will point to
  1972. the file, with a search string (@pxref{Search options}) pointing to the
  1973. contents of the current line. If there is an active region, the
  1974. selected words will form the basis of the search string. If the
  1975. automatically created link is not working correctly or accurately
  1976. enough, you can write custom functions to select the search string and
  1977. to do the search for particular file types - see @ref{Custom searches}.
  1978. The key binding @kbd{C-c l} is only a suggestion - see @ref{Installation}.
  1979. @c
  1980. @kindex C-c C-l
  1981. @cindex link completion
  1982. @cindex completion, of links
  1983. @cindex inserting links
  1984. @item C-c C-l
  1985. Insert a link. This prompts for a link to be inserted into the buffer.
  1986. You can just type a link, using text for an internal link, or one of the
  1987. link type prefixes mentioned in the examples above. All links stored
  1988. during the current session are part of the history for this prompt, so
  1989. you can access them with @key{up} and @key{down}. Completion, on the
  1990. other hand, will help you to insert valid link prefixes like
  1991. @samp{http:} or @samp{ftp:}, including the prefixes defined through link
  1992. abbreviations (@pxref{Link abbreviations}). The link will be inserted
  1993. into the buffer@footnote{After insertion of a stored link, the link will
  1994. be removed from the list of stored links. To keep it in the list later
  1995. use, use a triple @kbd{C-u} prefix to @kbd{C-c C-l}, or configure the
  1996. option @code{org-keep-stored-link-after-insertion}.}, along with a
  1997. descriptive text. If some text was selected when this command is
  1998. called, the selected text becomes the default description.@* Note that
  1999. you don't have to use this command to insert a link. Links in Org-mode
  2000. are plain text, and you can type or paste them straight into the buffer.
  2001. By using this command, the links are automatically enclosed in double
  2002. brackets, and you will be asked for the optional descriptive text.
  2003. @c
  2004. @c If the link is a @samp{file:} link and
  2005. @c the linked file is located in the same directory as the current file or
  2006. @c a subdirectory of it, the path of the file will be inserted relative to
  2007. @c the current directory.
  2008. @c
  2009. @kindex C-u C-c C-l
  2010. @cindex file name completion
  2011. @cindex completion, of file names
  2012. @item C-u C-c C-l
  2013. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
  2014. a file will be inserted and you may use file name completion to select
  2015. the name of the file. The path to the file is inserted relative to the
  2016. directory of the current org file, if the linked file is in the current
  2017. directory or in a subdirectory of it, or if the path is written relative
  2018. to the current directory using @samp{../}. Otherwise an absolute path
  2019. is used, if possible with @samp{~/} for your home directory. You can
  2020. force an absolute path with two @kbd{C-u} prefixes.
  2021. @c
  2022. @item C-c C-l @r{(with cursor on existing link)}
  2023. When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
  2024. link and description parts of the link.
  2025. @c
  2026. @cindex following links
  2027. @kindex C-c C-o
  2028. @item C-c C-o
  2029. Open link at point. This will launch a web browser for URLs (using
  2030. @command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
  2031. for the corresponding links, and execute the command in a shell link.
  2032. When the cursor is on an internal link, this commands runs the
  2033. corresponding search. When the cursor is on a TAG list in a headline,
  2034. it creates the corresponding TAGS view. If the cursor is on a time
  2035. stamp, it compiles the agenda for that date. Furthermore, it will visit
  2036. text and remote files in @samp{file:} links with Emacs and select a
  2037. suitable application for local non-text files. Classification of files
  2038. is based on file extension only. See option @code{org-file-apps}. If
  2039. you want to override the default application and visit the file with
  2040. Emacs, use a @kbd{C-u} prefix.
  2041. @c
  2042. @kindex mouse-2
  2043. @kindex mouse-1
  2044. @item mouse-2
  2045. @itemx mouse-1
  2046. On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
  2047. would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
  2048. @c
  2049. @kindex mouse-3
  2050. @item mouse-3
  2051. Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
  2052. internal links to be displayed in another window@footnote{See the
  2053. variable @code{org-display-internal-link-with-indirect-buffer}}.
  2054. @c
  2055. @cindex mark ring
  2056. @kindex C-c %
  2057. @item C-c %
  2058. Push the current position onto the mark ring, to be able to return
  2059. easily. Commands following an internal link do this automatically.
  2060. @c
  2061. @cindex links, returning to
  2062. @kindex C-c &
  2063. @item C-c &
  2064. Jump back to a recorded position. A position is recorded by the
  2065. commands following internal links, and by @kbd{C-c %}. Using this
  2066. command several times in direct succession moves through a ring of
  2067. previously recorded positions.
  2068. @c
  2069. @kindex C-c C-x C-n
  2070. @kindex C-c C-x C-p
  2071. @cindex links, finding next/previous
  2072. @item C-c C-x C-n
  2073. @itemx C-c C-x C-p
  2074. Move forward/backward to the next link in the buffer. At the limit of
  2075. the buffer, the search fails once, and then wraps around. The key
  2076. bindings for this are really too long, you might want to bind this also
  2077. to @kbd{C-n} and @kbd{C-p}
  2078. @lisp
  2079. (add-hook 'org-load-hook
  2080. (lambda ()
  2081. (define-key 'org-mode-map "\C-n" 'org-next-link)
  2082. (define-key 'org-mode-map "\C-p" 'org-previous-link)))
  2083. @end lisp
  2084. @end table
  2085. @node Using links outside Org-mode, Link abbreviations, Handling links, Hyperlinks
  2086. @section Using links outside Org-mode
  2087. You can insert and follow links that have Org-mode syntax not only in
  2088. Org-mode, but in any Emacs buffer. For this, you should create two
  2089. global commands, like this (please select suitable global keys
  2090. yourself):
  2091. @lisp
  2092. (global-set-key "\C-c L" 'org-insert-link-global)
  2093. (global-set-key "\C-c o" 'org-open-at-point-global)
  2094. @end lisp
  2095. @node Link abbreviations, Search options, Using links outside Org-mode, Hyperlinks
  2096. @section Link abbreviations
  2097. @cindex link abbreviations
  2098. @cindex abbreviation, links
  2099. Long URLs can be cumbersome to type, and often many similar links are
  2100. needed in a document. For this you can use link abbreviations. An
  2101. abbreviated link looks like this
  2102. @example
  2103. [[linkword:tag][description]]
  2104. @end example
  2105. @noindent
  2106. where the tag is optional. Such abbreviations are resolved according to
  2107. the information in the variable @code{org-link-abbrev-alist} that
  2108. relates the linkwords to replacement text. Here is an example:
  2109. @lisp
  2110. @group
  2111. (setq org-link-abbrev-alist
  2112. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  2113. ("google" . "http://www.google.com/search?q=")
  2114. ("ads" . "http://adsabs.harvard.edu/cgi-bin/
  2115. nph-abs_connect?author=%s&db_key=AST")))
  2116. @end group
  2117. @end lisp
  2118. If the replacement text contains the string @samp{%s}, it will be
  2119. replaced with the tag. Otherwise the tag will be appended to the string
  2120. in order to create the link. You may also specify a function that will
  2121. be called with the tag as the only argument to create the link.
  2122. With the above setting, you could link to a specific bug with
  2123. @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
  2124. @code{[[google:OrgMode]]} and find out what the Org-mode author is
  2125. doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
  2126. If you need special abbreviations just for a single Org-mode buffer, you
  2127. can define them in the file with
  2128. @example
  2129. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  2130. #+LINK: google http://www.google.com/search?q=%s
  2131. @end example
  2132. @noindent
  2133. In-buffer completion @pxref{Completion} can be used after @samp{[} to
  2134. complete link abbreviations.
  2135. @node Search options, Custom searches, Link abbreviations, Hyperlinks
  2136. @section Search options in file links
  2137. @cindex search option in file links
  2138. @cindex file links, searching
  2139. File links can contain additional information to make Emacs jump to a
  2140. particular location in the file when following a link. This can be a
  2141. line number or a search option after a double@footnote{For backward
  2142. compatibility, line numbers can also follow a single colon.} colon. For
  2143. example, when the command @kbd{C-c l} creates a link (@pxref{Handling
  2144. links}) to a file, it encodes the words in the current line as a search
  2145. string that can be used to find this line back later when following the
  2146. link with @kbd{C-c C-o}.
  2147. Here is the syntax of the different ways to attach a search to a file
  2148. link, together with an explanation:
  2149. @example
  2150. [[file:~/code/main.c::255]]
  2151. [[file:~/xx.org::My Target]]
  2152. [[file:~/xx.org::*My Target]]
  2153. [[file:~/xx.org::/regexp/]]
  2154. @end example
  2155. @table @code
  2156. @item 255
  2157. Jump to line 255.
  2158. @item My Target
  2159. Search for a link target @samp{<<My Target>>}, or do a text search for
  2160. @samp{my target}, similar to the search in internal links, see
  2161. @ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
  2162. link will become an HTML reference to the corresponding named anchor in
  2163. the linked file.
  2164. @item *My Target
  2165. In an Org-mode file, restrict search to headlines.
  2166. @item /regexp/
  2167. Do a regular expression search for @code{regexp}. This uses the Emacs
  2168. command @code{occur} to list all matches in a separate window. If the
  2169. target file is in Org-mode, @code{org-occur} is used to create a
  2170. sparse tree with the matches.
  2171. @c If the target file is a directory,
  2172. @c @code{grep} will be used to search all files in the directory.
  2173. @end table
  2174. As a degenerate case, a file link with an empty file name can be used
  2175. to search the current file. For example, @code{[[file:::find me]]} does
  2176. a search for @samp{find me} in the current file, just as
  2177. @samp{[[find me]]} would.
  2178. @node Custom searches, Remember, Search options, Hyperlinks
  2179. @section Custom Searches
  2180. @cindex custom search strings
  2181. @cindex search strings, custom
  2182. The default mechanism for creating search strings and for doing the
  2183. actual search related to a file link may not work correctly in all
  2184. cases. For example, BibTeX database files have many entries like
  2185. @samp{year="1993"} which would not result in good search strings,
  2186. because the only unique identification for a BibTeX entry is the
  2187. citation key.
  2188. If you come across such a problem, you can write custom functions to set
  2189. the right search string for a particular file type, and to do the search
  2190. for the string in the file. Using @code{add-hook}, these functions need
  2191. to be added to the hook variables
  2192. @code{org-create-file-search-functions} and
  2193. @code{org-execute-file-search-functions}. See the docstring for these
  2194. variables for more information. Org-mode actually uses this mechanism
  2195. for Bib@TeX{} database files, and you can use the corresponding code as
  2196. an implementation example. Search for @samp{BibTeX links} in the source
  2197. file.
  2198. @node Remember, , Custom searches, Hyperlinks
  2199. @section Remember
  2200. @cindex @file{remember.el}
  2201. Another way to create org entries with links to other files is through
  2202. the @i{remember} package by John Wiegley. @i{Remember} lets you store
  2203. quick notes with little interruption of your work flow. See
  2204. @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
  2205. information. The notes produced by @i{Remember} can be stored in
  2206. different ways, and Org-mode files are a good target. Org-mode
  2207. significantly expands the possibilities of @i{remember}: You may define
  2208. templates for different note types, and to associate target files and
  2209. headlines with specific templates. It also allows you to select the
  2210. location where a note should be stored interactively, on the fly.
  2211. @menu
  2212. * Setting up remember:: Some code for .emacs to get things going
  2213. * Remember templates:: Define the outline of different note types
  2214. * Storing notes:: Directly get the note to where it belongs
  2215. @end menu
  2216. @node Setting up remember, Remember templates, Remember, Remember
  2217. @subsection Setting up remember
  2218. The following customization will tell @i{remember} to use org files as
  2219. target, and to create annotations compatible with Org-mode links.
  2220. @example
  2221. (setq org-directory "~/path/to/my/orgfiles/")
  2222. (setq org-default-notes-file "~/.notes")
  2223. (setq remember-annotation-functions '(org-remember-annotation))
  2224. (setq remember-handler-functions '(org-remember-handler))
  2225. (add-hook 'remember-mode-hook 'org-remember-apply-template)
  2226. @end example
  2227. @node Remember templates, Storing notes, Setting up remember, Remember
  2228. @subsection Remember templates
  2229. @cindex templates, for remember
  2230. In combination with Org-mode, you can use templates to generate
  2231. different types of @i{remember} notes. For example, if you would like
  2232. to use one template to create general TODO entries, another one for
  2233. journal entries, and a third one for collecting random ideas, you could
  2234. use:
  2235. @example
  2236. (setq org-remember-templates
  2237. '((?t "* TODO %?\n %i\n %a" "~/org/TODO.org")
  2238. (?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
  2239. (?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  2240. @end example
  2241. @noindent In these entries, the character specifies how to select the
  2242. template. The first string specifies the template. Two more (optional)
  2243. strings give the file in which, and the headline under which the new
  2244. note should be stored. The file defaults (if not present or @code{nil})
  2245. to @code{org-default-notes-file}, the heading to
  2246. @code{org-remember-default-headline}. Both defaults help to get to the
  2247. storing location quickly, but you can change the location interactively
  2248. while storing the note.
  2249. When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
  2250. something, org will prompt for a key to select the template (if you have
  2251. more than one template) and then prepare the buffer like
  2252. @example
  2253. * TODO
  2254. [[file:link to where you called remember]]
  2255. @end example
  2256. @noindent or
  2257. @example
  2258. * [2006-03-21 Tue 15:37]
  2259. [[file:link to where you called remember]]
  2260. @end example
  2261. @noindent
  2262. During expansion of the template, special @kbd{%}-escapes allow dynamic
  2263. insertion of content:
  2264. @example
  2265. %^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
  2266. %t @r{time stamp, date only}
  2267. %T @r{time stamp with date and time}
  2268. %u, %U @r{like the above, but inactive time stamps}
  2269. %^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
  2270. @r{You may define a prompt like @code{%^@{Birthday@}t}}
  2271. %n @r{user name (taken from @code{user-full-name})}
  2272. %a @r{annotation, normally the link created with @code{org-store-link}}
  2273. %i @r{initial content, the region when remember is called with C-u.}
  2274. @r{The entire text will be indented like @code{%i} itself.}
  2275. %^g @r{prompt for tags, with completion on tags in target file.}
  2276. %^G @r{prompt for tags, with completion all tags in all agenda files.}
  2277. %:keyword @r{specific information for certain link types, see below}
  2278. @end example
  2279. @noindent
  2280. For specific link types, the following keywords will be defined:
  2281. @example
  2282. Link type | Available keywords
  2283. -------------------+----------------------------------------------
  2284. bbdb | %:name %:company
  2285. vm, wl, mh, rmail | %:type %:subject %:message-id
  2286. | %:from %:fromname %:fromaddress
  2287. | %:to %:toname %:toaddress
  2288. | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}}
  2289. gnus | %:group, @r{for messages also all email fields}
  2290. w3, w3m | %:url
  2291. info | %:file %:node
  2292. calendar | %:date"
  2293. @end example
  2294. @noindent
  2295. To place the cursor after template expansion use:
  2296. @example
  2297. %? @r{After completing the template, position cursor here.}
  2298. @end example
  2299. @noindent
  2300. If you change you mind about which template to use, call
  2301. @code{org-remember} in the remember buffer. You may then select a new
  2302. template that will be filled with the previous context information.
  2303. @node Storing notes, , Remember templates, Remember
  2304. @subsection Storing notes
  2305. When you are finished preparing a note with @i{remember}, you have to press
  2306. @kbd{C-c C-c} to file the note away. The handler first prompts for a
  2307. target file - if you press @key{RET}, the value specified for the
  2308. template is used. Then the command offers the headings tree of the
  2309. selected file, with the cursor position at the default headline (if you
  2310. had specified one in the template). You can either immediately press
  2311. @key{RET} to get the note placed there. Or you can use the following
  2312. keys to find a better location:
  2313. @example
  2314. @key{TAB} @r{Cycle visibility.}
  2315. @key{down} / @key{up} @r{Next/previous visible headline.}
  2316. n / p @r{Next/previous visible headline.}
  2317. f / b @r{Next/previous headline same level.}
  2318. u @r{One level up.}
  2319. @c 0-9 @r{Digit argument.}
  2320. @end example
  2321. @noindent
  2322. Pressing @key{RET} or @key{left} or @key{right}
  2323. then leads to the following result.
  2324. @multitable @columnfractions 0.2 0.15 0.65
  2325. @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
  2326. @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
  2327. @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
  2328. @item @tab @key{left}/@key{right} @tab as same level, before/after current heading
  2329. @item not on headline @tab @key{RET}
  2330. @tab at cursor position, level taken from context.
  2331. @end multitable
  2332. So a fast way to store the note to its default location is to press
  2333. @kbd{C-c C-c @key{RET} @key{RET}}. Even shorter would be @kbd{C-u C-c
  2334. C-c}, which does the same without even asking for a file or showing the
  2335. tree.
  2336. Before inserting the text into a tree, the function ensures that the
  2337. text has a headline, i.e. a first line that starts with a @samp{*}.
  2338. If not, a headline is constructed from the current date and some
  2339. additional data. If the variable @code{org-adapt-indentation} is
  2340. non-nil, the entire text is also indented so that it starts in the
  2341. same column as the headline (after the asterisks).
  2342. @node TODO items, Tags, Hyperlinks, Top
  2343. @chapter TODO items
  2344. @cindex TODO items
  2345. Org-mode does not maintain TODO lists as a separate document. TODO
  2346. items are an integral part of the notes file, because TODO items
  2347. usually come up while taking notes! With Org-mode, you simply mark
  2348. any entry in a tree as being a TODO item. In this way, the
  2349. information is not duplicated, and the entire context from which the
  2350. item emerged is always present when you check.
  2351. Of course, this technique causes TODO items to be scattered throughout
  2352. your file. Org-mode provides methods to give you an overview over all
  2353. things you have to do.
  2354. @menu
  2355. * TODO basics:: Marking and displaying TODO entries
  2356. * TODO extensions:: Workflow and assignments
  2357. * Priorities:: Some things are more important than others
  2358. * Breaking down tasks:: Splitting a task into manageable pieces
  2359. * Checkboxes:: Tick-off lists
  2360. @end menu
  2361. @node TODO basics, TODO extensions, TODO items, TODO items
  2362. @section Basic TODO functionality
  2363. Any headline can become a TODO item by starting it with the word TODO,
  2364. for example:
  2365. @example
  2366. *** TODO Write letter to Sam Fortune
  2367. @end example
  2368. @noindent
  2369. The most important commands to work with TODO entries are:
  2370. @table @kbd
  2371. @kindex C-c C-t
  2372. @cindex cycling, of TODO states
  2373. @item C-c C-t
  2374. Rotate the TODO state of the current item among
  2375. @example
  2376. ,-> (unmarked) -> TODO -> DONE --.
  2377. '--------------------------------'
  2378. @end example
  2379. The same rotation can also be done ``remotely'' from the timeline and
  2380. agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
  2381. @kindex S-@key{right}
  2382. @kindex S-@key{left}
  2383. @item S-@key{right}
  2384. @itemx S-@key{left}
  2385. Select the following/preceding TODO state, similar to cycling. Mostly
  2386. useful if more than two TODO states are possible (@pxref{TODO extensions}).
  2387. @kindex C-c C-v
  2388. @cindex sparse tree, for TODO
  2389. @item C-c C-v
  2390. View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
  2391. the entire buffer, but shows all TODO items and the headings hierarchy
  2392. above them. With prefix arg, search for a specific TODO. You will be
  2393. prompted for the keyword, and you can also give a list of keywords like
  2394. @code{kwd1|kwd2|...}. With numerical prefix N, show the tree for the
  2395. Nth keyword in the variable @code{org-todo-keywords}. With two prefix
  2396. args, find all TODO and DONE entries.
  2397. @kindex C-c a t
  2398. @item C-c a t
  2399. Show the global TODO list. This collects the TODO items from all
  2400. agenda files (@pxref{Agenda views}) into a single buffer. The buffer is in
  2401. @code{agenda-mode}, so there are commands to examine and manipulate
  2402. the TODO entries directly from that buffer (@pxref{Agenda commands}).
  2403. @xref{Global TODO list}, for more information.
  2404. @c @item @code{org-agenda-include-all-todo}
  2405. @c If you would like to have all your TODO items listed as part of your
  2406. @c agenda, customize the variable @code{org-agenda-include-all-todo}.
  2407. @kindex S-M-@key{RET}
  2408. @item S-M-@key{RET}
  2409. Insert a new TODO entry below the current one.
  2410. @end table
  2411. @node TODO extensions, Priorities, TODO basics, TODO items
  2412. @section Extended use of TODO keywords
  2413. @cindex extended TODO keywords
  2414. The default implementation of TODO entries is just two states: TODO and
  2415. DONE. You can use the TODO feature for more complicated things by
  2416. configuring the variable @code{org-todo-keywords}. With special setup,
  2417. the TODO keyword system can work differently in different files.
  2418. Note that @i{tags} are another way to classify headlines in general and
  2419. TODO items in particular (@pxref{Tags}).
  2420. @menu
  2421. * Workflow states:: From TODO to DONE in steps
  2422. * TODO types:: I do this, Fred the rest
  2423. * Multiple sets in one file:: Mixing it all, and still finding your way
  2424. * Per file keywords:: Different files, different requirements
  2425. @end menu
  2426. @node Workflow states, TODO types, TODO extensions, TODO extensions
  2427. @subsection TODO keywords as workflow states
  2428. @cindex TODO workflow
  2429. @cindex workflow states as TODO keywords
  2430. You can use TODO keywords to indicate different @emph{sequential} states
  2431. in the process of working on an item, for example@footnote{Changing
  2432. this variable only becomes effective after restarting Org-mode in a
  2433. buffer.}:
  2434. @lisp
  2435. (setq org-todo-keywords
  2436. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  2437. @end lisp
  2438. The vertical bar separates the TODO keywords (states that @emph{need
  2439. action}) from the DONE states (which need @emph{no further action}. If
  2440. you don't provide the separator bar, the last state is used as the DONE
  2441. state.
  2442. @cindex completion, of TODO keywords
  2443. With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
  2444. to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
  2445. also use a prefix argument to quickly select a specific state. For
  2446. example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
  2447. If you define many keywords, you can use in-buffer completion (see
  2448. @ref{Completion}) to insert these words into the buffer. Changing a
  2449. todo state can be logged with a timestamp, see @ref{Tracking TODO state
  2450. changes} for more information.
  2451. @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
  2452. @subsection TODO keywords as types
  2453. @cindex TODO types
  2454. @cindex names as TODO keywords
  2455. @cindex types as TODO keywords
  2456. The second possibility is to use TODO keywords to indicate different
  2457. @emph{types} of action items. For example, you might want to indicate
  2458. that items are for ``work'' or ``home''. Or, when you work with several
  2459. people on a single project, you might want to assign action items
  2460. directly to persons, by using their names as TODO keywords. This would
  2461. be set up like this:
  2462. @lisp
  2463. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  2464. @end lisp
  2465. In this case, different keywords do not indicate a sequence, but rather
  2466. different types. So the normal work flow would be to assign a task to a
  2467. person, and later to mark it DONE. Org-mode supports this style by
  2468. adapting the workings of the command @kbd{C-c C-t}@footnote{This is also
  2469. true for the @kbd{t} command in the timeline and agenda buffers.}. When
  2470. used several times in succession, it will still cycle through all names,
  2471. in order to first select the right type for a task. But when you return
  2472. to the item after some time and execute @kbd{C-c C-t} again, it will
  2473. switch from any name directly to DONE. Use prefix arguments or
  2474. completion to quickly select a specific name. You can also review the
  2475. items of a specific TODO type in a sparse tree by using a numeric prefix
  2476. to @kbd{C-c C-v}. For example, to see all things Lucy has to do, you
  2477. would use @kbd{C-3 C-c C-v}. To collect Lucy's items from all agenda
  2478. files into a single buffer, you would use the prefix arg as well when
  2479. creating the global todo list: @kbd{C-3 C-c t}.
  2480. @node Multiple sets in one file, Per file keywords, TODO types, TODO extensions
  2481. @subsection Multiple keyword sets in one file
  2482. @cindex todo keyword sets
  2483. Sometimes you may want to use different sets of TODO keywords in
  2484. parallel. For example, you may want to have the basic
  2485. @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
  2486. separate state indicating that an item has been canceled (so it is not
  2487. DONE, but also does not require action). Your setup would then look
  2488. like this:
  2489. @lisp
  2490. (setq org-todo-keywords
  2491. '((sequence "TODO" "|" "DONE")
  2492. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  2493. (sequence "|" "CANCELED")))
  2494. @end lisp
  2495. The keywords should all be different, this helps Org-mode to keep track
  2496. of which subsequence should be used for a given entry. In this setup,
  2497. @kbd{C-c C-t} only operates within a subsequence, so it switches from
  2498. @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
  2499. (nothing) to @code{REPORT}. Therefore you need a mechanism to initially
  2500. select the correct sequence. Besides the obvious ways like typing a
  2501. keyword or using completion, you may also apply the following commands:
  2502. @table @kbd
  2503. @kindex C-S-@key{right}
  2504. @kindex C-S-@key{left}
  2505. @item C-S-@key{right}
  2506. @itemx C-S-@key{left}
  2507. These keys jump from one TODO subset to the next. In the above example,
  2508. @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
  2509. @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
  2510. @kindex S-@key{right}
  2511. @kindex S-@key{left}
  2512. @item S-@key{right}
  2513. @itemx S-@key{left}
  2514. @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
  2515. @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
  2516. would switch from @code{DONE} to @code{REPORT} in the example above.
  2517. @end table
  2518. @node Per file keywords, , Multiple sets in one file, TODO extensions
  2519. @subsection Setting up keywords for individual files
  2520. @cindex keyword options
  2521. @cindex per file keywords
  2522. It can be very useful to use different aspects of the TODO mechanism in
  2523. different files. For file-local settings, you need to add special lines
  2524. to the file which set the keywords and interpretation for that file
  2525. only. For example, to set one of the two examples discussed above, you
  2526. need one of the following lines, starting in column zero anywhere in the
  2527. file:
  2528. @example
  2529. #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  2530. @end example
  2531. or
  2532. @example
  2533. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  2534. @end example
  2535. A setup for using several sets in parallel would be:
  2536. @example
  2537. #+SEQ_TODO: "TODO" "|" "DONE"
  2538. #+SEQ_TODO: "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED"
  2539. #+SEQ_TODO: "|" "CANCELED"
  2540. @end example
  2541. @cindex completion, of option keywords
  2542. @kindex M-@key{TAB}
  2543. @noindent To make sure you are using the correct keyword, type
  2544. @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
  2545. @cindex DONE, final TODO keyword
  2546. Remember that the keywords after the vertical bar (or the last keyword
  2547. if no bar is there) must always mean that the item is DONE (although you
  2548. may use a different word). After changing one of these lines, use
  2549. @kbd{C-c C-c} with the cursor still in the line to make the changes
  2550. known to Org-mode@footnote{Org-mode parses these lines only when
  2551. Org-mode is activated after visiting a file. @kbd{C-c C-c} with the
  2552. cursor in a line starting with @samp{#+} is simply restarting Org-mode
  2553. for the current buffer.}.
  2554. @node Priorities, Breaking down tasks, TODO extensions, TODO items
  2555. @section Priorities
  2556. @cindex priorities
  2557. If you use Org-mode extensively to organize your work, you may end up
  2558. with a number of TODO entries so large that you'd like to prioritize
  2559. them. This can be done by placing a @emph{priority cookie} into the
  2560. headline, like this
  2561. @example
  2562. *** TODO [#A] Write letter to Sam Fortune
  2563. @end example
  2564. @noindent
  2565. With its standard setup, Org-mode supports priorities @samp{A},
  2566. @samp{B}, and @samp{C}. @samp{A} is the highest priority. An entry
  2567. without a cookie is treated as priority @samp{B}. Priorities make a
  2568. difference only in the agenda (@pxref{Weekly/Daily agenda}).
  2569. @table @kbd
  2570. @kindex @kbd{C-c ,}
  2571. @item @kbd{C-c ,}
  2572. Set the priority of the current headline. The command prompts for a
  2573. priority character @samp{A}, @samp{B} or @samp{C}. When you press
  2574. @key{SPC} instead, the priority cookie is removed from the headline.
  2575. The priorities can also be changed ``remotely'' from the timeline and
  2576. agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
  2577. @c
  2578. @kindex S-@key{up}
  2579. @kindex S-@key{down}
  2580. @item S-@key{up}
  2581. @itemx S-@key{down}
  2582. Increase/decrease priority of current headline. Note that these keys
  2583. are also used to modify time stamps (@pxref{Creating timestamps}).
  2584. Furthermore, these keys are also used by CUA-mode (@pxref{Conflicts}).
  2585. @end table
  2586. You can change the range of allowed priorities by setting the variables
  2587. @code{org-highest-priority}, @code{org-lowest-priority}, and
  2588. @code{org-default-priority}. For an individual buffer, you may set
  2589. these values (highest, lowest, default) like this (please make sure that
  2590. the highest priority is earlier in the alphabet than the lowest
  2591. priority):
  2592. @example
  2593. #+PRIORITIES: A C B
  2594. @end example
  2595. @node Breaking down tasks, Checkboxes, Priorities, TODO items
  2596. @section Breaking tasks down into subtasks
  2597. @cindex tasks, breaking down
  2598. It is often advisable to break down large tasks into smaller, manageable
  2599. subtasks. You can do this by creating an outline tree below a TODO
  2600. item, with detailed subtasks on the tree@footnote{To keep subtasks out
  2601. of the global TODO list, see the
  2602. @code{org-agenda-todo-list-sublevels}.}. Another possibility is the use
  2603. of checkboxes to identify (a hierarchy of) a large number of subtasks
  2604. (@pxref{Checkboxes}).
  2605. @node Checkboxes, , Breaking down tasks, TODO items
  2606. @section Checkboxes
  2607. @cindex checkboxes
  2608. Every item in a plain list (@pxref{Plain lists}) can be made a checkbox
  2609. by starting it with the string @samp{[ ]}. This feature is similar to
  2610. TODO items (@pxref{TODO items}), but more lightweight. Checkboxes are
  2611. not included into the global TODO list, so they are often great to split
  2612. a task into a number of simple steps. Or you can use them in a shopping
  2613. list. To toggle a checkbox, use @kbd{C-c C-c}, or try Piotr Zielinski's
  2614. @file{org-mouse.el}. Here is an example of a checkbox list.
  2615. @example
  2616. * TODO Organize party [3/6]
  2617. - call people [1/3]
  2618. - [ ] Peter
  2619. - [X] Sarah
  2620. - [ ] Sam
  2621. - [X] order food
  2622. - [ ] think about what music to play
  2623. - [X] talk to the neighbors
  2624. @end example
  2625. @cindex statistics, for checkboxes
  2626. @cindex checkbox statistics
  2627. The @samp{[3/6]} and @samp{[1/3]} in the first and second line are
  2628. cookies indicating how many checkboxes are present in this entry, and
  2629. how many of them have been checked off. This can give you an idea on
  2630. how many checkboxes remain, even without opening a folded entry. The
  2631. cookies can be placed into a headline or into (the first line of) a
  2632. plain list item. Each cookie covers all checkboxes structurally below
  2633. that headline/item. You have to insert the cookie yourself by typing
  2634. either @samp{[/]} or @samp{[%]}. In the first case you get an @samp{n
  2635. out of m} result, in the second case you get information about the
  2636. percentage of checkboxes checked (in the above example, this would be
  2637. @samp{[50%]} and @samp{[33%], respectively}).
  2638. @noindent The following commands work with checkboxes:
  2639. @table @kbd
  2640. @kindex C-c C-c
  2641. @item C-c C-c
  2642. Toggle checkbox at point. With prefix argument, set it to @samp{[-]},
  2643. which is considered to be an intermediate state.
  2644. @kindex C-c C-x C-b
  2645. @item C-c C-x C-b
  2646. Toggle checkbox at point.
  2647. @itemize @minus
  2648. @item
  2649. If there is an active region, toggle the first checkbox in the region
  2650. and set all remaining boxes to the same status as the first. If you
  2651. want to toggle all boxes in the region independently, use a prefix
  2652. argument.
  2653. @item
  2654. If the cursor is in a headline, toggle checkboxes in the region between
  2655. this headline and the next (so @emph{not} the entire subtree).
  2656. @item
  2657. If there is no active region, just toggle the checkbox at point.
  2658. @end itemize
  2659. @kindex M-S-@key{RET}
  2660. @item M-S-@key{RET}
  2661. Insert a new item with a checkbox.
  2662. This works only if the cursor is already in a plain list item
  2663. (@pxref{Plain lists}).
  2664. @kindex C-c #
  2665. @item C-c #
  2666. Update the checkbox statistics in the current outline entry. When
  2667. called with a @kbd{C-u} prefix, update the entire file. Checkbox
  2668. statistic cookies are updated automatically if you toggle checkboxes
  2669. with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
  2670. delete boxes or add/change them by hand, use this command to get things
  2671. back into synch. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
  2672. @end table
  2673. @node Tags, Properties and columns, TODO items, Top
  2674. @chapter Tags
  2675. @cindex tags
  2676. @cindex headline tagging
  2677. @cindex matching, tags
  2678. @cindex sparse tree, tag based
  2679. If you wish to implement a system of labels and contexts for
  2680. cross-correlating information, an excellent way is to assign @i{tags} to
  2681. headlines. Org-mode has extensive support for using tags.
  2682. Every headline can contain a list of tags, at the end of the headline.
  2683. Tags are normal words containing letters, numbers, @samp{_}, and
  2684. @samp{@@}. Tags must be preceded and followed by a single colon; like
  2685. @samp{:WORK:}. Several tags can be specified like @samp{:WORK:URGENT:}.
  2686. @menu
  2687. * Tag inheritance:: Tags use the tree structure of the outline
  2688. * Setting tags:: How to assign tags to a headline
  2689. * Tag searches:: Searching for combinations of tags
  2690. @end menu
  2691. @node Tag inheritance, Setting tags, Tags, Tags
  2692. @section Tag inheritance
  2693. @cindex inheritance, of tags
  2694. @cindex sublevels, inclusion into tags match
  2695. @i{Tags} make use of the hierarchical structure of outline trees. If a
  2696. heading has a certain tag, all subheadings will inherit the tag as
  2697. well. For example, in the list
  2698. @example
  2699. * Meeting with the French group :WORK:
  2700. ** Summary by Frank :BOSS:NOTES:
  2701. *** TODO Prepare slides for him :ACTION:
  2702. @end example
  2703. @noindent
  2704. the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
  2705. @samp{:NOTES:}, and @samp{:ACTION:}. When executing tag searches and
  2706. Org-mode finds that a certain headline matches the search criterion, it
  2707. will not check any sublevel headline, assuming that these likely also
  2708. match, and that the list of matches can become very long. This may
  2709. not be what you want, however, and you can influence inheritance and
  2710. searching using the variables @code{org-use-tag-inheritance} and
  2711. @code{org-tags-match-list-sublevels}.
  2712. @node Setting tags, Tag searches, Tag inheritance, Tags
  2713. @section Setting tags
  2714. @cindex setting tags
  2715. @cindex tags, setting
  2716. @kindex M-@key{TAB}
  2717. Tags can simply be typed into the buffer at the end of a headline.
  2718. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  2719. also a special command for inserting tags:
  2720. @table @kbd
  2721. @kindex C-c C-c
  2722. @item C-c C-c
  2723. @cindex completion, of tags
  2724. Enter new tags for the current headline. Org-mode will either offer
  2725. completion or a special single-key interface for setting tags, see
  2726. below. After pressing @key{RET}, the tags will be inserted and aligned
  2727. to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
  2728. tags in the current buffer will be aligned to that column, just to make
  2729. things look nice. TAGS are automatically realigned after promotion,
  2730. demotion, and TODO state changes (@pxref{TODO basics}).
  2731. @end table
  2732. Org will support tag insertion based on a @emph{list of tags}. By
  2733. default this list is constructed dynamically, containing all tags
  2734. currently used in the buffer. You may also globally specify a hard list
  2735. of tags with the variable @code{org-tag-alist}. Finally you can set
  2736. the default tags for a given file with lines like
  2737. @example
  2738. #+TAGS: @@WORK @@HOME @@TENNISCLUB
  2739. #+TAGS: Laptop Car PC Sailboat
  2740. @end example
  2741. If you have globally defined your preferred set of tags using the
  2742. variable @code{org-tag-alist}, but would like to use a dynamic tag list
  2743. in a specific file: Just add an empty TAGS option line to that file:
  2744. @example
  2745. #+TAGS:
  2746. @end example
  2747. The default support method for entering tags is minibuffer completion.
  2748. However, Org-mode also implements a much better method: @emph{fast tag
  2749. selection}. This method allows to select and deselect tags with a
  2750. single key per tag. To function efficiently, you should assign unique
  2751. keys to most tags. This can be done globally with
  2752. @lisp
  2753. (setq org-tag-alist '(("@@WORK" . ?w) ("@@HOME" . ?h) ("Laptop" . ?l)))
  2754. @end lisp
  2755. @noindent or on a per-file basis with
  2756. @example
  2757. #+TAGS: @@WORK(w) @@HOME(h) @@TENNISCLUB(t) Laptop(l) PC(p)
  2758. @end example
  2759. @noindent
  2760. You can also group together tags that are mutually exclusive. With
  2761. curly braces@footnote{In @code{org-mode-alist} use
  2762. @code{'(:startgroup)} and @code{'(:endgroup)}, respectively. Several
  2763. groups are allowed.}
  2764. @example
  2765. #+TAGS: @{ @@WORK(w) @@HOME(h) @@TENNISCLUB(t) @} Laptop(l) PC(p)
  2766. @end example
  2767. @noindent you indicate that at most one of @samp{@@WORK}, @samp{@@HOME},
  2768. and @samp{@@TENNISCLUB} should be selected.
  2769. @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
  2770. these lines to activate any changes.
  2771. If at least one tag has a selection key, pressing @kbd{C-c C-c} will
  2772. automatically present you with a special interface, listing inherited
  2773. tags, the tags of the current headline, and a list of all legal tags
  2774. with corresponding keys@footnote{Keys will automatically be assigned to
  2775. tags which have no configured keys.}. In this interface, you can use
  2776. the following keys:
  2777. @table @kbd
  2778. @item a-z...
  2779. Pressing keys assigned to tags will add or remove them from the list of
  2780. tags in the current line. Selecting a tag in a group of mutually
  2781. exclusive tags will turn off any other tags from that group.
  2782. @kindex @key{TAB}
  2783. @item @key{TAB}
  2784. Enter a tag in the minibuffer, even if the tag is not in the predefined
  2785. list. You will be able to complete on all tags present in the buffer.
  2786. @kindex @key{SPC}
  2787. @item @key{SPC}
  2788. Clear all tags for this line.
  2789. @kindex @key{RET}
  2790. @item @key{RET}
  2791. Accept the modified set.
  2792. @item C-g
  2793. Abort without installing changes.
  2794. @item q
  2795. If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
  2796. @item !
  2797. Turn off groups of mutually exclusive tags. Use this to (as an
  2798. exception) assign several tags from such a group.
  2799. @item C-c
  2800. Toggle auto-exit after the next change (see below).
  2801. If you are using expert mode, the first @kbd{C-c} will display the
  2802. selection window.
  2803. @end table
  2804. @noindent
  2805. This method lets you assign tags to a headline with very few keys. With
  2806. the above setup, you could clear the current tags and set @samp{@@HOME},
  2807. @samp{Laptop} and @samp{PC} tags with just the following keys: @kbd{C-c
  2808. C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@HOME} to
  2809. @samp{@@WORK} would be done with @kbd{C-c C-c w @key{RET}} or
  2810. alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
  2811. @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
  2812. @key{RET} @key{RET}}.
  2813. If you find that most of the time, you need only a single keypress to
  2814. modify your list of tags, set the variable
  2815. @code{org-fast-tag-selection-single-key}. Then you no longer have to
  2816. press @key{RET} to exit fast tag selection - it will immediately exit
  2817. after the first change. If you then occasionally need more keys, press
  2818. @kbd{C-c} to turn off auto-exit for the current tag selection process
  2819. (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
  2820. C-c}). If you set the variable to the value @code{expert}, the special
  2821. window is not even shown for single-key tag selection, it comes up only
  2822. when you press an extra @kbd{C-c}.
  2823. @node Tag searches, , Setting tags, Tags
  2824. @section Tag searches
  2825. @cindex tag searches
  2826. @cindex searching for tags
  2827. Once a tags system has been set up, it can be used to collect related
  2828. information into special lists.
  2829. @table @kbd
  2830. @kindex C-c \
  2831. @item C-c \
  2832. Create a sparse tree with all headlines matching a tags search. With a
  2833. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  2834. @kindex C-c a m
  2835. @item C-c a m
  2836. Create a global list of tag matches from all agenda files.
  2837. @xref{Matching tags and properties}.
  2838. @kindex C-c a M
  2839. @item C-c a M
  2840. Create a global list of tag matches from all agenda files, but check
  2841. only TODO items and force checking subitems (see variable
  2842. @code{org-tags-match-list-sublevels}).
  2843. @end table
  2844. @cindex Boolean logic, for tag searches
  2845. A @i{tags} search string can use Boolean operators @samp{&} for AND and
  2846. @samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
  2847. Parenthesis are currently not implemented. A tag may also be preceded
  2848. by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
  2849. positive selection. The AND operator @samp{&} is optional when @samp{+}
  2850. or @samp{-} is present. Examples:
  2851. @table @samp
  2852. @item +WORK-BOSS
  2853. Select headlines tagged @samp{:WORK:}, but discard those also tagged
  2854. @samp{:BOSS:}.
  2855. @item WORK|LAPTOP
  2856. Selects lines tagged @samp{:WORK:} or @samp{:LAPTOP:}.
  2857. @item WORK|LAPTOP&NIGHT
  2858. Like before, but require the @samp{:LAPTOP:} lines to be tagged also
  2859. @samp{NIGHT}.
  2860. @end table
  2861. @cindex TODO keyword matching, with tags search
  2862. If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
  2863. can be useful to also match on the TODO keyword. This can be done by
  2864. adding a condition after a slash to a tags match. The syntax is similar
  2865. to the tag matches, but should be applied with consideration: For
  2866. example, a positive selection on several TODO keywords can not
  2867. meaningfully be combined with boolean AND. However, @emph{negative
  2868. selection} combined with AND can be meaningful. To make sure that only
  2869. lines are checked that actually have any TODO keyword, use @kbd{C-c a
  2870. M}, or equivalently start the todo part after the slash with @samp{!}.
  2871. Examples:
  2872. @table @samp
  2873. @item WORK/WAITING
  2874. Select @samp{:WORK:}-tagged TODO lines with the specific TODO
  2875. keyword @samp{WAITING}.
  2876. @item WORK/!-WAITING-NEXT
  2877. Select @samp{:WORK:}-tagged TODO lines that are neither @samp{WAITING}
  2878. nor @samp{NEXT}
  2879. @item WORK/+WAITING|+NEXT
  2880. Select @samp{:WORK:}-tagged TODO lines that are either @samp{WAITING} or
  2881. @samp{NEXT}.
  2882. @end table
  2883. @cindex regular expressions, with tags search
  2884. Any element of the tag/todo match can be a regular expression - in this
  2885. case it must be enclosed in curly braces. For example,
  2886. @samp{WORK+@{^BOSS.*@}} matches headlines that contain the tag
  2887. @samp{WORK} and any tag @i{starting} with @samp{BOSS}.
  2888. @cindex level, require for tags match
  2889. You can also require a headline to be of a certain level, by writing
  2890. instead of any TAG an expression like @samp{LEVEL=3}. For example, a
  2891. search @samp{+LEVEL=3+BOSS/-DONE} lists all level three headlines that
  2892. have the tag BOSS and are @emph{not} marked with the todo keyword DONE.
  2893. @node Properties and columns, Timestamps, Tags, Top
  2894. @chapter Properties and Columns
  2895. @cindex properties
  2896. Properties are a set of key-value pairs associated with an entry. There
  2897. are two main applications for properties in Org-mode. First, properties
  2898. are like tags, but with a value. For example, in a file where you
  2899. document bugs and plan releases of a piece of software, instead of using
  2900. tags like @code{:release_1:}, @code{:release_2:}, it can be more
  2901. efficient to use a property @code{RELEASE} with a value @code{1.0} or
  2902. @code{2.0}. Second, you can use properties to implement (very basic)
  2903. database capabilities in an Org-mode buffer, for example to create a
  2904. list of Music CD's you own. You can edit and view properties
  2905. conveniently in column view (@pxref{Column view}).
  2906. @menu
  2907. * Property syntax:: How properties are spelled out
  2908. * Special properties:: Access to other Org-mode features
  2909. * Property searches:: Matching property values
  2910. * Column view:: Tabular viewing and editing
  2911. * Property API:: Properties for Lisp programmers
  2912. @end menu
  2913. @node Property syntax, Special properties, Properties and columns, Properties and columns
  2914. @section Property Syntax
  2915. @cindex property syntax
  2916. @cindex drawer, for properties
  2917. Properties are key-value pairs. They need to be inserted into a special
  2918. drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
  2919. is specified on a single line, with the key (surrounded by colons)
  2920. first, and the value after it. Here is an example:
  2921. @example
  2922. * CD collection
  2923. ** Classic
  2924. *** Goldberg Variations
  2925. :PROPERTIES:
  2926. :Title: Goldberg Variations
  2927. :Composer: J.S. Bach
  2928. :Artist: Glen Gould
  2929. :Publisher: Deutsche Grammphon
  2930. :NDisks: 1
  2931. :END:
  2932. @end example
  2933. You may define the allowed values for a particular property @samp{XYZ}
  2934. by setting a property @samp{XYZ_ALL}. This special property is
  2935. @emph{inherited}, so if you set it in a level 1 entry, it will apply to
  2936. the entire tree. When allowed values are defined, setting the
  2937. corresponding property becomes easier and is less prone to typing
  2938. errors. For the example with the CD collection, we can predefine
  2939. publishers and the number of disks in a box like this:
  2940. @example
  2941. * CD collection
  2942. :PROPERTIES:
  2943. :NDisks_ALL: 1 2 3 4
  2944. :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
  2945. :END:
  2946. @end example
  2947. If you want to set properties that can be inherited by any entry in a
  2948. file, use a line like
  2949. @example
  2950. #+PROPERTY: NDisks_ALL 1 2 3 4
  2951. @end example
  2952. Property values set with the global variable
  2953. @code{org-global-properties} can be inherited by all entries in all
  2954. Org-mode files.
  2955. @noindent
  2956. The following commands help to work with properties:
  2957. @table @kbd
  2958. @kindex M-@key{TAB}
  2959. @item M-@key{TAB}
  2960. After an initial colon in a line, complete property keys. All keys used
  2961. in the current file will be offered as possible completions.
  2962. @item M-x org-insert-property-drawer
  2963. Insert a property drawer into the current entry. The drawer will be
  2964. inserted early in the entry, but after the lines with planning
  2965. information like deadlines.
  2966. @kindex C-c C-c
  2967. @item C-c C-c
  2968. With the cursor in a property drawer, this executes property commands.
  2969. @item C-c C-c s
  2970. Set a property in the current entry. Both the property and the value
  2971. can be inserted using completion.
  2972. @kindex S-@key{right}
  2973. @kindex S-@key{left}
  2974. @item S-@key{left}/@key{right}
  2975. Switch property at point to the next/previous allowed value.
  2976. @item C-c C-c d
  2977. Remove a property from the current entry.
  2978. @item C-c C-c D
  2979. Globally remove a property, from all entries in the current file.
  2980. @end table
  2981. @node Special properties, Property searches, Property syntax, Properties and columns
  2982. @section Special Properties
  2983. @cindex properties, special
  2984. Special properties provide alternative access method to Org-mode
  2985. features discussed in the previous chapters, like the TODO state or the
  2986. priority of an entry. This interface exists so that you can include
  2987. these states into columns view (@pxref{Column view}). The following
  2988. property names are special and should not be used as keys in the
  2989. properties drawer:
  2990. @example
  2991. TODO @r{The TODO keyword of the entry.}
  2992. TAGS @r{The tags defined directly in the headline.}
  2993. ALLTAGS @r{All tags, including inherited ones.}
  2994. PRIORITY @r{The priority of the entry, a string with a single letter.}
  2995. DEADLINE @r{The deadline time string, without the angular brackets.}
  2996. SCHEDULED @r{The scheduling time stamp, without the angular brackets.}
  2997. @end example
  2998. @node Property searches, Column view, Special properties, Properties and columns
  2999. @section Property searches
  3000. @cindex properties, searching
  3001. To create sparse trees and special lists with selection based on
  3002. properties, the same commands are used as for tag searches (@pxref{Tag
  3003. searches}), and the same logic applies. For example, a search string
  3004. @example
  3005. +WORK-BOSS+PRIORITY="A"+coffee="unlimited"+with=@{Sarah\|Denny@}
  3006. @end example
  3007. @noindent
  3008. finds entries tagged @samp{:WORK:} but not @samp{:BOSS:}, which
  3009. also have a priority value @samp{A}, a @samp{:coffee:} property with the
  3010. value @samp{unlimited}, and a @samp{:with:} property that is matched by
  3011. the regular expression @samp{Sarah\|Denny}.
  3012. @node Column view, Property API, Property searches, Properties and columns
  3013. @section Column View
  3014. A great way to view and edit properties in an outline tree is
  3015. @emph{column view}. In column view, each outline item is turned into a
  3016. table row. Columns in this table provide access to properties of the
  3017. entries. Org-mode implements columns by overlaying a tabular structure
  3018. over the headline of each item. While the headlines have been turned
  3019. into a table row, you can still change the visibility of the outline
  3020. tree. For example, you get a compact table by switching to CONTENTS
  3021. view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
  3022. is active), but you can still open, read, and edit the entry below each
  3023. headline. Or, you can switch to column view after executing a sparse
  3024. tree command and in this way get a table only for the selected items.
  3025. Column view also works in agenda buffers (@pxref{Agenda views}) where
  3026. queries have collected selected items, possibly from a number of files.
  3027. @menu
  3028. * Defining columns:: The COLUMNS format property
  3029. * Using column view:: How to create and use column view
  3030. @end menu
  3031. @node Defining columns, Using column view, Column view, Column view
  3032. @subsection Defining Columns
  3033. @cindex column view, for properties
  3034. @cindex properties, column view
  3035. Setting up a column view first requires defining the columns. This is
  3036. done by defining a column format line.
  3037. @menu
  3038. * Scope of column definitions:: Where defined, where valid?
  3039. * Column attributes:: Appearance and content of a column
  3040. @end menu
  3041. @node Scope of column definitions, Column attributes, Defining columns, Defining columns
  3042. @subsubsection Scope of column definitions
  3043. To define a column format for an entire file, use a line like
  3044. @example
  3045. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3046. @end example
  3047. To specify a format that only applies to a specific tree, add a COLUMNS
  3048. property to the top node of that tree, for example
  3049. @example
  3050. ** Top node for columns view
  3051. :PROPERTIES:
  3052. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3053. :END:
  3054. @end example
  3055. If a @code{COLUMNS} property is present in an entry, it defines columns
  3056. for the entry itself, and for the entire subtree below it. Since the
  3057. column definition is part of the hierarchical structure of the document,
  3058. you can define columns on level 1 that are general enough for all
  3059. sublevels, and more specific columns further down, when you edit a
  3060. deeper part of the tree.
  3061. @node Column attributes, , Scope of column definitions, Defining columns
  3062. @subsubsection Column attributes
  3063. A column definition sets the attributes of a column. The general
  3064. definition looks like this:
  3065. @example
  3066. %[width]property[(title)][@{summary-type@}]
  3067. @end example
  3068. @noindent
  3069. Except for the percent sign and the property name, all items are
  3070. optional. The individual parts have the following meaning:
  3071. @example
  3072. width @r{An integer specifying the width of the column in characters.}
  3073. @r{If omitted, the width will be determined automatically.}
  3074. property @r{The property that should be edited in this column.}
  3075. (title) @r{The header text for the column. If omitted, the}
  3076. @r{property name is used.}
  3077. @{summary-type@} @r{The summary type. If specified, the column values for}
  3078. @r{parent nodes are computed from the children.}
  3079. @r{Supported summary types are:}
  3080. @{+@} @r{Sum numbers in this column.}
  3081. @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
  3082. @{X@} @r{Checkbox status, [X] if all children are [X].}
  3083. @end example
  3084. @noindent
  3085. Here is an example for a complete columns definition, along with allowed
  3086. values.
  3087. @example
  3088. :COLUMNS: %20ITEM %9Approved(Approved?)@{X@} %Owner %11Status %10Time_Spent@{:@}
  3089. :Owner_ALL: Tammy Mark Karl Lisa Don
  3090. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  3091. :Approved_ALL: "[ ]" "[X]"
  3092. @end example
  3093. The first column, @samp{%25ITEM}, means the first 25 characters of the
  3094. item itself, i.e. of the headline. You probably always should start the
  3095. column definition with the ITEM specifier. The other specifiers create
  3096. columns @samp{Owner} with a list of names as allowed values, for
  3097. @samp{Status} with four different possible values, and for a checkbox
  3098. field @samp{Approved}. When no width is given after the @samp{%}
  3099. character, the column will be exactly as wide as it needs to be in order
  3100. to fully display all values. The @samp{Approved} column does have a
  3101. modified title (@samp{Approved?}, with a question mark). Summaries will
  3102. be created for the @samp{Time_Spent} column by adding time duration
  3103. expressions like HH:MM, and for the @samp{Approved} column, by providing
  3104. an @samp{[X]} status if all children have been checked.
  3105. @node Using column view, , Defining columns, Column view
  3106. @subsection Using Column View
  3107. @table @kbd
  3108. @tsubheading{Turning column view on and off}
  3109. @kindex C-c C-x C-c
  3110. @item C-c C-x C-c
  3111. Create the column view for the local environment. This command searches
  3112. the hierarchy, up from point, for a @code{COLUMNS} property that defines
  3113. a format. When one is found, the column view table is established for
  3114. the entire tree, starting from the entry that contains the @code{COLUMNS}
  3115. property. If none is found, the format is taken from the @code{#+COLUMNS}
  3116. line or from the variable @code{org-columns-default-format}, and column
  3117. view is established for the current entry and its subtree.
  3118. @kindex q
  3119. @item q
  3120. Exit column view.
  3121. @tsubheading{Editing values}
  3122. @item @key{left} @key{right} @key{up} @key{down}
  3123. Move through the column view from field to field.
  3124. @kindex S-@key{left}
  3125. @kindex S-@key{right}
  3126. @item S-@key{left}/@key{right}
  3127. Switch to the next/previous allowed value of the field. For this, you
  3128. have to have specified allowed values for a property.
  3129. @kindex n
  3130. @kindex p
  3131. @itemx n / p
  3132. Same as @kbd{S-@key{left}/@key{right}}
  3133. @kindex e
  3134. @item e
  3135. Edit the property at point. For the special properties, this will
  3136. invoke the same interface that you normally use to change that
  3137. property. For example, when editing a TAGS property, the tag completion
  3138. or fast selection interface will pop up.
  3139. @kindex v
  3140. @item v
  3141. View the full value of this property. This is useful if the width of
  3142. the column is smaller than that of the value.
  3143. @kindex a
  3144. @item a
  3145. Edit the list of allowed values for this property. If the list is found
  3146. in the hierarchy, the modified values is stored there. If no list is
  3147. found, the new value is stored in the first entry that is part of the
  3148. current column view.
  3149. @tsubheading{Modifying the table structure}
  3150. @kindex <
  3151. @kindex >
  3152. @item < / >
  3153. Make the column narrower/wider by one character.
  3154. @kindex S-M-@key{right}
  3155. @item S-M-@key{right}
  3156. Insert a new column, to the right of the current column.
  3157. @kindex S-M-@key{left}
  3158. @item S-M-@key{left}
  3159. Delete the current column.
  3160. @end table
  3161. @node Property API, , Column view, Properties and columns
  3162. @section The Property API
  3163. @cindex properties, API
  3164. @cindex API, for properties
  3165. There is a full API for accessing and changing properties. This API can
  3166. be used by Emacs Lisp programs to work with properties and to implement
  3167. features based on them. For more information see @ref{Using the
  3168. property API}.
  3169. @node Timestamps, Agenda views, Properties and columns, Top
  3170. @chapter Timestamps
  3171. @cindex time stamps
  3172. @cindex date stamps
  3173. Items can be labeled with timestamps to make them useful for project
  3174. planning.
  3175. @menu
  3176. * Time stamps:: Assigning a time to a tree entry
  3177. * Creating timestamps:: Commands which insert timestamps
  3178. * Deadlines and scheduling:: Planning your work
  3179. * Progress logging:: Documenting when what work was done.
  3180. @end menu
  3181. @node Time stamps, Creating timestamps, Timestamps, Timestamps
  3182. @section Time stamps, deadlines and scheduling
  3183. @cindex time stamps
  3184. @cindex ranges, time
  3185. @cindex date stamps
  3186. @cindex deadlines
  3187. @cindex scheduling
  3188. A time stamp is a specification of a date (possibly with time or a range
  3189. of times) in a special format, either @samp{<2003-09-16 Tue>} or
  3190. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
  3191. 12:00-12:30>}@footnote{This is the standard ISO date/time format. If
  3192. you cannot get used to these, see @ref{Custom time format}}. A time
  3193. stamp can appear anywhere in the headline or body of an org-tree entry.
  3194. Its presence causes entries to be shown on specific dates in the agenda
  3195. (@pxref{Weekly/Daily agenda}). We distinguish:
  3196. @table @var
  3197. @item Plain time stamp
  3198. @cindex timestamp
  3199. A simple time stamp just assigns a date/time to an item. This is just
  3200. like writing down an appointment in a paper agenda, or like writing down
  3201. an event in a diary, when you want to take note of when something
  3202. happened. In the timeline and agenda displays, the headline of an entry
  3203. associated with a plain time stamp will be shown exactly on that date.
  3204. @example
  3205. * Meet Peter at the movies <2006-11-01 Wed 19:15>
  3206. * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
  3207. @end example
  3208. @item Time stamp with repeater interval
  3209. @cindex timestamp, with repeater interval
  3210. A time stamp may contain a @emph{repeater interval}, indicating that it
  3211. applies not only on the given date, but again and again after a certain
  3212. interval of N days (d), weeks (w), months(m), or years(y). The
  3213. following will show up in the agenda every Wednesday:
  3214. @example
  3215. * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
  3216. @end example
  3217. @item Diary-style sexp entries
  3218. For more complex date specifications, Org-mode supports using the
  3219. special sexp diary entries implemented in the Emacs calendar/diary
  3220. package. For example
  3221. @example
  3222. * The nerd meeting on every 2nd Thursday of the month
  3223. <%%(diary-float t 4 2)>
  3224. @end example
  3225. @item Time/Date range
  3226. @cindex timerange
  3227. @cindex date range
  3228. Two time stamps connected by @samp{--} denote a range. The headline
  3229. will be shown on the first and last day of the range, and on any dates
  3230. that are displayed and fall in the range. Here is an example:
  3231. @example
  3232. ** Meeting in Amsterdam
  3233. <2004-08-23 Mon>--<2004-08-26 Thu>
  3234. @end example
  3235. @item Inactive time stamp
  3236. @cindex timestamp, inactive
  3237. @cindex inactive timestamp
  3238. Just like a plain time stamp, but with square brackets instead of
  3239. angular ones. These time stamps are inactive in the sense that they do
  3240. @emph{not} trigger an entry to show up in the agenda.
  3241. @example
  3242. * Gillian comes late for the fifth time [2006-11-01 Wed]
  3243. @end example
  3244. @end table
  3245. @node Creating timestamps, Deadlines and scheduling, Time stamps, Timestamps
  3246. @section Creating timestamps
  3247. @cindex creating timestamps
  3248. @cindex timestamps, creating
  3249. For Org-mode to recognize time stamps, they need to be in the specific
  3250. format. All commands listed below produce time stamps in the correct
  3251. format.
  3252. @table @kbd
  3253. @kindex C-c .
  3254. @item C-c .
  3255. Prompt for a date and insert a corresponding time stamp. When the
  3256. cursor is at a previously used time stamp, it is updated to NOW. When
  3257. this command is used twice in succession, a time range is inserted.
  3258. @c
  3259. @kindex C-u C-c .
  3260. @item C-u C-c .
  3261. Like @kbd{C-c .}, but use the alternative format which contains date
  3262. and time. The default time can be rounded to multiples of 5 minutes,
  3263. see the option @code{org-time-stamp-rounding-minutes}.
  3264. @c
  3265. @kindex C-c !
  3266. @item C-c !
  3267. Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
  3268. an agenda entry.
  3269. @c
  3270. @kindex C-c <
  3271. @item C-c <
  3272. Insert a time stamp corresponding to the cursor date in the Calendar.
  3273. @c
  3274. @kindex C-c >
  3275. @item C-c >
  3276. Access the Emacs calendar for the current date. If there is a
  3277. timestamp in the current line, goto the corresponding date
  3278. instead.
  3279. @c
  3280. @kindex C-c C-o
  3281. @item C-c C-o
  3282. Access the agenda for the date given by the time stamp or -range at
  3283. point (@pxref{Weekly/Daily agenda}).
  3284. @c
  3285. @kindex S-@key{left}
  3286. @kindex S-@key{right}
  3287. @item S-@key{left}
  3288. @itemx S-@key{right}
  3289. Change date at cursor by one day. These key bindings conflict with
  3290. CUA-mode (@pxref{Conflicts}).
  3291. @c
  3292. @kindex S-@key{up}
  3293. @kindex S-@key{down}
  3294. @item S-@key{up}
  3295. @itemx S-@key{down}
  3296. Change the item under the cursor in a timestamp. The cursor can be on a
  3297. year, month, day, hour or minute. Note that if the cursor is in a
  3298. headline and not at a time stamp, these same keys modify the priority of
  3299. an item. (@pxref{Priorities}). The key bindings also conflict with
  3300. CUA-mode (@pxref{Conflicts}).
  3301. @c
  3302. @kindex C-c C-y
  3303. @cindex evaluate time range
  3304. @item C-c C-y
  3305. Evaluate a time range by computing the difference between start and
  3306. end. With prefix arg, insert result after the time range (in a table:
  3307. into the following column).
  3308. @end table
  3309. @menu
  3310. * The date/time prompt:: How org-mode helps you entering date and time
  3311. * Custom time format:: Making dates look differently
  3312. @end menu
  3313. @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
  3314. @subsection The date/time prompt
  3315. @cindex date, reading in minibuffer
  3316. @cindex time, reading in minibuffer
  3317. When Org-mode prompts for a date/time, the prompt suggests to enter an
  3318. ISO date. But it will in fact accept any string containing some date
  3319. and/or time information. You can, for example, use @kbd{C-y} to paste a
  3320. (possibly multi-line) string copied from an email message. Org-mode
  3321. will find whatever information is in there and will replace anything not
  3322. specified with the current date and time. For example:
  3323. @example
  3324. 3-2-5 --> 2003-02-05
  3325. feb 15 --> currentyear-02-15
  3326. sep 12 9 --> 2009-09-12
  3327. 12:45 --> today 12:45
  3328. 22 sept 0:34 --> currentyear-09-22 0:34
  3329. 12 --> currentyear-currentmonth-12
  3330. Fri --> nearest Friday (today or later)
  3331. +4 --> 4 days from now (if +N is the only thing given)
  3332. @end example
  3333. The function understands English month and weekday abbreviations. If
  3334. you want to use unabbreviated names and/or other languages, configure
  3335. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  3336. @cindex calendar, for selecting date
  3337. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
  3338. you don't need/want the calendar, configure the variable
  3339. @code{org-popup-calendar-for-date-prompt}.}. When you exit the date
  3340. prompt, either by clicking on a date in the calendar, or by pressing
  3341. @key{RET}, the date selected in the calendar will be combined with the
  3342. information entered at the prompt. You can control the calendar fully
  3343. from the minibuffer:
  3344. @table @kbd
  3345. @kindex <
  3346. @item <
  3347. Scroll calendar backwards by one month.
  3348. @kindex >
  3349. @item >
  3350. Scroll calendar forwards by one month.
  3351. @kindex mouse-1
  3352. @item mouse-1
  3353. Select date by clicking on it.
  3354. @kindex S-@key{right}
  3355. @item S-@key{right}
  3356. One day forward.
  3357. @kindex S-@key{left}
  3358. @item S-@key{left}
  3359. One day back.
  3360. @kindex S-@key{down}
  3361. @item S-@key{down}
  3362. One week forward.
  3363. @kindex S-@key{up}
  3364. @item S-@key{up}
  3365. One week back.
  3366. @kindex M-S-@key{right}
  3367. @item M-S-@key{right}
  3368. One month forward.
  3369. @kindex M-S-@key{left}
  3370. @item M-S-@key{left}
  3371. One month back.
  3372. @kindex @key{RET}
  3373. @item @key{RET}
  3374. Choose date in calendar (only if nothing was typed into minibuffer).
  3375. @end table
  3376. @node Custom time format, , The date/time prompt, Creating timestamps
  3377. @subsection Custom time format
  3378. @cindex custom date/time format
  3379. @cindex time format, custom
  3380. @cindex date format, custom
  3381. Org-mode uses the standard ISO notation for dates and times as it is
  3382. defined in ISO 8601. If you cannot get used to this and require another
  3383. representation of date and time to keep you happy, you can get it by
  3384. customizing the variables @code{org-display-custom-times} and
  3385. @code{org-time-stamp-custom-formats}.
  3386. @table @kbd
  3387. @kindex C-c C-x C-t
  3388. @item C-c C-x C-t
  3389. Toggle the display of custom formats for dates and times.
  3390. @end table
  3391. @noindent
  3392. Org-mode needs the default format for scanning, so the custom date/time
  3393. format does not @emph{replace} the default format - instead it is put
  3394. @emph{over} the default format using text properties. This has the
  3395. following consequences:
  3396. @itemize @bullet
  3397. @item
  3398. You cannot place the cursor onto a time stamp anymore, only before or
  3399. after.
  3400. @item
  3401. The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
  3402. each component of a time stamp. If the cursor is at the beginning of
  3403. the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
  3404. just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
  3405. time will be changed by one minute.
  3406. @item
  3407. If the time stamp contains a range of clock times or a repeater, these
  3408. will not be overlayed, but remain in the buffer as they were.
  3409. @item
  3410. When you delete a time stamp character-by-character, it will only
  3411. disappear from the buffer after @emph{all} (invisible) characters
  3412. belonging to the ISO timestamp have been removed.
  3413. @item
  3414. If the custom time stamp format is longer than the default and you are
  3415. using dates in tables, table alignment will be messed up. If the custom
  3416. format is shorter, things do work as expected.
  3417. @end itemize
  3418. @node Deadlines and scheduling, Progress logging, Creating timestamps, Timestamps
  3419. @section Deadlines and Scheduling
  3420. A time stamp may be preceded by special keywords to facilitate planning
  3421. of work:
  3422. @table @var
  3423. @item DEADLINE
  3424. @cindex DEADLINE keyword
  3425. The task (most likely a TODO item) is supposed to be finished on that
  3426. date, and it will be listed then. In addition, the compilation for
  3427. @emph{today} will carry a warning about the approaching or missed
  3428. deadline, starting @code{org-deadline-warning-days} before the due date,
  3429. and continuing until the entry is marked DONE. An example:
  3430. @example
  3431. *** TODO write article about the Earth for the Guide
  3432. The editor in charge is [[bbdb:Ford Prefect]]
  3433. DEADLINE: <2004-02-29 Sun>
  3434. @end example
  3435. You can specify a different lead time for warnings for a specific
  3436. deadlines using the following syntax. Here is an example with a warning
  3437. period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
  3438. @item SCHEDULED
  3439. @cindex SCHEDULED keyword
  3440. You are planning to start working on that task on the given date. The
  3441. headline will be listed under the given date@footnote{It will still be
  3442. listed on that date after it has been marked DONE. If you don't like
  3443. this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
  3444. addition, a reminder that the scheduled date has passed will be present
  3445. in the compilation for @emph{today}, until the entry is marked DONE.
  3446. I.e., the task will automatically be forwarded until completed.
  3447. @example
  3448. *** TODO Call Trillian for a date on New Years Eve.
  3449. SCHEDULED: <2004-12-25 Sat>
  3450. @end example
  3451. @end table
  3452. @menu
  3453. * Inserting deadline/schedule:: Planning items
  3454. * Repeated tasks:: Items that show up again and again
  3455. @end menu
  3456. @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
  3457. @subsection Inserting deadline/schedule
  3458. The following commands allow to quickly insert a deadline or to schedule
  3459. an item:
  3460. @table @kbd
  3461. @c
  3462. @kindex C-c C-d
  3463. @item C-c C-d
  3464. Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
  3465. happen in the line directly following the headline.
  3466. @c FIXME Any CLOSED timestamp will be removed.????????
  3467. @c
  3468. @kindex C-c C-w
  3469. @cindex sparse tree, for deadlines
  3470. @item C-c C-w
  3471. Create a sparse tree with all deadlines that are either past-due, or
  3472. which will become due within @code{org-deadline-warning-days}.
  3473. With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
  3474. prefix, check that many days. For example, @kbd{C-1 C-c C-w} shows
  3475. all deadlines due tomorrow.
  3476. @c
  3477. @kindex C-c C-s
  3478. @item C-c C-s
  3479. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
  3480. happen in the line directly following the headline. Any CLOSED
  3481. timestamp will be removed.
  3482. @end table
  3483. @node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
  3484. @subsection Repeated Tasks
  3485. Some tasks need to be repeated again and again, and Org-mode therefore
  3486. allows to use a repeater in a DEADLINE or SCHEDULED time stamp, for
  3487. example:
  3488. @example
  3489. ** TODO Pay the rent
  3490. DEADLINE: <2005-10-01 Sat +1m>
  3491. @end example
  3492. Deadlines and scheduled items produce entries in the agenda when they
  3493. are over-due, so it is important to be able to mark such an entry as
  3494. completed once you have done so. When you mark a DEADLINE or a SCHEDULE
  3495. with the todo keyword DONE, it will no longer produce entries in the
  3496. agenda. The problem with this is, however, that then also the
  3497. @emph{next} instance of the repeated entry will not be active. Org-mode
  3498. deals with this in the following way: When you try to mark such an entry
  3499. DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
  3500. time stamp by the repeater interval, and immediately set the entry state
  3501. back to TODO. In the example above, setting the state to DONE would
  3502. actually switch the date like this:
  3503. @example
  3504. ** TODO Pay the rent
  3505. DEADLINE: <2005-11-01 Tue +1m>
  3506. @end example
  3507. You will also be prompted for a note that will be put under the DEADLINE
  3508. line to keep a record that you actually acted on the previous instance
  3509. of this deadline.
  3510. As a consequence of shifting the base date, this entry will no longer be
  3511. visible in the agenda when checking past dates, but all future instances
  3512. will be visible.
  3513. You may have both scheduling and deadline information for a specific
  3514. task - just make sure that the repeater intervals on both are the same.
  3515. @node Progress logging, , Deadlines and scheduling, Timestamps
  3516. @section Progress Logging
  3517. @cindex progress logging
  3518. @cindex logging, of progress
  3519. Org-mode can automatically record a time stamp when you mark a TODO item
  3520. as DONE, or even each time when you change the state of a TODO item.
  3521. You can also measure precisely the time you spent on specific items in a
  3522. project by starting and stopping a clock when you start and stop working
  3523. on an aspect of a project.
  3524. @menu
  3525. * Closing items:: When was this entry marked DONE?
  3526. * Tracking TODO state changes:: When did the status change?
  3527. * Clocking work time:: When exactly did you work on this item?
  3528. @end menu
  3529. @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
  3530. @subsection Closing items
  3531. If you want to keep track of @emph{when} a certain TODO item was
  3532. finished, turn on logging with@footnote{The corresponding in-buffer
  3533. setting is: @code{#+STARTUP: logdone}}
  3534. @lisp
  3535. (setq org-log-done t)
  3536. @end lisp
  3537. @noindent
  3538. Then each time you turn a TODO entry into DONE using either @kbd{C-c
  3539. C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
  3540. @samp{CLOSED: [timestamp]} will be inserted just after the headline. If
  3541. you turn the entry back into a TODO item through further state cycling,
  3542. that line will be removed again. In the timeline (@pxref{Timeline}) and
  3543. in the agenda (@pxref{Weekly/Daily agenda}), you can then use the
  3544. @kbd{l} key to display the TODO items closed on each day, giving you an
  3545. overview of what has been done on a day. If you want to record a note
  3546. along with the timestamp, use@footnote{The corresponding in-buffer
  3547. setting is: @code{#+STARTUP: lognotedone}}
  3548. @lisp
  3549. (setq org-log-done '(done))
  3550. @end lisp
  3551. @node Tracking TODO state changes, Clocking work time, Closing items, Progress logging
  3552. @subsection Tracking TODO state changes
  3553. When TODO keywords are used as workflow states (@pxref{Workflow
  3554. states}), you might want to keep track of when a state change occurred,
  3555. and you may even want to attach notes to that state change. With the
  3556. setting
  3557. @lisp
  3558. (setq org-log-done '(state))
  3559. @end lisp
  3560. @noindent
  3561. each state change will prompt you for a note that will be attached to
  3562. the current headline. Very likely you do not want this verbose tracking
  3563. all the time, so it is probably better to configure this behavior with
  3564. in-buffer options. For example, if you are tracking purchases, put
  3565. these into a separate file that starts with:
  3566. @example
  3567. #+SEQ_TODO: TODO ORDERED INVOICE PAYED RECEIVED SENT
  3568. #+STARTUP: lognotestate
  3569. @end example
  3570. @node Clocking work time, , Tracking TODO state changes, Progress logging
  3571. @subsection Clocking work time
  3572. Org-mode allows you to clock the time you spent on specific tasks in a
  3573. project. When you start working on an item, you can start the clock.
  3574. When you stop working on that task, or when you mark the task done, the
  3575. clock is stopped and the corresponding time interval is recorded. It
  3576. also computes the total time spent on each subtree of a project.
  3577. @table @kbd
  3578. @kindex C-c C-x C-i
  3579. @item C-c C-x C-i
  3580. Start the clock on the current item (clock-in). This inserts the CLOCK
  3581. keyword together with a timestamp.
  3582. @kindex C-c C-x C-o
  3583. @item C-c C-x C-o
  3584. Stop the clock (clock-out). The inserts another timestamp at the same
  3585. location where the clock was last started. It also directly computes
  3586. the resulting time in inserts it after the time range as @samp{=>
  3587. HH:MM}. See the variable @code{org-log-done} for the possibility to
  3588. record an additional note together with the clock-out time
  3589. stamp@footnote{The corresponding in-buffer setting is: @code{#+STARTUP:
  3590. lognoteclock-out}}.
  3591. @kindex C-c C-y
  3592. @item C-c C-y
  3593. Recompute the time interval after changing one of the time stamps. This
  3594. is only necessary if you edit the time stamps directly. If you change
  3595. them with @kbd{S-@key{cursor}} keys, the update is automatic.
  3596. @kindex C-c C-t
  3597. @item C-c C-t
  3598. Changing the TODO state of an item to DONE automatically stops the clock
  3599. if it is running in this same item.
  3600. @kindex C-c C-x C-x
  3601. @item C-c C-x C-x
  3602. Cancel the current clock. This is useful if a clock was started by
  3603. mistake, or if you ended up working on something else.
  3604. @kindex C-c C-x C-d
  3605. @item C-c C-x C-d
  3606. Display time summaries for each subtree in the current buffer. This
  3607. puts overlays at the end of each headline, showing the total time
  3608. recorded under that heading, including the time of any subheadings. You
  3609. can use visibility cycling to study the tree, but the overlays disappear
  3610. when you change the buffer (see variable
  3611. @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  3612. @kindex C-c C-x C-r
  3613. @item C-c C-x C-r
  3614. Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
  3615. report as an org-mode table into the current file.
  3616. @example
  3617. #+BEGIN: clocktable :maxlevel 2 :emphasize nil
  3618. #+END: clocktable
  3619. @end example
  3620. @noindent
  3621. If such a block already exists, its content is replaced by the new
  3622. table. The @samp{BEGIN} line can specify options:
  3623. @example
  3624. :maxlevels @r{Maximum level depth to which times are listed in the table.}
  3625. :emphasize @r{When @code{t}, emphasize level one and level two items}
  3626. :block @r{The time block to consider. This block is specified relative}
  3627. @r{to the current time and may be any of these keywords:}
  3628. @r{@code{today}, @code{yesterday}, @code{thisweek}, @code{lastweek},}
  3629. @r{@code{thismonth}, @code{lastmonth}, @code{thisyear}, or @code{lastyear}}.
  3630. :tstart @r{A time string specifying when to start considering times}
  3631. :tend @r{A time string specifying when to stop considering times}
  3632. @end example
  3633. So to get a clock summary for the current day, you could write
  3634. @example
  3635. #+BEGIN: clocktable :maxlevel 2 :block today
  3636. #+END: clocktable
  3637. @end example
  3638. and to use a specific time range you could write@footnote{Note that all
  3639. parameters must be specified in a single line - the line is broken here
  3640. only to fit it onto the manual.}
  3641. @example
  3642. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  3643. :tend "<2006-08-10 Thu 12:00>"
  3644. #+END: clocktable
  3645. @end example
  3646. @kindex C-u C-c C-x C-u
  3647. @item C-u C-c C-x C-u
  3648. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  3649. you have several clocktable blocks in a buffer.
  3650. @end table
  3651. The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
  3652. the agenda (@pxref{Weekly/Daily agenda}) to show which tasks have been
  3653. worked on or closed during a day.
  3654. @node Agenda views, Embedded LaTeX, Timestamps, Top
  3655. @chapter Agenda Views
  3656. @cindex agenda views
  3657. Due to the way Org-mode works, TODO items, time-stamped items, and
  3658. tagged headlines can be scattered throughout a file or even a number of
  3659. files. To get an overview over open action items, or over events that
  3660. are important for a particular date, this information must be collected,
  3661. sorted and displayed in an organized way.
  3662. Org-mode can select items based on various criteria, and display them
  3663. in a separate buffer. Six different view types are provided:
  3664. @itemize @bullet
  3665. @item
  3666. an @emph{agenda} that is like a calendar and shows information
  3667. for specific dates,
  3668. @item
  3669. a @emph{TODO list} that covers all unfinished
  3670. action items,
  3671. @item
  3672. a @emph{tags view}, showings headlines based on
  3673. the tags associated with them,
  3674. @item
  3675. a @emph{timeline view} that shows all events in a single Org-mode file,
  3676. in time-sorted view,
  3677. @item
  3678. a @emph{stuck projects view} showing projects that currently don't move
  3679. along, and
  3680. @item
  3681. @emph{custom views} that are special tag/keyword searches and
  3682. combinations of different views.
  3683. @end itemize
  3684. @noindent
  3685. The extracted information is displayed in a special @emph{agenda
  3686. buffer}. This buffer is read-only, but provides commands to visit the
  3687. corresponding locations in the original Org-mode files, and even to
  3688. edit these files remotely.
  3689. Two variables control how the agenda buffer is displayed and whether the
  3690. window configuration is restored when the agenda exits:
  3691. @code{org-agenda-window-setup} and
  3692. @code{org-agenda-restore-windows-after-quit}.
  3693. @menu
  3694. * Agenda files:: Files being searched for agenda information
  3695. * Agenda dispatcher:: Keyboard access to agenda views
  3696. * Built-in agenda views:: What is available out of the box?
  3697. * Presentation and sorting:: How agenda items are prepared for display
  3698. * Agenda commands:: Remote editing of org trees
  3699. * Custom agenda views:: Defining special searches and views
  3700. @end menu
  3701. @node Agenda files, Agenda dispatcher, Agenda views, Agenda views
  3702. @section Agenda files
  3703. @cindex agenda files
  3704. @cindex files for agenda
  3705. The information to be shown is collected from all @emph{agenda files},
  3706. the files listed in the variable @code{org-agenda-files}@footnote{If the
  3707. value of that variable is not a list, but a single file name, then the
  3708. list of agenda files will be maintained in that external file.}. Thus even
  3709. if you only work with a single Org-mode file, this file should be put
  3710. into that list@footnote{When using the dispatcher, pressing @kbd{1}
  3711. before selecting a command will actually limit the command to the
  3712. current file, and ignore @code{org-agenda-files} until the next
  3713. dispatcher command.}. You can customize @code{org-agenda-files}, but
  3714. the easiest way to maintain it is through the following commands
  3715. @cindex files, adding to agenda list
  3716. @table @kbd
  3717. @kindex C-c [
  3718. @item C-c [
  3719. Add current file to the list of agenda files. The file is added to
  3720. the front of the list. If it was already in the list, it is moved to
  3721. the front. With prefix arg, file is added/moved to the end.
  3722. @kindex C-c ]
  3723. @item C-c ]
  3724. Remove current file from the list of agenda files.
  3725. @kindex C-,
  3726. @kindex C-'
  3727. @item C-,
  3728. @itemx C-'
  3729. Cycle through agenda file list, visiting one file after the other.
  3730. @end table
  3731. @noindent
  3732. The Org menu contains the current list of files and can be used
  3733. to visit any of them.
  3734. @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda views
  3735. @section The agenda dispatcher
  3736. @cindex agenda dispatcher
  3737. @cindex dispatching agenda commands
  3738. The views are created through a dispatcher that should be bound to a
  3739. global key, for example @kbd{C-c a} (@pxref{Installation}). In the
  3740. following we will assume that @kbd{C-c a} is indeed how the dispatcher
  3741. is accessed and list keyboard access to commands accordingly. After
  3742. pressing @kbd{C-c a}, an additional letter is required to execute a
  3743. command. The dispatcher offers the following default commands:
  3744. @table @kbd
  3745. @item a
  3746. Create the calendar-like agenda (@pxref{Weekly/Daily agenda}).
  3747. @item t @r{/} T
  3748. Create a list of all TODO items (@pxref{Global TODO list}).
  3749. @item m @r{/} M
  3750. Create a list of headlines matching a TAGS expression (@pxref{Matching
  3751. tags and properties}).
  3752. @item L
  3753. Create the timeline view for the current buffer (@pxref{Timeline}).
  3754. @item # @r{/} !
  3755. Create a list of stuck projects (@pxref{Stuck projects}).
  3756. @item 1
  3757. Restrict an agenda command to the current buffer. After pressing
  3758. @kbd{1}, you still need to press the character selecting the command.
  3759. @item 0
  3760. If there is an active region, restrict the following agenda command to
  3761. the region. Otherwise, restrict it to the current subtree. After
  3762. pressing @kbd{0}, you still need to press the character selecting the
  3763. command.
  3764. @end table
  3765. You can also define custom commands that will be accessible through the
  3766. dispatcher, just like the default commands. This includes the
  3767. possibility to create extended agenda buffers that contain several
  3768. blocks together, for example the weekly agenda, the global TODO list and
  3769. a number of special tags matches. @xref{Custom agenda views}.
  3770. @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda views
  3771. @section The built-in agenda views
  3772. In this section we describe the built-in views.
  3773. @menu
  3774. * Weekly/Daily agenda:: The calendar page with current tasks
  3775. * Global TODO list:: All unfinished action items
  3776. * Matching tags and properties:: Structured information with fine-tuned search
  3777. * Timeline:: Time-sorted view for single file
  3778. * Stuck projects:: Find projects you need to review
  3779. @end menu
  3780. @node Weekly/Daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
  3781. @subsection The weekly/daily agenda
  3782. @cindex agenda
  3783. @cindex weekly agenda
  3784. @cindex daily agenda
  3785. The purpose of the weekly/daily @emph{agenda} is to act like a page of a
  3786. paper agenda, showing all the tasks for the current week or day.
  3787. @table @kbd
  3788. @cindex org-agenda, command
  3789. @kindex C-c a a
  3790. @item C-c a a
  3791. Compile an agenda for the current week from a list of org files. The
  3792. agenda shows the entries for each day. With a @kbd{C-u} prefix (or
  3793. when the variable @code{org-agenda-include-all-todo} is @code{t}), all
  3794. unfinished TODO items (including those without a date) are also listed at
  3795. the beginning of the buffer, before the first date.@*
  3796. @end table
  3797. Remote editing from the agenda buffer means, for example, that you can
  3798. change the dates of deadlines and appointments from the agenda buffer.
  3799. The commands available in the Agenda buffer are listed in @ref{Agenda
  3800. commands}.
  3801. @subsubheading Calendar/Diary integration
  3802. @cindex calendar integration
  3803. @cindex diary integration
  3804. Emacs contains the calendar and diary by Edward M. Reingold. The
  3805. calendar displays a three-month calendar with holidays from different
  3806. countries and cultures. The diary allows you to keep track of
  3807. anniversaries, lunar phases, sunrise/set, recurrent appointments
  3808. (weekly, monthly) and more. In this way, it is quite complementary to
  3809. Org-mode. It can be very useful to combine output from Org-mode with
  3810. the diary.
  3811. In order to include entries from the Emacs diary into Org-mode's
  3812. agenda, you only need to customize the variable
  3813. @lisp
  3814. (setq org-agenda-include-diary t)
  3815. @end lisp
  3816. @noindent After that, everything will happen automatically. All diary
  3817. entries including holidays, anniversaries etc will be included in the
  3818. agenda buffer created by Org-mode. @key{SPC}, @key{TAB}, and
  3819. @key{RET} can be used from the agenda buffer to jump to the diary
  3820. file in order to edit existing diary entries. The @kbd{i} command to
  3821. insert new entries for the current date works in the agenda buffer, as
  3822. well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
  3823. Sunrise/Sunset times, show lunar phases and to convert to other
  3824. calendars, respectively. @kbd{c} can be used to switch back and forth
  3825. between calendar and agenda.
  3826. If you are using the diary only for sexp entries and holidays, it is
  3827. faster to not use the above setting, but instead to copy or even move
  3828. the entries into an Org-mode file. Org-mode evaluates diary-style sexp
  3829. entries, and does it faster because there is no overhead for first
  3830. creating the diary display. Note that the sexp entries must start at
  3831. the left margin, no white space is allowed before them. For example,
  3832. the following segment of an Org-mode file will be processed and entries
  3833. will be made in the agenda:
  3834. @example
  3835. * Birthdays and similar stuff
  3836. #+CATEGORY: Holiday
  3837. %%(org-calendar-holiday) ; special function for holiday names
  3838. #+CATEGORY: Ann
  3839. %%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
  3840. %%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
  3841. @end example
  3842. @node Global TODO list, Matching tags and properties, Weekly/Daily agenda, Built-in agenda views
  3843. @subsection The global TODO list
  3844. @cindex global TODO list
  3845. @cindex TODO list, global
  3846. The global TODO list contains all unfinished TODO items, formatted and
  3847. collected into a single place.
  3848. @table @kbd
  3849. @kindex C-c a t
  3850. @item C-c a t
  3851. Show the global TODO list. This collects the TODO items from all
  3852. agenda files (@pxref{Agenda views}) into a single buffer. The buffer is in
  3853. @code{agenda-mode}, so there are commands to examine and manipulate
  3854. the TODO entries directly from that buffer (@pxref{Agenda commands}).
  3855. @kindex C-c a T
  3856. @item C-c a T
  3857. @cindex TODO keyword matching
  3858. Like the above, but allows selection of a specific TODO keyword. You
  3859. can also do this by specifying a prefix argument to @kbd{C-c a t}. With
  3860. a @kbd{C-u} prefix you are prompted for a keyword, and you may also
  3861. specify several keywords by separating them with @samp{|} as boolean OR
  3862. operator. With a numeric prefix, the Nth keyword in
  3863. @code{org-todo-keywords} is selected.
  3864. @kindex r
  3865. The @kbd{r} key in the agenda buffer regenerates it, and you can give
  3866. a prefix argument to this command to change the selected TODO keyword,
  3867. for example @kbd{3 r}. If you often need a search for a specific
  3868. keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
  3869. Matching specific TODO keywords can also be done as part of a tags
  3870. search (@pxref{Tag searches}).
  3871. @end table
  3872. Remote editing of TODO items means that you can change the state of a
  3873. TODO entry with a single key press. The commands available in the
  3874. TODO list are described in @ref{Agenda commands}.
  3875. @cindex sublevels, inclusion into todo list
  3876. Normally the global todo list simply shows all headlines with TODO
  3877. keywords. This list can become very long. There are two ways to keep
  3878. it more compact:
  3879. @itemize @minus
  3880. @item
  3881. Some people view a TODO item that has been @emph{scheduled} for
  3882. execution (@pxref{Time stamps}) as no longer @emph{open}. Configure the
  3883. variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
  3884. items from the global TODO list.
  3885. @item
  3886. TODO items may have sublevels to break up the task into subtasks. In
  3887. such cases it may be enough to list only the highest level TODO headline
  3888. and omit the sublevels from the global list. Configure the variable
  3889. @code{org-agenda-todo-list-sublevels} to get this behavior.
  3890. @end itemize
  3891. @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
  3892. @subsection Matching Tags and Properties
  3893. @cindex matching, of tags
  3894. @cindex matching, of properties
  3895. @cindex tags view
  3896. If headlines in the agenda files are marked with @emph{tags}
  3897. (@pxref{Tags}), you can select headlines based on the tags that apply
  3898. to them and collect them into an agenda buffer.
  3899. @table @kbd
  3900. @kindex C-c a m
  3901. @item C-c a m
  3902. Produce a list of all headlines that match a given set of tags. The
  3903. command prompts for a selection criterion, which is a boolean logic
  3904. expression with tags, like @samp{+WORK+URGENT-WITHBOSS} or
  3905. @samp{WORK|HOME} (@pxref{Tags}). If you often need a specific search,
  3906. define a custom command for it (@pxref{Agenda dispatcher}).
  3907. @kindex C-c a M
  3908. @item C-c a M
  3909. Like @kbd{C-c a m}, but only select headlines that are also TODO items
  3910. and force checking subitems (see variable
  3911. @code{org-tags-match-list-sublevels}). Matching specific todo keywords
  3912. together with a tags match is also possible, see @ref{Tag searches}.
  3913. @end table
  3914. The commands available in the tags list are described in @ref{Agenda
  3915. commands}.
  3916. @node Timeline, Stuck projects, Matching tags and properties, Built-in agenda views
  3917. @subsection Timeline for a single file
  3918. @cindex timeline, single file
  3919. @cindex time-sorted view
  3920. The timeline summarizes all time-stamped items from a single Org-mode
  3921. file in a @emph{time-sorted view}. The main purpose of this command is
  3922. to give an overview over events in a project.
  3923. @table @kbd
  3924. @kindex C-c a L
  3925. @item C-c a L
  3926. Show a time-sorted view of the org file, with all time-stamped items.
  3927. When called with a @kbd{C-u} prefix, all unfinished TODO entries
  3928. (scheduled or not) are also listed under the current date.
  3929. @end table
  3930. @noindent
  3931. The commands available in the timeline buffer are listed in
  3932. @ref{Agenda commands}.
  3933. @node Stuck projects, , Timeline, Built-in agenda views
  3934. @subsection Stuck projects
  3935. If you are following a system like David Allen's GTD to organize your
  3936. work, one of the ``duties'' you have is a regular review to make sure
  3937. that all projects move along. A @emph{stuck} project is a project that
  3938. has no defined next actions, so it will never show up in the TODO lists
  3939. Org-mode produces. During the review, you need to identify such
  3940. projects and define next actions for them.
  3941. @table @kbd
  3942. @kindex C-c a #
  3943. @item C-c a #
  3944. List projects that are stuck.
  3945. @kindex C-c a !
  3946. @item C-c a !
  3947. Customize the variable @code{org-stuck-projects} to define what a stuck
  3948. project is and how to find it.
  3949. @end table
  3950. You almost certainly will have to configure this view before it will
  3951. work for you. The built-in default assumes that all your projects are
  3952. level-2 headlines, and that a project is not stuck if it has at least
  3953. one entry marked with a todo keyword TODO or NEXT or NEXTACTION.
  3954. Lets assume that you, in your own way of using Org-mode, identify
  3955. projects with a tag PROJECT, and that you use a todo keyword MAYBE to
  3956. indicate a project that should not be considered yet. Lets further
  3957. assume that the todo keyword DONE marks finished projects, and that NEXT
  3958. and TODO indicate next actions. The tag @@SHOP indicates shopping and
  3959. is a next action even without the NEXT tag. Finally, if the project
  3960. contains the special word IGNORE anywhere, it should not be listed
  3961. either. In this case you would start by identifying eligible projects
  3962. with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
  3963. TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
  3964. are not stuck. The correct customization for this is
  3965. @lisp
  3966. (setq org-stuck-projects
  3967. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
  3968. "\\<IGNORE\\>"))
  3969. @end lisp
  3970. @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda views
  3971. @section Presentation and sorting
  3972. @cindex presentation, of agenda items
  3973. Before displaying items in an agenda view, Org-mode visually prepares
  3974. the items and sorts them. Each item occupies a single line. The line
  3975. starts with a @emph{prefix} that contains the @emph{category}
  3976. (@pxref{Categories}) of the item and other important information. You can
  3977. customize the prefix using the option @code{org-agenda-prefix-format}.
  3978. The prefix is followed by a cleaned-up version of the outline headline
  3979. associated with the item.
  3980. @menu
  3981. * Categories:: Not all tasks are equal
  3982. * Time-of-day specifications:: How the agenda knows the time
  3983. * Sorting of agenda items:: The order of things
  3984. @end menu
  3985. @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
  3986. @subsection Categories
  3987. @cindex category
  3988. The category is a broad label assigned to each agenda item. By default,
  3989. the category is simply derived from the file name, but you can also
  3990. specify it with a special line in the buffer, like this:
  3991. @example
  3992. #+CATEGORY: Thesis
  3993. @end example
  3994. If there are several such lines in a file, each specifies the category
  3995. for the text below it (but the first category also applies to any text
  3996. before the first CATEGORY line). The display in the agenda buffer looks
  3997. best if the category is not longer than 10 characters.
  3998. @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
  3999. @subsection Time-of-Day Specifications
  4000. @cindex time-of-day specification
  4001. Org-mode checks each agenda item for a time-of-day specification. The
  4002. time can be part of the time stamp that triggered inclusion into the
  4003. agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
  4004. ranges can be specified with two time stamps, like
  4005. @c
  4006. @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
  4007. In the headline of the entry itself, a time(range) may also appear as
  4008. plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
  4009. integrates the Emacs diary (@pxref{Weekly/Daily agenda}), time
  4010. specifications in diary entries are recognized as well.
  4011. For agenda display, Org-mode extracts the time and displays it in a
  4012. standard 24 hour format as part of the prefix. The example times in
  4013. the previous paragraphs would end up in the agenda like this:
  4014. @example
  4015. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4016. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4017. 19:00...... The Vogon reads his poem
  4018. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4019. @end example
  4020. @cindex time grid
  4021. If the agenda is in single-day mode, or for the display of today, the
  4022. timed entries are embedded in a time grid, like
  4023. @example
  4024. 8:00...... ------------------
  4025. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4026. 10:00...... ------------------
  4027. 12:00...... ------------------
  4028. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4029. 14:00...... ------------------
  4030. 16:00...... ------------------
  4031. 18:00...... ------------------
  4032. 19:00...... The Vogon reads his poem
  4033. 20:00...... ------------------
  4034. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4035. @end example
  4036. The time grid can be turned on and off with the variable
  4037. @code{org-agenda-use-time-grid}, and can be configured with
  4038. @code{org-agenda-time-grid}.
  4039. @node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
  4040. @subsection Sorting of agenda items
  4041. @cindex sorting, of agenda items
  4042. @cindex priorities, of agenda items
  4043. Before being inserted into a view, the items are sorted. How this is
  4044. done depends on the type of view.
  4045. @itemize @bullet
  4046. @item
  4047. For the daily/weekly agenda, the items for each day are sorted. The
  4048. default order is to first collect all items containing an explicit
  4049. time-of-day specification. These entries will be shown at the beginning
  4050. of the list, as a @emph{schedule} for the day. After that, items remain
  4051. grouped in categories, in the sequence given by @code{org-agenda-files}.
  4052. Within each category, items are sorted by priority (@pxref{Priorities}),
  4053. which is composed of the base priority (2000 for priority @samp{A}, 1000
  4054. for @samp{B}, and 0 for @samp{C}), plus additional increments for
  4055. overdue scheduled or deadline items.
  4056. @item
  4057. For the TODO list, items remain in the order of categories, but within
  4058. each category, sorting takes place according to priority
  4059. (@pxref{Priorities}).
  4060. @item
  4061. For tags matches, items are not sorted at all, but just appear in the
  4062. sequence in which they are found in the agenda files.
  4063. @end itemize
  4064. Sorting can be customized using the variable
  4065. @code{org-agenda-sorting-strategy}.
  4066. @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda views
  4067. @section Commands in the agenda buffer
  4068. @cindex commands, in agenda buffer
  4069. Entries in the agenda buffer are linked back to the org file or diary
  4070. file where they originate. You are not allowed to edit the agenda
  4071. buffer itself, but commands are provided to show and jump to the
  4072. original entry location, and to edit the org-files ``remotely'' from
  4073. the agenda buffer. In this way, all information is stored only once,
  4074. removing the risk that your agenda and note files may diverge.
  4075. Some commands can be executed with mouse clicks on agenda lines. For
  4076. the other commands, the cursor needs to be in the desired line.
  4077. @table @kbd
  4078. @tsubheading{Motion}
  4079. @cindex motion commands in agenda
  4080. @kindex n
  4081. @item n
  4082. Next line (same as @key{up}).
  4083. @kindex p
  4084. @item p
  4085. Previous line (same as @key{down}).
  4086. @tsubheading{View/GoTo org file}
  4087. @kindex mouse-3
  4088. @kindex @key{SPC}
  4089. @item mouse-3
  4090. @itemx @key{SPC}
  4091. Display the original location of the item in another window.
  4092. @c
  4093. @kindex L
  4094. @item L
  4095. Display original location and recenter that window.
  4096. @c
  4097. @kindex mouse-2
  4098. @kindex mouse-1
  4099. @kindex @key{TAB}
  4100. @item mouse-2
  4101. @itemx mouse-1
  4102. @itemx @key{TAB}
  4103. Go to the original location of the item in another window. Under Emacs
  4104. 22, @kbd{mouse-1} will also works for this.
  4105. @c
  4106. @kindex @key{RET}
  4107. @itemx @key{RET}
  4108. Go to the original location of the item and delete other windows.
  4109. @c
  4110. @kindex f
  4111. @item f
  4112. Toggle Follow mode. In Follow mode, as you move the cursor through
  4113. the agenda buffer, the other window always shows the corresponding
  4114. location in the org file. The initial setting for this mode in new
  4115. agenda buffers can be set with the variable
  4116. @code{org-agenda-start-with-follow-mode}.
  4117. @c
  4118. @kindex b
  4119. @item b
  4120. Display the entire subtree of the current item in an indirect buffer.
  4121. With numerical prefix ARG, go up to this level and then take that tree.
  4122. If ARG is negative, go up that many levels. With @kbd{C-u} prefix, do
  4123. not remove the previously used indirect buffer.
  4124. @c
  4125. @kindex l
  4126. @item l
  4127. Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
  4128. logging was on (variable @code{org-log-done}) are shown in the agenda,
  4129. as are entries that have been clocked on that day.
  4130. @tsubheading{Change display}
  4131. @cindex display changing, in agenda
  4132. @kindex o
  4133. @item o
  4134. Delete other windows.
  4135. @c
  4136. @kindex d
  4137. @kindex w
  4138. @kindex m
  4139. @kindex y
  4140. @item d w m y
  4141. Switch to day/week/month/year view. When switching to day or week view,
  4142. this setting becomes the default for subseqent agenda commands. Since
  4143. month and year views are slow to create, the do not become the default.
  4144. @c
  4145. @kindex D
  4146. @item D
  4147. Toggle the inclusion of diary entries. See @ref{Weekly/Daily agenda}.
  4148. @c
  4149. @kindex g
  4150. @item g
  4151. Toggle the time grid on and off. See also the variables
  4152. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  4153. @c
  4154. @kindex r
  4155. @item r
  4156. Recreate the agenda buffer, for example to reflect the changes
  4157. after modification of the time stamps of items with S-@key{left} and
  4158. S-@key{right}. When the buffer is the global todo list, a prefix
  4159. argument is interpreted to create a selective list for a specific TODO
  4160. keyword.
  4161. @c
  4162. @kindex s
  4163. @item s
  4164. Save all Org-mode buffers in the current Emacs session.
  4165. @c
  4166. @kindex @key{right}
  4167. @item @key{right}
  4168. Display the following @code{org-agenda-ndays} days. For example, if
  4169. the display covers a week, switch to the following week. With prefix
  4170. arg, go forward that many times @code{org-agenda-ndays} days.
  4171. @c
  4172. @kindex @key{left}
  4173. @item @key{left}
  4174. Display the previous dates.
  4175. @c
  4176. @kindex .
  4177. @item .
  4178. Goto today.
  4179. @tsubheading{Remote editing}
  4180. @cindex remote editing, from agenda
  4181. @item 0-9
  4182. Digit argument.
  4183. @c
  4184. @cindex undoing remote-editing events
  4185. @cindex remote editing, undo
  4186. @kindex C-_
  4187. @item C-_
  4188. Undo a change due to a remote editing command. The change is undone
  4189. both in the agenda buffer and in the remote buffer.
  4190. @c
  4191. @kindex t
  4192. @item t
  4193. Change the TODO state of the item, both in the agenda and in the
  4194. original org file.
  4195. @c
  4196. @kindex C-k
  4197. @item C-k
  4198. Delete the current agenda item along with the entire subtree belonging
  4199. to it in the original Org-mode file. If the text to be deleted remotely
  4200. is longer than one line, the kill needs to be confirmed by the user. See
  4201. variable @code{org-agenda-confirm-kill}.
  4202. @c
  4203. @kindex $
  4204. @item $
  4205. Archive the subtree corresponding to the current headline.
  4206. @c
  4207. @kindex T
  4208. @item T
  4209. Show all tags associated with the current item. Because of
  4210. inheritance, this may be more than the tags listed in the line itself.
  4211. @c
  4212. @kindex :
  4213. @item :
  4214. Set tags for the current headline.
  4215. @c
  4216. @kindex a
  4217. @item a
  4218. Toggle the ARCHIVE tag for the current headline.
  4219. @c
  4220. @kindex ,
  4221. @item ,
  4222. Set the priority for the current item. Org-mode prompts for the
  4223. priority character. If you reply with @key{SPC}, the priority cookie
  4224. is removed from the entry.
  4225. @c
  4226. @kindex P
  4227. @item P
  4228. Display weighted priority of current item.
  4229. @c
  4230. @kindex +
  4231. @kindex S-@key{up}
  4232. @item +
  4233. @itemx S-@key{up}
  4234. Increase the priority of the current item. The priority is changed in
  4235. the original buffer, but the agenda is not resorted. Use the @kbd{r}
  4236. key for this.
  4237. @c
  4238. @kindex -
  4239. @kindex S-@key{down}
  4240. @item -
  4241. @itemx S-@key{down}
  4242. Decrease the priority of the current item.
  4243. @c
  4244. @kindex C-c C-s
  4245. @item C-c C-s
  4246. Schedule this item
  4247. @c
  4248. @kindex C-c C-d
  4249. @item C-c C-d
  4250. Set a deadline for this item.
  4251. @c
  4252. @kindex S-@key{right}
  4253. @item S-@key{right}
  4254. Change the time stamp associated with the current line by one day into
  4255. the future. With prefix argument, change it by that many days. For
  4256. example, @kbd{3 6 5 S-@key{right}} will change it by a year. The
  4257. stamp is changed in the original org file, but the change is not
  4258. directly reflected in the agenda buffer. Use the
  4259. @kbd{r} key to update the buffer.
  4260. @c
  4261. @kindex S-@key{left}
  4262. @item S-@key{left}
  4263. Change the time stamp associated with the current line by one day
  4264. into the past.
  4265. @c
  4266. @kindex >
  4267. @item >
  4268. Change the time stamp associated with the current line to today.
  4269. The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
  4270. on my keyboard.
  4271. @c
  4272. @kindex I
  4273. @item I
  4274. Start the clock on the current item. If a clock is running already, it
  4275. is stopped first.
  4276. @c
  4277. @kindex O
  4278. @item O
  4279. Stop the previously started clock.
  4280. @c
  4281. @kindex X
  4282. @item X
  4283. Cancel the currently running clock.
  4284. @tsubheading{Calendar commands}
  4285. @cindex calendar commands, from agenda
  4286. @kindex c
  4287. @item c
  4288. Open the Emacs calendar and move to the date at the agenda cursor.
  4289. @c
  4290. @item c
  4291. When in the calendar, compute and show the Org-mode agenda for the
  4292. date at the cursor.
  4293. @c
  4294. @cindex diary entries, creating from agenda
  4295. @kindex i
  4296. @item i
  4297. Insert a new entry into the diary. Prompts for the type of entry
  4298. (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
  4299. entry in the diary, just as @kbd{i d} etc. would do in the calendar.
  4300. The date is taken from the cursor position.
  4301. @c
  4302. @kindex M
  4303. @item M
  4304. Show the phases of the moon for the three months around current date.
  4305. @c
  4306. @kindex S
  4307. @item S
  4308. Show sunrise and sunset times. The geographical location must be set
  4309. with calendar variables, see documentation of the Emacs calendar.
  4310. @c
  4311. @kindex C
  4312. @item C
  4313. Convert the date at cursor into many other cultural and historic
  4314. calendars.
  4315. @c
  4316. @kindex H
  4317. @item H
  4318. Show holidays for three month around the cursor date.
  4319. @c
  4320. @c FIXME: This should be a different key.
  4321. @kindex C-c C-x C-c
  4322. @item C-c C-x C-c
  4323. Export a single iCalendar file containing entries from all agenda files.
  4324. @tsubheading{Exporting to a file}
  4325. @kindex C-x C-w
  4326. @item C-x C-w
  4327. @cindex exporting agenda views
  4328. @cindex agenda views, exporting
  4329. Write the agenda view to a file. Depending on the extension of the
  4330. selected file name, the view will be exported as HTML (extension
  4331. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
  4332. plain text (any other extension). Use the variable
  4333. @code{org-agenda-exporter-settings} to set options for @file{ps-print}
  4334. and for @file{htmlize} to be used during export.
  4335. @tsubheading{Quit and Exit}
  4336. @kindex q
  4337. @item q
  4338. Quit agenda, remove the agenda buffer.
  4339. @c
  4340. @kindex x
  4341. @cindex agenda files, removing buffers
  4342. @item x
  4343. Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
  4344. for the compilation of the agenda. Buffers created by the user to
  4345. visit org files will not be removed.
  4346. @end table
  4347. @node Custom agenda views, , Agenda commands, Agenda views
  4348. @section Custom agenda views
  4349. @cindex custom agenda views
  4350. @cindex agenda views, custom
  4351. Custom agenda commands serve two purposes: to store and quickly access
  4352. frequently used TODO and tags searches, and to create special composite
  4353. agenda buffers. Custom agenda commands will be accessible through the
  4354. dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
  4355. @menu
  4356. * Storing searches:: Type once, use often
  4357. * Block agenda:: All the stuff you need in a single buffer
  4358. * Setting Options:: Changing the rules
  4359. * Exporting Agenda Views:: Writing agendas to files.
  4360. * Extracting Agenda Information for other programs::
  4361. @end menu
  4362. @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
  4363. @subsection Storing searches
  4364. The first application of custom searches is the definition of keyboard
  4365. shortcuts for frequently used searches, either creating an agenda
  4366. buffer, or a sparse tree (the latter covering of course only the current
  4367. buffer).
  4368. @kindex C-c a C
  4369. Custom commands are configured in the variable
  4370. @code{org-agenda-custom-commands}. You can customize this variable, for
  4371. example by pressing @kbd{C-c a C}. You can also directly set it with
  4372. Emacs Lisp in @file{.emacs}. The following example contains all valid
  4373. search types:
  4374. @lisp
  4375. @group
  4376. (setq org-agenda-custom-commands
  4377. '(("w" todo "WAITING")
  4378. ("W" todo-tree "WAITING")
  4379. ("u" tags "+BOSS-URGENT")
  4380. ("v" tags-todo "+BOSS-URGENT")
  4381. ("U" tags-tree "+BOSS-URGENT")
  4382. ("f" occur-tree "\\<FIXME\\>")))
  4383. @end group
  4384. @end lisp
  4385. @noindent
  4386. The initial single-character string in each entry defines the character
  4387. you have to press after the dispatcher command @kbd{C-c a} in order to
  4388. access the command. The second parameter is the search type, followed
  4389. by the string or regular expression to be used for the matching. The
  4390. example above will therefore define:
  4391. @table @kbd
  4392. @item C-c a w
  4393. as a global search for TODO entries with @samp{WAITING} as the TODO
  4394. keyword
  4395. @item C-c a W
  4396. as the same search, but only in the current buffer and displaying the
  4397. results as a sparse tree
  4398. @item C-c a u
  4399. as a global tags search for headlines marked @samp{:BOSS:} but not
  4400. @samp{:URGENT:}
  4401. @item C-c a v
  4402. as the same search as @kbd{C-c a u}, but limiting the search to
  4403. headlines that are also TODO items
  4404. @item C-c a U
  4405. as the same search as @kbd{C-c a u}, but only in the current buffer and
  4406. displaying the result as a sparse tree
  4407. @item C-c a f
  4408. to create a sparse tree (again: current buffer only) with all entries
  4409. containing the word @samp{FIXME}.
  4410. @end table
  4411. @node Block agenda, Setting Options, Storing searches, Custom agenda views
  4412. @subsection Block agenda
  4413. @cindex block agenda
  4414. @cindex agenda, with block views
  4415. Another possibility is the construction of agenda views that comprise
  4416. the results of @emph{several} commands, each of which creates a block in
  4417. the agenda buffer. The available commands include @code{agenda} for the
  4418. daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
  4419. for the global todo list (as constructed with @kbd{C-c a t}), and the
  4420. matching commands discussed above: @code{todo}, @code{tags}, and
  4421. @code{tags-todo}. Here are two examples:
  4422. @lisp
  4423. @group
  4424. (setq org-agenda-custom-commands
  4425. '(("h" "Agenda and Home-related tasks"
  4426. ((agenda)
  4427. (tags-todo "HOME")
  4428. (tags "GARDEN")))
  4429. ("o" "Agenda and Office-related tasks"
  4430. ((agenda)
  4431. (tags-todo "WORK")
  4432. (tags "OFFICE")))))
  4433. @end group
  4434. @end lisp
  4435. @noindent
  4436. This will define @kbd{C-c a h} to create a multi-block view for stuff
  4437. you need to attend to at home. The resulting agenda buffer will contain
  4438. your agenda for the current week, all TODO items that carry the tag
  4439. @samp{HOME}, and also all lines tagged with @samp{GARDEN}. Finally the
  4440. command @kbd{C-c a o} provides a similar view for office tasks.
  4441. @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
  4442. @subsection Setting Options for custom commands
  4443. @cindex options, for custom agenda views
  4444. Org-mode contains a number of variables regulating agenda construction
  4445. and display. The global variables define the behavior for all agenda
  4446. commands, including the custom commands. However, if you want to change
  4447. some settings just for a single custom view, you can do so. Setting
  4448. options requires inserting a list of variable names and values at the
  4449. right spot in @code{org-agenda-custom-commands}. For example:
  4450. @lisp
  4451. @group
  4452. (setq org-agenda-custom-commands
  4453. '(("w" todo "WAITING"
  4454. ((org-agenda-sorting-strategy '(priority-down))
  4455. (org-agenda-prefix-format " Mixed: ")))
  4456. ("U" tags-tree "+BOSS-URGENT"
  4457. ((org-show-following-heading nil)
  4458. (org-show-hierarchy-above nil)))))
  4459. @end group
  4460. @end lisp
  4461. @noindent
  4462. Now the @kbd{C-c a w} command will sort the collected entries only by
  4463. priority, and the prefix format is modified to just say @samp{ Mixed:}
  4464. instead of giving the category of the entry. The sparse tags tree of
  4465. @kbd{C-c a U} will now turn out ultra-compact, because neither the
  4466. headline hierarchy above the match, nor the headline following the match
  4467. will be shown.
  4468. For command sets creating a block agenda,
  4469. @code{org-agenda-custom-commands} has two separate spots for setting
  4470. options. You can add options that should be valid for just a single
  4471. command in the set, and options that should be valid for all commands in
  4472. the set. The former are just added to the command entry, the latter
  4473. must come after the list of command entries. Going back to the block
  4474. agenda example (@pxref{Block agenda}), let's change the sorting strategy
  4475. for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
  4476. the results for GARDEN tags query in the opposite order,
  4477. @code{priority-up}. This would look like this:
  4478. @lisp
  4479. @group
  4480. (setq org-agenda-custom-commands
  4481. '(("h" "Agenda and Home-related tasks"
  4482. ((agenda)
  4483. (tags-todo "HOME")
  4484. (tags "GARDEN"
  4485. ((org-agenda-sorting-strategy '(priority-up)))))
  4486. ((org-agenda-sorting-strategy '(priority-down))))
  4487. ("o" "Agenda and Office-related tasks"
  4488. ((agenda)
  4489. (tags-todo "WORK")
  4490. (tags "OFFICE")))))
  4491. @end group
  4492. @end lisp
  4493. As you see, the values and parenthesis setting is a little complex.
  4494. When in doubt, use the customize interface to set this variable - it
  4495. fully supports its structure. Just one caveat: When setting options in
  4496. this interface, the @emph{values} are just lisp expressions. So if the
  4497. value is a string, you need to add the double quotes around the value
  4498. yourself.
  4499. @node Exporting Agenda Views, Extracting Agenda Information for other programs, Setting Options, Custom agenda views
  4500. @subsection Exporting Agenda Views
  4501. @cindex agenda views, exporting
  4502. If you are away from your computer, it can be very useful to have a
  4503. printed version of some agenda views to carry around. Org-mode can
  4504. export custom agenda views as plain text, HTML@footnote{You need to
  4505. install Hrvoje Niksic' @file{htmlize.el}.} and postscript. If you want
  4506. to do this only occasionally, use the command
  4507. @table @kbd
  4508. @kindex C-x C-w
  4509. @item C-x C-w
  4510. @cindex exporting agenda views
  4511. @cindex agenda views, exporting
  4512. Write the agenda view to a file. Depending on the extension of the
  4513. selected file name, the view will be exported as HTML (extension
  4514. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
  4515. plain text (any other extension). Use the variable
  4516. @code{org-agenda-exporter-settings} to set options for @file{ps-print}
  4517. and for @file{htmlize} to be used during export, for example
  4518. @lisp
  4519. (setq org-agenda-exporter-settings
  4520. '((ps-number-of-columns 2)
  4521. (ps-landscape-mode t)
  4522. (htmlize-output-type 'css)))
  4523. @end lisp
  4524. @end table
  4525. If you need to export certain agenda views frequently, you can associate
  4526. any custom agenda command with a list of output file names
  4527. @footnote{If you want to store standard views like the weekly agenda
  4528. or the global TODO list as well, you need to define custom commands for
  4529. them in order to be able to specify filenames.}. Here is an example
  4530. that first does define custom commands for the agenda and the global
  4531. todo list, together with a number of files to which to export them.
  4532. Then we define two block agenda commands and specify filenames for them
  4533. as well. File names can be relative to the current working directory,
  4534. or absolute.
  4535. @lisp
  4536. @group
  4537. (setq org-agenda-custom-commands
  4538. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  4539. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  4540. ("h" "Agenda and Home-related tasks"
  4541. ((agenda)
  4542. (tags-todo "HOME")
  4543. (tags "GARDEN"))
  4544. nil
  4545. ("~/views/home.html"))
  4546. ("o" "Agenda and Office-related tasks"
  4547. ((agenda)
  4548. (tags-todo "WORK")
  4549. (tags "OFFICE"))
  4550. nil
  4551. ("~/views/office.ps"))))
  4552. @end group
  4553. @end lisp
  4554. The extension of the file name determines the type of export. If it is
  4555. @file{.html}, Org-mode will use the @file{htmlize.el} package to convert
  4556. the buffer to HTML and save it to this file name. If the extension is
  4557. @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
  4558. postscript output. Any other extension produces a plain ASCII file.
  4559. The export files are @emph{not} created when you use one of those
  4560. commands interactively. Instead, there is a special command to produce
  4561. @emph{all} specified files in one step:
  4562. @table @kbd
  4563. @kindex C-c a e
  4564. @item C-c a e
  4565. Export all agenda views that have export filenames associated with
  4566. them.
  4567. @end table
  4568. You can use the options section of the custom agenda commands to also
  4569. set options for the export commands. For example:
  4570. @lisp
  4571. (setq org-agenda-custom-commands
  4572. '(("X" agenda ""
  4573. ((ps-number-of-columns 2)
  4574. (ps-landscape-mode t)
  4575. (org-agenda-prefix-format " [ ] ")
  4576. (org-agenda-with-colors nil)
  4577. (org-agenda-remove-tags t))
  4578. ("theagenda.ps"))))
  4579. @end lisp
  4580. @noindent
  4581. This command sets two options for the postscript exporter, to make it
  4582. print in two columns in landscape format - the resulting page can be cut
  4583. in two and then used in a paper agenda. The remaining settings modify
  4584. the agenda prefix to omit category and scheduling information, and
  4585. instead include a checkbox to check off items. We also remove the tags
  4586. to make the lines compact, and we don't want to use colors for the
  4587. black-and-white printer. Settings specified in
  4588. @code{org-agenda-exporter-settings} will also apply, but the settings
  4589. in @code{org-agenda-custom-commands} take precedence.
  4590. @noindent
  4591. From the command line you may also use
  4592. @example
  4593. emacs -f org-batch-store-agenda-views -kill
  4594. @end example
  4595. @noindent
  4596. or, if you need to modify some parameters
  4597. @example
  4598. emacs -eval '(org-batch-store-agenda-views \
  4599. org-agenda-ndays 30 \
  4600. org-agenda-include-diary nil \
  4601. org-agenda-files (quote ("~/org/project.org")))' \
  4602. -kill
  4603. @end example
  4604. @noindent
  4605. which will create the agenda views restricted to the file
  4606. @file{~/org/project.org}, without diary entries and with 30 days
  4607. extent.
  4608. @node Extracting Agenda Information for other programs, , Exporting Agenda Views, Custom agenda views
  4609. @subsection Extracting Agenda Information for other programs
  4610. @cindex agenda, pipe
  4611. @cindex Scripts, for agenda processing
  4612. Org-mode provides commands to access agenda information for the command
  4613. line in emacs batch mode. This extracted information can be sent
  4614. directly to a printer, or it can be read by a program that does further
  4615. processing of the data. The first of these commands is the function
  4616. @code{org-batch-agenda}, that produces an agenda view and sends it as
  4617. ASCII text to STDOUT. The command takes a single string as parameter.
  4618. If the string has length 1, it is used as a key to one of the commands
  4619. you have configured in @code{org-agenda-custom-commands}, basically any
  4620. key you can use after @kbd{C-c a}. For example, to directly print the
  4621. current TODO list, you could use
  4622. @example
  4623. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  4624. @end example
  4625. If the parameter is a string with 2 or more characters, it is used as a
  4626. tags/todo match string. For example, to print your local shopping list
  4627. (all items with the tag @samp{shop}, but excluding the tag
  4628. @samp{NewYork}), you could use
  4629. @example
  4630. emacs -batch -l ~/.emacs \
  4631. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  4632. @end example
  4633. @noindent
  4634. You may also modify parameters on the fly like this:
  4635. @example
  4636. emacs -batch -l ~/.emacs \
  4637. -eval '(org-batch-agenda "a" \
  4638. org-agenda-ndays 30 \
  4639. org-agenda-include-diary nil \
  4640. org-agenda-files (quote ("~/org/project.org")))' \
  4641. | lpr
  4642. @end example
  4643. @noindent
  4644. which will produce a 30 day agenda, fully restricted to the Org file
  4645. @file{~/org/projects.org}, not even including the diary.
  4646. If you want to process the agenda data in more sophisticated ways, you
  4647. can use the command @code{org-batch-agenda-csv} to get a comma-separated
  4648. list of values for each agenda item. Each line in the output will
  4649. contain a number of fields separated by commas. The fields in a line
  4650. are:
  4651. @example
  4652. category @r{The category of the item}
  4653. head @r{The headline, without TODO kwd, TAGS and PRIORITY}
  4654. type @r{The type of the agenda entry, can be}
  4655. todo @r{selected in TODO match}
  4656. tagsmatch @r{selected in tags match}
  4657. diary @r{imported from diary}
  4658. deadline @r{a deadline}
  4659. scheduled @r{scheduled}
  4660. timestamp @r{appointment, selected by timestamp}
  4661. closed @r{entry was closed on date}
  4662. upcoming-deadline @r{warning about nearing deadline}
  4663. past-scheduled @r{forwarded scheduled item}
  4664. block @r{entry has date block including date}
  4665. todo @r{The todo keyword, if any}
  4666. tags @r{All tags including inherited ones, separated by colons}
  4667. date @r{The relevant date, like 2007-2-14}
  4668. time @r{The time, like 15:00-16:50}
  4669. extra @r{String with extra planning info}
  4670. priority-l @r{The priority letter if any was given}
  4671. priority-n @r{The computed numerical priority}
  4672. @end example
  4673. @noindent
  4674. Time and date will only be given if a timestamp (or deadline/scheduled)
  4675. lead to the selection of the item.
  4676. A CSV list like this is very easy to use in a post processing script.
  4677. For example, here is a Perl program that gets the TODO list from
  4678. Emacs/org-mode and prints all the items, preceded by a checkbox:
  4679. @example
  4680. @group
  4681. #!/usr/bin/perl
  4682. # define the Emacs command to run
  4683. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  4684. # run it and capture the output
  4685. $agenda = qx@{$cmd 2>/dev/null@};
  4686. # loop over all lines
  4687. foreach $line (split(/\n/,$agenda)) @{
  4688. # get the individual values
  4689. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  4690. $priority_l,$priority_n) = split(/,/,$line);
  4691. # proccess and print
  4692. print "[ ] $head\n";
  4693. @}
  4694. @end group
  4695. @end example
  4696. @node Embedded LaTeX, Exporting, Agenda views, Top
  4697. @chapter Embedded LaTeX
  4698. @cindex @TeX{} interpretation
  4699. @cindex La@TeX{} interpretation
  4700. Plain ASCII is normally sufficient for almost all note taking. One
  4701. exception, however, are scientific notes which need to be able to
  4702. contain mathematical symbols and the occasional formula.
  4703. La@TeX{}@footnote{La@TeX{} is a macro system based on Donald E. Knuth's
  4704. @TeX{} system. Many of the features described here as ``La@TeX{}'' are
  4705. really from @TeX{}, but for simplicity I am blurring this distinction.}
  4706. is widely used to typeset scientific documents. Org-mode supports
  4707. embedding La@TeX{} code into its files, because many academics are used
  4708. to read La@TeX{} source code, and because it can be readily processed
  4709. into images for HTML production.
  4710. It is not necessary to mark La@TeX{} macros and code in any special way.
  4711. If you observe a few conventions, Org-mode knows how to find it and what
  4712. to do with it.
  4713. @menu
  4714. * Math symbols:: TeX macros for symbols and Greek letters
  4715. * Subscripts and Superscripts:: Simple syntax for raising/lowering text
  4716. * LaTeX fragments:: Complex formulas made easy
  4717. * Processing LaTeX fragments:: Previewing LaTeX processing
  4718. * CDLaTeX mode:: Speed up entering of formulas
  4719. @end menu
  4720. @node Math symbols, Subscripts and Superscripts, Embedded LaTeX, Embedded LaTeX
  4721. @section Math symbols
  4722. @cindex math symbols
  4723. @cindex TeX macros
  4724. You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
  4725. to indicate the Greek letter, or @samp{\to} to indicate an arrow.
  4726. Completion for these macros is available, just type @samp{\} and maybe a
  4727. few letters, and press @kbd{M-@key{TAB}} to see possible completions.
  4728. Unlike La@TeX{} code, Org-mode allows these macros to be present
  4729. without surrounding math delimiters, for example:
  4730. @example
  4731. Angles are written as Greek letters \alpha, \beta and \gamma.
  4732. @end example
  4733. During HTML export (@pxref{HTML export}), these symbols are translated
  4734. into the proper syntax for HTML, for the above examples this is
  4735. @samp{&alpha;} and @samp{&rarr;}, respectively.
  4736. @node Subscripts and Superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
  4737. @section Subscripts and Superscripts
  4738. @cindex subscript
  4739. @cindex superscript
  4740. Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
  4741. and subscripts. Again, these can be used without embedding them in
  4742. math-mode delimiters. To increase the readability of ASCII text, it is
  4743. not necessary (but OK) to surround multi-character sub- and superscripts
  4744. with curly braces. For example
  4745. @example
  4746. The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
  4747. the sun is R_@{sun@} = 6.96 x 10^8 m.
  4748. @end example
  4749. To avoid interpretation as raised or lowered text, you can quote
  4750. @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
  4751. During HTML export (@pxref{HTML export}), subscript and superscripts
  4752. are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
  4753. @node LaTeX fragments, Processing LaTeX fragments, Subscripts and Superscripts, Embedded LaTeX
  4754. @section LaTeX fragments
  4755. @cindex LaTeX fragments
  4756. With symbols, sub- and superscripts, HTML is pretty much at its end when
  4757. it comes to representing mathematical formulas@footnote{Yes, there is
  4758. MathML, but that is not yet fully supported by many browsers, and there
  4759. is no decent converter for turning La@TeX{} or ASCII representations of
  4760. formulas into MathML. So for the time being, converting formulas into
  4761. images seems the way to go.}. More complex expressions need a dedicated
  4762. formula processor. To this end, Org-mode can contain arbitrary La@TeX{}
  4763. fragments. It provides commands to preview the typeset result of these
  4764. fragments, and upon export to HTML, all fragments will be converted to
  4765. images and inlined into the HTML document@footnote{The La@TeX{} export
  4766. will not use images for displaying La@TeX{} fragments but include these
  4767. fragments directly into the La@TeX{} code.}. For this to work you
  4768. need to be on a system with a working La@TeX{} installation. You also
  4769. need the @file{dvipng} program, available at
  4770. @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
  4771. will be used when processing a fragment can be configured with the
  4772. variable @code{org-format-latex-header}.
  4773. La@TeX{} fragments don't need any special marking at all. The following
  4774. snippets will be identified as La@TeX{} source code:
  4775. @itemize @bullet
  4776. @item
  4777. Environments of any kind. The only requirement is that the
  4778. @code{\begin} statement appears on a new line, preceded by only
  4779. whitespace.
  4780. @item
  4781. Text within the usual La@TeX{} math delimiters. To avoid conflicts with
  4782. currency specifications, single @samp{$} characters are only recognized
  4783. as math delimiters if the enclosed text contains at most two line breaks,
  4784. is directly attached to the @samp{$} characters with no whitespace in
  4785. between, and if the closing @samp{$} is followed by whitespace or
  4786. punctuation. For the other delimiters, there is no such restriction, so
  4787. when in doubt, use @samp{\(...\)} as inline math delimiters.
  4788. @end itemize
  4789. @noindent For example:
  4790. @example
  4791. \begin@{equation@} % arbitrary environments,
  4792. x=\sqrt@{b@} % even tables, figures
  4793. \end@{equation@} % etc
  4794. If $a^2=b$ and \( b=2 \), then the solution must be
  4795. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  4796. @end example
  4797. @noindent
  4798. If you need any of the delimiter ASCII sequences for other purposes, you
  4799. can configure the option @code{org-format-latex-options} to deselect the
  4800. ones you do not wish to have interpreted by the La@TeX{} converter.
  4801. @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
  4802. @section Processing LaTeX fragments
  4803. @cindex LaTeX fragments, preview
  4804. La@TeX{} fragments can be processed to produce a preview images of the
  4805. typeset expressions:
  4806. @table @kbd
  4807. @kindex C-c C-x C-l
  4808. @item C-c C-x C-l
  4809. Produce a preview image of the La@TeX{} fragment at point and overlay it
  4810. over the source code. If there is no fragment at point, process all
  4811. fragments in the current entry (between two headlines). When called
  4812. with a prefix argument, process the entire subtree. When called with
  4813. two prefix arguments, or when the cursor is before the first headline,
  4814. process the entire buffer.
  4815. @kindex C-c C-c
  4816. @item C-c C-c
  4817. Remove the overlay preview images.
  4818. @end table
  4819. During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
  4820. converted into images and inlined into the document if the following
  4821. setting is active:
  4822. @lisp
  4823. (setq org-export-with-LaTeX-fragments t)
  4824. @end lisp
  4825. @node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
  4826. @section Using CDLaTeX to enter math
  4827. @cindex CDLaTeX
  4828. CDLaTeX-mode is a minor mode that is normally used in combination with a
  4829. major La@TeX{} mode like AUCTeX in order to speed-up insertion of
  4830. environments and math templates. Inside Org-mode, you can make use of
  4831. some of the features of cdlatex-mode. You need to install
  4832. @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
  4833. AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
  4834. Don't turn cdlatex-mode itself under Org-mode, but use the light
  4835. version @code{org-cdlatex-mode} that comes as part of Org-mode. Turn it
  4836. on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
  4837. Org-mode files with
  4838. @lisp
  4839. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  4840. @end lisp
  4841. When this mode is enabled, the following features are present (for more
  4842. details see the documentation of cdlatex-mode):
  4843. @itemize @bullet
  4844. @kindex C-c @{
  4845. @item
  4846. Environment templates can be inserted with @kbd{C-c @{}.
  4847. @item
  4848. @kindex @key{TAB}
  4849. The @key{TAB} key will do template expansion if the cursor is inside a
  4850. La@TeX{} fragment@footnote{Org-mode has a method to test if the cursor is
  4851. inside such a fragment, see the documentation of the function
  4852. @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
  4853. expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
  4854. correctly inside the first brace. Another @key{TAB} will get you into
  4855. the second brace. Even outside fragments, @key{TAB} will expand
  4856. environment abbreviations at the beginning of a line. For example, if
  4857. you write @samp{equ} at the beginning of a line and press @key{TAB},
  4858. this abbreviation will be expanded to an @code{equation} environment.
  4859. To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  4860. @item
  4861. @kindex _
  4862. @kindex ^
  4863. Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
  4864. characters together with a pair of braces. If you use @key{TAB} to move
  4865. out of the braces, and if the braces surround only a single character or
  4866. macro, they are removed again (depending on the variable
  4867. @code{cdlatex-simplify-sub-super-scripts}).
  4868. @item
  4869. @kindex `
  4870. Pressing the backquote @kbd{`} followed by a character inserts math
  4871. macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
  4872. after the backquote, a help window will pop up.
  4873. @item
  4874. @kindex '
  4875. Pressing the normal quote @kbd{'} followed by another character modifies
  4876. the symbol before point with an accent or a font. If you wait more than
  4877. 1.5 seconds after the backquote, a help window will pop up. Character
  4878. modification will work only inside La@TeX{} fragments, outside the quote
  4879. is normal.
  4880. @end itemize
  4881. @node Exporting, Publishing, Embedded LaTeX, Top
  4882. @chapter Exporting
  4883. @cindex exporting
  4884. Org-mode documents can be exported into a variety of other formats. For
  4885. printing and sharing of notes, ASCII export produces a readable and
  4886. simple version of an Org-mode file. HTML export allows you to publish a
  4887. notes file on the web, while the XOXO format provides a solid base for
  4888. exchange with a broad range of other applications. La@TeX{} export lets
  4889. you use Org-mode and its structured editing functions to easily create
  4890. La@TeX{} files. To incorporate entries with associated times like
  4891. deadlines or appointments into a desktop calendar program like iCal,
  4892. Org-mode can also produce extracts in the iCalendar format. Currently
  4893. Org-mode only supports export, not import of these different formats.
  4894. When exporting, Org-mode uses special conventions to enrich the output
  4895. produced. @xref{Text interpretation}, for more details.
  4896. @table @kbd
  4897. @kindex C-c C-e
  4898. @item C-c C-e
  4899. Dispatcher for export and publishing commands. Displays a help-window
  4900. listing the additional key(s) needed to launch an export or publishing
  4901. command.
  4902. @end table
  4903. @menu
  4904. * ASCII export:: Exporting to plain ASCII
  4905. * HTML export:: Exporting to HTML
  4906. * LaTeX export:: Exporting to LaTeX
  4907. * XOXO export:: Exporting to XOXO
  4908. * iCalendar export:: Exporting in iCalendar format
  4909. * Text interpretation:: How the exporter looks at the file
  4910. @end menu
  4911. @node ASCII export, HTML export, Exporting, Exporting
  4912. @section ASCII export
  4913. @cindex ASCII export
  4914. ASCII export produces a simple and very readable version of an Org-mode
  4915. file.
  4916. @cindex region, active
  4917. @cindex active region
  4918. @cindex transient-mark-mode
  4919. @table @kbd
  4920. @kindex C-c C-e a
  4921. @item C-c C-e a
  4922. Export as ASCII file. For an org file @file{myfile.org}, the ASCII file
  4923. will be @file{myfile.txt}. The file will be overwritten without
  4924. warning. If there is an active region, only the region will be
  4925. exported. If the selected region is a single tree, the tree head will
  4926. become the document title. If the tree head entry has or inherits an
  4927. EXPORT_FILE_NAME property, that name will be used for the export.
  4928. @kindex C-c C-e v a
  4929. @item C-c C-e v a
  4930. Export only the visible part of the document.
  4931. @end table
  4932. @cindex headline levels, for exporting
  4933. In the exported version, the first 3 outline levels will become
  4934. headlines, defining a general document structure. Additional levels
  4935. will be exported as itemized lists. If you want that transition to occur
  4936. at a different level, specify it with a prefix argument. For example,
  4937. @example
  4938. @kbd{C-1 C-c C-e a}
  4939. @end example
  4940. @noindent
  4941. creates only top level headlines and does the rest as items. When
  4942. headlines are converted to items, the indentation of the text following
  4943. the headline is changed to fit nicely under the item. This is done with
  4944. the assumption that the first bodyline indicates the base indentation of
  4945. the body text. Any indentation larger than this is adjusted to preserve
  4946. the layout relative to the first line. Should there be lines with less
  4947. indentation than the first, these are left alone.
  4948. @node HTML export, LaTeX export, ASCII export, Exporting
  4949. @section HTML export
  4950. @cindex HTML export
  4951. Org-mode contains an HTML (XHTML 1.0 strict) exporter with extensive
  4952. HTML formatting, in ways similar to John Grubers @emph{markdown}
  4953. language, but with additional support for tables.
  4954. @menu
  4955. * HTML Export commands:: How to invoke LaTeX export
  4956. * Quoting HTML tags:: Using direct HTML in Org-mode
  4957. * Links:: Transformation of links for HTML
  4958. * Images:: How to include images
  4959. * CSS support:: Changing the appearence of the output
  4960. @end menu
  4961. @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
  4962. @subsection HTML export commands
  4963. @cindex region, active
  4964. @cindex active region
  4965. @cindex transient-mark-mode
  4966. @table @kbd
  4967. @kindex C-c C-e h
  4968. @item C-c C-e h
  4969. Export as HTML file @file{myfile.html}. For an org file
  4970. @file{myfile.org}, the ASCII file will be @file{myfile.html}. The file
  4971. will be overwritten without warning. If there is an active region, only
  4972. the region will be exported. If the selected region is a single tree,
  4973. the tree head will become the document title. If the tree head entry
  4974. has or inherits an EXPORT_FILE_NAME property, that name will be used for
  4975. the export.
  4976. @kindex C-c C-e b
  4977. @item C-c C-e b
  4978. Export as HTML file and immediately open it with a browser.
  4979. @kindex C-c C-e H
  4980. @item C-c C-e H
  4981. Export to a temporary buffer, do not create a file.
  4982. @kindex C-c C-e R
  4983. @item C-c C-e H
  4984. Export the active region to a temporary buffer. With prefix arg, do not
  4985. produce file header and foot, but just the plain HTML section for the
  4986. region. This is good for cut-and-paste operations.
  4987. @kindex C-c C-e v h
  4988. @kindex C-c C-e v b
  4989. @kindex C-c C-e v H
  4990. @kindex C-c C-e v R
  4991. @item C-c C-e v h
  4992. @item C-c C-e v b
  4993. @item C-c C-e v H
  4994. @item C-c C-e v R
  4995. Export only the visible part of the document.
  4996. @item M-x org-export-region-as-html
  4997. Convert the region to HTML under the assumption that it was org-mode
  4998. syntax before. This is a global command that can be invoked in any
  4999. buffer.
  5000. @item M-x org-replace-region-by-HTML
  5001. Replace the active region (assumed to be in Org-mode syntax) by HTML
  5002. code.
  5003. @end table
  5004. @cindex headline levels, for exporting
  5005. In the exported version, the first 3 outline levels will become
  5006. headlines, defining a general document structure. Additional levels
  5007. will be exported as itemized lists. If you want that transition to occur
  5008. at a different level, specify it with a prefix argument. For example,
  5009. @example
  5010. @kbd{C-2 C-c C-e b}
  5011. @end example
  5012. @noindent
  5013. creates two levels of headings and does the rest as items.
  5014. @node Quoting HTML tags, Links, HTML Export commands, HTML export
  5015. @subsection Quoting HTML tags
  5016. Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
  5017. @samp{&gt;} in HTML export. If you want to include simple HTML tags
  5018. which should be interpreted as such, mark them with @samp{@@} as in
  5019. @samp{@@<b>bold text@@</b>}. Note that this really works only for
  5020. simple tags. For more extensive HTML that should be copied verbatim to
  5021. the exported file use either
  5022. @example
  5023. #+HTML: Literal HTML code for export
  5024. @end example
  5025. @noindent or
  5026. @example
  5027. #+BEGIN_HTML
  5028. All lines between these markers are exported literally
  5029. #+END_HTML
  5030. @end example
  5031. @node Links, Images, Quoting HTML tags, HTML export
  5032. @subsection Links
  5033. @cindex links, in HTML export
  5034. @cindex internal links, in HTML export
  5035. @cindex external links, in HTML export
  5036. Internal links (@pxref{Internal links}) will continue to work in HTML
  5037. files only if they match a dedicated @samp{<<target>>}. Automatic links
  5038. created by radio targets (@pxref{Radio targets}) will also work in the
  5039. HTML file. Links to external files will still work if the HTML file is
  5040. in the same directory as the Org-mode file. Links to other @file{.org}
  5041. files will be translated into HTML links under the assumption that an
  5042. HTML version also exists of the linked file. For information related to
  5043. linking files while publishing them to a publishing directory see
  5044. @ref{Publishing links}.
  5045. @node Images, CSS support, Links, HTML export
  5046. @subsection Images
  5047. @cindex images, inline in HTML
  5048. @cindex inlining images in HTML
  5049. HTML export can inline images given as links in the Org-mode file, and
  5050. it can make an image the clickable part of a link. By
  5051. default@footnote{but see the variable
  5052. @code{org-export-html-inline-images}}, images are inlined if a link does
  5053. not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
  5054. while @samp{[[file:myimg.jpg][the image]]} will just produce a link
  5055. @samp{the image} that points to the image. If the description part
  5056. itself is a @code{file:} link or a @code{http:} URL pointing to an
  5057. image, this image will be inlined and activated so that clicking on the
  5058. image will activate the link. For example, to include a thumbnail that
  5059. will link to a high resolution version of the image, you could use:
  5060. @example
  5061. [[file:highres.jpg][file:thumb.jpg]]
  5062. @end example
  5063. @noindent
  5064. and you could use @code{http} addresses just as well.
  5065. @node CSS support, , Images, HTML export
  5066. @subsection CSS support
  5067. You can also give style information for the exported file. The HTML
  5068. exporter assigns the following CSS classes to appropriate parts of the
  5069. document - your style specifications may change these:
  5070. @example
  5071. .todo @r{TODO keywords}
  5072. .done @r{the DONE keyword}
  5073. .timestamp @r{time stamp}
  5074. .timestamp-kwd @r{keyword associated with a time stamp, like SCHEDULED}
  5075. .tag @r{tag in a headline}
  5076. .target @r{target for links}
  5077. @end example
  5078. The default style specification can be configured through the option
  5079. @code{org-export-html-style}. If you want to use a file-local style,
  5080. you may use file variables, best wrapped into a COMMENT section at the
  5081. end of the outline tree. For example@footnote{Under Emacs 21, the
  5082. continuation lines for a variable value should have no @samp{#} at the
  5083. start of the line.}:
  5084. @example
  5085. * COMMENT html style specifications
  5086. # Local Variables:
  5087. # org-export-html-style: " <style type=\"text/css\">
  5088. # p @{font-weight: normal; color: gray; @}
  5089. # h1 @{color: black; @}
  5090. # </style>"
  5091. # End:
  5092. @end example
  5093. Remember to execute @kbd{M-x normal-mode} after changing this to make
  5094. the new style visible to Emacs. This command restarts org-mode for the
  5095. current buffer and forces Emacs to re-evaluate the local variables
  5096. section in the buffer.
  5097. @c FIXME: More about header and footer styles
  5098. @c FIXME: Talk about links and targets.
  5099. @node LaTeX export, XOXO export, HTML export, Exporting
  5100. @section LaTeX export
  5101. @cindex LaTeX export
  5102. Org-mode contains a La@TeX{} exporter written by Bastien Guerry.
  5103. @menu
  5104. * LaTeX export commands:: How to invoke LaTeX export
  5105. * Quoting LaTeX code:: Incorporating literal LaTeX code
  5106. @end menu
  5107. @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
  5108. @subsection LaTeX export commands
  5109. @table @kbd
  5110. @kindex C-c C-e l
  5111. @item C-c C-e l
  5112. Export as La@TeX{} file @file{myfile.tex}.
  5113. @kindex C-c C-e L
  5114. @item C-c C-e L
  5115. Export to a temporary buffer, do not create a file.
  5116. @kindex C-c C-e v l
  5117. @kindex C-c C-e v L
  5118. @item C-c C-e v l
  5119. @item C-c C-e v L
  5120. Export only the visible part of the document.
  5121. @item M-x org-export-region-as-latex
  5122. Convert the region to La@TeX{} under the assumption that it was org-mode
  5123. syntax before. This is a global command that can be invoked in any
  5124. buffer.
  5125. @item M-x org-replace-region-by-latex
  5126. Replace the active region (assumed to be in Org-mode syntax) by La@TeX{}
  5127. code.
  5128. @end table
  5129. @cindex headline levels, for exporting
  5130. In the exported version, the first 3 outline levels will become
  5131. headlines, defining a general document structure. Additional levels
  5132. will be exported as description lists. The exporter can ignore them or
  5133. convert them to a custom string depending on
  5134. @code{org-latex-low-levels}.
  5135. If you want that transition to occur at a different level, specify it
  5136. with a prefix argument. For example,
  5137. @example
  5138. @kbd{C-2 C-c C-e l}
  5139. @end example
  5140. @noindent
  5141. creates two levels of headings and does the rest as items.
  5142. @node Quoting LaTeX code, , LaTeX export commands, LaTeX export
  5143. @subsection Quoting LaTeX code
  5144. Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
  5145. inserted into the La@TeX{} file. Forthermore, you can add special code
  5146. that should only be present in La@TeX{} export with the following
  5147. constructs:
  5148. @example
  5149. #+LaTeX: Literal LaTeX code for export
  5150. @end example
  5151. @noindent or
  5152. @example
  5153. #+BEGIN_LaTeX
  5154. All lines between these markers are exported literally
  5155. #+END_LaTeX
  5156. @end example
  5157. @node XOXO export, iCalendar export, LaTeX export, Exporting
  5158. @section XOXO export
  5159. @cindex XOXO export
  5160. Org-mode contains an exporter that produces XOXO-style output.
  5161. Currently, this exporter only handles the general outline structure and
  5162. does not interpret any additional Org-mode features.
  5163. @table @kbd
  5164. @kindex C-c C-e x
  5165. @item C-c C-e x
  5166. Export as XOXO file @file{myfile.html}.
  5167. @kindex C-c C-e v
  5168. @item C-c C-e v x
  5169. Export only the visible part of the document.
  5170. @end table
  5171. @node iCalendar export, Text interpretation, XOXO export, Exporting
  5172. @section iCalendar export
  5173. @cindex iCalendar export
  5174. Some people like to use Org-mode for keeping track of projects, but
  5175. still prefer a standard calendar application for anniversaries and
  5176. appointments. In this case it can be useful to have deadlines and
  5177. other time-stamped items in Org-mode files show up in the calendar
  5178. application. Org-mode can export calendar information in the standard
  5179. iCalendar format. If you also want to have TODO entries included in the
  5180. export, configure the variable @code{org-icalendar-include-todo}.
  5181. @table @kbd
  5182. @kindex C-c C-e i
  5183. @item C-c C-e i
  5184. Create iCalendar entries for the current file and store them in the same
  5185. directory, using a file extension @file{.ics}.
  5186. @kindex C-c C-e I
  5187. @item C-c C-e I
  5188. Like @kbd{C-c C-e i}, but do this for all files in
  5189. @code{org-agenda-files}. For each of these files, a separate iCalendar
  5190. file will be written.
  5191. @kindex C-c C-e c
  5192. @item C-c C-e c
  5193. Create a single large iCalendar file from all files in
  5194. @code{org-agenda-files} and write it to the file given by
  5195. @code{org-combined-agenda-icalendar-file}.
  5196. @end table
  5197. How this calendar is best read and updated, depends on the application
  5198. you are using. The FAQ covers this issue.
  5199. @node Text interpretation, , iCalendar export, Exporting
  5200. @section Text interpretation by the exporter
  5201. The exporter backends interpret additional structure in the Org-mode file
  5202. in order to produce better output.
  5203. @menu
  5204. * Comment lines:: Some lines will not be exported
  5205. * Initial text:: Text before the first headline
  5206. * Footnotes:: Numbers like [1]
  5207. * Enhancing text:: Subscripts, symbols and more
  5208. * Export options:: How to influence the export settings
  5209. @end menu
  5210. @node Comment lines, Initial text, Text interpretation, Text interpretation
  5211. @subsection Comment lines
  5212. @cindex comment lines
  5213. @cindex exporting, not
  5214. Lines starting with @samp{#} in column zero are treated as comments
  5215. and will never be exported. Also entire subtrees starting with the
  5216. word @samp{COMMENT} will never be exported.
  5217. @table @kbd
  5218. @kindex C-c ;
  5219. @item C-c ;
  5220. Toggle the COMMENT keyword at the beginning of an entry.
  5221. @end table
  5222. @node Initial text, Footnotes, Comment lines, Text interpretation
  5223. @subsection Text before the first headline
  5224. Org-mode normally ignores any text before the first headline when
  5225. exporting, leaving this region for internal links to speed up navigation
  5226. etc. However, in publishing-oriented files, you might want to have some
  5227. text before the first headline, like a small introduction, special HTML
  5228. code with a navigation bar, etc. You can ask to have this part of the
  5229. file exported as well by setting the variable
  5230. @code{org-export-skip-text-before-1st-heading} to @code{nil}. On a
  5231. per-file basis, you can get the same effect with
  5232. @example
  5233. #+OPTIONS: skip:nil
  5234. @end example
  5235. The text before the first headline will be fully processed
  5236. (@pxref{Enhancing text}), and the first non-comment line becomes the
  5237. title of the exported document. If you need to include literal HTML,
  5238. use the special constructs described in @ref{Quoting HTML tags}. The
  5239. table of contents is normally inserted directly before the first
  5240. headline of the file. If you would like to get it to a different
  5241. location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
  5242. itself at the desired location.
  5243. Finally, if you want to use the space before the first headline for
  5244. internal purposes, but @emph{still} want to place something before the
  5245. first headline when exporting the file, you can use the @code{#+TEXT}
  5246. construct:
  5247. @example
  5248. #+OPTIONS: skip:t
  5249. #+TEXT: This text will go before the *first* headline.
  5250. #+TEXT: We place the table of contents here:
  5251. #+TEXT: [TABLE-OF-CONTENTS]
  5252. #+TEXT: This goes between the table of contents and the first headline
  5253. @end example
  5254. @node Footnotes, Enhancing text, Initial text, Text interpretation
  5255. @subsection Footnotes
  5256. @cindex footnotes
  5257. @cindex @file{footnote.el}
  5258. Numbers in square brackets are treated as footnotes, so that you can use
  5259. the Emacs package @file{footnote.el} to create footnotes. For example:
  5260. @example
  5261. The org-mode homepage[1] clearly needs help from
  5262. a good web designer.
  5263. [1] The link is: http://www.astro.uva.nl/~dominik/Tools/org
  5264. @end example
  5265. @noindent
  5266. @kindex C-c !
  5267. Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
  5268. commands. This binding conflicts with the org-mode command for
  5269. inserting inactive time stamps. You could use the variable
  5270. @code{footnote-prefix} to switch footnotes commands to another key. Or,
  5271. if you are too used to this binding, you could use
  5272. @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
  5273. the settings in Org-mode.
  5274. @node Enhancing text, Export options, Footnotes, Text interpretation
  5275. @subsection Enhancing text for export
  5276. @cindex enhancing text
  5277. @cindex richer text
  5278. Some of the export backends of Org-mode allow for sophisticated text
  5279. formatting, this is true in particular for the HTML and La@TeX{}
  5280. backends. Org-mode has a number of typing conventions that allow to
  5281. produce a richly formatted output.
  5282. @itemize @bullet
  5283. @cindex hand-formatted lists
  5284. @cindex lists, hand-formatted
  5285. @item
  5286. Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
  5287. or @samp{2)} as enumerator will be recognized and transformed if the
  5288. backend supports lists. See @xref{Plain lists}.
  5289. @cindex underlined text
  5290. @cindex bold text
  5291. @cindex italic text
  5292. @item
  5293. You can make words @b{*bold*}, @i{/italic/}, _underlined_,
  5294. @code{=code=}, and even @samp{+strikethrough+}@footnote{but remember
  5295. that strikethrough is typographically evil and should @i{never} be
  5296. used.}.
  5297. @cindex horizontal rules, in exported files
  5298. @item
  5299. A line consisting of only dashes, and at least 5 of them, will be
  5300. exported as a horizontal line (@samp{<hr/>} in HTML).
  5301. @cindex LaTeX fragments, export
  5302. @cindex TeX macros, export
  5303. @item
  5304. Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
  5305. entities or images (@pxref{Embedded LaTeX}).
  5306. @cindex tables, export
  5307. @item
  5308. Tables are transformed into native tables under the exporter, if the
  5309. export backend supports this. Data fields before the first horizontal
  5310. separator line will be formatted as table header fields.
  5311. @cindex fixed width
  5312. @item
  5313. If a headline starts with the word @samp{QUOTE}, the text below the
  5314. headline will be typeset as fixed-width, to allow quoting of computer
  5315. codes etc. Lines starting with @samp{:} are also typeset in fixed-width
  5316. font.
  5317. @table @kbd
  5318. @kindex C-c :
  5319. @item C-c :
  5320. Toggle fixed-width for entry (QUOTE) or region, see below.
  5321. @end table
  5322. @cindex linebreak, forced
  5323. @item
  5324. A double backslash @emph{at the end of a line} enforces a line break at
  5325. this position.
  5326. @end itemize
  5327. If these conversions conflict with your habits of typing ASCII text,
  5328. they can all be turned off with corresponding variables. See the
  5329. customization group @code{org-export-general}, and the following section
  5330. which explains how to set export options with special lines in a
  5331. buffer.
  5332. @node Export options, , Enhancing text, Text interpretation
  5333. @subsection Export options
  5334. @cindex options, for export
  5335. @cindex completion, of option keywords
  5336. The exporter recognizes special lines in the buffer which provide
  5337. additional information. These lines may be put anywhere in the file.
  5338. The whole set of lines can be inserted into the buffer with @kbd{C-c
  5339. C-e t}. For individual lines, a good way to make sure the keyword is
  5340. correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
  5341. (@pxref{Completion}).
  5342. @table @kbd
  5343. @kindex C-c C-e t
  5344. @item C-c C-e t
  5345. Insert template with export options, see example below.
  5346. @end table
  5347. @example
  5348. #+TITLE: the title to be shown (default is the buffer name)
  5349. #+AUTHOR: the author (default taken from @code{user-full-name})
  5350. #+EMAIL: his/her email address (default from @code{user-mail-address})
  5351. #+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
  5352. #+TEXT: Some descriptive text to be inserted at the beginning.
  5353. #+TEXT: Several lines may be given.
  5354. #+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
  5355. @end example
  5356. @noindent
  5357. The OPTIONS line is a compact form to specify export settings. Here
  5358. you can:
  5359. @cindex headline levels
  5360. @cindex section-numbers
  5361. @cindex table of contents
  5362. @cindex linebreak preservation
  5363. @cindex quoted HTML tags
  5364. @cindex fixed-width sections
  5365. @cindex tables
  5366. @cindex @TeX{}-like syntax for sub- and superscripts
  5367. @cindex footnotes
  5368. @cindex emphasized text
  5369. @cindex @TeX{} macros
  5370. @cindex La@TeX{} fragments
  5371. @cindex author info, in export
  5372. @cindex time info, in export
  5373. @example
  5374. H: @r{set the number of headline levels for export}
  5375. num: @r{turn on/off section-numbers}
  5376. toc: @r{turn on/off table of contents, or set level limit (integer)}
  5377. \n: @r{turn on/off linebreak-preservation}
  5378. @@: @r{turn on/off quoted HTML tags}
  5379. :: @r{turn on/off fixed-width sections}
  5380. |: @r{turn on/off tables}
  5381. ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
  5382. @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
  5383. @r{the simple @code{a_b} will be left as it is.}
  5384. f: @r{turn on/off foototes like this[1].}
  5385. *: @r{turn on/off emphasized text (bold, italic, underlined)}
  5386. TeX: @r{turn on/off simple @TeX{} macros in plain text}
  5387. LaTeX: @r{turn on/off La@TeX{} fragments}
  5388. skip: @r{turn on/off skipping the text before the first heading}
  5389. author: @r{turn on/off inclusion of author name/email into exported file}
  5390. timestamp: @r{turn on/off inclusion creation time into exported file}
  5391. @end example
  5392. These options take effect in both the HTML and La@TeX{} export, except
  5393. for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
  5394. @code{nil} for the La@TeX{} export.
  5395. @node Publishing, Miscellaneous, Exporting, Top
  5396. @chapter Publishing
  5397. @cindex publishing
  5398. Org-mode includes@footnote{@file{org-publish.el} is not distributed with
  5399. Emacs 21, if you are still using Emacs 21, you need you need to download
  5400. this file separately.} a publishing management system that allows you to
  5401. configure automatic HTML conversion of @emph{projects} composed of
  5402. interlinked org files. This system is called @emph{org-publish}. You can
  5403. also configure org-publish to automatically upload your exported HTML
  5404. pages and related attachments, such as images and source code files, to
  5405. a web server. Org-publish turns org-mode into a web-site authoring tool.
  5406. You can also use Org-publish to convert files into La@TeX{}, or even
  5407. combine HTML and La@TeX{} conversion so that files are available in both
  5408. formats on the server@footnote{Since La@TeX{} files on a server are not
  5409. that helpful, you surely want to perform further conversion on them --
  5410. e.g. convert them to @code{PDF} format.}.
  5411. Org-publish has been contributed to Org-mode by David O'Toole.
  5412. @menu
  5413. * Configuration:: Defining projects
  5414. * Sample configuration:: Example projects
  5415. * Triggering publication:: Publication commands
  5416. @end menu
  5417. @node Configuration, Sample configuration, Publishing, Publishing
  5418. @section Configuration
  5419. Publishing needs significant configuration to specify files, destination
  5420. and many other properties of a project.
  5421. @menu
  5422. * Project alist:: The central configuration variable
  5423. * Sources and destinations:: From here to there
  5424. * Selecting files:: What files are part of the project?
  5425. * Publishing action:: Setting the function doing the publishing
  5426. * Publishing options:: Tweaking HTML export
  5427. * Publishing links:: Which links keep working after publishing?
  5428. * Project page index:: Publishing a list of project files
  5429. @end menu
  5430. @node Project alist, Sources and destinations, Configuration, Configuration
  5431. @subsection The variable @code{org-publish-project-alist}
  5432. @cindex org-publish-project-alist
  5433. @cindex projects, for publishing
  5434. Org-publish is configured almost entirely through setting the value of
  5435. one variable, called @code{org-publish-project-alist}.
  5436. Each element of the list configures one project, and may be in one of
  5437. the two following forms:
  5438. @lisp
  5439. ("project-name" :property value :property value ...)
  5440. @r{or}
  5441. ("project-name" :components ("project-name" "project-name" ...))
  5442. @end lisp
  5443. In both cases, projects are configured by specifying property values.
  5444. A project defines the set of files that will be published, as well as
  5445. the publishing configuration to use when publishing those files. When
  5446. a project takes the second form listed above, the individual members
  5447. of the ``components'' property are taken to be components of the
  5448. project, which group together files requiring different publishing
  5449. options. When you publish such a ``meta-project'' all the components
  5450. will also publish.
  5451. @node Sources and destinations, Selecting files, Project alist, Configuration
  5452. @subsection Sources and destinations for files
  5453. @cindex directories, for publishing
  5454. Most properties are optional, but some should always be set. In
  5455. particular, org-publish needs to know where to look for source files,
  5456. and where to put published files.
  5457. @multitable @columnfractions 0.3 0.7
  5458. @item @code{:base-directory}
  5459. @tab Directory containing publishing source files
  5460. @item @code{:publishing-directory}
  5461. @tab Directory (possibly remote) where output files will be published.
  5462. @item @code{:preparation-function}
  5463. @tab Function called before starting publishing process, for example to
  5464. run @code{make} for updating files to be published.
  5465. @end multitable
  5466. @noindent
  5467. @node Selecting files, Publishing action, Sources and destinations, Configuration
  5468. @subsection Selecting files
  5469. @cindex files, selecting for publishing
  5470. By default, all files with extension @file{.org} in the base directory
  5471. are considered part of the project. This can be modified by setting the
  5472. properties
  5473. @multitable @columnfractions 0.25 0.75
  5474. @item @code{:base-extension}
  5475. @tab Extension (without the dot!) of source files. This actually is a
  5476. regular expression.
  5477. @item @code{:exclude}
  5478. @tab Regular expression to match file names that should not be
  5479. published, even though they have been selected on the basis of their
  5480. extension.
  5481. @item @code{:include}
  5482. @tab List of files to be included regardless of @code{:base-extension}
  5483. and @code{:exclude}.
  5484. @end multitable
  5485. @node Publishing action, Publishing options, Selecting files, Configuration
  5486. @subsection Publishing Action
  5487. @cindex action, for publishing
  5488. Publishing means that a file is copied to the destination directory and
  5489. possibly transformed in the process. The default transformation is to
  5490. export Org-mode files as HTML files, and this is done by the function
  5491. @code{org-publish-org-to-html} which calls the HTML exporter
  5492. (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
  5493. using the function @code{org-publish-org-to-latex} instead. Other files
  5494. like images only need to be copied to the publishing destination. For
  5495. non-Org-mode files, you need to specify the publishing function.
  5496. @multitable @columnfractions 0.3 0.7
  5497. @item @code{:publishing-function}
  5498. @tab Function executing the publication of a file. This may also be a
  5499. list of functions, which will all be called in turn.
  5500. @end multitable
  5501. The function must accept two arguments: a property list containing at
  5502. least a @code{:publishing-directory} property, and the name of the file
  5503. to be published. It should take the specified file, make the necessary
  5504. transformation (if any) and place the result into the destination folder.
  5505. You can write your own publishing function, but @code{org-publish}
  5506. provides one for attachments (files that only need to be copied):
  5507. @code{org-publish-attachment}.
  5508. @node Publishing options, Publishing links, Publishing action, Configuration
  5509. @subsection Options for the HTML/LaTeX exporters
  5510. @cindex options, for publishing
  5511. The property list can be used to set many export options for the HTML
  5512. and La@TeX{} exporters. In most cases, these properties correspond to user
  5513. variables in Org-mode. The table below lists these properties along
  5514. with the variable they belong to. See the documentation string for the
  5515. respective variable for details.
  5516. @multitable @columnfractions 0.3 0.7
  5517. @item @code{:language} @tab @code{org-export-default-language}
  5518. @item @code{:headline-levels} @tab @code{org-export-headline-levels}
  5519. @item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
  5520. @item @code{:table-of-contents} @tab @code{org-export-with-toc}
  5521. @item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
  5522. @item @code{:emphasize} @tab @code{org-export-with-emphasize}
  5523. @item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
  5524. @item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
  5525. @item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
  5526. @item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
  5527. @item @code{:timestamps} .@tab @code{org-export-with-timestamps}
  5528. @item @code{:tags} .@tab @code{org-export-with-tags}
  5529. @item @code{:tables} @tab @code{org-export-with-tables}
  5530. @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
  5531. @item @code{:style} @tab @code{org-export-html-style}
  5532. @item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
  5533. @item @code{:inline-images} @tab @code{org-export-html-inline-images}
  5534. @item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
  5535. @item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
  5536. @item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
  5537. @item @code{:preamble} @tab @code{org-export-html-preamble}
  5538. @item @code{:postamble} @tab @code{org-export-html-postamble}
  5539. @item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
  5540. @item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
  5541. @item @code{:author} @tab @code{user-full-name}
  5542. @item @code{:email} @tab @code{user-mail-address}
  5543. @end multitable
  5544. Most of the @code{org-export-with-*} variables have the same effect in
  5545. both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
  5546. @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
  5547. La@TeX{} export.
  5548. When a property is given a value in org-publish-project-alist, its
  5549. setting overrides the value of the corresponding user variable (if any)
  5550. during publishing. Options set within a file (@pxref{Export
  5551. options}), however, override everything.
  5552. @node Publishing links, Project page index, Publishing options, Configuration
  5553. @subsection Links between published files
  5554. @cindex links, publishing
  5555. To create a link from one Org-mode file to another, you would use
  5556. something like @samp{[[file:foo.org][The foo]]} or simply
  5557. @samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link
  5558. becomes a link to @file{foo.html}. In this way, you can interlink the
  5559. pages of your "org web" project and the links will work as expected when
  5560. you publish them to HTML.
  5561. You may also link to related files, such as images. Provided you are
  5562. careful with relative pathnames, and provided you have also configured
  5563. org-publish to upload the related files, these links will work
  5564. too. @ref{Complex example} for an example of this usage.
  5565. Sometime an Org-mode file to be published may contain links that are
  5566. only valid in your production environment, but not in the publishing
  5567. location. In this case, use the property
  5568. @multitable @columnfractions 0.4 0.6
  5569. @item @code{:link-validation-function}
  5570. @tab Function to validate links
  5571. @end multitable
  5572. @noindent
  5573. to define a function for checking link validity. This function must
  5574. accept two arguments, the file name and a directory relative to which
  5575. the file name is interpreted in the production environment. If this
  5576. function returns @code{nil}, then the HTML generator will only insert a
  5577. description into the HTML file, but no link. One option for this
  5578. function is @code{org-publish-validate-link} which checks if the given
  5579. file is part of any project in @code{org-publish-project-alist}.
  5580. @node Project page index, , Publishing links, Configuration
  5581. @subsection Project page index
  5582. @cindex index, of published pages
  5583. The following properties may be used to control publishing of an
  5584. index of files or summary page for a given project.
  5585. @multitable @columnfractions 0.25 0.75
  5586. @item @code{:auto-index}
  5587. @tab When non-nil, publish an index during org-publish-current-project or
  5588. org-publish-all.
  5589. @item @code{:index-filename}
  5590. @tab Filename for output of index. Defaults to @file{index.org} (which
  5591. becomes @file{index.html}).
  5592. @item @code{:index-title}
  5593. @tab Title of index page. Defaults to name of file.
  5594. @item @code{:index-function}
  5595. @tab Plugin function to use for generation of index.
  5596. Defaults to @code{org-publish-org-index}, which generates a plain list
  5597. of links to all files in the project.
  5598. @end multitable
  5599. @node Sample configuration, Triggering publication, Configuration, Publishing
  5600. @section Sample configuration
  5601. Below we provide two example configurations. The first one is a simple
  5602. project publishing only a set of Org-mode files. The second example is
  5603. more complex, with a multi-component project.
  5604. @menu
  5605. * Simple example:: One-component publishing
  5606. * Complex example:: A multi-component publishing example
  5607. @end menu
  5608. @node Simple example, Complex example, Sample configuration, Sample configuration
  5609. @subsection Example: simple publishing configuration
  5610. This example publishes a set of Org-mode files to the @file{public_html}
  5611. directory on the local machine.
  5612. @lisp
  5613. (setq org-publish-project-alist
  5614. '(("org"
  5615. :base-directory "~/org/"
  5616. :publishing-directory "~/public_html"
  5617. :section-numbers nil
  5618. :table-of-contents nil
  5619. :style "<link rel=stylesheet
  5620. href=\"../other/mystyle.css\"
  5621. type=\"text/css\">")))
  5622. @end lisp
  5623. @node Complex example, , Simple example, Sample configuration
  5624. @subsection Example: complex publishing configuration
  5625. This more complicated example publishes an entire website, including
  5626. org files converted to HTML, image files, emacs lisp source code, and
  5627. stylesheets. The publishing-directory is remote and private files are
  5628. excluded.
  5629. To ensure that links are preserved, care should be taken to replicate
  5630. your directory structure on the web server, and to use relative file
  5631. paths. For example, if your org files are kept in @file{~/org} and your
  5632. publishable images in @file{~/images}, you'd link to an image with
  5633. @c
  5634. @example
  5635. file:../images/myimage.png
  5636. @end example
  5637. @c
  5638. On the web server, the relative path to the image should be the
  5639. same. You can accomplish this by setting up an "images" folder in the
  5640. right place on the webserver, and publishing images to it.
  5641. @lisp
  5642. (setq org-publish-project-alist
  5643. '(("orgfiles"
  5644. :base-directory "~/org/"
  5645. :base-extension "org"
  5646. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  5647. :publishing-function org-publish-org-to-html
  5648. :exclude "PrivatePage.org" ;; regexp
  5649. :headline-levels 3
  5650. :section-numbers nil
  5651. :table-of-contents nil
  5652. :style "<link rel=stylesheet
  5653. href=\"../other/mystyle.css\" type=\"text/css\">"
  5654. :auto-preamble t
  5655. :auto-postamble nil)
  5656. ("images"
  5657. :base-directory "~/images/"
  5658. :base-extension "jpg\\|gif\\|png"
  5659. :publishing-directory "/ssh:user@@host:~/html/images/"
  5660. :publishing-function org-publish-attachment)
  5661. ("other"
  5662. :base-directory "~/other/"
  5663. :base-extension "css\\|el"
  5664. :publishing-directory "/ssh:user@@host:~/html/other/"
  5665. :publishing-function org-publish-attachment)
  5666. ("website" :components ("orgfiles" "images" "other"))))
  5667. @end lisp
  5668. @node Triggering publication, , Sample configuration, Publishing
  5669. @section Triggering publication
  5670. Once org-publish is properly configured, you can publish with the
  5671. following functions:
  5672. @table @kbd
  5673. @item C-c C-e C
  5674. Prompt for a specific project and publish all files that belong to it.
  5675. @item C-c C-e P
  5676. Publish the project containing the current file.
  5677. @item C-c C-e F
  5678. Publish only the current file.
  5679. @item C-c C-e A
  5680. Publish all projects.
  5681. @end table
  5682. Org uses timestamps to track when a file has changed. The above
  5683. functions normally only publish changed files. You can override this and
  5684. force publishing of all files by giving a prefix argument.
  5685. @node Miscellaneous, Extensions and Hacking, Publishing, Top
  5686. @chapter Miscellaneous
  5687. @menu
  5688. * Completion:: M-TAB knows what you need
  5689. * Customization:: Adapting Org-mode to your taste
  5690. * In-buffer settings:: Overview of the #+KEYWORDS
  5691. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  5692. * Clean view:: Getting rid of leading stars in the outline
  5693. * TTY keys:: Using Org-mode on a tty
  5694. * Interaction:: Other Emacs packages
  5695. * Bugs:: Things which do not work perfectly
  5696. @end menu
  5697. @node Completion, Customization, Miscellaneous, Miscellaneous
  5698. @section Completion
  5699. @cindex completion, of @TeX{} symbols
  5700. @cindex completion, of TODO keywords
  5701. @cindex completion, of dictionary words
  5702. @cindex completion, of option keywords
  5703. @cindex completion, of tags
  5704. @cindex completion, of property keys
  5705. @cindex completion, of link abbreviations
  5706. @cindex @TeX{} symbol completion
  5707. @cindex TODO keywords completion
  5708. @cindex dictionary word completion
  5709. @cindex option keyword completion
  5710. @cindex tag completion
  5711. @cindex link abbreviations, completion of
  5712. Org-mode supports in-buffer completion. This type of completion does
  5713. not make use of the minibuffer. You simply type a few letters into
  5714. the buffer and use the key to complete text right there.
  5715. @table @kbd
  5716. @kindex M-@key{TAB}
  5717. @item M-@key{TAB}
  5718. Complete word at point
  5719. @itemize @bullet
  5720. @item
  5721. At the beginning of a headline, complete TODO keywords.
  5722. @item
  5723. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  5724. @item
  5725. After @samp{*}, complete headlines in the current buffer so that they
  5726. can be used in search links like @samp{[[*find this headline]]}.
  5727. @item
  5728. After @samp{:} in a headline, complete tags. The list of tags is taken
  5729. from the variable @code{org-tag-alist} (possibly set through the
  5730. @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
  5731. dynamically from all tags used in the current buffer.
  5732. @item
  5733. After @samp{:} and not in a headline, complete property keys. The list
  5734. of keys is constructed dynamically from all keys used in the current
  5735. buffer.
  5736. @item
  5737. After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
  5738. @item
  5739. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  5740. @samp{OPTIONS} which set file-specific options for Org-mode. When the
  5741. option keyword is already complete, pressing @kbd{M-@key{TAB}} again
  5742. will insert example settings for this keyword.
  5743. @item
  5744. In the line after @samp{#+STARTUP: }, complete startup keywords,
  5745. i.e. valid keys for this line.
  5746. @item
  5747. Elsewhere, complete dictionary words using ispell.
  5748. @end itemize
  5749. @end table
  5750. @node Customization, In-buffer settings, Completion, Miscellaneous
  5751. @section Customization
  5752. @cindex customization
  5753. @cindex options, for customization
  5754. @cindex variables, for customization
  5755. There are more than 180 variables that can be used to customize
  5756. Org-mode. For the sake of compactness of the manual, I am not
  5757. describing the variables here. A structured overview of customization
  5758. variables is available with @kbd{M-x org-customize}. Or select
  5759. @code{Browse Org Group} from the @code{Org->Customization} menu. Many
  5760. settings can also be activated on a per-file basis, by putting special
  5761. lines into the buffer (@pxref{In-buffer settings}).
  5762. @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
  5763. @section Summary of in-buffer settings
  5764. @cindex in-buffer settings
  5765. @cindex special keywords
  5766. Org-mode uses special lines in the buffer to define settings on a
  5767. per-file basis. These lines start with a @samp{#+} followed by a
  5768. keyword, a colon, and then individual words defining a setting. Several
  5769. setting words can be in the same line, but you can also have multiple
  5770. lines for the keyword. While these settings are described throughout
  5771. the manual, here is a summary. After changing any of those lines in the
  5772. buffer, press @kbd{C-c C-c} with the cursor still in the line to
  5773. activate the changes immediately. Otherwise they become effective only
  5774. when the file is visited again in a new Emacs session.
  5775. @table @kbd
  5776. @item #+ARCHIVE: %s_done::
  5777. This line sets the archive location for the agenda file. It applies for
  5778. all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
  5779. of the file. The first such line also applies to any entries before it.
  5780. The corresponding variable is @code{org-archive-location}.
  5781. @item #+CATEGORY:
  5782. This line sets the category for the agenda file. The category applies
  5783. for all subsequent lines until the next @samp{#+CATEGORY} line, or the
  5784. end of the file. The first such line also applies to any entries before it.
  5785. @item #+COLUMNS: %25ITEM .....
  5786. Set the default format for columns view. This format applies when
  5787. columns view is invoked in location where no COLUMNS property applies.
  5788. @item #+CONSTANTS: name1=value1 ...
  5789. Set file-local values for constants to be used in table formulas. This
  5790. line set the local variable @code{org-table-formula-constants-local}.
  5791. The global version of theis variable is
  5792. @code{org-table-formula-constants}.
  5793. corresponding
  5794. @item #+LINK: linkword replace
  5795. These lines (several are allowed) specify link abbreviations.
  5796. @xref{Link abbreviations}. The corresponding variable is
  5797. @code{org-link-abbrev-alist}.
  5798. @item #+PRIORITIES: highest lowest default
  5799. This line sets the limits and the default for the priorities. All three
  5800. must be either letters A-Z or numbers 0-9. The highest priority must
  5801. have a lower ASCII number that the lowest priority.
  5802. @item #+PROPERTY: Property_Name Value
  5803. This line sets a default inheritance value for entries in the current
  5804. buffer, most useful for specifying the allowed values of a property.
  5805. @item #+STARTUP:
  5806. This line sets options to be used at startup of Org-mode, when an
  5807. Org-mode file is being visited. The first set of options deals with the
  5808. initial visibility of the outline tree. The corresponding variable for
  5809. global default settings is @code{org-startup-folded}, with a default
  5810. value @code{t}, which means @code{overview}.
  5811. @cindex @code{overview}, STARTUP keyword
  5812. @cindex @code{content}, STARTUP keyword
  5813. @cindex @code{showall}, STARTUP keyword
  5814. @example
  5815. overview @r{top-level headlines only}
  5816. content @r{all headlines}
  5817. showall @r{no folding at all, show everything}
  5818. @end example
  5819. Then there are options for aligning tables upon visiting a file. This
  5820. is useful in files containing narrowed table columns. The corresponding
  5821. variable is @code{org-startup-align-all-tables}, with a default value
  5822. @code{nil}.
  5823. @cindex @code{align}, STARTUP keyword
  5824. @cindex @code{noalign}, STARTUP keyword
  5825. @example
  5826. align @r{align all tables}
  5827. noalign @r{don't align tables on startup}
  5828. @end example
  5829. Logging TODO state changes and clock intervals (variable
  5830. @code{org-log-done}) can be configured using these options.
  5831. @cindex @code{logdone}, STARTUP keyword
  5832. @cindex @code{nologging}, STARTUP keyword
  5833. @cindex @code{lognotedone}, STARTUP keyword
  5834. @cindex @code{lognoteclock-out}, STARTUP keyword
  5835. @cindex @code{lognotestate}, STARTUP keyword
  5836. @cindex @code{logrepeat}, STARTUP keyword
  5837. @cindex @code{nologrepeat}, STARTUP keyword
  5838. @example
  5839. logging @r{record a timestamp when an item is marked DONE}
  5840. nologging @r{don't record when items are marked DONE}
  5841. lognotedone @r{record timestamp and a note when DONE}
  5842. lognotestate @r{record timestamp and a note when TODO state changes}
  5843. logrepeat @r{record a note when re-instating a repeating item}
  5844. nologrepeat @r{do not record when re-instating repeating item}
  5845. lognoteclock-out @r{record timestamp and a note when clocking out}
  5846. @end example
  5847. Here are the options for hiding leading stars in outline headings. The
  5848. corresponding variables are @code{org-hide-leading-stars} and
  5849. @code{org-odd-levels-only}, both with a default setting @code{nil}
  5850. (meaning @code{showstars} and @code{oddeven}).
  5851. @cindex @code{hidestars}, STARTUP keyword
  5852. @cindex @code{showstars}, STARTUP keyword
  5853. @cindex @code{odd}, STARTUP keyword
  5854. @cindex @code{even}, STARTUP keyword
  5855. @example
  5856. hidestars @r{make all but one of the stars starting a headline invisible.}
  5857. showstars @r{show all stars starting a headline}
  5858. odd @r{allow only odd outline levels (1,3,...)}
  5859. oddeven @r{allow all outline levels}
  5860. @end example
  5861. To turn on custom format overlays over time stamps (variables
  5862. @code{org-put-time-stamp-overlays} and
  5863. @code{org-time-stamp-overlay-formats}), use
  5864. @cindex @code{customtime}, STARTUP keyword
  5865. @example
  5866. customtime @r{overlay custom time format}
  5867. @end example
  5868. The following options influence the table spreadsheet (variable
  5869. @code{constants-unit-system}).
  5870. @cindex @code{constcgs}, STARTUP keyword
  5871. @cindex @code{constSI}, STARTUP keyword
  5872. @example
  5873. constcgs @r{@file{constants.el} should use the c-g-s unit system}
  5874. constSI @r{@file{constants.el} should use the SI unit system}
  5875. @end example
  5876. @item #+TAGS: TAG1(c1) TAG2(c2)
  5877. These lines (several such lines are allowed) specify the legal tags in
  5878. this file, and (potentially) the corresponding @emph{fast tag selection}
  5879. keys. The corresponding variable is @code{org-tag-alist}.
  5880. @item #+TBLFM:
  5881. This line contains the formulas for the table directly above the line.
  5882. @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS:
  5883. These lines provide settings for exporting files. For more details see
  5884. @ref{Export options}.
  5885. @item #+SEQ_TODO: #+TYP_TODO:
  5886. These lines set the TODO keywords and their interpretation in the
  5887. current file. The corresponding variables are @code{org-todo-keywords}
  5888. and @code{org-todo-interpretation}.
  5889. @end table
  5890. @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
  5891. @section The very busy C-c C-c key
  5892. @kindex C-c C-c
  5893. @cindex C-c C-c, overview
  5894. The key @kbd{C-c C-c} has many purposes in org-mode, which are all
  5895. mentioned scattered throughout this manual. One specific function of
  5896. this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
  5897. other circumstances it means something like @emph{Hey Org-mode, look
  5898. here and update according to what you see here}. Here is a summary of
  5899. what this means in different contexts.
  5900. @itemize @minus
  5901. @item
  5902. If there are highlights in the buffer from the creation of a sparse
  5903. tree, or from clock display, remove these highlights.
  5904. @item
  5905. If the cursor is in one of the special @code{#+KEYWORD} lines, this
  5906. triggers scanning the buffer for these lines and updating the
  5907. information.
  5908. @item
  5909. If the cursor is inside a table, realign the table. This command
  5910. works even if the automatic table editor has been turned off.
  5911. @item
  5912. If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
  5913. the entire table.
  5914. @item
  5915. If the cursor is inside a table created by the @file{table.el} package,
  5916. activate that table.
  5917. @item
  5918. If the current buffer is a remember buffer, close the note and file it.
  5919. With a prefix argument, file it, without further interaction, to the
  5920. default location.
  5921. @item
  5922. If the cursor is on a @code{<<<target>>>}, update radio targets and
  5923. corresponding links in this buffer.
  5924. @item
  5925. If the cursor is in a property line or at the start or end of a property
  5926. drawer, offer property commands.
  5927. @item
  5928. If the cursor is in a plain list item with a checkbox, toggle the status
  5929. of the checkbox.
  5930. @item
  5931. If the cursor is on a numbered item in a plain list, renumber the
  5932. ordered list.
  5933. @end itemize
  5934. @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
  5935. @section A cleaner outline view
  5936. @cindex hiding leading stars
  5937. @cindex clean outline view
  5938. Some people find it noisy and distracting that the Org-mode headlines
  5939. are starting with a potentially large number of stars. For example
  5940. the tree from @ref{Headlines}:
  5941. @example
  5942. * Top level headline
  5943. ** Second level
  5944. *** 3rd level
  5945. some text
  5946. *** 3rd level
  5947. more text
  5948. * Another top level headline
  5949. @end example
  5950. @noindent
  5951. Unfortunately this is deeply ingrained into the code of Org-mode and
  5952. cannot be easily changed. You can, however, modify the display in such
  5953. a way that all leading stars become invisible and the outline more easy
  5954. to read. To do this, customize the variable
  5955. @code{org-hide-leading-stars} like this:
  5956. @lisp
  5957. (setq org-hide-leading-stars t)
  5958. @end lisp
  5959. @noindent
  5960. or change this on a per-file basis with one of the lines (anywhere in
  5961. the buffer)
  5962. @example
  5963. #+STARTUP: showstars
  5964. #+STARTUP: hidestars
  5965. @end example
  5966. @noindent
  5967. Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
  5968. the modifications.
  5969. With stars hidden, the tree becomes:
  5970. @example
  5971. * Top level headline
  5972. * Second level
  5973. * 3rd level
  5974. some text
  5975. * 3rd level
  5976. more text
  5977. * Another top level headline
  5978. @end example
  5979. @noindent
  5980. Note that the leading stars are not truly replaced by whitespace, they
  5981. are only fontified with the face @code{org-hide} that uses the
  5982. background color as font color. If you are not using either white or
  5983. black background, you may have to customize this face to get the wanted
  5984. effect. Another possibility is to set this font such that the extra
  5985. stars are @i{almost} invisible, for example using the color
  5986. @code{grey90} on a white background.
  5987. Things become cleaner still if you skip all the even levels and use only
  5988. odd levels 1, 3, 5..., effectively adding two stars to go from one
  5989. outline level to the next:
  5990. @example
  5991. * Top level headline
  5992. * Second level
  5993. * 3rd level
  5994. some text
  5995. * 3rd level
  5996. more text
  5997. * Another top level headline
  5998. @end example
  5999. @noindent
  6000. In order to make the structure editing and export commands handle this
  6001. convention correctly, use
  6002. @lisp
  6003. (setq org-odd-levels-only t)
  6004. @end lisp
  6005. @noindent
  6006. or set this on a per-file basis with one of the following lines (don't
  6007. forget to press @kbd{C-c C-c} with the cursor in the startup line to
  6008. activate changes immediately).
  6009. @example
  6010. #+STARTUP: odd
  6011. #+STARTUP: oddeven
  6012. @end example
  6013. You can convert an Org-mode file from single-star-per-level to the
  6014. double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
  6015. RET} in that file. The reverse operation is @kbd{M-x
  6016. org-convert-to-oddeven-levels}.
  6017. @node TTY keys, Interaction, Clean view, Miscellaneous
  6018. @section Using org-mode on a tty
  6019. @cindex tty keybindings
  6020. Org-mode uses a number of keys that are not accessible on a tty. This
  6021. applies to most special keys like cursor keys, @key{TAB} and
  6022. @key{RET}, when these are combined with modifier keys like @key{Meta}
  6023. and/or @key{Shift}. Org-mode uses these bindings because it needs to
  6024. provide keys for a large number of commands, and because these keys
  6025. appeared particularly easy to remember. In order to still be able to
  6026. access the core functionality of Org-mode on a tty, alternative
  6027. bindings are provided. Here is a complete list of these bindings,
  6028. which are obviously more cumbersome to use. Note that sometimes a
  6029. work-around can be better. For example changing a time stamp is
  6030. really only fun with @kbd{S-@key{cursor}} keys. On a tty you would
  6031. rather use @kbd{C-c .} to re-insert the timestamp.
  6032. @multitable @columnfractions 0.15 0.2 0.2
  6033. @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
  6034. @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
  6035. @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
  6036. @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
  6037. @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
  6038. @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
  6039. @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
  6040. @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
  6041. @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
  6042. @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
  6043. @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
  6044. @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
  6045. @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
  6046. @item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
  6047. @item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
  6048. @item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
  6049. @item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
  6050. @item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
  6051. @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
  6052. @end multitable
  6053. @node Interaction, Bugs, TTY keys, Miscellaneous
  6054. @section Interaction with other packages
  6055. @cindex packages, interaction with other
  6056. Org-mode lives in the world of GNU Emacs and interacts in various ways
  6057. with other code out there.
  6058. @menu
  6059. * Cooperation:: Packages Org-mode cooperates with
  6060. * Conflicts:: Packages that lead to conflicts
  6061. @end menu
  6062. @node Cooperation, Conflicts, Interaction, Interaction
  6063. @subsection Packages that Org-mode cooperates with
  6064. @table @asis
  6065. @cindex @file{calc.el}
  6066. @item @file{calc.el} by Dave Gillespie
  6067. Org-mode uses the calc package for implementing spreadsheet
  6068. functionality in its tables (@pxref{The spreadsheet}). Org-mode
  6069. checks for the availability of calc by looking for the function
  6070. @code{calc-eval} which should be autoloaded in your setup if calc has
  6071. been installed properly. As of Emacs 22, calc is part of the Emacs
  6072. distribution. Another possibility for interaction between the two
  6073. packages is using calc for embedded calculations. @xref{Embedded Mode,
  6074. , Embedded Mode, calc, GNU Emacs Calc Manual}.
  6075. @cindex @file{constants.el}
  6076. @item @file{constants.el} by Carsten Dominik
  6077. In a table formula (@pxref{The spreadsheet}), it is possible to use
  6078. names for natural constants or units. Instead of defining your own
  6079. constants in the variable @code{org-table-formula-constants}, install
  6080. the @file{constants} package which defines a large number of constants
  6081. and units, and lets you use unit prefixes like @samp{M} for
  6082. @samp{Mega} etc. You will need version 2.0 of this package, available
  6083. at @url{http://www.astro.uva.nl/~dominik/Tools}. Org-mode checks for
  6084. the function @code{constants-get}, which has to be autoloaded in your
  6085. setup. See the installation instructions in the file
  6086. @file{constants.el}.
  6087. @item @file{cdlatex.el} by Carsten Dominik
  6088. @cindex @file{cdlatex.el}
  6089. Org-mode can make use of the cdlatex package to efficiently enter
  6090. La@TeX{} fragments into Org-mode files. See @ref{CDLaTeX mode}.
  6091. @item @file{remember.el} by John Wiegley
  6092. @cindex @file{remember.el}
  6093. Org mode cooperates with remember, see @ref{Remember}.
  6094. @file{Remember.el} is not part of Emacs, find it on the web.
  6095. @cindex @file{table.el}
  6096. @item @file{table.el} by Takaaki Ota
  6097. @kindex C-c C-c
  6098. @cindex table editor, @file{table.el}
  6099. @cindex @file{table.el}
  6100. Complex ASCII tables with automatic line wrapping, column- and
  6101. row-spanning, and alignment can be created using the Emacs table
  6102. package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
  6103. and also part of Emacs 22).
  6104. When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org-mode
  6105. will call @command{table-recognize-table} and move the cursor into the
  6106. table. Inside a table, the keymap of Org-mode is inactive. In order
  6107. to execute Org-mode-related commands, leave the table.
  6108. @table @kbd
  6109. @kindex C-c C-c
  6110. @item C-c C-c
  6111. Recognize @file{table.el} table. Works when the cursor is in a
  6112. table.el table.
  6113. @c
  6114. @kindex C-c ~
  6115. @item C-c ~
  6116. Insert a table.el table. If there is already a table at point, this
  6117. command converts it between the table.el format and the Org-mode
  6118. format. See the documentation string of the command
  6119. @code{org-convert-table} for the restrictions under which this is
  6120. possible.
  6121. @end table
  6122. @file{table.el} is part of Emacs 22.
  6123. @cindex @file{footnote.el}
  6124. @item @file{footnote.el} by Steven L. Baur
  6125. Org-mode recognizes numerical footnotes as provided by this package
  6126. (@pxref{Footnotes}).
  6127. @end table
  6128. @node Conflicts, , Cooperation, Interaction
  6129. @subsection Packages that lead to conflicts with Org-mode
  6130. @table @asis
  6131. @cindex @file{allout.el}
  6132. @item @file{allout.el} by Ken Manheimer
  6133. Startup of Org-mode may fail with the error message
  6134. @code{(wrong-type-argument keymapp nil)} when there is an outdated
  6135. version @file{allout.el} on the load path, for example the version
  6136. distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will
  6137. disappear. If for some reason you cannot do this, make sure that org.el
  6138. is loaded @emph{before} @file{allout.el}, for example by putting
  6139. @code{(require 'org)} early enough into your @file{.emacs} file.
  6140. @cindex @file{CUA.el}
  6141. @item @file{CUA.el} by Kim. F. Storm
  6142. Keybindings in Org-mode conflict with the @kbd{S-<cursor>} keys
  6143. used by CUA-mode (as well as pc-select-mode and s-region-mode) to
  6144. select and extend the region. If you want to use one of these
  6145. packages along with Org-mode, configure the variable
  6146. @code{org-CUA-compatible}. When set, Org-mode will move the following
  6147. keybindings in Org-mode files, and in the agenda buffer (but not
  6148. during date selection).
  6149. @example
  6150. S-UP -> M-p S-DOWN -> M-n
  6151. S-LEFT -> M-- S-RIGHT -> M-+
  6152. @end example
  6153. Yes, these are unfortunately more difficult to remember. If you want
  6154. to have other replacement keys, look at the variable
  6155. @code{org-disputed-keys}.
  6156. @item @file{windmove.el} by Hovav Shacham
  6157. @cindex @file{windmove.el}
  6158. Also this package uses the @kbd{S-<cursor>} keys, so everything written
  6159. in the paragraph above about CUA mode also applies here.
  6160. @cindex @file{footnote.el}
  6161. @item @file{footnote.el} by Steven L. Baur
  6162. Org-mode supports the syntax of the footnote package, but only the
  6163. numerical footnote markers. Also, the default key for footnote
  6164. commands, @kbd{C-c !} is already used by Org-mode. You could use the
  6165. variable @code{footnote-prefix} to switch footnotes commands to another
  6166. key. Or, you could use @code{org-replace-disputed-keys} and
  6167. @code{org-disputed-keys} to change the settings in Org-mode.
  6168. @end table
  6169. @node Bugs, , Interaction, Miscellaneous
  6170. @section Bugs
  6171. @cindex bugs
  6172. Here is a list of things that should work differently, but which I
  6173. have found too hard to fix.
  6174. @itemize @bullet
  6175. @item
  6176. If a table field starts with a link, and if the corresponding table
  6177. column is narrowed (@pxref{Narrow columns}) to a width too small to
  6178. display the link, the field would look entirely empty even though it is
  6179. not. To prevent this, Org-mode throws an error. The work-around is to
  6180. make the column wide enough to fit the link, or to add some text (at
  6181. least 2 characters) before the link in the same field.
  6182. @item
  6183. Narrowing table columns does not work on XEmacs, because the
  6184. @code{format} function does not transport text properties.
  6185. @item
  6186. Text in an entry protected with the @samp{QUOTE} keyword should not
  6187. autowrap.
  6188. @item
  6189. When the application called by @kbd{C-c C-o} to open a file link fails
  6190. (for example because the application does not exist or refuses to open
  6191. the file), it does so silently. No error message is displayed.
  6192. @item
  6193. Recalculating a table line applies the formulas from left to right.
  6194. If a formula uses @emph{calculated} fields further down the row,
  6195. multiple recalculation may be needed to get all fields consistent. You
  6196. may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
  6197. recalculate until convergence.
  6198. @item
  6199. A single letter cannot be made bold, for example @samp{*a*}.
  6200. @item
  6201. The exporters work well, but could be made more efficient.
  6202. @end itemize
  6203. @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
  6204. @appendix Extensions, Hooks and Hacking
  6205. This appendix lists extensions for Org-mode written by other authors.
  6206. It also covers some aspects where users can extend the functionality of
  6207. Org-mode.
  6208. @menu
  6209. * Extensions:: Existing 3rd-part extensions
  6210. * Adding hyperlink types:: New custom link types
  6211. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  6212. * Dynamic blocks:: Automatically filled blocks
  6213. * Special agenda views:: Customized views
  6214. * Using the property API:: Writing programs that use entry properties
  6215. @end menu
  6216. @node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
  6217. @section Third-party extensions for Org-mode
  6218. @cindex extension, third-party
  6219. The following extensions for Org-mode have been written by other people:
  6220. @table @asis
  6221. @cindex @file{org-publish.el}
  6222. @item @file{org-publish.el} by David O'Toole
  6223. This package provides facilities for publishing related sets of Org-mode
  6224. files together with linked files like images as webpages. It is
  6225. highly configurable and can be used for other publishing purposes as
  6226. well. As of Org-mode version 4.30, @file{org-publish.el} is part of the
  6227. Org-mode distribution. It is not yet part of Emacs, however, a delay
  6228. caused by the preparations for the 22.1 release. In the mean time,
  6229. @file{org-publish.el} can be downloaded from David's site:
  6230. @url{http://dto.freeshell.org/e/org-publish.el}.
  6231. @cindex @file{org-mouse.el}
  6232. @item @file{org-mouse.el} by Piotr Zielinski
  6233. This package implements extended mouse functionality for Org-mode. It
  6234. allows you to cycle visibility and to edit the document structure with
  6235. the mouse. Best of all, it provides a context-sensitive menu on
  6236. @key{mouse-3} that changes depending on the context of a mouse-click.
  6237. As of Org-mode version 4.53, @file{org-mouse.el} is part of the
  6238. Org-mode distribution. It is not yet part of Emacs, however, a delay
  6239. caused by the preparations for the 22.1 release. In the mean time,
  6240. @file{org-mouse.el} can be downloaded from Piotr's site:
  6241. @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
  6242. @cindex @file{org-blog.el}
  6243. @item @file{org-blog.el} by David O'Toole
  6244. A blogging plug-in for @file{org-publish.el}.@*
  6245. @url{http://dto.freeshell.org/notebook/OrgMode.html}.
  6246. @cindex @file{blorg.el}
  6247. @item @file{blorg.el} by Bastien Guerry
  6248. Publish Org-mode files as
  6249. blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
  6250. @cindex @file{org2rem.el}
  6251. @item @file{org2rem.el} by Bastien Guerry
  6252. Translates Org-mode files into something readable by
  6253. Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
  6254. @end table
  6255. @page
  6256. @node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
  6257. @section Adding hyperlink types
  6258. @cindex hyperlinks, adding new types
  6259. Org-mode has a large number of hyperlink types built-in
  6260. (@pxref{Hyperlinks}). If you would like to add new link types, it
  6261. provides an interface for doing so. Lets look at an example file
  6262. @file{org-man.el} that will add support for creating links like
  6263. @samp{[[man:printf][The printf manpage]]} to show unix manual pages inside
  6264. emacs:
  6265. @lisp
  6266. ;;; org-man.el - Support for links to manpages in Org-mode
  6267. (require 'org)
  6268. (org-add-link-type "man" 'org-man-open)
  6269. (add-hook 'org-store-link-functions 'org-man-store-link)
  6270. (defcustom org-man-command 'man
  6271. "The Emacs command to be used to display a man page."
  6272. :group 'org-link
  6273. :type '(choice (const man) (const woman)))
  6274. (defun org-man-open (path)
  6275. "Visit the manpage on PATH.
  6276. PATH should be a topic that can be thrown at the man command."
  6277. (funcall org-man-command path))
  6278. (defun org-man-store-link ()
  6279. "Store a link to a manpage."
  6280. (when (memq major-mode '(Man-mode woman-mode))
  6281. ;; This is a man page, we do make this link
  6282. (let* ((page (org-man-get-page-name))
  6283. (link (concat "man:" page))
  6284. (description (format "Manpage for %s" page)))
  6285. (org-store-link-props
  6286. :type "man"
  6287. :link link
  6288. :description description))))
  6289. (defun org-man-get-page-name ()
  6290. "Extract the page name from the buffer name."
  6291. ;; This works for both `Man-mode' and `woman-mode'.
  6292. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  6293. (match-string 1 (buffer-name))
  6294. (error "Cannot create link to this man page")))
  6295. (provide 'org-man)
  6296. ;;; org-man.el ends here
  6297. @end lisp
  6298. @noindent
  6299. You would activate this new link type in @file{.emacs} with
  6300. @lisp
  6301. (require 'org-man)
  6302. @end lisp
  6303. @noindent
  6304. Lets go through the file and see what it does.
  6305. @enumerate
  6306. @item
  6307. It does @code{(require 'org)} to make sure that @file{org.el} has been
  6308. loaded.
  6309. @item
  6310. The next line calls @code{org-add-link-type} to define a new link type
  6311. with prefix @samp{man}. The call also contains the name of a function
  6312. that will be called to follow such a link.
  6313. @item
  6314. The next line adds a function to @code{org-store-link-functions}, in
  6315. order to allow the command @kbd{C-c l} to record a useful link in a
  6316. buffer displaying a man page.
  6317. @end enumerate
  6318. The rest of the file defines the necessary variables and functions.
  6319. First there is a customization variable that determines which emacs
  6320. command should be used to display manpages. There are two options,
  6321. @code{man} and @code{woman}. Then the function to follow a link is
  6322. defined. It gets the link path as an argument - in this case the link
  6323. path is just a topic for the manual command. The function calls the
  6324. value of @code{org-man-command} to display the man page.
  6325. Finally the function @code{org-man-store-link} is defined. When you try
  6326. to store a link with @kbd{C-c l}, also this function will be called to
  6327. try to make a link. The function must first decide if it is supposed to
  6328. create the link for this buffer type, we do this by checking the value
  6329. of the variable @code{major-mode}. If not, the function must exit and
  6330. retunr the value @code{nil}. If yes, the link is created by getting the
  6331. manual tpoic from the buffer name and prefixing it with the string
  6332. @samp{man:}. Then it must call the command @code{org-store-link-props}
  6333. and set the @code{:type} and @code{:link} properties. Optionally you
  6334. can also set the @code{:description} property to provide a default for
  6335. the link description when the link is later inserted into tan Org-mode
  6336. buffer with @kbd{C-c C-l}.
  6337. @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
  6338. @section Tables in arbitrary syntax
  6339. @cindex tables, in other modes
  6340. @cindex orgtbl-mode
  6341. Since Orgtbl-mode can be used as a minor mode in arbitrary buffers, a
  6342. frequent feature request has been to make it work with native tables in
  6343. specific languages, for example La@TeX{}. However, this is extremely hard
  6344. to do in a general way, would lead to a customization nightmare, and
  6345. would take away much of the simplicity of the Orgtbl-mode table editor.
  6346. This appendix describes a different approach. We keep the Orgtbl-mode
  6347. table in its native format (the @i{source table}), and use a custom
  6348. function to @i{translate} the table to the correct syntax, and to
  6349. @i{install} it in the right location (the @i{target table}). This puts
  6350. the burden of writing conversion functions on the user, but it allows
  6351. for a very flexible system.
  6352. @menu
  6353. * Radio tables:: Sending and receiving
  6354. * A LaTeX example:: Step by step, almost a tutorial
  6355. * Translator functions:: Copy and modify
  6356. @end menu
  6357. @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
  6358. @subsection Radio tables
  6359. @cindex radio tables
  6360. To define the location of the target table, you first need to create two
  6361. lines that are comments in the current mode, but contain magic words for
  6362. Orgtbl-mode to find. Orgtbl-mode will insert the translated table
  6363. between these lines, replacing whatever was there before. For example:
  6364. @example
  6365. /* BEGIN RECEIVE ORGTBL table_name */
  6366. /* END RECEIVE ORGTBL table_name */
  6367. @end example
  6368. @noindent
  6369. Just above the source table, we put a special line that tells
  6370. Orgtbl-mode how to translate this table and where to install it. For
  6371. example:
  6372. @example
  6373. #+ORGTBL: SEND table_name translation_function arguments....
  6374. @end example
  6375. @noindent
  6376. @code{table_name} is the reference name for the table that is also used
  6377. in the receiver lines. @code{translation_function} is the Lisp function
  6378. that does the translation. Furthermore, the line can contain a list of
  6379. arguments (alternating key and value) at the end. The arguments will be
  6380. passed as a property list to the translation function for
  6381. interpretation. A few standard parameters are already recognized and
  6382. acted upon before the translation function is called:
  6383. @table @code
  6384. @item :skip N
  6385. Skip the first N lines of the table. Hlines do count!
  6386. @item :skipcols (n1 n2 ...)
  6387. List of columns that should be skipped. If the table has a column with
  6388. calculation marks, that column is automatically discarded as well.
  6389. Please note that the translator function sees the table @emph{after} the
  6390. removal of these columns, the function never knows that there have been
  6391. additional columns.
  6392. @end table
  6393. @noindent
  6394. The one problem remaining is how to keep the source table in the buffer
  6395. without disturbing the normal workings of the file, for example during
  6396. compilation of a C file or processing of a La@TeX{} file. There are a
  6397. number of different solutions:
  6398. @itemize @bullet
  6399. @item
  6400. The table could be placed in a block comment if that is supported by the
  6401. language. For example, in C-mode you could wrap the table between
  6402. @samp{/*} and @samp{*/} lines.
  6403. @item
  6404. Sometimes it is possible to put the table after some kind of @i{END}
  6405. statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
  6406. in La@TeX{}.
  6407. @item
  6408. You can just comment the table line by line whenever you want to process
  6409. the file, and uncomment it whenever you need to edit the table. This
  6410. only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
  6411. make this comment-toggling very easy, in particular if you bind it to a
  6412. key.
  6413. @end itemize
  6414. @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
  6415. @subsection A LaTeX example
  6416. @cindex LaTeX, and orgtbl-mode
  6417. The best way to wrap the source table in La@TeX{} is to use the
  6418. @code{comment} environment provided by @file{comment.sty}. It has to be
  6419. activated by placing @code{\usepackage@{comment@}} into the document
  6420. header. Orgtbl-mode can insert a radio table skeleton@footnote{By
  6421. default this works only for La@TeX{}, HTML, and TeXInfo. Configure the
  6422. variable @code{orgtbl-radio-tables} to install templates for other
  6423. modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
  6424. be prompted for a table name, lets say we use @samp{salesfigures}. You
  6425. will then get the following template:
  6426. @example
  6427. % BEGIN RECEIVE ORGTBL salesfigures
  6428. % END RECEIVE ORGTBL salesfigures
  6429. \begin@{comment@}
  6430. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  6431. | | |
  6432. \end@{comment@}
  6433. @end example
  6434. @noindent
  6435. The @code{#+ORGTBL: SEND} line tells orgtbl-mode to use the function
  6436. @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
  6437. into the receiver location with name @code{salesfigures}. You may now
  6438. fill in the table, feel free to use the spreadsheet features@footnote{If
  6439. the @samp{#+TBLFM} line contains an odd number of dollar characters,
  6440. this may cause problems with font-lock in latex-mode. As shown in the
  6441. example you can fix this by adding an extra line inside the
  6442. @code{comment} environment that is used to balance the dollar
  6443. expressions. If you are using AUCTeX with the font-latex library, a
  6444. much better solution is to add the @code{comment} environment to the
  6445. variable @code{LaTeX-verbatim-environments}.}:
  6446. @example
  6447. % BEGIN RECEIVE ORGTBL salesfigures
  6448. % END RECEIVE ORGTBL salesfigures
  6449. \begin@{comment@}
  6450. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  6451. | Month | Days | Nr sold | per day |
  6452. |-------+------+---------+---------|
  6453. | Jan | 23 | 55 | 2.4 |
  6454. | Feb | 21 | 16 | 0.8 |
  6455. | March | 22 | 278 | 12.6 |
  6456. #+TBLFM: $4=$3/$2;%.1f
  6457. % $ (optional extra dollar to keep font-lock happy, see footnote)
  6458. \end@{comment@}
  6459. @end example
  6460. @noindent
  6461. When you are done, press @kbd{C-c C-c} in the table to get the converted
  6462. table inserted between the two marker lines.
  6463. Now lets assume you want to make the table header by hand, because you
  6464. want to control how columns are aligned etc. In this case we make sure
  6465. that the table translator does skip the first 2 lines of the source
  6466. table, and tell the command to work as a @i{splice}, i.e. to not produce
  6467. header and footer commands of the target table:
  6468. @example
  6469. \begin@{tabular@}@{lrrr@}
  6470. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  6471. % BEGIN RECEIVE ORGTBL salesfigures
  6472. % END RECEIVE ORGTBL salesfigures
  6473. \end@{tabular@}
  6474. %
  6475. \begin@{comment@}
  6476. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  6477. | Month | Days | Nr sold | per day |
  6478. |-------+------+---------+---------|
  6479. | Jan | 23 | 55 | 2.4 |
  6480. | Feb | 21 | 16 | 0.8 |
  6481. | March | 22 | 278 | 12.6 |
  6482. #+TBLFM: $4=$3/$2;%.1f
  6483. \end@{comment@}
  6484. @end example
  6485. The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
  6486. Orgtbl-mode. It uses a @code{tabular} environment to typeset the table
  6487. and marks horizontal lines with @code{\hline}. Furthermore, it
  6488. interprets the following parameters:
  6489. @table @code
  6490. @item :splice nil/t
  6491. When set to t, return only table body lines, don't wrap them into a
  6492. tabular environment. Default is nil.
  6493. @item :fmt fmt
  6494. A format to be used to wrap each field, should contain @code{%s} for the
  6495. original field value. For example, to wrap each field value in dollars,
  6496. you could use @code{:fmt "$%s$"}. This may also be a property list with
  6497. column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
  6498. @item :efmt efmt
  6499. Use this format to print numbers with exponentials. The format should
  6500. have @code{%s} twice for inserting mantissa and exponent, for example
  6501. @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
  6502. may also be a property list with column numbers and formats, for example
  6503. @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  6504. @code{efmt} has been applied to a value, @code{fmt} will also be
  6505. applied.
  6506. @end table
  6507. @node Translator functions, , A LaTeX example, Tables in arbitrary syntax
  6508. @subsection Translator functions
  6509. @cindex HTML, and orgtbl-mode
  6510. @cindex translator function
  6511. Orgtbl-mode has several translator functions built-in:
  6512. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
  6513. @code{orgtbl-to-texinfo}. Except for @code{orgtbl-to-html}@footnote{The
  6514. HTML translator uses the same code that produces tables during HTML
  6515. export.}, these all use a generic translator, @code{orgtbl-to-generic}.
  6516. For example, @code{orgtbl-to-latex} itself is a very short function that
  6517. computes the column definitions for the @code{tabular} environment,
  6518. defines a few field and line separators and then hands over to the
  6519. generic translator. Here is the entire code:
  6520. @lisp
  6521. @group
  6522. (defun orgtbl-to-latex (table params)
  6523. "Convert the orgtbl-mode TABLE to LaTeX."
  6524. (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
  6525. org-table-last-alignment ""))
  6526. (params2
  6527. (list
  6528. :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
  6529. :tend "\\end@{tabular@}"
  6530. :lstart "" :lend " \\\\" :sep " & "
  6531. :efmt "%s\\,(%s)" :hline "\\hline")))
  6532. (orgtbl-to-generic table (org-combine-plists params2 params))))
  6533. @end group
  6534. @end lisp
  6535. As you can see, the properties passed into the function (variable
  6536. @var{PARAMS}) are combined with the ones newly defined in the function
  6537. (variable @var{PARAMS2}). The ones passed into the function (i.e. the
  6538. ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
  6539. would like to use the La@TeX{} translator, but wanted the line endings to
  6540. be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
  6541. overrule the default with
  6542. @example
  6543. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  6544. @end example
  6545. For a new language, you can either write your own converter function in
  6546. analogy with the La@TeX{} translator, or you can use the generic function
  6547. directly. For example, if you have a language where a table is started
  6548. with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
  6549. started with @samp{!BL!}, ended with @samp{!EL!} and where the field
  6550. separator is a TAB, you could call the generic translator like this (on
  6551. a single line!):
  6552. @example
  6553. #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
  6554. :lstart "!BL! " :lend " !EL!" :sep "\t"
  6555. @end example
  6556. @noindent
  6557. Please check the documentation string of the function
  6558. @code{orgtbl-to-generic} for a full list of parameters understood by
  6559. that function and remember that you can pass each of them into
  6560. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
  6561. using the generic function.
  6562. Of course you can also write a completely new function doing complicated
  6563. things the generic translator cannot do. A translator function takes
  6564. two arguments. The first argument is the table, a list of lines, each
  6565. line either the symbol @code{hline} or a list of fields. The second
  6566. argument is the property list containing all parameters specified in the
  6567. @samp{#+ORGTBL: SEND} line. The function must return a single string
  6568. containing the formatted table. If you write a generally useful
  6569. translator, please post it on @code{emacs-orgmode@@gnu.org} so that
  6570. others can benefit from your work.
  6571. @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
  6572. @section Dynamic blocks
  6573. @cindex dynamic blocks
  6574. Org-mode documents can contain @emph{dynamic blocks}. These are
  6575. specially marked regions that are updated by some user-written function.
  6576. A good example for such a block is the clock table inserted by the
  6577. command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
  6578. Dynamic block are enclosed by a BEGIN-END structure that assigns a name
  6579. to the block and can also specify parameters for the function producing
  6580. the content of the block.
  6581. @example
  6582. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  6583. #+END:
  6584. @end example
  6585. Dynamic blocks are updated with the following commands
  6586. @table @kbd
  6587. @kindex C-c C-x C-u
  6588. @item C-c C-x C-u
  6589. Update dynamic block at point.
  6590. @kindex C-u C-c C-x C-u
  6591. @item C-u C-c C-x C-u
  6592. Update all dynamic blocks in the current file.
  6593. @end table
  6594. Updating a dynamic block means to remove all the text between BEGIN and
  6595. END, parse the BEGIN line for parameters and then call the specific
  6596. writer function for this block to insert the new content. For a block
  6597. with name @code{myblock}, the writer function is
  6598. @code{org-dblock-write:myblock} with as only parameter a property list
  6599. with the parameters given in the begin line. Here is a trivial example
  6600. of a block that keeps track of when the block update function was last
  6601. run:
  6602. @example
  6603. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  6604. #+END:
  6605. @end example
  6606. @noindent
  6607. The corresponding block writer function could look like this:
  6608. @lisp
  6609. (defun org-dblock-write:block-update-time (params)
  6610. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  6611. (insert "Last block update at: "
  6612. (format-time-string fmt (current-time)))))
  6613. @end lisp
  6614. If you want to make sure that all dynamic blocks are always up-to-date,
  6615. you could add the function @code{org-update-all-dblocks} to a hook, for
  6616. example @code{before-save-hook}. @code{org-update-all-dblocks} is
  6617. written in a way that is does nothing in buffers that are not in Org-mode.
  6618. @node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
  6619. @section Special Agenda Views
  6620. @cindex agenda views, user-defined
  6621. Org-mode provides a special hook that can be used to narrow down the
  6622. selection made by any of the agenda views. You may specify a function
  6623. that is used at each match to verify if the match should indeed be part
  6624. of the agenda view, and if not, how much should be skipped.
  6625. Let's say you want to produce a list of projects that contain a WAITING
  6626. tag anywhere in the project tree. Let's further assume that you have
  6627. marked all tree headings that define a project with the todo keyword
  6628. PROJECT. In this case you would run a todo search for the keyword
  6629. PROJECT, but skip the match unless there is a WAITING tag anywhere in
  6630. the subtree belonging to the project line.
  6631. To achieve this, you must write a function that searches the subtree for
  6632. the tag. If the tag is found, the function must return @code{nil} to
  6633. indicate that this match should not be skipped. If there is no such
  6634. tag, return the location of the end of the subtree, to indicate that
  6635. search should continue from there.
  6636. @lisp
  6637. (defun my-skip-unless-waiting ()
  6638. "Skip trees that are not waiting"
  6639. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  6640. (if (re-search-forward ":WAITING:" subtree-end t)
  6641. nil ; tag found, do not skip
  6642. subtree-end))) ; tag not found, continue after end of subtree
  6643. @end lisp
  6644. Now you may use this function in an agenda custom command, for example
  6645. like this:
  6646. @lisp
  6647. (org-add-agenda-custom-command
  6648. '("b" todo "PROJECT"
  6649. ((org-agenda-skip-function 'my-org-waiting-projects)
  6650. (org-agenda-overriding-header "Projects waiting for something: "))))
  6651. @end lisp
  6652. Note that this also binds @code{org-agenda-overriding-header} to get a
  6653. meaningful header in the agenda view.
  6654. You may also put a Lisp form into @code{org-agenda-skip-function}. In
  6655. particular, you may use the functions @code{org-agenda-skip-entry-if}
  6656. and @code{org-agenda-skip-subtree-if} in this form, for example:
  6657. @table @code
  6658. @item '(org-agenda-skip-entry-if 'scheduled)
  6659. Skip current entry if it has been scheduled.
  6660. @item '(org-agenda-skip-entry-if 'notscheduled)
  6661. Skip current entry if it has not been scheduled.
  6662. @item '(org-agenda-skip-entry-if 'deadline)
  6663. Skip current entry if it has a deadline.
  6664. @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
  6665. Skip current entry if it has a deadline, or if it is scheduled.
  6666. @item '(org-agenda-skip-entry 'regexp "regular expression")
  6667. Skip current entry if the regular expression contained in the variable
  6668. @code{org-agenda-skip-regexp} matches in the entry.
  6669. @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
  6670. Same as above, but check and skip the entire subtree.
  6671. @end table
  6672. Therefore we could also have written the search for WAITING projects
  6673. like this, even without defining a special function:
  6674. @lisp
  6675. (org-add-agenda-custom-command
  6676. '("b" todo "PROJECT"
  6677. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  6678. 'regexp ":WAITING:"))
  6679. (org-agenda-overriding-header "Projects waiting for something: "))))
  6680. @end lisp
  6681. @node Using the property API, , Special agenda views, Extensions and Hacking
  6682. @section Using the property API
  6683. @cindex API, for properties
  6684. @cindex properties, API
  6685. Here is a description of the functions that can be used to work with
  6686. properties.
  6687. @defun org-entry-properties &optional pom which
  6688. Get all properties of the entry at point-or-marker POM.
  6689. This includes the TODO keyword, the tags, time strings for deadline,
  6690. scheduled, and clocking, and any additional properties defined in the
  6691. entry. The return value is an alist, keys may occur multiple times
  6692. if the property key was used several times.
  6693. POM may also be nil, in which case the current entry is used.
  6694. If WHICH is nil or `all', get all properties. If WHICH is
  6695. `special' or `standard', only get that subclass.
  6696. @end defun
  6697. @defun org-entry-get pom property &optional inherit
  6698. Get value of PROPERTY for entry at point-or-marker POM.
  6699. If INHERIT is non-nil and the entry does not have the property,
  6700. then also check higher levels of the hierarchy.
  6701. @end defun
  6702. @defun org-entry-delete pom property
  6703. Delete the property PROPERTY from entry at point-or-marker POM.
  6704. @end defun
  6705. @defun org-entry-put pom property value
  6706. Set PROPERTY to VALUE for entry at point-or-marker POM.
  6707. @end defun
  6708. @defun org-buffer-property-keys &optional include-specials
  6709. Get all property keys in the current buffer.
  6710. @end defun
  6711. @defun org-insert-property-drawer
  6712. Insert a property drawer at point.
  6713. @end defun
  6714. @node History and Acknowledgments, Index, Extensions and Hacking, Top
  6715. @appendix History and Acknowledgments
  6716. @cindex acknowledgments
  6717. @cindex history
  6718. @cindex thanks
  6719. Org-mode was borne in 2003, out of frustration over the user interface
  6720. of the Emacs outline-mode. I was trying to organize my notes and
  6721. projects, and using Emacs seemed to be the natural way to go. However,
  6722. having to remember eleven different commands with two or three keys per
  6723. command, only to hide and unhide parts of the outline tree, that seemed
  6724. entirely unacceptable to me. Also, when using outlines to take notes, I
  6725. constantly want to restructure the tree, organizing it parallel to my
  6726. thoughts and plans. @emph{Visibility cycling} and @emph{structure
  6727. editing} were originally implemented in the package
  6728. @file{outline-magic.el}, but quickly moved to the more general
  6729. @file{org.el}. As this environment became comfortable for project
  6730. planning, the next step was adding @emph{TODO entries}, basic @emph{time
  6731. stamps}, and @emph{table support}. These areas highlight the two main
  6732. goals that Org-mode still has today: To create a new, outline-based,
  6733. plain text mode with innovative and intuitive editing features, and to
  6734. incorporate project planning functionality directly into a notes file.
  6735. Since the first release, literally thousands of emails to me or on
  6736. @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
  6737. reports, feedback, new ideas, and sometimes patches and add-on code.
  6738. Many thanks to everyone who has helped to improve this package. I am
  6739. trying to keep here a list of the people who had significant influence
  6740. in shaping one or more aspects of Org-mode. The list may not be
  6741. complete, if I have forgotten someone, please accept my apologies and
  6742. let me know.
  6743. @itemize @bullet
  6744. @item
  6745. @i{Russel Adams} came up with the idea for drawers.
  6746. @item
  6747. @i{Thomas Baumann} contributed the code for links to the MH-E email
  6748. system.
  6749. @item
  6750. @i{Alex Bochannek} provided a patch for rounding time stamps.
  6751. @item
  6752. @i{Charles Cave}'s suggestion sparked the implementation of templates
  6753. for Remember.
  6754. @item
  6755. @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
  6756. specified time.
  6757. @item
  6758. @i{Gregory Chernov} patched support for lisp forms into table
  6759. calculations and improved XEmacs compatibility, in particular by porting
  6760. @file{nouline.el} to XEmacs.
  6761. @item
  6762. @i{Sacha Chua} suggested to copy some linking code from Planner.
  6763. @item
  6764. @i{Eddward DeVilla} proposed and tested checkbox statistics. He also
  6765. came up with the idea of properties, and that there should be an API for
  6766. them.
  6767. @item
  6768. @i{Kees Dullemond} used to edit projects lists directly in HTML and so
  6769. inspired some of the early development, including HTML export. He also
  6770. asked for a way to narrow wide table columns.
  6771. @item
  6772. @i{Christian Egli} converted the documentation into TeXInfo format,
  6773. patched CSS formatting into the HTML exporter, and inspired the agenda.
  6774. @item
  6775. @i{David Emery} provided a patch for custom CSS support in exported
  6776. HTML agendas.
  6777. @item
  6778. @i{Nic Ferrier} contributed mailcap and XOXO support.
  6779. @item
  6780. @i{John Foerch} figured out how to make incremental search show context
  6781. around a match in a hidden outline tree.
  6782. @item
  6783. @i{Niels Giessen} had the idea to automatically archive DONE trees.
  6784. @item
  6785. @i{Bastien Guerry} wrote the La@TeX{} exporter and has been prolific
  6786. with patches, ideas, and bug reports.
  6787. to Org-mode.
  6788. @item
  6789. @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
  6790. @item
  6791. @i{Scott Jaderholm} proposed footnotes, control over whitespace between
  6792. folded entries, and column view for properties.
  6793. @item
  6794. @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
  6795. provided frequent feedback and some patches.
  6796. @item
  6797. @i{Jason F. McBrayer} suggested agenda export to CSV format.
  6798. @item
  6799. @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
  6800. basis.
  6801. @item
  6802. @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
  6803. happy.
  6804. @item
  6805. @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file.
  6806. @item
  6807. @i{Todd Neal} provided patches for links to Info files and elisp forms.
  6808. @item
  6809. @i{Tim O'Callaghan} suggested in-file links, search options for general
  6810. file links, and TAGS.
  6811. @item
  6812. @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
  6813. into Japanese.
  6814. @item
  6815. @i{Oliver Oppitz} suggested multi-state TODO items.
  6816. @item
  6817. @i{Scott Otterson} sparked the introduction of descriptive text for
  6818. links, among other things.
  6819. @item
  6820. @i{Pete Phillips} helped during the development of the TAGS feature, and
  6821. provided frequent feedback.
  6822. @item
  6823. @i{T.V. Raman} reported bugs and suggested improvements.
  6824. @item
  6825. @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
  6826. control.
  6827. @item
  6828. @i{Kevin Rogers} contributed code to access VM files on remote hosts.
  6829. @item
  6830. @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
  6831. conflict with @file{allout.el}.
  6832. @item
  6833. @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
  6834. @item
  6835. @i{Philip Rooke} created the Org-mode reference card and provided lots
  6836. of feedback.
  6837. @item
  6838. @i{Christian Schlauer} proposed angular brackets around links, among
  6839. other things.
  6840. @item
  6841. Linking to VM/BBDB/GNUS was inspired by @i{Tom Shannon}'s
  6842. @file{organizer-mode.el}.
  6843. @item
  6844. @i{Daniel Sinder} came up with the idea of internal archiving by locking
  6845. subtrees.
  6846. @item
  6847. @i{Dale Smith} proposed link abbreviations.
  6848. @item
  6849. @i{Adam Spiers} asked for global linking commands and inspired the link
  6850. extension system. support mairix.
  6851. @item
  6852. @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
  6853. chapter about publishing.
  6854. @item
  6855. @i{J@"urgen Vollmer} contributed code generating the table of contents
  6856. in HTML output.
  6857. @item
  6858. @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
  6859. keyword.
  6860. @item
  6861. @i{David Wainberg} suggested archiving, and improvements to the linking
  6862. system.
  6863. @item
  6864. @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The
  6865. development of Org-mode was fully independent, and both systems are
  6866. really different beasts in their basic ideas and implementation details.
  6867. I later looked at John's code, however, and learned from his
  6868. implementation of (i) links where the link itself is hidden and only a
  6869. description is shown, and (ii) popping up a calendar to select a date.
  6870. John has also contributed a number of great ideas directly to Org-mode.
  6871. @item
  6872. @i{Carsten Wimmer} suggested some changes and helped fix a bug in
  6873. linking to GNUS.
  6874. @item
  6875. @i{Roland Winkler} requested additional keybindings to make Org-mode
  6876. work on a tty.
  6877. @item
  6878. @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
  6879. and contributed various ideas and code snippets.
  6880. @end itemize
  6881. @node Index, Key Index, History and Acknowledgments, Top
  6882. @unnumbered Index
  6883. @printindex cp
  6884. @node Key Index, , Index, Top
  6885. @unnumbered Key Index
  6886. @printindex ky
  6887. @bye
  6888. @ignore
  6889. arch-tag: 7893d1fe-cc57-4d13-b5e5-f494a1bcc7ac
  6890. @end ignore