org.texi 346 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename ../../info/org
  4. @settitle The Org Manual
  5. @set VERSION 6.00pre-4
  6. @set DATE April 2008
  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://orgmode.org,maintainers webpage}
  13. @set AUTHOR Carsten Dominik
  14. @set MAINTAINER Carsten Dominik
  15. @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
  16. @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,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 (version @value{VERSION}).
  31. Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 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 The Org 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:: Storing information about an entry
  69. * Dates and Times:: Making items useful for planning
  70. * Remember:: Quickly adding nodes to the outline tree
  71. * Agenda Views:: Collecting information into views
  72. * Embedded LaTeX:: LaTeX fragments and formulas
  73. * Exporting:: Sharing and publishing of notes
  74. * Publishing:: Create a web site of linked Org files
  75. * Miscellaneous:: All the rest which did not fit elsewhere
  76. * Extensions and Hacking:: It is possible to write add-on code
  77. * History and Acknowledgments:: How Org came into being
  78. * Main Index:: An index of Org's concepts and features
  79. * Key Index:: Key bindings and where they are described
  80. @detailmenu
  81. --- The Detailed Node Listing ---
  82. Introduction
  83. * Summary:: Brief summary of what Org does
  84. * Installation:: How to install a downloaded version of Org
  85. * Activation:: How to activate Org for certain buffers
  86. * Feedback:: Bug reports, ideas, patches etc.
  87. * Conventions:: Type-setting conventions in the manual
  88. Document Structure
  89. * Outlines:: Org is based on Outline mode
  90. * Headlines:: How to typeset Org tree headlines
  91. * Visibility cycling:: Show and hide, much simplified
  92. * Motion:: Jumping to other headlines
  93. * Structure editing:: Changing sequence and level of headlines
  94. * Archiving:: Move done task trees to a different place
  95. * Sparse trees:: Matches embedded in context
  96. * Plain lists:: Additional structure within an entry
  97. * Drawers:: Tucking stuff away
  98. * Orgstruct mode:: Structure editing outside Org
  99. Archiving
  100. * ARCHIVE tag:: Marking a tree as inactive
  101. * Moving subtrees:: Moving a tree to an archive file
  102. Tables
  103. * Built-in table editor:: Simple tables
  104. * Narrow columns:: Stop wasting space in tables
  105. * Column groups:: Grouping to trigger vertical lines
  106. * Orgtbl mode:: The table editor as minor mode
  107. * The spreadsheet:: The table editor has spreadsheet capabilities
  108. The spreadsheet
  109. * References:: How to refer to another field or range
  110. * Formula syntax for Calc:: Using Calc to compute stuff
  111. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  112. * Field formulas:: Formulas valid for a single field
  113. * Column formulas:: Formulas valid for an entire column
  114. * Editing and debugging formulas:: Fixing formulas
  115. * Updating the table:: Recomputing all dependent fields
  116. * Advanced features:: Field names, parameters and automatic recalc
  117. Hyperlinks
  118. * Link format:: How links in Org are formatted
  119. * Internal links:: Links to other places in the current file
  120. * External links:: URL-like links to the world
  121. * Handling links:: Creating, inserting and following
  122. * Using links outside Org:: Linking from my C source code?
  123. * Link abbreviations:: Shortcuts for writing complex links
  124. * Search options:: Linking to a specific location
  125. * Custom searches:: When the default search is not enough
  126. Internal links
  127. * Radio targets:: Make targets trigger links in plain text
  128. TODO Items
  129. * TODO basics:: Marking and displaying TODO entries
  130. * TODO extensions:: Workflow and assignments
  131. * Progress logging:: Dates and notes for progress
  132. * Priorities:: Some things are more important than others
  133. * Breaking down tasks:: Splitting a task into manageable pieces
  134. * Checkboxes:: Tick-off lists
  135. Extended use of TODO keywords
  136. * Workflow states:: From TODO to DONE in steps
  137. * TODO types:: I do this, Fred does the rest
  138. * Multiple sets in one file:: Mixing it all, and still finding your way
  139. * Fast access to TODO states:: Single letter selection of a state
  140. * Per-file keywords:: Different files, different requirements
  141. * Faces for TODO keywords:: Highlighting states
  142. Progress logging
  143. * Closing items:: When was this entry marked DONE?
  144. * Tracking TODO state changes:: When did the status change?
  145. Tags
  146. * Tag inheritance:: Tags use the tree structure of the outline
  147. * Setting tags:: How to assign tags to a headline
  148. * Tag searches:: Searching for combinations of tags
  149. Properties and Columns
  150. * Property syntax:: How properties are spelled out
  151. * Special properties:: Access to other Org mode features
  152. * Property searches:: Matching property values
  153. * Property inheritance:: Passing values down the tree
  154. * Column view:: Tabular viewing and editing
  155. * Property API:: Properties for Lisp programmers
  156. Column view
  157. * Defining columns:: The COLUMNS format property
  158. * Using column view:: How to create and use column view
  159. * Capturing column view:: A dynamic block for column view
  160. Defining columns
  161. * Scope of column definitions:: Where defined, where valid?
  162. * Column attributes:: Appearance and content of a column
  163. Dates and Times
  164. * Timestamps:: Assigning a time to a tree entry
  165. * Creating timestamps:: Commands which insert timestamps
  166. * Deadlines and scheduling:: Planning your work
  167. * Clocking work time:: Tracking how long you spend on a task
  168. Creating timestamps
  169. * The date/time prompt:: How Org mode helps you entering date and time
  170. * Custom time format:: Making dates look different
  171. Deadlines and scheduling
  172. * Inserting deadline/schedule:: Planning items
  173. * Repeated tasks:: Items that show up again and again
  174. Remember
  175. * Setting up Remember:: Some code for .emacs to get things going
  176. * Remember templates:: Define the outline of different note types
  177. * Storing notes:: Directly get the note to where it belongs
  178. * Refiling notes:: Moving a note or task to a project
  179. Agenda Views
  180. * Agenda files:: Files being searched for agenda information
  181. * Agenda dispatcher:: Keyboard access to agenda views
  182. * Built-in agenda views:: What is available out of the box?
  183. * Presentation and sorting:: How agenda items are prepared for display
  184. * Agenda commands:: Remote editing of Org trees
  185. * Custom agenda views:: Defining special searches and views
  186. The built-in agenda views
  187. * Weekly/daily agenda:: The calendar page with current tasks
  188. * Global TODO list:: All unfinished action items
  189. * Matching tags and properties:: Structured information with fine-tuned search
  190. * Timeline:: Time-sorted view for single file
  191. * Keyword search:: Finding entries by keyword
  192. * Stuck projects:: Find projects you need to review
  193. Presentation and sorting
  194. * Categories:: Not all tasks are equal
  195. * Time-of-day specifications:: How the agenda knows the time
  196. * Sorting of agenda items:: The order of things
  197. Custom agenda views
  198. * Storing searches:: Type once, use often
  199. * Block agenda:: All the stuff you need in a single buffer
  200. * Setting Options:: Changing the rules
  201. * Exporting Agenda Views:: Writing agendas to files
  202. * Using the agenda elsewhere:: Using agenda information in other programs
  203. Embedded LaTeX
  204. * Math symbols:: TeX macros for symbols and Greek letters
  205. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  206. * LaTeX fragments:: Complex formulas made easy
  207. * Processing LaTeX fragments:: Previewing LaTeX processing
  208. * CDLaTeX mode:: Speed up entering of formulas
  209. Exporting
  210. * ASCII export:: Exporting to plain ASCII
  211. * HTML export:: Exporting to HTML
  212. * LaTeX export:: Exporting to LaTeX
  213. * XOXO export:: Exporting to XOXO
  214. * iCalendar export:: Exporting in iCalendar format
  215. * Text interpretation:: How the exporter looks at the file
  216. HTML export
  217. * HTML Export commands:: How to invoke LaTeX export
  218. * Quoting HTML tags:: Using direct HTML in Org mode
  219. * Links:: Transformation of links for HTML
  220. * Images:: How to include images
  221. * CSS support:: Changing the appearance of the output
  222. LaTeX export
  223. * LaTeX export commands:: How to invoke LaTeX export
  224. * Quoting LaTeX code:: Incorporating literal LaTeX code
  225. * Sectioning structure:: Changing sectioning in LaTeX output
  226. Text interpretation by the exporter
  227. * Comment lines:: Some lines will not be exported
  228. * Initial text:: Text before the first headline
  229. * Footnotes:: Numbers like [1]
  230. * Quoted examples:: Inserting quoted chunks of text
  231. * Enhancing text:: Subscripts, symbols and more
  232. * Export options:: How to influence the export settings
  233. Publishing
  234. * Configuration:: Defining projects
  235. * Sample configuration:: Example projects
  236. * Triggering publication:: Publication commands
  237. Configuration
  238. * Project alist:: The central configuration variable
  239. * Sources and destinations:: From here to there
  240. * Selecting files:: What files are part of the project?
  241. * Publishing action:: Setting the function doing the publishing
  242. * Publishing options:: Tweaking HTML export
  243. * Publishing links:: Which links keep working after publishing?
  244. * Project page index:: Publishing a list of project files
  245. Sample configuration
  246. * Simple example:: One-component publishing
  247. * Complex example:: A multi-component publishing example
  248. Miscellaneous
  249. * Completion:: M-TAB knows what you need
  250. * Customization:: Adapting Org to your taste
  251. * In-buffer settings:: Overview of the #+KEYWORDS
  252. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  253. * Clean view:: Getting rid of leading stars in the outline
  254. * TTY keys:: Using Org on a tty
  255. * Interaction:: Other Emacs packages
  256. * Bugs:: Things which do not work perfectly
  257. Interaction with other packages
  258. * Cooperation:: Packages Org cooperates with
  259. * Conflicts:: Packages that lead to conflicts
  260. Extensions, Hooks and Hacking
  261. * Extensions:: Existing 3rd-party extensions
  262. * Adding hyperlink types:: New custom link types
  263. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  264. * Dynamic blocks:: Automatically filled blocks
  265. * Special agenda views:: Customized views
  266. * Using the property API:: Writing programs that use entry properties
  267. Tables and lists in arbitrary syntax
  268. * Radio tables:: Sending and receiving
  269. * A LaTeX example:: Step by step, almost a tutorial
  270. * Translator functions:: Copy and modify
  271. * Radio lists:: Doing the same for lists
  272. @end detailmenu
  273. @end menu
  274. @node Introduction, Document Structure, Top, Top
  275. @chapter Introduction
  276. @cindex introduction
  277. @menu
  278. * Summary:: Brief summary of what Org does
  279. * Installation:: How to install a downloaded version of Org
  280. * Activation:: How to activate Org for certain buffers
  281. * Feedback:: Bug reports, ideas, patches etc.
  282. * Conventions:: Type-setting conventions in the manual
  283. @end menu
  284. @node Summary, Installation, Introduction, Introduction
  285. @section Summary
  286. @cindex summary
  287. Org is a mode for keeping notes, maintaining TODO lists, and doing
  288. project planning with a fast and effective plain-text system.
  289. Org develops organizational tasks around NOTES files that contain
  290. lists or information about projects as plain text. Org is
  291. implemented on top of Outline mode, which makes it possible to keep the
  292. content of large files well structured. Visibility cycling and
  293. structure editing help to work with the tree. Tables are easily created
  294. with a built-in table editor. Org supports TODO items, deadlines,
  295. time stamps, and scheduling. It dynamically compiles entries into an
  296. agenda that utilizes and smoothly integrates much of the Emacs calendar
  297. and diary. Plain text URL-like links connect to websites, emails,
  298. Usenet messages, BBDB entries, and any files related to the projects.
  299. For printing and sharing of notes, an Org file can be exported as a
  300. structured ASCII file, as HTML, or (TODO and agenda items only) as an
  301. iCalendar file. It can also serve as a publishing tool for a set of
  302. linked web pages.
  303. An important design aspect that distinguishes Org from for example
  304. Planner/Muse is that it encourages to store every piece of information
  305. only once. In Planner, you have project pages, day pages and possibly
  306. other files, duplicating some information such as tasks. In Org,
  307. you only have notes files. In your notes you mark entries as tasks,
  308. label them with tags and timestamps. All necessary lists like a
  309. schedule for the day, the agenda for a meeting, tasks lists selected by
  310. tags etc are created dynamically when you need them.
  311. Org keeps simple things simple. When first fired up, it should
  312. feel like a straightforward, easy to use outliner. Complexity is not
  313. imposed, but a large amount of functionality is available when you need
  314. it. Org is a toolbox and can be used in different ways, for
  315. example as:
  316. @example
  317. @r{@bullet{} outline extension with visibility cycling and structure editing}
  318. @r{@bullet{} ASCII system and table editor for taking structured notes}
  319. @r{@bullet{} ASCII table editor with spreadsheet-like capabilities}
  320. @r{@bullet{} TODO list editor}
  321. @r{@bullet{} full agenda and planner with deadlines and work scheduling}
  322. @r{@bullet{} environment to implement David Allen's GTD system}
  323. @r{@bullet{} a basic database application}
  324. @r{@bullet{} simple hypertext system, with HTML and LaTeX export}
  325. @r{@bullet{} publishing tool to create a set of interlinked webpages}
  326. @end example
  327. Org's automatic, context sensitive table editor with spreadsheet
  328. capabilities can be integrated into any major mode by activating the
  329. minor Orgtbl mode. Using a translation step, it can be used to maintain
  330. tables in arbitrary file types, for example in La@TeX{}. The structure
  331. editing and list creation capabilities can be used outside Org with
  332. the minor Orgstruct mode.
  333. @cindex FAQ
  334. There is a website for Org which provides links to the newest
  335. version of Org, as well as additional information, frequently asked
  336. questions (FAQ), links to tutorials etc. This page is located at
  337. @uref{http://orgmode.org}.
  338. @page
  339. @node Installation, Activation, Summary, Introduction
  340. @section Installation
  341. @cindex installation
  342. @cindex XEmacs
  343. @b{Important:} @i{If Org is part of the Emacs distribution or an
  344. XEmacs package, please skip this section and go directly to
  345. @ref{Activation}.}
  346. If you have downloaded Org from the Web, either as a distribution @file{.zip}
  347. or @file{.tar} file, or as a GIT archive, you must take the following steps
  348. to install it: Go into the unpacked Org distribution directory and edit the
  349. top section of the file @file{Makefile}. You must set the name of the Emacs
  350. binary (likely either @file{emacs} or @file{xemacs}), and the paths to the
  351. directories where local Lisp and Info files are kept. If you don't have
  352. access to the system-wide directories, you can simply run Org directly from
  353. the distribution directory by adding the @file{lisp} subdirectory to the
  354. Emacs load path. To do this, add the following line to @file{.emacs}:
  355. @example
  356. (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
  357. @end example
  358. @noindent
  359. If you plan to use code from the @file{contrib} subdirectory, do a similar
  360. step for this directory:
  361. @example
  362. (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
  363. @end example
  364. @b{XEmacs users now need to install the file @file{noutline.el} from
  365. the @file{xemacs} sub-directory of the Org distribution. Use the
  366. command:}
  367. @example
  368. @b{make install-noutline}
  369. @end example
  370. @noindent Now byte-compile the Lisp files with the shell command:
  371. @example
  372. make
  373. @end example
  374. @noindent If you are running Org from the distribution directory, this is
  375. all. If you want to install into the system directories, use
  376. @example
  377. make install
  378. make install-info
  379. @end example
  380. @noindent Then add to @file{.emacs}:
  381. @lisp
  382. ;; This line only if Org is not part of the X/Emacs distribution.
  383. (require 'org-install)
  384. @end lisp
  385. @node Activation, Feedback, Installation, Introduction
  386. @section Activation
  387. @cindex activation
  388. @cindex autoload
  389. @cindex global key bindings
  390. @cindex key bindings, global
  391. @iftex
  392. @b{Important:} @i{If you use copy-and-paste to copy lisp code from the
  393. PDF documentation as viewed by Acrobat reader to your .emacs file, the
  394. single quote character comes out incorrectly and the code will not work.
  395. You need to fix the single quotes by hand, or copy from Info
  396. documentation.}
  397. @end iftex
  398. Add the following lines to your @file{.emacs} file. The last two lines
  399. define @emph{global} keys for the commands @command{org-store-link} and
  400. @command{org-agenda} - please choose suitable keys yourself.
  401. @lisp
  402. ;; The following lines are always needed. Choose your own keys.
  403. (add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
  404. (global-set-key "\C-cl" 'org-store-link)
  405. (global-set-key "\C-ca" 'org-agenda)
  406. @end lisp
  407. Furthermore, you must activate @code{font-lock-mode} in Org
  408. buffers, because significant functionality depends on font-locking being
  409. active. You can do this with either one of the following two lines
  410. (XEmacs user must use the second option):
  411. @lisp
  412. (global-font-lock-mode 1) ; for all buffers
  413. (add-hook 'org-mode-hook 'turn-on-font-lock) ; Org buffers only
  414. @end lisp
  415. @cindex Org mode, turning on
  416. With this setup, all files with extension @samp{.org} will be put
  417. into Org mode. As an alternative, make the first line of a file look
  418. like this:
  419. @example
  420. MY PROJECTS -*- mode: org; -*-
  421. @end example
  422. @noindent which will select Org mode for this buffer no matter what
  423. the file's name is. See also the variable
  424. @code{org-insert-mode-line-in-empty-file}.
  425. @node Feedback, Conventions, Activation, Introduction
  426. @section Feedback
  427. @cindex feedback
  428. @cindex bug reports
  429. @cindex maintainer
  430. @cindex author
  431. If you find problems with Org, or if you have questions, remarks,
  432. or ideas about it, please contact the maintainer @value{MAINTAINER} at
  433. @value{MAINTAINEREMAIL}.
  434. For bug reports, please provide as much information as possible,
  435. including the version information of Emacs (@kbd{C-h v emacs-version
  436. @key{RET}}) and Org (@kbd{C-h v org-version @key{RET}}), as well as
  437. the Org related setup in @file{.emacs}. If an error occurs, a
  438. backtrace can be very useful (see below on how to create one). Often a
  439. small example file helps, along with clear information about:
  440. @enumerate
  441. @item What exactly did you do?
  442. @item What did you expect to happen?
  443. @item What happened instead?
  444. @end enumerate
  445. @noindent Thank you for helping to improve this mode.
  446. @subsubheading How to create a useful backtrace
  447. @cindex backtrace of an error
  448. If working with Org produces an error with a message you don't
  449. understand, you may have hit a bug. The best way to report this is by
  450. providing, in addition to what was mentioned above, a @emph{Backtrace}.
  451. This is information from the built-in debugger about where and how the
  452. error occurred. Here is how to produce a useful backtrace:
  453. @enumerate
  454. @item
  455. Start a fresh Emacs or XEmacs, and make sure that it will load the
  456. original Lisp code in @file{org.el} instead of the compiled version in
  457. @file{org.elc}. The backtrace contains much more information if it is
  458. produced with uncompiled code. To do this, either rename @file{org.elc}
  459. to something else before starting Emacs, or ask Emacs explicitly to load
  460. @file{org.el} by using the command line
  461. @example
  462. emacs -l /path/to/org.el
  463. @end example
  464. @item
  465. Go to the @code{Options} menu and select @code{Enter Debugger on Error}
  466. (XEmacs has this option in the @code{Troubleshooting} sub-menu).
  467. @item
  468. Do whatever you have to do to hit the error. Don't forget to
  469. document the steps you take.
  470. @item
  471. When you hit the error, a @file{*Backtrace*} buffer will appear on the
  472. screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
  473. attach it to your bug report.
  474. @end enumerate
  475. @node Conventions, , Feedback, Introduction
  476. @section Typesetting conventions used in this manual
  477. Org uses three types of keywords: TODO keywords, tags, and property
  478. names. In this manual we use the following conventions:
  479. @table @code
  480. @item TODO
  481. @itemx WAITING
  482. TODO keywords are written with all capitals, even if they are
  483. user-defined.
  484. @item boss
  485. @itemx ARCHIVE
  486. User-defined tags are written in lowercase; built-in tags with special
  487. meaning are written with all capitals.
  488. @item Release
  489. @itemx PRIORITY
  490. User-defined properties are capitalized; built-in properties with
  491. special meaning are written with all capitals.
  492. @end table
  493. @node Document Structure, Tables, Introduction, Top
  494. @chapter Document Structure
  495. @cindex document structure
  496. @cindex structure of document
  497. Org is based on outline mode and provides flexible commands to
  498. edit the structure of the document.
  499. @menu
  500. * Outlines:: Org is based on Outline mode
  501. * Headlines:: How to typeset Org tree headlines
  502. * Visibility cycling:: Show and hide, much simplified
  503. * Motion:: Jumping to other headlines
  504. * Structure editing:: Changing sequence and level of headlines
  505. * Archiving:: Move done task trees to a different place
  506. * Sparse trees:: Matches embedded in context
  507. * Plain lists:: Additional structure within an entry
  508. * Drawers:: Tucking stuff away
  509. * Orgstruct mode:: Structure editing outside Org
  510. @end menu
  511. @node Outlines, Headlines, Document Structure, Document Structure
  512. @section Outlines
  513. @cindex outlines
  514. @cindex Outline mode
  515. Org is implemented on top of Outline mode. Outlines allow a
  516. document to be organized in a hierarchical structure, which (at least
  517. for me) is the best representation of notes and thoughts. An overview
  518. of this structure is achieved by folding (hiding) large parts of the
  519. document to show only the general document structure and the parts
  520. currently being worked on. Org greatly simplifies the use of
  521. outlines by compressing the entire show/hide functionality into a single
  522. command @command{org-cycle}, which is bound to the @key{TAB} key.
  523. @node Headlines, Visibility cycling, Outlines, Document Structure
  524. @section Headlines
  525. @cindex headlines
  526. @cindex outline tree
  527. Headlines define the structure of an outline tree. The headlines in
  528. Org start with one or more stars, on the left margin@footnote{See
  529. the variable @code{org-special-ctrl-a/e} to configure special behavior
  530. of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
  531. @example
  532. * Top level headline
  533. ** Second level
  534. *** 3rd level
  535. some text
  536. *** 3rd level
  537. more text
  538. * Another top level headline
  539. @end example
  540. @noindent Some people find the many stars too noisy and would prefer an
  541. outline that has whitespace followed by a single star as headline
  542. starters. @ref{Clean view} describes a setup to realize this.
  543. An empty line after the end of a subtree is considered part of it and
  544. will be hidden when the subtree is folded. However, if you leave at
  545. least two empty lines, one empty line will remain visible after folding
  546. the subtree, in order to structure the collapsed view. See the
  547. variable @code{org-cycle-separator-lines} to modify this behavior.
  548. @node Visibility cycling, Motion, Headlines, Document Structure
  549. @section Visibility cycling
  550. @cindex cycling, visibility
  551. @cindex visibility cycling
  552. @cindex trees, visibility
  553. @cindex show hidden text
  554. @cindex hide text
  555. Outlines make it possible to hide parts of the text in the buffer.
  556. Org uses just two commands, bound to @key{TAB} and
  557. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  558. @cindex subtree visibility states
  559. @cindex subtree cycling
  560. @cindex folded, subtree visibility state
  561. @cindex children, subtree visibility state
  562. @cindex subtree, subtree visibility state
  563. @table @kbd
  564. @kindex @key{TAB}
  565. @item @key{TAB}
  566. @emph{Subtree cycling}: Rotate current subtree among the states
  567. @example
  568. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  569. '-----------------------------------'
  570. @end example
  571. The cursor must be on a headline for this to work@footnote{see, however,
  572. the option @code{org-cycle-emulate-tab}.}. When the cursor is at the
  573. beginning of the buffer and the first line is not a headline, then
  574. @key{TAB} actually runs global cycling (see below)@footnote{see the
  575. option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
  576. argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
  577. @cindex global visibility states
  578. @cindex global cycling
  579. @cindex overview, global visibility state
  580. @cindex contents, global visibility state
  581. @cindex show all, global visibility state
  582. @kindex S-@key{TAB}
  583. @item S-@key{TAB}
  584. @itemx C-u @key{TAB}
  585. @emph{Global cycling}: Rotate the entire buffer among the states
  586. @example
  587. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  588. '--------------------------------------'
  589. @end example
  590. When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
  591. CONTENTS view up to headlines of level N will be shown. Note that inside
  592. tables, @kbd{S-@key{TAB}} jumps to the previous field.
  593. @cindex show all, command
  594. @kindex C-c C-a
  595. @item C-c C-a
  596. Show all.
  597. @kindex C-c C-r
  598. @item C-c C-r
  599. Reveal context around point, showing the current entry, the following heading
  600. and the hierarchy above. Useful for working near a location that has been
  601. exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
  602. (@pxref{Agenda commands}). With a prefix argument show, on each
  603. level, all sibling headings.
  604. @kindex C-c C-x b
  605. @item C-c C-x b
  606. Show the current subtree in an indirect buffer@footnote{The indirect
  607. buffer
  608. @ifinfo
  609. (@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual})
  610. @end ifinfo
  611. @ifnotinfo
  612. (see the Emacs manual for more information about indirect buffers)
  613. @end ifnotinfo
  614. will contain the entire buffer, but will be narrowed to the current
  615. tree. Editing the indirect buffer will also change the original buffer,
  616. but without affecting visibility in that buffer.}. With a numeric
  617. prefix argument N, go up to level N and then take that tree. If N is
  618. negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
  619. the previously used indirect buffer.
  620. @end table
  621. When Emacs first visits an Org file, the global state is set to
  622. OVERVIEW, i.e. only the top level headlines are visible. This can be
  623. configured through the variable @code{org-startup-folded}, or on a
  624. per-file basis by adding one of the following lines anywhere in the
  625. buffer:
  626. @example
  627. #+STARTUP: overview
  628. #+STARTUP: content
  629. #+STARTUP: showall
  630. @end example
  631. @node Motion, Structure editing, Visibility cycling, Document Structure
  632. @section Motion
  633. @cindex motion, between headlines
  634. @cindex jumping, to headlines
  635. @cindex headline navigation
  636. The following commands jump to other headlines in the buffer.
  637. @table @kbd
  638. @kindex C-c C-n
  639. @item C-c C-n
  640. Next heading.
  641. @kindex C-c C-p
  642. @item C-c C-p
  643. Previous heading.
  644. @kindex C-c C-f
  645. @item C-c C-f
  646. Next heading same level.
  647. @kindex C-c C-b
  648. @item C-c C-b
  649. Previous heading same level.
  650. @kindex C-c C-u
  651. @item C-c C-u
  652. Backward to higher level heading.
  653. @kindex C-c C-j
  654. @item C-c C-j
  655. Jump to a different place without changing the current outline
  656. visibility. Shows the document structure in a temporary buffer, where
  657. you can use the following keys to find your destination:
  658. @example
  659. @key{TAB} @r{Cycle visibility.}
  660. @key{down} / @key{up} @r{Next/previous visible headline.}
  661. n / p @r{Next/previous visible headline.}
  662. f / b @r{Next/previous headline same level.}
  663. u @r{One level up.}
  664. 0-9 @r{Digit argument.}
  665. @key{RET} @r{Select this location.}
  666. @end example
  667. @end table
  668. @node Structure editing, Archiving, Motion, Document Structure
  669. @section Structure editing
  670. @cindex structure editing
  671. @cindex headline, promotion and demotion
  672. @cindex promotion, of subtrees
  673. @cindex demotion, of subtrees
  674. @cindex subtree, cut and paste
  675. @cindex pasting, of subtrees
  676. @cindex cutting, of subtrees
  677. @cindex copying, of subtrees
  678. @cindex subtrees, cut and paste
  679. @table @kbd
  680. @kindex M-@key{RET}
  681. @item M-@key{RET}
  682. Insert new heading with same level as current. If the cursor is in a
  683. plain list item, a new item is created (@pxref{Plain lists}). To force
  684. creation of a new headline, use a prefix argument, or first press @key{RET}
  685. to get to the beginning of the next line. When this command is used in
  686. the middle of a line, the line is split and the rest of the line becomes
  687. the new headline@footnote{If you do not want the line to be split,
  688. customize the variable @code{org-M-RET-may-split-line}.}. If the
  689. command is used at the beginning of a headline, the new headline is
  690. created before the current line. If at the beginning of any other line,
  691. the content of that line is made the new heading. If the command is
  692. used at the end of a folded subtree (i.e. behind the ellipses at the end
  693. of a headline), then a headline like the current one will be inserted
  694. after the end of the subtree.
  695. @kindex C-@key{RET}
  696. @item C-@key{RET}
  697. Insert a new heading after the current subtree, same level as the
  698. current headline. This command works from anywhere in the entry.
  699. @kindex M-S-@key{RET}
  700. @item M-S-@key{RET}
  701. Insert new TODO entry with same level as current heading.
  702. @kindex M-@key{left}
  703. @item M-@key{left}
  704. Promote current heading by one level.
  705. @kindex M-@key{right}
  706. @item M-@key{right}
  707. Demote current heading by one level.
  708. @kindex M-S-@key{left}
  709. @item M-S-@key{left}
  710. Promote the current subtree by one level.
  711. @kindex M-S-@key{right}
  712. @item M-S-@key{right}
  713. Demote the current subtree by one level.
  714. @kindex M-S-@key{up}
  715. @item M-S-@key{up}
  716. Move subtree up (swap with previous subtree of same
  717. level).
  718. @kindex M-S-@key{down}
  719. @item M-S-@key{down}
  720. Move subtree down (swap with next subtree of same level).
  721. @kindex C-c C-x C-w
  722. @kindex C-c C-x C-k
  723. @item C-c C-x C-w
  724. @itemx C-c C-x C-k
  725. Kill subtree, i.e. remove it from buffer but save in kill ring.
  726. With a numeric prefix argument N, kill N sequential subtrees.
  727. @kindex C-c C-x M-w
  728. @item C-c C-x M-w
  729. Copy subtree to kill ring. With a numeric prefix argument N, copy the N
  730. sequential subtrees.
  731. @kindex C-c C-x C-y
  732. @item C-c C-x C-y
  733. Yank subtree from kill ring. This does modify the level of the subtree to
  734. make sure the tree fits in nicely at the yank position. The yank level can
  735. also be specified with a numeric prefix argument, or by yanking after a
  736. headline marker like @samp{****}.
  737. @kindex C-c C-w
  738. @item C-c C-w
  739. Refile entry to a different location. @xref{Refiling notes}.
  740. @kindex C-c ^
  741. @item C-c ^
  742. Sort same-level entries. When there is an active region, all entries in
  743. the region will be sorted. Otherwise the children of the current
  744. headline are sorted. The command prompts for the sorting method, which
  745. can be alphabetically, numerically, by time (using the first time stamp
  746. in each entry), by priority, and each of these in reverse order. You
  747. can also supply your own function to extract the sorting key. With a
  748. @kbd{C-u} prefix, sorting will be case-sensitive. With two @kbd{C-u
  749. C-u} prefixes, duplicate entries will also be removed.
  750. @kindex C-c *
  751. @item C-c *
  752. Turn a normal line or plain list item into a headline (so that it
  753. becomes a subheading at its location). Also turn a headline into a
  754. normal line by removing the stars. If there is an active region, turn
  755. all lines in the region into headlines. Or, if the first line is a
  756. headline, remove the stars from all headlines in the region.
  757. @end table
  758. @cindex region, active
  759. @cindex active region
  760. @cindex Transient mark mode
  761. When there is an active region (Transient mark mode), promotion and
  762. demotion work on all headlines in the region. To select a region of
  763. headlines, it is best to place both point and mark at the beginning of a
  764. line, mark at the beginning of the first headline, and point at the line
  765. just after the last headline to change. Note that when the cursor is
  766. inside a table (@pxref{Tables}), the Meta-Cursor keys have different
  767. functionality.
  768. @node Archiving, Sparse trees, Structure editing, Document Structure
  769. @section Archiving
  770. @cindex archiving
  771. When a project represented by a (sub)tree is finished, you may want
  772. to move the tree out of the way and to stop it from contributing to the
  773. agenda. Org mode knows two ways of archiving. You can mark a tree with
  774. the ARCHIVE tag, or you can move an entire (sub)tree to a different
  775. location.
  776. @menu
  777. * ARCHIVE tag:: Marking a tree as inactive
  778. * Moving subtrees:: Moving a tree to an archive file
  779. @end menu
  780. @node ARCHIVE tag, Moving subtrees, Archiving, Archiving
  781. @subsection The ARCHIVE tag
  782. @cindex internal archiving
  783. A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at
  784. its location in the outline tree, but behaves in the following way:
  785. @itemize @minus
  786. @item
  787. It does not open when you attempt to do so with a visibility cycling
  788. command (@pxref{Visibility cycling}). You can force cycling archived
  789. subtrees with @kbd{C-@key{TAB}}, or by setting the option
  790. @code{org-cycle-open-archived-trees}. Also normal outline commands like
  791. @code{show-all} will open archived subtrees.
  792. @item
  793. During sparse tree construction (@pxref{Sparse trees}), matches in
  794. archived subtrees are not exposed, unless you configure the option
  795. @code{org-sparse-tree-open-archived-trees}.
  796. @item
  797. During agenda view construction (@pxref{Agenda Views}), the content of
  798. archived trees is ignored unless you configure the option
  799. @code{org-agenda-skip-archived-trees}.
  800. @item
  801. Archived trees are not exported (@pxref{Exporting}), only the headline
  802. is. Configure the details using the variable
  803. @code{org-export-with-archived-trees}.
  804. @end itemize
  805. The following commands help managing the ARCHIVE tag:
  806. @table @kbd
  807. @kindex C-c C-x a
  808. @item C-c C-x a
  809. Toggle the ARCHIVE tag for the current headline. When the tag is set,
  810. the headline changes to a shadowed face, and the subtree below it is
  811. hidden.
  812. @kindex C-u C-c C-x a
  813. @item C-u C-c C-x a
  814. Check if any direct children of the current headline should be archived.
  815. To do this, each subtree is checked for open TODO entries. If none are
  816. found, the command offers to set the ARCHIVE tag for the child. If the
  817. cursor is @emph{not} on a headline when this command is invoked, the
  818. level 1 trees will be checked.
  819. @kindex C-@kbd{TAB}
  820. @item C-@kbd{TAB}
  821. Cycle a tree even if it is tagged with ARCHIVE.
  822. @end table
  823. @node Moving subtrees, , ARCHIVE tag, Archiving
  824. @subsection Moving subtrees
  825. @cindex external archiving
  826. Once an entire project is finished, you may want to move it to a different
  827. location. Org can move it to an @emph{Attic Sibling} in the same tree, to a
  828. different tree in the current file, or to a different file, the archive file.
  829. @table @kbd
  830. @kindex C-c C-x A
  831. @item C-c C-x A
  832. Move the curent entry to the @emph{Attic Sibling}. This is a sibling of the
  833. entry with the heading @samp{Attic} and the tag @samp{ARCHIVE}
  834. (@pxref{ARCHIVE tag}). The entry becomes a child of that sibling and in this
  835. way retains a lot of its original context, including inherited tags and
  836. approximate position in the outline.
  837. @kindex C-c C-x C-s
  838. @item C-c C-x C-s
  839. Archive the subtree starting at the cursor position to the location
  840. given by @code{org-archive-location}. Context information that could be
  841. lost like the file name, the category, inherited tags, and the TODO
  842. state will be store as properties in the entry.
  843. @kindex C-u C-c C-x C-s
  844. @item C-u C-c C-x C-s
  845. Check if any direct children of the current headline could be moved to
  846. the archive. To do this, each subtree is checked for open TODO entries.
  847. If none are found, the command offers to move it to the archive
  848. location. If the cursor is @emph{not} on a headline when this command
  849. is invoked, the level 1 trees will be checked.
  850. @end table
  851. @cindex archive locations
  852. The default archive location is a file in the same directory as the
  853. current file, with the name derived by appending @file{_archive} to the
  854. current file name. For information and examples on how to change this,
  855. see the documentation string of the variable
  856. @code{org-archive-location}. There is also an in-buffer option for
  857. setting this variable, for example@footnote{For backward compatibility,
  858. the following also works: If there are several such lines in a file,
  859. each specifies the archive location for the text below it. The first
  860. such line also applies to any text before its definition. However,
  861. using this method is @emph{strongly} deprecated as it is incompatible
  862. with the outline structure of the document. The correct method for
  863. setting multiple archive locations in a buffer is using a property.}:
  864. @example
  865. #+ARCHIVE: %s_done::
  866. @end example
  867. @noindent
  868. If you would like to have a special ARCHIVE location for a single entry
  869. or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
  870. location as the value (@pxref{Properties and Columns}).
  871. When a subtree is moved, it receives a number of special properties that
  872. record context information like the file from where the entry came, it's
  873. outline path the archiving time etc. Configure the variable
  874. @code{org-archive-save-context-info} to adjust the amount of information
  875. added.
  876. @node Sparse trees, Plain lists, Archiving, Document Structure
  877. @section Sparse trees
  878. @cindex sparse trees
  879. @cindex trees, sparse
  880. @cindex folding, sparse trees
  881. @cindex occur, command
  882. An important feature of Org mode is the ability to construct
  883. @emph{sparse trees} for selected information in an outline tree, so that
  884. the entire document is folded as much as possible, but the selected
  885. information is made visible along with the headline structure above
  886. it@footnote{See also the variables @code{org-show-hierarchy-above},
  887. @code{org-show-following-heading}, and @code{org-show-siblings} for
  888. detailed control on how much context is shown around each match.}. Just
  889. try it out and you will see immediately how it works.
  890. Org mode contains several commands creating such trees, all these
  891. commands can be accessed through a dispatcher:
  892. @table @kbd
  893. @kindex C-c /
  894. @item C-c /
  895. This prompts for an extra key to select a sparse-tree creating command.
  896. @kindex C-c / r
  897. @item C-c / r
  898. Occur. Prompts for a regexp and shows a sparse tree with all matches.
  899. If the match is in a headline, the headline is made visible. If the
  900. match is in the body of an entry, headline and body are made visible.
  901. In order to provide minimal context, also the full hierarchy of
  902. headlines above the match is shown, as well as the headline following
  903. the match. Each match is also highlighted; the highlights disappear
  904. when the buffer is changed by an editing command, or by pressing
  905. @kbd{C-c C-c}. When called with a @kbd{C-u} prefix argument, previous
  906. highlights are kept, so several calls to this command can be stacked.
  907. @end table
  908. @noindent
  909. For frequently used sparse trees of specific search strings, you can
  910. use the variable @code{org-agenda-custom-commands} to define fast
  911. keyboard access to specific sparse trees. These commands will then be
  912. accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
  913. For example:
  914. @lisp
  915. (setq org-agenda-custom-commands
  916. '(("f" occur-tree "FIXME")))
  917. @end lisp
  918. @noindent will define the key @kbd{C-c a f} as a shortcut for creating
  919. a sparse tree matching the string @samp{FIXME}.
  920. The other sparse tree commands select headings based on TODO keywords,
  921. tags, or properties and will be discussed later in this manual.
  922. @kindex C-c C-e v
  923. @cindex printing sparse trees
  924. @cindex visible text, printing
  925. To print a sparse tree, you can use the Emacs command
  926. @code{ps-print-buffer-with-faces} which does not print invisible parts
  927. of the document @footnote{This does not work under XEmacs, because
  928. XEmacs uses selective display for outlining, not text properties.}.
  929. Or you can use the command @kbd{C-c C-e v} to export only the visible
  930. part of the document and print the resulting file.
  931. @node Plain lists, Drawers, Sparse trees, Document Structure
  932. @section Plain lists
  933. @cindex plain lists
  934. @cindex lists, plain
  935. @cindex lists, ordered
  936. @cindex ordered lists
  937. Within an entry of the outline tree, hand-formatted lists can provide
  938. additional structure. They also provide a way to create lists of
  939. checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
  940. and the HTML exporter (@pxref{Exporting}) parses and formats them.
  941. Org knows ordered and unordered lists. Unordered list items start
  942. with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
  943. bullet, lines must be indented or they will be seen as top-level
  944. headlines. Also, when you are hiding leading stars to get a clean
  945. outline view, plain list items starting with a star are visually
  946. indistinguishable from true headlines. In short: even though @samp{*}
  947. is supported, it may be better to not use it for plain list items.} as
  948. bullets. Ordered list items start with a numeral followed by either a
  949. period or a right parenthesis, such as @samp{1.} or @samp{1)}. Items
  950. belonging to the same list must have the same indentation on the first
  951. line. In particular, if an ordered list reaches number @samp{10.}, then
  952. the 2--digit numbers must be written left-aligned with the other numbers
  953. in the list. Indentation also determines the end of a list item. It
  954. ends before the next line that is indented like the bullet/number, or
  955. less. Empty lines are part of the previous item, so you can have
  956. several paragraphs in one item. If you would like an empty line to
  957. terminate all currently open plain lists, configure the variable
  958. @code{org-empty-line-terminates-plain-lists}. Here is an example:
  959. @example
  960. @group
  961. ** Lord of the Rings
  962. My favorite scenes are (in this order)
  963. 1. The attack of the Rohirrim
  964. 2. Eowyns fight with the witch king
  965. + this was already my favorite scene in the book
  966. + I really like Miranda Otto.
  967. 3. Peter Jackson being shot by Legolas
  968. - on DVD only
  969. He makes a really funny face when it happens.
  970. But in the end, not individual scenes matter but the film as a whole.
  971. @end group
  972. @end example
  973. Org supports these lists by tuning filling and wrapping commands to
  974. deal with them correctly@footnote{Org only changes the filling
  975. settings for Emacs. For XEmacs, you should use Kyle E. Jones'
  976. @file{filladapt.el}. To turn this on, put into @file{.emacs}:
  977. @code{(require 'filladapt)}}.
  978. The following commands act on items when the cursor is in the first line
  979. of an item (the line with the bullet or number).
  980. @table @kbd
  981. @kindex @key{TAB}
  982. @item @key{TAB}
  983. Items can be folded just like headline levels if you set the variable
  984. @code{org-cycle-include-plain-lists}. The level of an item is then
  985. given by the indentation of the bullet/number. Items are always
  986. subordinate to real headlines, however; the hierarchies remain
  987. completely separated.
  988. If @code{org-cycle-include-plain-lists} has not been set, @key{TAB}
  989. fixes the indentation of the current line in a heuristic way.
  990. @kindex M-@key{RET}
  991. @item M-@key{RET}
  992. Insert new item at current level. With a prefix argument, force a new
  993. heading (@pxref{Structure editing}). If this command is used in the middle
  994. of a line, the line is @emph{split} and the rest of the line becomes the new
  995. item@footnote{If you do not want the line to be split, customize the variable
  996. @code{org-M-RET-may-split-line}.}. If this command is executed in the
  997. @emph{whitespace before a bullet or number}, the new item is created
  998. @emph{before} the current item. If the command is executed in the white
  999. space before the text that is part of an item but does not contain the
  1000. bullet, a bullet is added to the current line.
  1001. @kindex M-S-@key{RET}
  1002. @item M-S-@key{RET}
  1003. Insert a new item with a checkbox (@pxref{Checkboxes}).
  1004. @kindex S-@key{up}
  1005. @kindex S-@key{down}
  1006. @item S-@key{up}
  1007. @itemx S-@key{down}
  1008. Jump to the previous/next item in the current list.
  1009. @kindex M-S-@key{up}
  1010. @kindex M-S-@key{down}
  1011. @item M-S-@key{up}
  1012. @itemx M-S-@key{down}
  1013. Move the item including subitems up/down (swap with previous/next item
  1014. of same indentation). If the list is ordered, renumbering is
  1015. automatic.
  1016. @kindex M-S-@key{left}
  1017. @kindex M-S-@key{right}
  1018. @item M-S-@key{left}
  1019. @itemx M-S-@key{right}
  1020. Decrease/increase the indentation of the item, including subitems.
  1021. Initially, the item tree is selected based on current indentation.
  1022. When these commands are executed several times in direct succession,
  1023. the initially selected region is used, even if the new indentation
  1024. would imply a different hierarchy. To use the new hierarchy, break
  1025. the command chain with a cursor motion or so.
  1026. @kindex C-c C-c
  1027. @item C-c C-c
  1028. If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
  1029. state of the checkbox. If not, this command makes sure that all the
  1030. items on this list level use the same bullet. Furthermore, if this is
  1031. an ordered list, make sure the numbering is OK.
  1032. @kindex C-c -
  1033. @item C-c -
  1034. Cycle the entire list level through the different itemize/enumerate bullets
  1035. (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix
  1036. argument N, select the Nth bullet from this list. If there is an active
  1037. region when calling this, all lines will be converted to list items. If the
  1038. first line already was a list item, any item markers will be removed from the
  1039. list. Finally, even without an active region, a normal line will be
  1040. converted into a list item.
  1041. @end table
  1042. @node Drawers, Orgstruct mode, Plain lists, Document Structure
  1043. @section Drawers
  1044. @cindex drawers
  1045. @cindex visibility cycling, drawers
  1046. Sometimes you want to keep information associated with an entry, but you
  1047. normally don't want to see it. For this, Org mode has @emph{drawers}.
  1048. Drawers need to be configured with the variable
  1049. @code{org-drawers}@footnote{You can define drawers on a per-file basis
  1050. with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers
  1051. look like this:
  1052. @example
  1053. ** This is a headline
  1054. Still outside the drawer
  1055. :DRAWERNAME:
  1056. This is inside the drawer.
  1057. :END:
  1058. After the drawer.
  1059. @end example
  1060. Visibility cycling (@pxref{Visibility cycling}) on the headline will
  1061. hide and show the entry, but keep the drawer collapsed to a single line.
  1062. In order to look inside the drawer, you need to move the cursor to the
  1063. drawer line and press @key{TAB} there. Org mode uses a drawer for
  1064. storing properties (@pxref{Properties and Columns}).
  1065. @node Orgstruct mode, , Drawers, Document Structure
  1066. @section The Orgstruct minor mode
  1067. @cindex Orgstruct mode
  1068. @cindex minor mode for structure editing
  1069. If you like the intuitive way the Org mode structure editing and list
  1070. formatting works, you might want to use these commands in other modes
  1071. like Text mode or Mail mode as well. The minor mode Orgstruct mode
  1072. makes this possible. You can always toggle the mode with @kbd{M-x
  1073. orgstruct-mode}. To turn it on by default, for example in Mail mode,
  1074. use
  1075. @lisp
  1076. (add-hook 'mail-mode-hook 'turn-on-orgstruct)
  1077. @end lisp
  1078. When this mode is active and the cursor is on a line that looks to
  1079. Org like a headline of the first line of a list item, most
  1080. structure editing commands will work, even if the same keys normally
  1081. have different functionality in the major mode you are using. If the
  1082. cursor is not in one of those special lines, Orgstruct mode lurks
  1083. silently in the shadow.
  1084. @node Tables, Hyperlinks, Document Structure, Top
  1085. @chapter Tables
  1086. @cindex tables
  1087. @cindex editing tables
  1088. Org comes with a fast and intuitive table editor. Spreadsheet-like
  1089. calculations are supported in connection with the Emacs @file{calc}
  1090. package
  1091. @ifinfo
  1092. (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
  1093. @end ifinfo
  1094. @ifnotinfo
  1095. (see the Emacs Calculator manual for more information about the Emacs
  1096. calculator).
  1097. @end ifnotinfo
  1098. @menu
  1099. * Built-in table editor:: Simple tables
  1100. * Narrow columns:: Stop wasting space in tables
  1101. * Column groups:: Grouping to trigger vertical lines
  1102. * Orgtbl mode:: The table editor as minor mode
  1103. * The spreadsheet:: The table editor has spreadsheet capabilities
  1104. @end menu
  1105. @node Built-in table editor, Narrow columns, Tables, Tables
  1106. @section The built-in table editor
  1107. @cindex table editor, built-in
  1108. Org makes it easy to format tables in plain ASCII. Any line with
  1109. @samp{|} as the first non-whitespace character is considered part of a
  1110. table. @samp{|} is also the column separator. A table might look like
  1111. this:
  1112. @example
  1113. | Name | Phone | Age |
  1114. |-------+-------+-----|
  1115. | Peter | 1234 | 17 |
  1116. | Anna | 4321 | 25 |
  1117. @end example
  1118. A table is re-aligned automatically each time you press @key{TAB} or
  1119. @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
  1120. the next field (@key{RET} to the next row) and creates new table rows
  1121. at the end of the table or before horizontal lines. The indentation
  1122. of the table is set by the first line. Any line starting with
  1123. @samp{|-} is considered as a horizontal separator line and will be
  1124. expanded on the next re-align to span the whole table width. So, to
  1125. create the above table, you would only type
  1126. @example
  1127. |Name|Phone|Age|
  1128. |-
  1129. @end example
  1130. @noindent and then press @key{TAB} to align the table and start filling in
  1131. fields.
  1132. When typing text into a field, Org treats @key{DEL},
  1133. @key{Backspace}, and all character keys in a special way, so that
  1134. inserting and deleting avoids shifting other fields. Also, when
  1135. typing @emph{immediately after the cursor was moved into a new field
  1136. with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
  1137. field is automatically made blank. If this behavior is too
  1138. unpredictable for you, configure the variables
  1139. @code{org-enable-table-editor} and @code{org-table-auto-blank-field}.
  1140. @table @kbd
  1141. @tsubheading{Creation and conversion}
  1142. @kindex C-c |
  1143. @item C-c |
  1144. Convert the active region to table. If every line contains at least one
  1145. TAB character, the function assumes that the material is tab separated.
  1146. If every line contains a comma, comma-separated values (CSV) are assumed.
  1147. If not, lines are split at whitespace into fields. You can use a prefix
  1148. argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
  1149. C-u} forces TAB, and a numeric argument N indicates that at least N
  1150. consecutive spaces, or alternatively a TAB will be the separator.
  1151. @*
  1152. If there is no active region, this command creates an empty Org
  1153. table. But it's easier just to start typing, like
  1154. @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
  1155. @tsubheading{Re-aligning and field motion}
  1156. @kindex C-c C-c
  1157. @item C-c C-c
  1158. Re-align the table without moving the cursor.
  1159. @c
  1160. @kindex @key{TAB}
  1161. @item @key{TAB}
  1162. Re-align the table, move to the next field. Creates a new row if
  1163. necessary.
  1164. @c
  1165. @kindex S-@key{TAB}
  1166. @item S-@key{TAB}
  1167. Re-align, move to previous field.
  1168. @c
  1169. @kindex @key{RET}
  1170. @item @key{RET}
  1171. Re-align the table and move down to next row. Creates a new row if
  1172. necessary. At the beginning or end of a line, @key{RET} still does
  1173. NEWLINE, so it can be used to split a table.
  1174. @tsubheading{Column and row editing}
  1175. @kindex M-@key{left}
  1176. @kindex M-@key{right}
  1177. @item M-@key{left}
  1178. @itemx M-@key{right}
  1179. Move the current column left/right.
  1180. @c
  1181. @kindex M-S-@key{left}
  1182. @item M-S-@key{left}
  1183. Kill the current column.
  1184. @c
  1185. @kindex M-S-@key{right}
  1186. @item M-S-@key{right}
  1187. Insert a new column to the left of the cursor position.
  1188. @c
  1189. @kindex M-@key{up}
  1190. @kindex M-@key{down}
  1191. @item M-@key{up}
  1192. @itemx M-@key{down}
  1193. Move the current row up/down.
  1194. @c
  1195. @kindex M-S-@key{up}
  1196. @item M-S-@key{up}
  1197. Kill the current row or horizontal line.
  1198. @c
  1199. @kindex M-S-@key{down}
  1200. @item M-S-@key{down}
  1201. Insert a new row above the current row. With a prefix argument, the line is
  1202. created below the current one.
  1203. @c
  1204. @kindex C-c -
  1205. @item C-c -
  1206. Insert a horizontal line below current row. With a prefix argument, the line
  1207. is created above the current line.
  1208. @c
  1209. @kindex C-c ^
  1210. @item C-c ^
  1211. Sort the table lines in the region. The position of point indicates the
  1212. column to be used for sorting, and the range of lines is the range
  1213. between the nearest horizontal separator lines, or the entire table. If
  1214. point is before the first column, you will be prompted for the sorting
  1215. column. If there is an active region, the mark specifies the first line
  1216. and the sorting column, while point should be in the last line to be
  1217. included into the sorting. The command prompts for the sorting type
  1218. (alphabetically, numerically, or by time). When called with a prefix
  1219. argument, alphabetic sorting will be case-sensitive.
  1220. @tsubheading{Regions}
  1221. @kindex C-c C-x M-w
  1222. @item C-c C-x M-w
  1223. Copy a rectangular region from a table to a special clipboard. Point
  1224. and mark determine edge fields of the rectangle. The process ignores
  1225. horizontal separator lines.
  1226. @c
  1227. @kindex C-c C-x C-w
  1228. @item C-c C-x C-w
  1229. Copy a rectangular region from a table to a special clipboard, and
  1230. blank all fields in the rectangle. So this is the ``cut'' operation.
  1231. @c
  1232. @kindex C-c C-x C-y
  1233. @item C-c C-x C-y
  1234. Paste a rectangular region into a table.
  1235. The upper right corner ends up in the current field. All involved fields
  1236. will be overwritten. If the rectangle does not fit into the present table,
  1237. the table is enlarged as needed. The process ignores horizontal separator
  1238. lines.
  1239. @c
  1240. @kindex C-c C-q
  1241. @kindex M-@key{RET}
  1242. @item C-c C-q
  1243. @itemx M-@kbd{RET}
  1244. Wrap several fields in a column like a paragraph. If there is an active
  1245. region, and both point and mark are in the same column, the text in the
  1246. column is wrapped to minimum width for the given number of lines. A numeric
  1247. prefix argument may be used to change the number of desired lines. If there
  1248. is no region, the current field is split at the cursor position and the text
  1249. fragment to the right of the cursor is prepended to the field one line
  1250. down. If there is no region, but you specify a prefix argument, the current
  1251. field is made blank, and the content is appended to the field above.
  1252. @tsubheading{Calculations}
  1253. @cindex formula, in tables
  1254. @cindex calculations, in tables
  1255. @cindex region, active
  1256. @cindex active region
  1257. @cindex Transient mark mode
  1258. @kindex C-c +
  1259. @item C-c +
  1260. Sum the numbers in the current column, or in the rectangle defined by
  1261. the active region. The result is shown in the echo area and can
  1262. be inserted with @kbd{C-y}.
  1263. @c
  1264. @kindex S-@key{RET}
  1265. @item S-@key{RET}
  1266. When current field is empty, copy from first non-empty field above.
  1267. When not empty, copy current field down to next row and move cursor
  1268. along with it. Depending on the variable
  1269. @code{org-table-copy-increment}, integer field values will be
  1270. incremented during copy. This key is also used by CUA mode
  1271. (@pxref{Cooperation}).
  1272. @tsubheading{Miscellaneous}
  1273. @kindex C-c `
  1274. @item C-c `
  1275. Edit the current field in a separate window. This is useful for fields
  1276. that are not fully visible (@pxref{Narrow columns}). When called with a
  1277. @kbd{C-u} prefix, just make the full field visible, so that it can be
  1278. edited in place.
  1279. @c
  1280. @item M-x org-table-import
  1281. Import a file as a table. The table should be TAB- or whitespace
  1282. separated. Useful, for example, to import a spreadsheet table or data
  1283. from a database, because these programs generally can write
  1284. TAB-separated text files. This command works by inserting the file into
  1285. the buffer and then converting the region to a table. Any prefix
  1286. argument is passed on to the converter, which uses it to determine the
  1287. separator.
  1288. @item C-c |
  1289. Tables can also be imported by pasting tabular text into the Org
  1290. buffer, selecting the pasted text with @kbd{C-x C-x} and then using the
  1291. @kbd{C-c |} command (see above under @i{Creation and conversion}.
  1292. @c
  1293. @item M-x org-table-export
  1294. Export the table as a TAB-separated file. Useful for data exchange with,
  1295. for example, spreadsheet or database programs.
  1296. @end table
  1297. If you don't like the automatic table editor because it gets in your
  1298. way on lines which you would like to start with @samp{|}, you can turn
  1299. it off with
  1300. @lisp
  1301. (setq org-enable-table-editor nil)
  1302. @end lisp
  1303. @noindent Then the only table command that still works is
  1304. @kbd{C-c C-c} to do a manual re-align.
  1305. @node Narrow columns, Column groups, Built-in table editor, Tables
  1306. @section Narrow columns
  1307. @cindex narrow columns in tables
  1308. The width of columns is automatically determined by the table editor.
  1309. Sometimes a single field or a few fields need to carry more text,
  1310. leading to inconveniently wide columns. To limit@footnote{This feature
  1311. does not work on XEmacs.} the width of a column, one field anywhere in
  1312. the column may contain just the string @samp{<N>} where @samp{N} is an
  1313. integer specifying the width of the column in characters. The next
  1314. re-align will then set the width of this column to no more than this
  1315. value.
  1316. @example
  1317. @group
  1318. |---+------------------------------| |---+--------|
  1319. | | | | | <6> |
  1320. | 1 | one | | 1 | one |
  1321. | 2 | two | ----\ | 2 | two |
  1322. | 3 | This is a long chunk of text | ----/ | 3 | This=> |
  1323. | 4 | four | | 4 | four |
  1324. |---+------------------------------| |---+--------|
  1325. @end group
  1326. @end example
  1327. @noindent
  1328. Fields that are wider become clipped and end in the string @samp{=>}.
  1329. Note that the full text is still in the buffer, it is only invisible.
  1330. To see the full text, hold the mouse over the field - a tool-tip window
  1331. will show the full content. To edit such a field, use the command
  1332. @kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
  1333. open a new window with the full field. Edit it and finish with @kbd{C-c
  1334. C-c}.
  1335. When visiting a file containing a table with narrowed columns, the
  1336. necessary character hiding has not yet happened, and the table needs to
  1337. be aligned before it looks nice. Setting the option
  1338. @code{org-startup-align-all-tables} will realign all tables in a file
  1339. upon visiting, but also slow down startup. You can also set this option
  1340. on a per-file basis with:
  1341. @example
  1342. #+STARTUP: align
  1343. #+STARTUP: noalign
  1344. @end example
  1345. @node Column groups, Orgtbl mode, Narrow columns, Tables
  1346. @section Column groups
  1347. @cindex grouping columns in tables
  1348. When Org exports tables, it does so by default without vertical
  1349. lines because that is visually more satisfying in general. Occasionally
  1350. however, vertical lines can be useful to structure a table into groups
  1351. of columns, much like horizontal lines can do for groups of rows. In
  1352. order to specify column groups, you can use a special row where the
  1353. first field contains only @samp{/}. The further fields can either
  1354. contain @samp{<} to indicate that this column should start a group,
  1355. @samp{>} to indicate the end of a column, or @samp{<>} to make a column
  1356. a group of its own. Boundaries between column groups will upon export be
  1357. marked with vertical lines. Here is an example:
  1358. @example
  1359. | | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1360. |---+----+-----+-----+-----+---------+------------|
  1361. | / | <> | < | | > | < | > |
  1362. | # | 1 | 1 | 1 | 1 | 1 | 1 |
  1363. | # | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
  1364. | # | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
  1365. |---+----+-----+-----+-----+---------+------------|
  1366. #+TBLFM: $3=$2^2::$4=$2^3::$5=$2^4::$6=sqrt($2)::$7=sqrt(sqrt(($2))
  1367. @end example
  1368. It is also sufficient to just insert the column group starters after
  1369. every vertical line you'd like to have:
  1370. @example
  1371. | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) |
  1372. |----+-----+-----+-----+---------+------------|
  1373. | / | < | | | < | |
  1374. @end example
  1375. @node Orgtbl mode, The spreadsheet, Column groups, Tables
  1376. @section The Orgtbl minor mode
  1377. @cindex Orgtbl mode
  1378. @cindex minor mode for tables
  1379. If you like the intuitive way the Org table editor works, you
  1380. might also want to use it in other modes like Text mode or Mail mode.
  1381. The minor mode Orgtbl mode makes this possible. You can always toggle
  1382. the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
  1383. example in mail mode, use
  1384. @lisp
  1385. (add-hook 'mail-mode-hook 'turn-on-orgtbl)
  1386. @end lisp
  1387. Furthermore, with some special setup, it is possible to maintain tables
  1388. in arbitrary syntax with Orgtbl mode. For example, it is possible to
  1389. construct La@TeX{} tables with the underlying ease and power of
  1390. Orgtbl mode, including spreadsheet capabilities. For details, see
  1391. @ref{Tables in arbitrary syntax}.
  1392. @node The spreadsheet, , Orgtbl mode, Tables
  1393. @section The spreadsheet
  1394. @cindex calculations, in tables
  1395. @cindex spreadsheet capabilities
  1396. @cindex @file{calc} package
  1397. The table editor makes use of the Emacs @file{calc} package to implement
  1398. spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to
  1399. derive fields from other fields. While fully featured, Org's
  1400. implementation is not identical to other spreadsheets. For example,
  1401. Org knows the concept of a @emph{column formula} that will be
  1402. applied to all non-header fields in a column without having to copy the
  1403. formula to each relevant field.
  1404. @menu
  1405. * References:: How to refer to another field or range
  1406. * Formula syntax for Calc:: Using Calc to compute stuff
  1407. * Formula syntax for Lisp:: Writing formulas in Emacs Lisp
  1408. * Field formulas:: Formulas valid for a single field
  1409. * Column formulas:: Formulas valid for an entire column
  1410. * Editing and debugging formulas:: Fixing formulas
  1411. * Updating the table:: Recomputing all dependent fields
  1412. * Advanced features:: Field names, parameters and automatic recalc
  1413. @end menu
  1414. @node References, Formula syntax for Calc, The spreadsheet, The spreadsheet
  1415. @subsection References
  1416. @cindex references
  1417. To compute fields in the table from other fields, formulas must
  1418. reference other fields or ranges. In Org, fields can be referenced
  1419. by name, by absolute coordinates, and by relative coordinates. To find
  1420. out what the coordinates of a field are, press @kbd{C-c ?} in that
  1421. field, or press @kbd{C-c @}} to toggle the display of a grid.
  1422. @subsubheading Field references
  1423. @cindex field references
  1424. @cindex references, to fields
  1425. Formulas can reference the value of another field in two ways. Like in
  1426. any other spreadsheet, you may reference fields with a letter/number
  1427. combination like @code{B3}, meaning the 2nd field in the 3rd row.
  1428. @c Such references are always fixed to that field, they don't change
  1429. @c when you copy and paste a formula to a different field. So
  1430. @c Org's @code{B3} behaves like @code{$B$3} in other spreadsheets.
  1431. @noindent
  1432. Org also uses another, more general operator that looks like this:
  1433. @example
  1434. @@row$column
  1435. @end example
  1436. @noindent
  1437. Column references can be absolute like @samp{1}, @samp{2},...@samp{N},
  1438. or relative to the current column like @samp{+1} or @samp{-2}.
  1439. The row specification only counts data lines and ignores horizontal
  1440. separator lines (hlines). You can use absolute row numbers
  1441. @samp{1}...@samp{N}, and row numbers relative to the current row like
  1442. @samp{+3} or @samp{-1}. Or specify the row relative to one of the
  1443. hlines: @samp{I} refers to the first hline@footnote{Note that only
  1444. hlines are counted that @emph{separate} table lines. If the table
  1445. starts with a hline above the header, it does not count.}, @samp{II} to
  1446. the second etc. @samp{-I} refers to the first such line above the
  1447. current line, @samp{+I} to the first such line below the current line.
  1448. You can also write @samp{III+2} which is the second data line after the
  1449. third hline in the table. Relative row numbers like @samp{-3} will not
  1450. cross hlines if the current line is too close to the hline. Instead,
  1451. the value directly at the hline is used.
  1452. @samp{0} refers to the current row and column. Also, if you omit
  1453. either the column or the row part of the reference, the current
  1454. row/column is implied.
  1455. Org's references with @emph{unsigned} numbers are fixed references
  1456. in the sense that if you use the same reference in the formula for two
  1457. different fields, the same field will be referenced each time.
  1458. Org's references with @emph{signed} numbers are floating
  1459. references because the same reference operator can reference different
  1460. fields depending on the field being calculated by the formula.
  1461. Here are a few examples:
  1462. @example
  1463. @@2$3 @r{2nd row, 3rd column}
  1464. C2 @r{same as previous}
  1465. $5 @r{column 5 in the current row}
  1466. E& @r{same as previous}
  1467. @@2 @r{current column, row 2}
  1468. @@-1$-3 @r{the field one row up, three columns to the left}
  1469. @@-I$2 @r{field just under hline above current row, column 2}
  1470. @end example
  1471. @subsubheading Range references
  1472. @cindex range references
  1473. @cindex references, to ranges
  1474. You may reference a rectangular range of fields by specifying two field
  1475. references connected by two dots @samp{..}. If both fields are in the
  1476. current row, you may simply use @samp{$2..$7}, but if at least one field
  1477. is in a different row, you need to use the general @code{@@row$column}
  1478. format at least for the first field (i.e the reference must start with
  1479. @samp{@@} in order to be interpreted correctly). Examples:
  1480. @example
  1481. $1..$3 @r{First three fields in the current row.}
  1482. $P..$Q @r{Range, using column names (see under Advanced)}
  1483. @@2$1..@@4$3 @r{6 fields between these two fields.}
  1484. A2..C4 @r{Same as above.}
  1485. @@-1$-2..@@-1 @r{3 numbers from the column to the left, 2 up to current row}
  1486. @end example
  1487. @noindent Range references return a vector of values that can be fed
  1488. into Calc vector functions. Empty fields in ranges are normally
  1489. suppressed, so that the vector contains only the non-empty fields (but
  1490. see the @samp{E} mode switch below). If there are no non-empty fields,
  1491. @samp{[0]} is returned to avoid syntax errors in formulas.
  1492. @subsubheading Named references
  1493. @cindex named references
  1494. @cindex references, named
  1495. @cindex name, of column or field
  1496. @cindex constants, in calculations
  1497. @samp{$name} is interpreted as the name of a column, parameter or
  1498. constant. Constants are defined globally through the variable
  1499. @code{org-table-formula-constants}, and locally (for the file) through a
  1500. line like
  1501. @example
  1502. #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
  1503. @end example
  1504. @noindent
  1505. Also properties (@pxref{Properties and Columns}) can be used as
  1506. constants in table formulas: For a property @samp{:Xyz:} use the name
  1507. @samp{$PROP_Xyz}, and the property will be searched in the current
  1508. outline entry and in the hierarchy above it. If you have the
  1509. @file{constants.el} package, it will also be used to resolve constants,
  1510. including natural constants like @samp{$h} for Planck's constant, and
  1511. units like @samp{$km} for kilometers@footnote{@file{Constant.el} can
  1512. supply the values of constants in two different unit systems, @code{SI}
  1513. and @code{cgs}. Which one is used depends on the value of the variable
  1514. @code{constants-unit-system}. You can use the @code{#+STARTUP} options
  1515. @code{constSI} and @code{constcgs} to set this value for the current
  1516. buffer.}. Column names and parameters can be specified in special table
  1517. lines. These are described below, see @ref{Advanced features}. All
  1518. names must start with a letter, and further consist of letters and
  1519. numbers.
  1520. @node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet
  1521. @subsection Formula syntax for Calc
  1522. @cindex formula syntax, Calc
  1523. @cindex syntax, of formulas
  1524. A formula can be any algebraic expression understood by the Emacs
  1525. @file{Calc} package. @b{Note that @file{calc} has the
  1526. non-standard convention that @samp{/} has lower precedence than
  1527. @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
  1528. evaluation by @code{calc-eval} (@pxref{Calling Calc from
  1529. Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU
  1530. Emacs Calc Manual}),
  1531. @c FIXME: The link to the Calc manual in HTML does not work.
  1532. variable substitution takes place according to the rules described above.
  1533. @cindex vectors, in table calculations
  1534. The range vectors can be directly fed into the Calc vector functions
  1535. like @samp{vmean} and @samp{vsum}.
  1536. @cindex format specifier
  1537. @cindex mode, for @file{calc}
  1538. A formula can contain an optional mode string after a semicolon. This
  1539. string consists of flags to influence Calc and other modes during
  1540. execution. By default, Org uses the standard Calc modes (precision
  1541. 12, angular units degrees, fraction and symbolic modes off. The display
  1542. format, however, has been changed to @code{(float 5)} to keep tables
  1543. compact. The default settings can be configured using the variable
  1544. @code{org-calc-default-modes}.
  1545. @example
  1546. p20 @r{switch the internal precision to 20 digits}
  1547. n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format}
  1548. D R @r{angle modes: degrees, radians}
  1549. F S @r{fraction and symbolic modes}
  1550. N @r{interpret all fields as numbers, use 0 for non-numbers}
  1551. T @r{force text interpretation}
  1552. E @r{keep empty fields in ranges}
  1553. @end example
  1554. @noindent
  1555. In addition, you may provide a @code{printf} format specifier to
  1556. reformat the final result. A few examples:
  1557. @example
  1558. $1+$2 @r{Sum of first and second field}
  1559. $1+$2;%.2f @r{Same, format result to two decimals}
  1560. exp($2)+exp($1) @r{Math functions can be used}
  1561. $0;%.1f @r{Reformat current cell to 1 decimal}
  1562. ($3-32)*5/9 @r{Degrees F -> C conversion}
  1563. $c/$1/$cm @r{Hz -> cm conversion, using @file{constants.el}}
  1564. tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
  1565. sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
  1566. vmean($2..$7) @r{Compute column range mean, using vector function}
  1567. vmean($2..$7);EN @r{Same, but treat empty fields as 0}
  1568. taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
  1569. @end example
  1570. Calc also contains a complete set of logical operations. For example
  1571. @example
  1572. if($1<20,teen,string("")) @r{``teen'' if age $1 less than 20, else empty}
  1573. @end example
  1574. @node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
  1575. @subsection Emacs Lisp forms as formulas
  1576. @cindex Lisp forms, as table formulas
  1577. It is also possible to write a formula in Emacs Lisp; this can be useful
  1578. for string manipulation and control structures, if the Calc's
  1579. functionality is not enough. If a formula starts with a single quote
  1580. followed by an opening parenthesis, then it is evaluated as a lisp form.
  1581. The evaluation should return either a string or a number. Just as with
  1582. @file{calc} formulas, you can specify modes and a printf format after a
  1583. semicolon. With Emacs Lisp forms, you need to be conscious about the way
  1584. field references are interpolated into the form. By default, a
  1585. reference will be interpolated as a Lisp string (in double quotes)
  1586. containing the field. If you provide the @samp{N} mode switch, all
  1587. referenced elements will be numbers (non-number fields will be zero) and
  1588. interpolated as Lisp numbers, without quotes. If you provide the
  1589. @samp{L} flag, all fields will be interpolated literally, without quotes.
  1590. I.e., if you want a reference to be interpreted as a string by the Lisp
  1591. form, enclose the reference operator itself in double quotes, like
  1592. @code{"$3"}. Ranges are inserted as space-separated fields, so you can
  1593. embed them in list or vector syntax. A few examples, note how the
  1594. @samp{N} mode is used when we do computations in lisp.
  1595. @example
  1596. @r{Swap the first two characters of the content of column 1}
  1597. '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
  1598. @r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
  1599. '(+ $1 $2);N
  1600. @r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
  1601. '(apply '+ '($1..$4));N
  1602. @end example
  1603. @node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
  1604. @subsection Field formulas
  1605. @cindex field formula
  1606. @cindex formula, for individual table field
  1607. To assign a formula to a particular field, type it directly into the
  1608. field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
  1609. press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
  1610. the field, the formula will be stored as the formula for this field,
  1611. evaluated, and the current field replaced with the result.
  1612. Formulas are stored in a special line starting with @samp{#+TBLFM:}
  1613. directly below the table. If you typed the equation in the 4th field of
  1614. the 3rd data line in the table, the formula will look like
  1615. @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows
  1616. with the appropriate commands, @i{absolute references} (but not relative
  1617. ones) in stored formulas are modified in order to still reference the
  1618. same field. Of cause this is not true if you edit the table structure
  1619. with normal editing commands - then you must fix the equations yourself.
  1620. Instead of typing an equation into the field, you may also use the
  1621. following command
  1622. @table @kbd
  1623. @kindex C-u C-c =
  1624. @item C-u C-c =
  1625. Install a new formula for the current field. The command prompts for a
  1626. formula, with default taken from the @samp{#+TBLFM:} line, applies
  1627. it to the current field and stores it.
  1628. @end table
  1629. @node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
  1630. @subsection Column formulas
  1631. @cindex column formula
  1632. @cindex formula, for table column
  1633. Often in a table, the same formula should be used for all fields in a
  1634. particular column. Instead of having to copy the formula to all fields
  1635. in that column, Org allows to assign a single formula to an entire
  1636. column. If the table contains horizontal separator hlines, everything
  1637. before the first such line is considered part of the table @emph{header}
  1638. and will not be modified by column formulas.
  1639. To assign a formula to a column, type it directly into any field in the
  1640. column, preceded by an equal sign, like @samp{=$1+$2}. When you press
  1641. @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
  1642. field, the formula will be stored as the formula for the current column,
  1643. evaluated and the current field replaced with the result. If the field
  1644. contains only @samp{=}, the previously stored formula for this column is
  1645. used. For each column, Org will only remember the most recently
  1646. used formula. In the @samp{TBLFM:} line, column formulas will look like
  1647. @samp{$4=$1+$2}.
  1648. Instead of typing an equation into the field, you may also use the
  1649. following command:
  1650. @table @kbd
  1651. @kindex C-c =
  1652. @item C-c =
  1653. Install a new formula for the current column and replace current field with
  1654. the result of the formula. The command prompts for a formula, with default
  1655. taken from the @samp{#+TBLFM} line, applies it to the current field and
  1656. stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command
  1657. will apply it to that many consecutive fields in the current column.
  1658. @end table
  1659. @node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
  1660. @subsection Editing and debugging formulas
  1661. @cindex formula editing
  1662. @cindex editing, of table formulas
  1663. You can edit individual formulas in the minibuffer or directly in the
  1664. field. Org can also prepare a special buffer with all active
  1665. formulas of a table. When offering a formula for editing, Org
  1666. converts references to the standard format (like @code{B3} or @code{D&})
  1667. if possible. If you prefer to only work with the internal format (like
  1668. @code{@@3$2} or @code{$4}), configure the variable
  1669. @code{org-table-use-standard-references}.
  1670. @table @kbd
  1671. @kindex C-c =
  1672. @kindex C-u C-c =
  1673. @item C-c =
  1674. @itemx C-u C-c =
  1675. Edit the formula associated with the current column/field in the
  1676. minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
  1677. @kindex C-u C-u C-c =
  1678. @item C-u C-u C-c =
  1679. Re-insert the active formula (either a
  1680. field formula, or a column formula) into the current field, so that you
  1681. can edit it directly in the field. The advantage over editing in the
  1682. minibuffer is that you can use the command @kbd{C-c ?}.
  1683. @kindex C-c ?
  1684. @item C-c ?
  1685. While editing a formula in a table field, highlight the field(s)
  1686. referenced by the reference at the cursor position in the formula.
  1687. @kindex C-c @}
  1688. @item C-c @}
  1689. Toggle the display of row and column numbers for a table, using
  1690. overlays. These are updated each time the table is aligned, you can
  1691. force it with @kbd{C-c C-c}.
  1692. @kindex C-c @{
  1693. @item C-c @{
  1694. Toggle the formula debugger on and off. See below.
  1695. @kindex C-c '
  1696. @item C-c '
  1697. Edit all formulas for the current table in a special buffer, where the
  1698. formulas will be displayed one per line. If the current field has an
  1699. active formula, the cursor in the formula editor will mark it.
  1700. While inside the special buffer, Org will automatically highlight
  1701. any field or range reference at the cursor position. You may edit,
  1702. remove and add formulas, and use the following commands:
  1703. @table @kbd
  1704. @kindex C-c C-c
  1705. @kindex C-x C-s
  1706. @item C-c C-c
  1707. @itemx C-x C-s
  1708. Exit the formula editor and store the modified formulas. With @kbd{C-u}
  1709. prefix, also apply the new formulas to the entire table.
  1710. @kindex C-c C-q
  1711. @item C-c C-q
  1712. Exit the formula editor without installing changes.
  1713. @kindex C-c C-r
  1714. @item C-c C-r
  1715. Toggle all references in the formula editor between standard (like
  1716. @code{B3}) and internal (like @code{@@3$2}).
  1717. @kindex @key{TAB}
  1718. @item @key{TAB}
  1719. Pretty-print or indent lisp formula at point. When in a line containing
  1720. a lisp formula, format the formula according to Emacs Lisp rules.
  1721. Another @key{TAB} collapses the formula back again. In the open
  1722. formula, @key{TAB} re-indents just like in Emacs lisp mode.
  1723. @kindex M-@key{TAB}
  1724. @item M-@key{TAB}
  1725. Complete Lisp symbols, just like in Emacs lisp mode.
  1726. @kindex S-@key{up}
  1727. @kindex S-@key{down}
  1728. @kindex S-@key{left}
  1729. @kindex S-@key{right}
  1730. @item S-@key{up}/@key{down}/@key{left}/@key{right}
  1731. Shift the reference at point. For example, if the reference is
  1732. @code{B3} and you press @kbd{S-@key{right}}, it will become @code{C3}.
  1733. This also works for relative references, and for hline references.
  1734. @kindex M-S-@key{up}
  1735. @kindex M-S-@key{down}
  1736. @item M-S-@key{up}/@key{down}
  1737. Move the test line for column formulas in the Org buffer up and
  1738. down.
  1739. @kindex M-@key{up}
  1740. @kindex M-@key{down}
  1741. @item M-@key{up}/@key{down}
  1742. Scroll the window displaying the table.
  1743. @kindex C-c @}
  1744. @item C-c @}
  1745. Turn the coordinate grid in the table on and off.
  1746. @end table
  1747. @end table
  1748. Making a table field blank does not remove the formula associated with
  1749. the field, because that is stored in a different line (the @samp{TBLFM}
  1750. line) - during the next recalculation the field will be filled again.
  1751. To remove a formula from a field, you have to give an empty reply when
  1752. prompted for the formula, or to edit the @samp{#+TBLFM} line.
  1753. @kindex C-c C-c
  1754. You may edit the @samp{#+TBLFM} directly and re-apply the changed
  1755. equations with @kbd{C-c C-c} in that line, or with the normal
  1756. recalculation commands in the table.
  1757. @subsubheading Debugging formulas
  1758. @cindex formula debugging
  1759. @cindex debugging, of table formulas
  1760. When the evaluation of a formula leads to an error, the field content
  1761. becomes the string @samp{#ERROR}. If you would like see what is going
  1762. on during variable substitution and calculation in order to find a bug,
  1763. turn on formula debugging in the @code{Tbl} menu and repeat the
  1764. calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
  1765. field. Detailed information will be displayed.
  1766. @node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
  1767. @subsection Updating the table
  1768. @cindex recomputing table fields
  1769. @cindex updating, table
  1770. Recalculation of a table is normally not automatic, but needs to be
  1771. triggered by a command. See @ref{Advanced features} for a way to make
  1772. recalculation at least semi-automatically.
  1773. In order to recalculate a line of a table or the entire table, use the
  1774. following commands:
  1775. @table @kbd
  1776. @kindex C-c *
  1777. @item C-c *
  1778. Recalculate the current row by first applying the stored column formulas
  1779. from left to right, and all field formulas in the current row.
  1780. @c
  1781. @kindex C-u C-c *
  1782. @item C-u C-c *
  1783. @kindex C-u C-c C-c
  1784. @itemx C-u C-c C-c
  1785. Recompute the entire table, line by line. Any lines before the first
  1786. hline are left alone, assuming that these are part of the table header.
  1787. @c
  1788. @kindex C-u C-u C-c *
  1789. @kindex C-u C-u C-c C-c
  1790. @item C-u C-u C-c *
  1791. @itemx C-u C-u C-c C-c
  1792. Iterate the table by recomputing it until no further changes occur.
  1793. This may be necessary if some computed fields use the value of other
  1794. fields that are computed @i{later} in the calculation sequence.
  1795. @end table
  1796. @node Advanced features, , Updating the table, The spreadsheet
  1797. @subsection Advanced features
  1798. If you want the recalculation of fields to happen automatically, or if
  1799. you want to be able to assign @i{names} to fields and columns, you need
  1800. to reserve the first column of the table for special marking characters.
  1801. @table @kbd
  1802. @kindex C-#
  1803. @item C-#
  1804. Rotate the calculation mark in first column through the states @samp{},
  1805. @samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
  1806. is discussed below. When there is an active region, change all marks in
  1807. the region.
  1808. @end table
  1809. Here is an example of a table that collects exam results of students and
  1810. makes use of these features:
  1811. @example
  1812. @group
  1813. |---+---------+--------+--------+--------+-------+------|
  1814. | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
  1815. |---+---------+--------+--------+--------+-------+------|
  1816. | ! | | P1 | P2 | P3 | Tot | |
  1817. | # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
  1818. | ^ | | m1 | m2 | m3 | mt | |
  1819. |---+---------+--------+--------+--------+-------+------|
  1820. | # | Peter | 10 | 8 | 23 | 41 | 8.2 |
  1821. | # | Sara | 6 | 14 | 19 | 39 | 7.8 |
  1822. | # | Sam | 2 | 4 | 3 | 9 | 1.8 |
  1823. |---+---------+--------+--------+--------+-------+------|
  1824. | | Average | | | | 29.7 | |
  1825. | ^ | | | | | at | |
  1826. | $ | max=50 | | | | | |
  1827. |---+---------+--------+--------+--------+-------+------|
  1828. #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
  1829. @end group
  1830. @end example
  1831. @noindent @b{Important}: Please note that for these special tables,
  1832. recalculating the table with @kbd{C-u C-c *} will only affect rows that
  1833. are marked @samp{#} or @samp{*}, and fields that have a formula assigned
  1834. to the field itself. The column formulas are not applied in rows with
  1835. empty first field.
  1836. @cindex marking characters, tables
  1837. The marking characters have the following meaning:
  1838. @table @samp
  1839. @item !
  1840. The fields in this line define names for the columns, so that you may
  1841. refer to a column as @samp{$Tot} instead of @samp{$6}.
  1842. @item ^
  1843. This row defines names for the fields @emph{above} the row. With such
  1844. a definition, any formula in the table may use @samp{$m1} to refer to
  1845. the value @samp{10}. Also, if you assign a formula to a names field, it
  1846. will be stored as @samp{$name=...}.
  1847. @item _
  1848. Similar to @samp{^}, but defines names for the fields in the row
  1849. @emph{below}.
  1850. @item $
  1851. Fields in this row can define @emph{parameters} for formulas. For
  1852. example, if a field in a @samp{$} row contains @samp{max=50}, then
  1853. formulas in this table can refer to the value 50 using @samp{$max}.
  1854. Parameters work exactly like constants, only that they can be defined on
  1855. a per-table basis.
  1856. @item #
  1857. Fields in this row are automatically recalculated when pressing
  1858. @key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
  1859. is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
  1860. lines will be left alone by this command.
  1861. @item *
  1862. Selects this line for global recalculation with @kbd{C-u C-c *}, but
  1863. not for automatic recalculation. Use this when automatic
  1864. recalculation slows down editing too much.
  1865. @item
  1866. Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
  1867. All lines that should be recalculated should be marked with @samp{#}
  1868. or @samp{*}.
  1869. @item /
  1870. Do not export this line. Useful for lines that contain the narrowing
  1871. @samp{<N>} markers.
  1872. @end table
  1873. Finally, just to whet your appetite on what can be done with the
  1874. fantastic @file{calc} package, here is a table that computes the Taylor
  1875. series of degree @code{n} at location @code{x} for a couple of
  1876. functions.
  1877. @example
  1878. @group
  1879. |---+-------------+---+-----+--------------------------------------|
  1880. | | Func | n | x | Result |
  1881. |---+-------------+---+-----+--------------------------------------|
  1882. | # | exp(x) | 1 | x | 1 + x |
  1883. | # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
  1884. | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
  1885. | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
  1886. | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
  1887. | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
  1888. |---+-------------+---+-----+--------------------------------------|
  1889. #+TBLFM: $5=taylor($2,$4,$3);n3
  1890. @end group
  1891. @end example
  1892. @node Hyperlinks, TODO Items, Tables, Top
  1893. @chapter Hyperlinks
  1894. @cindex hyperlinks
  1895. Like HTML, Org provides links inside a file, external links to
  1896. other files, Usenet articles, emails, and much more.
  1897. @menu
  1898. * Link format:: How links in Org are formatted
  1899. * Internal links:: Links to other places in the current file
  1900. * External links:: URL-like links to the world
  1901. * Handling links:: Creating, inserting and following
  1902. * Using links outside Org:: Linking from my C source code?
  1903. * Link abbreviations:: Shortcuts for writing complex links
  1904. * Search options:: Linking to a specific location
  1905. * Custom searches:: When the default search is not enough
  1906. @end menu
  1907. @node Link format, Internal links, Hyperlinks, Hyperlinks
  1908. @section Link format
  1909. @cindex link format
  1910. @cindex format, of links
  1911. Org will recognize plain URL-like links and activate them as
  1912. clickable links. The general link format, however, looks like this:
  1913. @example
  1914. [[link][description]] @r{or alternatively} [[link]]
  1915. @end example
  1916. Once a link in the buffer is complete (all brackets present), Org
  1917. will change the display so that @samp{description} is displayed instead
  1918. of @samp{[[link][description]]} and @samp{link} is displayed instead of
  1919. @samp{[[link]]}. Links will be highlighted in the face @code{org-link},
  1920. which by default is an underlined face. You can directly edit the
  1921. visible part of a link. Note that this can be either the @samp{link}
  1922. part (if there is no description) or the @samp{description} part. To
  1923. edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
  1924. cursor on the link.
  1925. If you place the cursor at the beginning or just behind the end of the
  1926. displayed text and press @key{BACKSPACE}, you will remove the
  1927. (invisible) bracket at that location. This makes the link incomplete
  1928. and the internals are again displayed as plain text. Inserting the
  1929. missing bracket hides the link internals again. To show the
  1930. internal structure of all links, use the menu entry
  1931. @code{Org->Hyperlinks->Literal links}.
  1932. @node Internal links, External links, Link format, Hyperlinks
  1933. @section Internal links
  1934. @cindex internal links
  1935. @cindex links, internal
  1936. @cindex targets, for links
  1937. If the link does not look like a URL, it is considered to be internal in
  1938. the current file. Links such as @samp{[[My Target]]} or @samp{[[My
  1939. Target][Find my target]]} lead to a text search in the current file.
  1940. The link can be followed with @kbd{C-c C-o} when the cursor is on the
  1941. link, or with a mouse click (@pxref{Handling links}). The preferred
  1942. match for such a link is a dedicated target: the same string in double
  1943. angular brackets. Targets may be located anywhere; sometimes it is
  1944. convenient to put them into a comment line. For example
  1945. @example
  1946. # <<My Target>>
  1947. @end example
  1948. @noindent In HTML export (@pxref{HTML export}), such targets will become
  1949. named anchors for direct access through @samp{http} links@footnote{Note
  1950. that text before the first headline is usually not exported, so the
  1951. first such target should be after the first headline.}.
  1952. If no dedicated target exists, Org will search for the words in the
  1953. link. In the above example the search would be for @samp{my target}.
  1954. Links starting with a star like @samp{*My Target} restrict the search to
  1955. headlines. When searching, Org mode will first try an exact match, but
  1956. then move on to more and more lenient searches. For example, the link
  1957. @samp{[[*My Targets]]} will find any of the following:
  1958. @example
  1959. ** My targets
  1960. ** TODO my targets are bright
  1961. ** my 20 targets are
  1962. @end example
  1963. To insert a link targeting a headline, in-buffer completion can be used.
  1964. Just type a star followed by a few optional letters into the buffer and
  1965. press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
  1966. offered as completions. @xref{Handling links}, for more commands
  1967. creating links.
  1968. Following a link pushes a mark onto Org's own mark ring. You can
  1969. return to the previous position with @kbd{C-c &}. Using this command
  1970. several times in direct succession goes back to positions recorded
  1971. earlier.
  1972. @menu
  1973. * Radio targets:: Make targets trigger links in plain text
  1974. @end menu
  1975. @node Radio targets, , Internal links, Internal links
  1976. @subsection Radio targets
  1977. @cindex radio targets
  1978. @cindex targets, radio
  1979. @cindex links, radio targets
  1980. Org can automatically turn any occurrences of certain target names
  1981. in normal text into a link. So without explicitly creating a link, the
  1982. text connects to the target radioing its position. Radio targets are
  1983. enclosed by triple angular brackets. For example, a target @samp{<<<My
  1984. Target>>>} causes each occurrence of @samp{my target} in normal text to
  1985. become activated as a link. The Org file is scanned automatically
  1986. for radio targets only when the file is first loaded into Emacs. To
  1987. update the target list during editing, press @kbd{C-c C-c} with the
  1988. cursor on or at a target.
  1989. @node External links, Handling links, Internal links, Hyperlinks
  1990. @section External links
  1991. @cindex links, external
  1992. @cindex external links
  1993. @cindex links, external
  1994. @cindex Gnus links
  1995. @cindex BBDB links
  1996. @cindex IRC links
  1997. @cindex URL links
  1998. @cindex file links
  1999. @cindex VM links
  2000. @cindex RMAIL links
  2001. @cindex WANDERLUST links
  2002. @cindex MH-E links
  2003. @cindex USENET links
  2004. @cindex SHELL links
  2005. @cindex Info links
  2006. @cindex elisp links
  2007. Org supports links to files, websites, Usenet and email messages,
  2008. BBDB database entries and links to both IRC conversations and their
  2009. logs. External links are URL-like locators. They start with a short
  2010. identifying string followed by a colon. There can be no space after
  2011. the colon. The following list shows examples for each link type.
  2012. @example
  2013. http://www.astro.uva.nl/~dominik @r{on the web}
  2014. file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
  2015. file:papers/last.pdf @r{file, relative path}
  2016. news:comp.emacs @r{Usenet link}
  2017. mailto:adent@@galaxy.net @r{Mail link}
  2018. vm:folder @r{VM folder link}
  2019. vm:folder#id @r{VM message link}
  2020. vm://myself@@some.where.org/folder#id @r{VM on remote machine}
  2021. wl:folder @r{WANDERLUST folder link}
  2022. wl:folder#id @r{WANDERLUST message link}
  2023. mhe:folder @r{MH-E folder link}
  2024. mhe:folder#id @r{MH-E message link}
  2025. rmail:folder @r{RMAIL folder link}
  2026. rmail:folder#id @r{RMAIL message link}
  2027. gnus:group @r{Gnus group link}
  2028. gnus:group#id @r{Gnus article link}
  2029. bbdb:Richard Stallman @r{BBDB link}
  2030. irc:/irc.com/#emacs/bob @r{IRC link}
  2031. shell:ls *.org @r{A shell command}
  2032. elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
  2033. @end example
  2034. A link should be enclosed in double brackets and may contain a
  2035. descriptive text to be displayed instead of the URL (@pxref{Link
  2036. format}), for example:
  2037. @example
  2038. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  2039. @end example
  2040. @noindent
  2041. If the description is a file name or URL that points to an image, HTML
  2042. export (@pxref{HTML export}) will inline the image as a clickable
  2043. button. If there is no description at all and the link points to an
  2044. image,
  2045. that image will be inlined into the exported HTML file.
  2046. @cindex angular brackets, around links
  2047. @cindex plain text external links
  2048. Org also finds external links in the normal text and activates them
  2049. as links. If spaces must be part of the link (for example in
  2050. @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
  2051. about the end of the link, enclose them in angular brackets.
  2052. @node Handling links, Using links outside Org, External links, Hyperlinks
  2053. @section Handling links
  2054. @cindex links, handling
  2055. Org provides methods to create a link in the correct syntax, to
  2056. insert it into an Org file, and to follow the link.
  2057. @table @kbd
  2058. @kindex C-c l
  2059. @cindex storing links
  2060. @item C-c l
  2061. Store a link to the current location. This is a @emph{global} command
  2062. which can be used in any buffer to create a link. The link will be
  2063. stored for later insertion into an Org buffer (see below). For
  2064. Org files, if there is a @samp{<<target>>} at the cursor, the
  2065. link points to the target. Otherwise it points to the current
  2066. headline. For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the
  2067. link will indicate the current article/entry. For W3 and W3M buffers,
  2068. the link goes to the current URL. For IRC links, if you set the
  2069. variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will
  2070. store a @samp{file:/} style link to the relevant point in the logs for
  2071. the current conversation. Otherwise an @samp{irc:/} style link to the
  2072. user/channel/server under the point will be stored. For any other
  2073. files, the link will point to the file, with a search string
  2074. (@pxref{Search options}) pointing to the contents of the current line.
  2075. If there is an active region, the selected words will form the basis
  2076. of the search string. If the automatically created link is not
  2077. working correctly or accurately enough, you can write custom functions
  2078. to select the search string and to do the search for particular file
  2079. types - see @ref{Custom searches}. The key binding @kbd{C-c l} is
  2080. only a suggestion - see @ref{Installation}.
  2081. @c
  2082. @kindex C-c C-l
  2083. @cindex link completion
  2084. @cindex completion, of links
  2085. @cindex inserting links
  2086. @item C-c C-l
  2087. Insert a link. This prompts for a link to be inserted into the buffer. You
  2088. can just type a link, using text for an internal link, or one of the link
  2089. type prefixes mentioned in the examples above. All links stored during the
  2090. current session are part of the history for this prompt, so you can access
  2091. them with @key{up} and @key{down} (or @kbd{M-p/n}). Completion, on the other
  2092. hand, will help you to insert valid link prefixes like @samp{http:} or
  2093. @samp{ftp:}, including the prefixes defined through link abbreviations
  2094. (@pxref{Link abbreviations}). The link will be inserted into the
  2095. buffer@footnote{After insertion of a stored link, the link will be removed
  2096. from the list of stored links. To keep it in the list later use, use a
  2097. triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or configure the option
  2098. @code{org-keep-stored-link-after-insertion}.}, along with a descriptive text.
  2099. If some text was selected when this command is called, the selected text
  2100. becomes the default description.@* Note that you don't have to use this
  2101. command to insert a link. Links in Org are plain text, and you can type
  2102. or paste them straight into the buffer. By using this command, the links are
  2103. automatically enclosed in double brackets, and you will be asked for the
  2104. optional descriptive text.
  2105. @c
  2106. @c If the link is a @samp{file:} link and
  2107. @c the linked file is located in the same directory as the current file or
  2108. @c a subdirectory of it, the path of the file will be inserted relative to
  2109. @c the current directory.
  2110. @c
  2111. @kindex C-u C-c C-l
  2112. @cindex file name completion
  2113. @cindex completion, of file names
  2114. @item C-u C-c C-l
  2115. When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
  2116. a file will be inserted and you may use file name completion to select
  2117. the name of the file. The path to the file is inserted relative to the
  2118. directory of the current org file, if the linked file is in the current
  2119. directory or in a sub-directory of it, or if the path is written relative
  2120. to the current directory using @samp{../}. Otherwise an absolute path
  2121. is used, if possible with @samp{~/} for your home directory. You can
  2122. force an absolute path with two @kbd{C-u} prefixes.
  2123. @c
  2124. @item C-c C-l @r{(with cursor on existing link)}
  2125. When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
  2126. link and description parts of the link.
  2127. @c
  2128. @cindex following links
  2129. @kindex C-c C-o
  2130. @item C-c C-o
  2131. Open link at point. This will launch a web browser for URLs (using
  2132. @command{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB
  2133. for the corresponding links, and execute the command in a shell link.
  2134. When the cursor is on an internal link, this commands runs the
  2135. corresponding search. When the cursor is on a TAG list in a headline,
  2136. it creates the corresponding TAGS view. If the cursor is on a time
  2137. stamp, it compiles the agenda for that date. Furthermore, it will visit
  2138. text and remote files in @samp{file:} links with Emacs and select a
  2139. suitable application for local non-text files. Classification of files
  2140. is based on file extension only. See option @code{org-file-apps}. If
  2141. you want to override the default application and visit the file with
  2142. Emacs, use a @kbd{C-u} prefix.
  2143. @c
  2144. @kindex mouse-2
  2145. @kindex mouse-1
  2146. @item mouse-2
  2147. @itemx mouse-1
  2148. On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
  2149. would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
  2150. @c
  2151. @kindex mouse-3
  2152. @item mouse-3
  2153. Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
  2154. internal links to be displayed in another window@footnote{See the
  2155. variable @code{org-display-internal-link-with-indirect-buffer}}.
  2156. @c
  2157. @cindex mark ring
  2158. @kindex C-c %
  2159. @item C-c %
  2160. Push the current position onto the mark ring, to be able to return
  2161. easily. Commands following an internal link do this automatically.
  2162. @c
  2163. @cindex links, returning to
  2164. @kindex C-c &
  2165. @item C-c &
  2166. Jump back to a recorded position. A position is recorded by the
  2167. commands following internal links, and by @kbd{C-c %}. Using this
  2168. command several times in direct succession moves through a ring of
  2169. previously recorded positions.
  2170. @c
  2171. @kindex C-c C-x C-n
  2172. @kindex C-c C-x C-p
  2173. @cindex links, finding next/previous
  2174. @item C-c C-x C-n
  2175. @itemx C-c C-x C-p
  2176. Move forward/backward to the next link in the buffer. At the limit of
  2177. the buffer, the search fails once, and then wraps around. The key
  2178. bindings for this are really too long, you might want to bind this also
  2179. to @kbd{C-n} and @kbd{C-p}
  2180. @lisp
  2181. (add-hook 'org-load-hook
  2182. (lambda ()
  2183. (define-key 'org-mode-map "\C-n" 'org-next-link)
  2184. (define-key 'org-mode-map "\C-p" 'org-previous-link)))
  2185. @end lisp
  2186. @end table
  2187. @node Using links outside Org, Link abbreviations, Handling links, Hyperlinks
  2188. @section Using links outside Org
  2189. You can insert and follow links that have Org syntax not only in
  2190. Org, but in any Emacs buffer. For this, you should create two
  2191. global commands, like this (please select suitable global keys
  2192. yourself):
  2193. @lisp
  2194. (global-set-key "\C-c L" 'org-insert-link-global)
  2195. (global-set-key "\C-c o" 'org-open-at-point-global)
  2196. @end lisp
  2197. @node Link abbreviations, Search options, Using links outside Org, Hyperlinks
  2198. @section Link abbreviations
  2199. @cindex link abbreviations
  2200. @cindex abbreviation, links
  2201. Long URLs can be cumbersome to type, and often many similar links are
  2202. needed in a document. For this you can use link abbreviations. An
  2203. abbreviated link looks like this
  2204. @example
  2205. [[linkword:tag][description]]
  2206. @end example
  2207. @noindent
  2208. where the tag is optional. Such abbreviations are resolved according to
  2209. the information in the variable @code{org-link-abbrev-alist} that
  2210. relates the linkwords to replacement text. Here is an example:
  2211. @lisp
  2212. @group
  2213. (setq org-link-abbrev-alist
  2214. '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
  2215. ("google" . "http://www.google.com/search?q=")
  2216. ("ads" . "http://adsabs.harvard.edu/cgi-bin/
  2217. nph-abs_connect?author=%s&db_key=AST")))
  2218. @end group
  2219. @end lisp
  2220. If the replacement text contains the string @samp{%s}, it will be
  2221. replaced with the tag. Otherwise the tag will be appended to the string
  2222. in order to create the link. You may also specify a function that will
  2223. be called with the tag as the only argument to create the link.
  2224. With the above setting, you could link to a specific bug with
  2225. @code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
  2226. @code{[[google:OrgMode]]} and find out what the Org author is
  2227. doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
  2228. If you need special abbreviations just for a single Org buffer, you
  2229. can define them in the file with
  2230. @example
  2231. #+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
  2232. #+LINK: google http://www.google.com/search?q=%s
  2233. @end example
  2234. @noindent
  2235. In-buffer completion @pxref{Completion} can be used after @samp{[} to
  2236. complete link abbreviations.
  2237. @node Search options, Custom searches, Link abbreviations, Hyperlinks
  2238. @section Search options in file links
  2239. @cindex search option in file links
  2240. @cindex file links, searching
  2241. File links can contain additional information to make Emacs jump to a
  2242. particular location in the file when following a link. This can be a
  2243. line number or a search option after a double@footnote{For backward
  2244. compatibility, line numbers can also follow a single colon.} colon. For
  2245. example, when the command @kbd{C-c l} creates a link (@pxref{Handling
  2246. links}) to a file, it encodes the words in the current line as a search
  2247. string that can be used to find this line back later when following the
  2248. link with @kbd{C-c C-o}.
  2249. Here is the syntax of the different ways to attach a search to a file
  2250. link, together with an explanation:
  2251. @example
  2252. [[file:~/code/main.c::255]]
  2253. [[file:~/xx.org::My Target]]
  2254. [[file:~/xx.org::*My Target]]
  2255. [[file:~/xx.org::/regexp/]]
  2256. @end example
  2257. @table @code
  2258. @item 255
  2259. Jump to line 255.
  2260. @item My Target
  2261. Search for a link target @samp{<<My Target>>}, or do a text search for
  2262. @samp{my target}, similar to the search in internal links, see
  2263. @ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
  2264. link will become an HTML reference to the corresponding named anchor in
  2265. the linked file.
  2266. @item *My Target
  2267. In an Org file, restrict search to headlines.
  2268. @item /regexp/
  2269. Do a regular expression search for @code{regexp}. This uses the Emacs
  2270. command @code{occur} to list all matches in a separate window. If the
  2271. target file is in Org mode, @code{org-occur} is used to create a
  2272. sparse tree with the matches.
  2273. @c If the target file is a directory,
  2274. @c @code{grep} will be used to search all files in the directory.
  2275. @end table
  2276. As a degenerate case, a file link with an empty file name can be used
  2277. to search the current file. For example, @code{[[file:::find me]]} does
  2278. a search for @samp{find me} in the current file, just as
  2279. @samp{[[find me]]} would.
  2280. @node Custom searches, , Search options, Hyperlinks
  2281. @section Custom Searches
  2282. @cindex custom search strings
  2283. @cindex search strings, custom
  2284. The default mechanism for creating search strings and for doing the
  2285. actual search related to a file link may not work correctly in all
  2286. cases. For example, BibTeX database files have many entries like
  2287. @samp{year="1993"} which would not result in good search strings,
  2288. because the only unique identification for a BibTeX entry is the
  2289. citation key.
  2290. If you come across such a problem, you can write custom functions to set
  2291. the right search string for a particular file type, and to do the search
  2292. for the string in the file. Using @code{add-hook}, these functions need
  2293. to be added to the hook variables
  2294. @code{org-create-file-search-functions} and
  2295. @code{org-execute-file-search-functions}. See the docstring for these
  2296. variables for more information. Org actually uses this mechanism
  2297. for Bib@TeX{} database files, and you can use the corresponding code as
  2298. an implementation example. Search for @samp{BibTeX links} in the source
  2299. file.
  2300. @node TODO Items, Tags, Hyperlinks, Top
  2301. @chapter TODO Items
  2302. @cindex TODO items
  2303. Org mode does not maintain TODO lists as separate documents. Instead,
  2304. TODO items are an integral part of the notes file, because TODO items
  2305. usually come up while taking notes! With Org mode, simply mark any
  2306. entry in a tree as being a TODO item. In this way, information is not
  2307. duplicated, and the entire context from which the TODO item emerged is
  2308. always present.
  2309. Of course, this technique for managing TODO items scatters them
  2310. throughout your notes file. Org mode compensates for this by providing
  2311. methods to give you an overview of all the things that you have to do.
  2312. @menu
  2313. * TODO basics:: Marking and displaying TODO entries
  2314. * TODO extensions:: Workflow and assignments
  2315. * Progress logging:: Dates and notes for progress
  2316. * Priorities:: Some things are more important than others
  2317. * Breaking down tasks:: Splitting a task into manageable pieces
  2318. * Checkboxes:: Tick-off lists
  2319. @end menu
  2320. @node TODO basics, TODO extensions, TODO Items, TODO Items
  2321. @section Basic TODO functionality
  2322. Any headline becomes a TODO item when it starts with the word
  2323. @samp{TODO}, for example:
  2324. @example
  2325. *** TODO Write letter to Sam Fortune
  2326. @end example
  2327. @noindent
  2328. The most important commands to work with TODO entries are:
  2329. @table @kbd
  2330. @kindex C-c C-t
  2331. @cindex cycling, of TODO states
  2332. @item C-c C-t
  2333. Rotate the TODO state of the current item among
  2334. @example
  2335. ,-> (unmarked) -> TODO -> DONE --.
  2336. '--------------------------------'
  2337. @end example
  2338. The same rotation can also be done ``remotely'' from the timeline and
  2339. agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
  2340. @kindex C-u C-c C-t
  2341. @item C-u C-c C-t
  2342. Select a specific keyword using completion or (if it has been set up)
  2343. the fast selection interface. For the latter, you need to assign keys
  2344. to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for
  2345. more information.
  2346. @kindex S-@key{right}
  2347. @kindex S-@key{left}
  2348. @item S-@key{right}
  2349. @itemx S-@key{left}
  2350. Select the following/preceding TODO state, similar to cycling. Useful
  2351. mostly if more than two TODO states are possible (@pxref{TODO
  2352. extensions}).
  2353. @kindex C-c C-v
  2354. @kindex C-c / t
  2355. @cindex sparse tree, for TODO
  2356. @item C-c C-v
  2357. @itemx C-c / t
  2358. View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds
  2359. the entire buffer, but shows all TODO items and the headings hierarchy
  2360. above them. With a prefix argument, search for a specific TODO. You will be
  2361. prompted for the keyword, and you can also give a list of keywords like
  2362. @code{KWD1|KWD2|...}. With numeric prefix argument N, show the tree for the
  2363. Nth keyword in the variable @code{org-todo-keywords}. With two prefix
  2364. arguments, find all TODO and DONE entries.
  2365. @kindex C-c a t
  2366. @item C-c a t
  2367. Show the global TODO list. Collects the TODO items from all agenda
  2368. files (@pxref{Agenda Views}) into a single buffer. The new buffer will
  2369. be in @code{agenda-mode}, which provides commands to examine and
  2370. manipulate the TODO entries from the new buffer (@pxref{Agenda
  2371. commands}). @xref{Global TODO list}, for more information.
  2372. @kindex S-M-@key{RET}
  2373. @item S-M-@key{RET}
  2374. Insert a new TODO entry below the current one.
  2375. @end table
  2376. @node TODO extensions, Progress logging, TODO basics, TODO Items
  2377. @section Extended use of TODO keywords
  2378. @cindex extended TODO keywords
  2379. By default, marked TODO entries have one of only two states: TODO and
  2380. DONE. Org mode allows you to classify TODO items in more complex ways
  2381. with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With
  2382. special setup, the TODO keyword system can work differently in different
  2383. files.
  2384. Note that @i{tags} are another way to classify headlines in general and
  2385. TODO items in particular (@pxref{Tags}).
  2386. @menu
  2387. * Workflow states:: From TODO to DONE in steps
  2388. * TODO types:: I do this, Fred does the rest
  2389. * Multiple sets in one file:: Mixing it all, and still finding your way
  2390. * Fast access to TODO states:: Single letter selection of a state
  2391. * Per-file keywords:: Different files, different requirements
  2392. * Faces for TODO keywords:: Highlighting states
  2393. @end menu
  2394. @node Workflow states, TODO types, TODO extensions, TODO extensions
  2395. @subsection TODO keywords as workflow states
  2396. @cindex TODO workflow
  2397. @cindex workflow states as TODO keywords
  2398. You can use TODO keywords to indicate different @emph{sequential} states
  2399. in the process of working on an item, for example@footnote{Changing
  2400. this variable only becomes effective after restarting Org mode in a
  2401. buffer.}:
  2402. @lisp
  2403. (setq org-todo-keywords
  2404. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  2405. @end lisp
  2406. The vertical bar separates the TODO keywords (states that @emph{need
  2407. action}) from the DONE states (which need @emph{no further action}. If
  2408. you don't provide the separator bar, the last state is used as the DONE
  2409. state.
  2410. @cindex completion, of TODO keywords
  2411. With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO
  2412. to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may
  2413. also use a numeric prefix argument to quickly select a specific state. For
  2414. example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY.
  2415. Or you can use @kbd{S-left} to go backward through the sequence. If you
  2416. define many keywords, you can use in-buffer completion
  2417. (@pxref{Completion}) or even a special one-key selection scheme
  2418. (@pxref{Fast access to TODO states}) to insert these words into the
  2419. buffer. Changing a TODO state can be logged with a timestamp, see
  2420. @ref{Tracking TODO state changes} for more information.
  2421. @node TODO types, Multiple sets in one file, Workflow states, TODO extensions
  2422. @subsection TODO keywords as types
  2423. @cindex TODO types
  2424. @cindex names as TODO keywords
  2425. @cindex types as TODO keywords
  2426. The second possibility is to use TODO keywords to indicate different
  2427. @emph{types} of action items. For example, you might want to indicate
  2428. that items are for ``work'' or ``home''. Or, when you work with several
  2429. people on a single project, you might want to assign action items
  2430. directly to persons, by using their names as TODO keywords. This would
  2431. be set up like this:
  2432. @lisp
  2433. (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE")))
  2434. @end lisp
  2435. In this case, different keywords do not indicate a sequence, but rather
  2436. different types. So the normal work flow would be to assign a task to a
  2437. person, and later to mark it DONE. Org mode supports this style by adapting
  2438. the workings of the command @kbd{C-c C-t}@footnote{This is also true for the
  2439. @kbd{t} command in the timeline and agenda buffers.}. When used several
  2440. times in succession, it will still cycle through all names, in order to first
  2441. select the right type for a task. But when you return to the item after some
  2442. time and execute @kbd{C-c C-t} again, it will switch from any name directly
  2443. to DONE. Use prefix arguments or completion to quickly select a specific
  2444. name. You can also review the items of a specific TODO type in a sparse tree
  2445. by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things
  2446. Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items
  2447. from all agenda files into a single buffer, you would use the numeric prefix
  2448. argument as well when creating the global TODO list: @kbd{C-3 C-c t}.
  2449. @node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions
  2450. @subsection Multiple keyword sets in one file
  2451. @cindex TODO keyword sets
  2452. Sometimes you may want to use different sets of TODO keywords in
  2453. parallel. For example, you may want to have the basic
  2454. @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a
  2455. separate state indicating that an item has been canceled (so it is not
  2456. DONE, but also does not require action). Your setup would then look
  2457. like this:
  2458. @lisp
  2459. (setq org-todo-keywords
  2460. '((sequence "TODO" "|" "DONE")
  2461. (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED")
  2462. (sequence "|" "CANCELED")))
  2463. @end lisp
  2464. The keywords should all be different, this helps Org mode to keep track
  2465. of which subsequence should be used for a given entry. In this setup,
  2466. @kbd{C-c C-t} only operates within a subsequence, so it switches from
  2467. @code{DONE} to (nothing) to @code{TODO}, and from @code{FIXED} to
  2468. (nothing) to @code{REPORT}. Therefore you need a mechanism to initially
  2469. select the correct sequence. Besides the obvious ways like typing a
  2470. keyword or using completion, you may also apply the following commands:
  2471. @table @kbd
  2472. @kindex C-S-@key{right}
  2473. @kindex C-S-@key{left}
  2474. @item C-S-@key{right}
  2475. @itemx C-S-@key{left}
  2476. These keys jump from one TODO subset to the next. In the above example,
  2477. @kbd{C-S-@key{right}} would jump from @code{TODO} or @code{DONE} to
  2478. @code{REPORT}, and any of the words in the second row to @code{CANCELED}.
  2479. @kindex S-@key{right}
  2480. @kindex S-@key{left}
  2481. @item S-@key{right}
  2482. @itemx S-@key{left}
  2483. @kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through
  2484. @emph{all} keywords from all sets, so for example @kbd{S-@key{<right>}}
  2485. would switch from @code{DONE} to @code{REPORT} in the example above.
  2486. @end table
  2487. @node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions
  2488. @subsection Fast access to TODO states
  2489. If you would like to quickly change an entry to an arbitrary TODO state
  2490. instead of cycling through the states, you can set up keys for
  2491. single-letter access to the states. This is done by adding the section
  2492. key after each keyword, in parenthesis. For example:
  2493. @lisp
  2494. (setq org-todo-keywords
  2495. '((sequence "TODO(t)" "|" "DONE(d)")
  2496. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")
  2497. (sequence "|" "CANCELED(c)")))
  2498. @end lisp
  2499. If you then press @code{C-u C-c C-t} followed by the selection key, the
  2500. entry will be switched to this state. @key{SPC} can be used to remove
  2501. any TODO keyword from an entry. Should you like this way of selecting
  2502. TODO states a lot, you might want to set the variable
  2503. @code{org-use-fast-todo-selection} to @code{t} and make this behavior
  2504. the default. Check also the variable
  2505. @code{org-fast-tag-selection-include-todo}, it allows to change the TODO
  2506. state through the tags interface (@pxref{Setting tags}), in case you
  2507. like to mingle the two concepts.
  2508. @node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions
  2509. @subsection Setting up keywords for individual files
  2510. @cindex keyword options
  2511. @cindex per-file keywords
  2512. It can be very useful to use different aspects of the TODO mechanism in
  2513. different files. For file-local settings, you need to add special lines
  2514. to the file which set the keywords and interpretation for that file
  2515. only. For example, to set one of the two examples discussed above, you
  2516. need one of the following lines, starting in column zero anywhere in the
  2517. file:
  2518. @example
  2519. #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED
  2520. @end example
  2521. or
  2522. @example
  2523. #+TYP_TODO: Fred Sara Lucy Mike | DONE
  2524. @end example
  2525. A setup for using several sets in parallel would be:
  2526. @example
  2527. #+SEQ_TODO: TODO | DONE
  2528. #+SEQ_TODO: REPORT BUG KNOWNCAUSE | FIXED
  2529. #+SEQ_TODO: | CANCELED
  2530. @end example
  2531. @cindex completion, of option keywords
  2532. @kindex M-@key{TAB}
  2533. @noindent To make sure you are using the correct keyword, type
  2534. @samp{#+} into the buffer and then use @kbd{M-@key{TAB}} completion.
  2535. @cindex DONE, final TODO keyword
  2536. Remember that the keywords after the vertical bar (or the last keyword
  2537. if no bar is there) must always mean that the item is DONE (although you
  2538. may use a different word). After changing one of these lines, use
  2539. @kbd{C-c C-c} with the cursor still in the line to make the changes
  2540. known to Org mode@footnote{Org mode parses these lines only when
  2541. Org mode is activated after visiting a file. @kbd{C-c C-c} with the
  2542. cursor in a line starting with @samp{#+} is simply restarting Org mode
  2543. for the current buffer.}.
  2544. @node Faces for TODO keywords, , Per-file keywords, TODO extensions
  2545. @subsection Faces for TODO keywords
  2546. @cindex faces, for TODO keywords
  2547. Org mode highlights TODO keywords with special faces: @code{org-todo}
  2548. for keywords indicating that an item still has to be acted upon, and
  2549. @code{org-done} for keywords indicating that an item is finished. If
  2550. you are using more than 2 different states, you might want to use
  2551. special faces for some of them. This can be done using the variable
  2552. @code{org-todo-keyword-faces}. For example:
  2553. @lisp
  2554. (setq org-todo-keyword-faces
  2555. '(("TODO" . org-warning)
  2556. ("DEFERRED" . shadow)
  2557. ("CANCELED" . (:foreground "blue" :weight bold))))
  2558. @end lisp
  2559. While using a list with face properties as shown for CANCELED
  2560. @emph{should} work, this does not aways seem to be the case. If
  2561. necessary, define a special face and use that.
  2562. @page
  2563. @node Progress logging, Priorities, TODO extensions, TODO Items
  2564. @section Progress logging
  2565. @cindex progress logging
  2566. @cindex logging, of progress
  2567. Org mode can automatically record a time stamp and possibly a note when
  2568. you mark a TODO item as DONE, or even each time you change the state of
  2569. a TODO item. This system is highly configurable, settings can be on a
  2570. per-keyword basis and can be localized to a file or even a subtree. For
  2571. information on how to clock working time for a task, see @ref{Clocking
  2572. work time}.
  2573. @menu
  2574. * Closing items:: When was this entry marked DONE?
  2575. * Tracking TODO state changes:: When did the status change?
  2576. @end menu
  2577. @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
  2578. @subsection Closing items
  2579. The most basic logging is to keep track of @emph{when} a certain TODO
  2580. item was finished. This is achieved with@footnote{The corresponding
  2581. in-buffer setting is: @code{#+STARTUP: logdone}}.
  2582. @lisp
  2583. (setq org-log-done 'time)
  2584. @end lisp
  2585. @noindent
  2586. Then each time you turn an entry from a TODO (not-done) state into any
  2587. of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted
  2588. just after the headline. If you turn the entry back into a TODO item
  2589. through further state cycling, that line will be removed again. If you
  2590. want to record a note along with the timestamp, use@footnote{The
  2591. corresponding in-buffer setting is: @code{#+STARTUP: lognotedone}}
  2592. @lisp
  2593. (setq org-log-done 'note)
  2594. @end lisp
  2595. @noindent
  2596. You will then be prompted for a note, and that note will be stored below
  2597. the entry with a @samp{Closing Note} heading.
  2598. In the timeline (@pxref{Timeline}) and in the agenda
  2599. (@pxref{Weekly/daily agenda}), you can then use the @kbd{l} key to
  2600. display the TODO items with a @samp{CLOSED} timestamp on each day,
  2601. giving you an overview of what has been done.
  2602. @node Tracking TODO state changes, , Closing items, Progress logging
  2603. @subsection Tracking TODO state changes
  2604. When TODO keywords are used as workflow states (@pxref{Workflow
  2605. states}), you might want to keep track of when a state change occurred
  2606. and maybe take a note about this change. Since it is normally too much
  2607. to record a note for every state, Org mode expects configuration on a
  2608. per-keyword basis for this. This is achieved by adding special markers
  2609. @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis
  2610. after each keyword. For example, with the setting
  2611. @lisp
  2612. (setq org-todo-keywords
  2613. '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)")))
  2614. @end lisp
  2615. @noindent
  2616. you not only define global TODO keywords and fast access keys, but also
  2617. request that a time is recorded when the entry is turned into
  2618. DONE@footnote{It is possible that Org mode will record two time stamps
  2619. when you are using both @code{org-log-done} and state change logging.
  2620. However, it will never prompt for two notes - if you have configured
  2621. both, the state change recording note will take precedence and cancel
  2622. the @samp{Closing Note}.}, and that a note is recorded when switching to
  2623. WAIT or CANCELED. The setting for WAIT is even more special: The
  2624. @samp{!} after the slash means that in addition to the note taken when
  2625. entering the state, a time stamp should be recorded when @i{leaving} the
  2626. WAIT state, if and only if the @i{target} state does not configure
  2627. logging for entering it. So it has no effect when switching from WAIT
  2628. to DONE, because DONE is configured to record a timestamp only. But
  2629. when switching from WAIT back to TODO, the @samp{/!} in the WAIT
  2630. setting now triggers a timestamp even though TODO has no logging
  2631. configured.
  2632. You can use the exact same syntax for setting logging preferences local
  2633. to a buffer:
  2634. @example
  2635. #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  2636. @end example
  2637. In order to define logging settings that are local to a subtree or a
  2638. single item, define a LOGGING property in this entry. Any non-empty
  2639. LOGGING property resets all logging settings to nil. You may then turn
  2640. on logging for this specific tree using STARTUP keywords like
  2641. @code{lognotedone} or @code{logrepeat}, as well as adding state specific
  2642. settings like @code{TODO(!)}. For example
  2643. @example
  2644. * TODO Log each state with only a time
  2645. :PROPERTIES:
  2646. :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!)
  2647. :END:
  2648. * TODO Only log when switching to WAIT, and when repeating
  2649. :PROPERTIES:
  2650. :LOGGING: WAIT(@@) logrepeat
  2651. :END:
  2652. * TODO No logging at all
  2653. :PROPERTIES:
  2654. :LOGGING: nil
  2655. :END:
  2656. @end example
  2657. @node Priorities, Breaking down tasks, Progress logging, TODO Items
  2658. @section Priorities
  2659. @cindex priorities
  2660. If you use Org mode extensively, you may end up enough TODO items that
  2661. it starts to make sense to prioritize them. Prioritizing can be done by
  2662. placing a @emph{priority cookie} into the headline of a TODO item, like
  2663. this
  2664. @example
  2665. *** TODO [#A] Write letter to Sam Fortune
  2666. @end example
  2667. @noindent
  2668. By default, Org mode supports three priorities: @samp{A}, @samp{B}, and
  2669. @samp{C}. @samp{A} is the highest priority. An entry without a cookie
  2670. is treated as priority @samp{B}. Priorities make a difference only in
  2671. the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have
  2672. no inherent meaning to Org mode.
  2673. Priorities can be attached to any outline tree entries; they do not need
  2674. to be TODO items.
  2675. @table @kbd
  2676. @kindex @kbd{C-c ,}
  2677. @item @kbd{C-c ,}
  2678. Set the priority of the current headline. The command prompts for a
  2679. priority character @samp{A}, @samp{B} or @samp{C}. When you press
  2680. @key{SPC} instead, the priority cookie is removed from the headline.
  2681. The priorities can also be changed ``remotely'' from the timeline and
  2682. agenda buffer with the @kbd{,} command (@pxref{Agenda commands}).
  2683. @c
  2684. @kindex S-@key{up}
  2685. @kindex S-@key{down}
  2686. @item S-@key{up}
  2687. @itemx S-@key{down}
  2688. Increase/decrease priority of current headline@footnote{See also the
  2689. option @code{org-priority-start-cycle-with-default'}.}. Note that these
  2690. keys are also used to modify time stamps (@pxref{Creating timestamps}).
  2691. Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}).
  2692. @end table
  2693. You can change the range of allowed priorities by setting the variables
  2694. @code{org-highest-priority}, @code{org-lowest-priority}, and
  2695. @code{org-default-priority}. For an individual buffer, you may set
  2696. these values (highest, lowest, default) like this (please make sure that
  2697. the highest priority is earlier in the alphabet than the lowest
  2698. priority):
  2699. @example
  2700. #+PRIORITIES: A C B
  2701. @end example
  2702. @node Breaking down tasks, Checkboxes, Priorities, TODO Items
  2703. @section Breaking tasks down into subtasks
  2704. @cindex tasks, breaking down
  2705. It is often advisable to break down large tasks into smaller, manageable
  2706. subtasks. You can do this by creating an outline tree below a TODO
  2707. item, with detailed subtasks on the tree@footnote{To keep subtasks out
  2708. of the global TODO list, see the
  2709. @code{org-agenda-todo-list-sublevels}.}. Another possibility is the use
  2710. of checkboxes to identify (a hierarchy of) a large number of subtasks
  2711. (@pxref{Checkboxes}).
  2712. @node Checkboxes, , Breaking down tasks, TODO Items
  2713. @section Checkboxes
  2714. @cindex checkboxes
  2715. Every item in a plain list (@pxref{Plain lists}) can be made into a
  2716. checkbox by starting it with the string @samp{[ ]}. This feature is
  2717. similar to TODO items (@pxref{TODO Items}), but is more lightweight.
  2718. Checkboxes are not included into the global TODO list, so they are often
  2719. great to split a task into a number of simple steps. Or you can use
  2720. them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or
  2721. use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}).
  2722. Here is an example of a checkbox list.
  2723. @example
  2724. * TODO Organize party [2/4]
  2725. - [-] call people [1/3]
  2726. - [ ] Peter
  2727. - [X] Sarah
  2728. - [ ] Sam
  2729. - [X] order food
  2730. - [ ] think about what music to play
  2731. - [X] talk to the neighbors
  2732. @end example
  2733. Checkboxes work hierarchically, so if a checkbox item has children that
  2734. are checkboxes, toggling one of the children checkboxes will make the
  2735. parent checkbox reflect if none, some, or all of the children are
  2736. checked.
  2737. @cindex statistics, for checkboxes
  2738. @cindex checkbox statistics
  2739. The @samp{[2/4]} and @samp{[1/3]} in the first and second line are
  2740. cookies indicating how many checkboxes present in this entry have been
  2741. checked off, and the total number of checkboxes are present. This can
  2742. give you an idea on how many checkboxes remain, even without opening a
  2743. folded entry. The cookies can be placed into a headline or into (the
  2744. first line of) a plain list item. Each cookie covers all checkboxes
  2745. structurally below the headline/item on which the cookie appear. You
  2746. have to insert the cookie yourself by typing either @samp{[/]} or
  2747. @samp{[%]}. With @samp{[/]} you get an @samp{n out of m} result, as in
  2748. the examples above. With @samp{[%]} you get information about the
  2749. percentage of checkboxes checked (in the above example, this would be
  2750. @samp{[50%]} and @samp{[33%]}, respectively).
  2751. @noindent The following commands work with checkboxes:
  2752. @table @kbd
  2753. @kindex C-c C-c
  2754. @item C-c C-c
  2755. Toggle checkbox at point. With a prefix argument, set it to @samp{[-]},
  2756. which is considered to be an intermediate state.
  2757. @kindex C-c C-x C-b
  2758. @item C-c C-x C-b
  2759. Toggle checkbox at point.
  2760. @itemize @minus
  2761. @item
  2762. If there is an active region, toggle the first checkbox in the region
  2763. and set all remaining boxes to the same status as the first. If you
  2764. want to toggle all boxes in the region independently, use a prefix
  2765. argument.
  2766. @item
  2767. If the cursor is in a headline, toggle checkboxes in the region between
  2768. this headline and the next (so @emph{not} the entire subtree).
  2769. @item
  2770. If there is no active region, just toggle the checkbox at point.
  2771. @end itemize
  2772. @kindex M-S-@key{RET}
  2773. @item M-S-@key{RET}
  2774. Insert a new item with a checkbox.
  2775. This works only if the cursor is already in a plain list item
  2776. (@pxref{Plain lists}).
  2777. @kindex C-c #
  2778. @item C-c #
  2779. Update the checkbox statistics in the current outline entry. When
  2780. called with a @kbd{C-u} prefix, update the entire file. Checkbox
  2781. statistic cookies are updated automatically if you toggle checkboxes
  2782. with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you
  2783. delete boxes or add/change them by hand, use this command to get things
  2784. back into synch. Or simply toggle any checkbox twice with @kbd{C-c C-c}.
  2785. @end table
  2786. @node Tags, Properties and Columns, TODO Items, Top
  2787. @chapter Tags
  2788. @cindex tags
  2789. @cindex headline tagging
  2790. @cindex matching, tags
  2791. @cindex sparse tree, tag based
  2792. An excellent way to implement labels and contexts for cross-correlating
  2793. information is to assign @i{tags} to headlines. Org mode has extensive
  2794. support for tags.
  2795. Every headline can contain a list of tags; they occur at the end of the
  2796. headline. Tags are normal words containing letters, numbers, @samp{_},
  2797. and @samp{@@}. Tags must be preceded and followed by a single colon,
  2798. e.g., @samp{:WORK:}. Several tags can be specified, as in
  2799. @samp{:work:URGENT:}.
  2800. @menu
  2801. * Tag inheritance:: Tags use the tree structure of the outline
  2802. * Setting tags:: How to assign tags to a headline
  2803. * Tag searches:: Searching for combinations of tags
  2804. @end menu
  2805. @node Tag inheritance, Setting tags, Tags, Tags
  2806. @section Tag inheritance
  2807. @cindex tag inheritance
  2808. @cindex inheritance, of tags
  2809. @cindex sublevels, inclusion into tags match
  2810. @i{Tags} make use of the hierarchical structure of outline trees. If a
  2811. heading has a certain tag, all subheadings will inherit the tag as
  2812. well. For example, in the list
  2813. @example
  2814. * Meeting with the French group :work:
  2815. ** Summary by Frank :boss:notes:
  2816. *** TODO Prepare slides for him :action:
  2817. @end example
  2818. @noindent
  2819. the final heading will have the tags @samp{:work:}, @samp{:boss:},
  2820. @samp{:notes:}, and @samp{:action:} even though the final heading is not
  2821. explicitly marked with those tags. When executing tag searches and
  2822. Org mode finds that a certain headline matches the search criterion, it
  2823. will not check any sublevel headline, assuming that these also match and
  2824. that the list of matches could become very long because of that. If you
  2825. do want the sublevels be tested and listed as well, you may set the
  2826. variable @code{org-tags-match-list-sublevels}. To limit tag inheritance
  2827. to specific tags, or to turn it off entirely, use the variable
  2828. @code{org-use-tag-inheritance}.
  2829. @node Setting tags, Tag searches, Tag inheritance, Tags
  2830. @section Setting tags
  2831. @cindex setting tags
  2832. @cindex tags, setting
  2833. @kindex M-@key{TAB}
  2834. Tags can simply be typed into the buffer at the end of a headline.
  2835. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  2836. also a special command for inserting tags:
  2837. @table @kbd
  2838. @kindex C-c C-c
  2839. @item C-c C-c
  2840. @cindex completion, of tags
  2841. Enter new tags for the current headline. Org mode will either offer
  2842. completion or a special single-key interface for setting tags, see
  2843. below. After pressing @key{RET}, the tags will be inserted and aligned
  2844. to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
  2845. tags in the current buffer will be aligned to that column, just to make
  2846. things look nice. TAGS are automatically realigned after promotion,
  2847. demotion, and TODO state changes (@pxref{TODO basics}).
  2848. @end table
  2849. Org will support tag insertion based on a @emph{list of tags}. By
  2850. default this list is constructed dynamically, containing all tags
  2851. currently used in the buffer. You may also globally specify a hard list
  2852. of tags with the variable @code{org-tag-alist}. Finally you can set
  2853. the default tags for a given file with lines like
  2854. @example
  2855. #+TAGS: @@work @@home @@tennisclub
  2856. #+TAGS: laptop car pc sailboat
  2857. @end example
  2858. If you have globally defined your preferred set of tags using the
  2859. variable @code{org-tag-alist}, but would like to use a dynamic tag list
  2860. in a specific file, add an empty TAGS option line to that file:
  2861. @example
  2862. #+TAGS:
  2863. @end example
  2864. By default Org mode uses the standard minibuffer completion facilities for
  2865. entering tags. However, it also implements another, quicker, tag selection
  2866. method called @emph{fast tag selection}. This allows you to select and
  2867. deselect tags with just a single key press. For this to work well you should
  2868. assign unique letters to most of your commonly used tags. You can do this
  2869. globally by configuring the variable @code{org-tag-alist} in your
  2870. @file{.emacs} file. For example, you may find the need to tag many items in
  2871. different files with @samp{:@@home:}. In this case you can set something
  2872. like:
  2873. @lisp
  2874. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  2875. @end lisp
  2876. @noindent If the tag is only relevant to the file you are working on then you
  2877. can, instead, set the TAGS option line as:
  2878. @example
  2879. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  2880. @end example
  2881. @noindent
  2882. You can also group together tags that are mutually exclusive. By using
  2883. braces, as in:
  2884. @example
  2885. #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p)
  2886. @end example
  2887. @noindent you indicate that at most one of @samp{@@work}, @samp{@@home},
  2888. and @samp{@@tennisclub} should be selected. Multiple such groups are allowed.
  2889. @noindent Don't forget to press @kbd{C-c C-c} with the cursor in one of
  2890. these lines to activate any changes.
  2891. @noindent
  2892. To set these mutually exclusive groups in the variable @code{org-mode-alist}
  2893. you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead
  2894. of the braces. The previous example would be set globally by the following
  2895. configuration:
  2896. @lisp
  2897. (setq org-tag-alist '((:startgroup . nil)
  2898. ("@@work" . ?w) ("@@home" . ?h)
  2899. ("@@tennisclub" . ?t)
  2900. (:endgroup . nil)
  2901. ("laptop" . ?l) ("pc" . ?p)))
  2902. @end lisp
  2903. If at least one tag has a selection key then pressing @kbd{C-c C-c} will
  2904. automatically present you with a special interface, listing inherited tags,
  2905. the tags of the current headline, and a list of all valid tags with
  2906. corresponding keys@footnote{Keys will automatically be assigned to tags which
  2907. have no configured keys.}. In this interface, you can use the following
  2908. keys:
  2909. @table @kbd
  2910. @item a-z...
  2911. Pressing keys assigned to tags will add or remove them from the list of
  2912. tags in the current line. Selecting a tag in a group of mutually
  2913. exclusive tags will turn off any other tags from that group.
  2914. @kindex @key{TAB}
  2915. @item @key{TAB}
  2916. Enter a tag in the minibuffer, even if the tag is not in the predefined
  2917. list. You will be able to complete on all tags present in the buffer.
  2918. @kindex @key{SPC}
  2919. @item @key{SPC}
  2920. Clear all tags for this line.
  2921. @kindex @key{RET}
  2922. @item @key{RET}
  2923. Accept the modified set.
  2924. @item C-g
  2925. Abort without installing changes.
  2926. @item q
  2927. If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
  2928. @item !
  2929. Turn off groups of mutually exclusive tags. Use this to (as an
  2930. exception) assign several tags from such a group.
  2931. @item C-c
  2932. Toggle auto-exit after the next change (see below).
  2933. If you are using expert mode, the first @kbd{C-c} will display the
  2934. selection window.
  2935. @end table
  2936. @noindent
  2937. This method lets you assign tags to a headline with very few keys. With
  2938. the above setup, you could clear the current tags and set @samp{@@home},
  2939. @samp{laptop} and @samp{pc} tags with just the following keys: @kbd{C-c
  2940. C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to
  2941. @samp{@@work} would be done with @kbd{C-c C-c w @key{RET}} or
  2942. alternatively with @kbd{C-c C-c C-c w}. Adding the non-predefined tag
  2943. @samp{Sarah} could be done with @kbd{C-c C-c @key{TAB} S a r a h
  2944. @key{RET} @key{RET}}.
  2945. If you find that most of the time, you need only a single key press to
  2946. modify your list of tags, set the variable
  2947. @code{org-fast-tag-selection-single-key}. Then you no longer have to
  2948. press @key{RET} to exit fast tag selection - it will immediately exit
  2949. after the first change. If you then occasionally need more keys, press
  2950. @kbd{C-c} to turn off auto-exit for the current tag selection process
  2951. (in effect: start selection with @kbd{C-c C-c C-c} instead of @kbd{C-c
  2952. C-c}). If you set the variable to the value @code{expert}, the special
  2953. window is not even shown for single-key tag selection, it comes up only
  2954. when you press an extra @kbd{C-c}.
  2955. @node Tag searches, , Setting tags, Tags
  2956. @section Tag searches
  2957. @cindex tag searches
  2958. @cindex searching for tags
  2959. Once a system of tags has been set up, it can be used to collect related
  2960. information into special lists.
  2961. @table @kbd
  2962. @kindex C-c \
  2963. @kindex C-c / T
  2964. @item C-c \
  2965. @itemx C-c / T
  2966. Create a sparse tree with all headlines matching a tags search. With a
  2967. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  2968. @kindex C-c a m
  2969. @item C-c a m
  2970. Create a global list of tag matches from all agenda files.
  2971. @xref{Matching tags and properties}.
  2972. @kindex C-c a M
  2973. @item C-c a M
  2974. Create a global list of tag matches from all agenda files, but check
  2975. only TODO items and force checking subitems (see variable
  2976. @code{org-tags-match-list-sublevels}).
  2977. @end table
  2978. @cindex Boolean logic, for tag searches
  2979. A @i{tags} search string can use Boolean operators @samp{&} for AND and
  2980. @samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
  2981. Parenthesis are currently not implemented. A tag may also be preceded
  2982. by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
  2983. positive selection. The AND operator @samp{&} is optional when @samp{+}
  2984. or @samp{-} is present. Examples:
  2985. @table @samp
  2986. @item +work-boss
  2987. Select headlines tagged @samp{:work:}, but discard those also tagged
  2988. @samp{:boss:}.
  2989. @item work|laptop
  2990. Selects lines tagged @samp{:work:} or @samp{:laptop:}.
  2991. @item work|laptop&night
  2992. Like before, but require the @samp{:laptop:} lines to be tagged also
  2993. @samp{:night:}.
  2994. @end table
  2995. @cindex TODO keyword matching, with tags search
  2996. If you are using multi-state TODO keywords (@pxref{TODO extensions}), it
  2997. can be useful to also match on the TODO keyword. This can be done by
  2998. adding a condition after a slash to a tags match. The syntax is similar
  2999. to the tag matches, but should be applied with consideration: For
  3000. example, a positive selection on several TODO keywords can not
  3001. meaningfully be combined with boolean AND. However, @emph{negative
  3002. selection} combined with AND can be meaningful. To make sure that only
  3003. lines are checked that actually have any TODO keyword, use @kbd{C-c a
  3004. M}, or equivalently start the TODO part after the slash with @samp{!}.
  3005. Examples:
  3006. @table @samp
  3007. @item work/WAITING
  3008. Select @samp{:work:}-tagged TODO lines with the specific TODO
  3009. keyword @samp{WAITING}.
  3010. @item work/!-WAITING-NEXT
  3011. Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING}
  3012. nor @samp{NEXT}
  3013. @item work/+WAITING|+NEXT
  3014. Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
  3015. @samp{NEXT}.
  3016. @end table
  3017. @cindex regular expressions, with tags search
  3018. Any element of the tag/todo match can be a regular expression - in this
  3019. case it must be enclosed in curly braces. For example,
  3020. @samp{work+@{^boss.*@}} matches headlines that contain the tag
  3021. @samp{:work:} and any tag @i{starting} with @samp{boss}.
  3022. @cindex level, require for tags/property match
  3023. @cindex category, require for tags/property match
  3024. You can also require a headline to be of a certain level or category, by
  3025. writing instead of any TAG an expression like @samp{LEVEL=3} or
  3026. @samp{CATEGORY="work"}, respectively. For example, a search
  3027. @samp{+LEVEL=3+boss/-DONE} lists all level three headlines that have the
  3028. tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE.
  3029. @node Properties and Columns, Dates and Times, Tags, Top
  3030. @chapter Properties and Columns
  3031. @cindex properties
  3032. Properties are a set of key-value pairs associated with an entry. There
  3033. are two main applications for properties in Org mode. First, properties
  3034. are like tags, but with a value. Second, you can use properties to
  3035. implement (very basic) database capabilities in an Org buffer. For
  3036. an example of the first application, imagine maintaining a file where
  3037. you document bugs and plan releases of a piece of software. Instead of
  3038. using tags like @code{:release_1:}, @code{:release_2:}, one can use a
  3039. property, say @code{:Release:}, that in different subtrees has different
  3040. values, such as @code{1.0} or @code{2.0}. For an example of the second
  3041. application of properties, imagine keeping track of your music CD's,
  3042. where properties could be things such as the album artist, date of
  3043. release, number of tracks, and so on.
  3044. Properties can be conveniently edited and viewed in column view
  3045. (@pxref{Column view}).
  3046. Properties are like tags, but with a value. For example, in a file
  3047. where you document bugs and plan releases of a piece of software,
  3048. instead of using tags like @code{:release_1:}, @code{:release_2:}, it
  3049. can be more efficient to use a property @code{:Release:} with a value
  3050. @code{1.0} or @code{2.0}. Second, you can use properties to implement
  3051. (very basic) database capabilities in an Org buffer, for example to
  3052. create a list of Music CD's you own. You can edit and view properties
  3053. conveniently in column view (@pxref{Column view}).
  3054. @menu
  3055. * Property syntax:: How properties are spelled out
  3056. * Special properties:: Access to other Org mode features
  3057. * Property searches:: Matching property values
  3058. * Property inheritance:: Passing values down the tree
  3059. * Column view:: Tabular viewing and editing
  3060. * Property API:: Properties for Lisp programmers
  3061. @end menu
  3062. @node Property syntax, Special properties, Properties and Columns, Properties and Columns
  3063. @section Property syntax
  3064. @cindex property syntax
  3065. @cindex drawer, for properties
  3066. Properties are key-value pairs. They need to be inserted into a special
  3067. drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property
  3068. is specified on a single line, with the key (surrounded by colons)
  3069. first, and the value after it. Here is an example:
  3070. @example
  3071. * CD collection
  3072. ** Classic
  3073. *** Goldberg Variations
  3074. :PROPERTIES:
  3075. :Title: Goldberg Variations
  3076. :Composer: J.S. Bach
  3077. :Artist: Glen Gould
  3078. :Publisher: Deutsche Grammphon
  3079. :NDisks: 1
  3080. :END:
  3081. @end example
  3082. You may define the allowed values for a particular property @samp{:Xyz:}
  3083. by setting a property @samp{:Xyz_ALL:}. This special property is
  3084. @emph{inherited}, so if you set it in a level 1 entry, it will apply to
  3085. the entire tree. When allowed values are defined, setting the
  3086. corresponding property becomes easier and is less prone to typing
  3087. errors. For the example with the CD collection, we can predefine
  3088. publishers and the number of disks in a box like this:
  3089. @example
  3090. * CD collection
  3091. :PROPERTIES:
  3092. :NDisks_ALL: 1 2 3 4
  3093. :Publisher_ALL: "Deutsche Grammophon" Phillips EMI
  3094. :END:
  3095. @end example
  3096. If you want to set properties that can be inherited by any entry in a
  3097. file, use a line like
  3098. @example
  3099. #+PROPERTY: NDisks_ALL 1 2 3 4
  3100. @end example
  3101. Property values set with the global variable
  3102. @code{org-global-properties} can be inherited by all entries in all
  3103. Org files.
  3104. @noindent
  3105. The following commands help to work with properties:
  3106. @table @kbd
  3107. @kindex M-@key{TAB}
  3108. @item M-@key{TAB}
  3109. After an initial colon in a line, complete property keys. All keys used
  3110. in the current file will be offered as possible completions.
  3111. @kindex C-c C-x p
  3112. @item C-c C-x p
  3113. Set a property. This prompts for a property name and a value. If
  3114. necessary, the property drawer is created as well.
  3115. @item M-x org-insert-property-drawer
  3116. Insert a property drawer into the current entry. The drawer will be
  3117. inserted early in the entry, but after the lines with planning
  3118. information like deadlines.
  3119. @kindex C-c C-c
  3120. @item C-c C-c
  3121. With the cursor in a property drawer, this executes property commands.
  3122. @item C-c C-c s
  3123. Set a property in the current entry. Both the property and the value
  3124. can be inserted using completion.
  3125. @kindex S-@key{right}
  3126. @kindex S-@key{left}
  3127. @item S-@key{left}/@key{right}
  3128. Switch property at point to the next/previous allowed value.
  3129. @item C-c C-c d
  3130. Remove a property from the current entry.
  3131. @item C-c C-c D
  3132. Globally remove a property, from all entries in the current file.
  3133. @item C-c C-c c
  3134. Compute the property at point, using the operator and scope from the
  3135. nearest column format definition.
  3136. @end table
  3137. @node Special properties, Property searches, Property syntax, Properties and Columns
  3138. @section Special properties
  3139. @cindex properties, special
  3140. Special properties provide alternative access method to Org mode
  3141. features discussed in the previous chapters, like the TODO state or the
  3142. priority of an entry. This interface exists so that you can include
  3143. these states into columns view (@pxref{Column view}), or to use them in
  3144. queries. The following property names are special and should not be
  3145. used as keys in the properties drawer:
  3146. @example
  3147. TODO @r{The TODO keyword of the entry.}
  3148. TAGS @r{The tags defined directly in the headline.}
  3149. ALLTAGS @r{All tags, including inherited ones.}
  3150. PRIORITY @r{The priority of the entry, a string with a single letter.}
  3151. DEADLINE @r{The deadline time string, without the angular brackets.}
  3152. SCHEDULED @r{The scheduling time stamp, without the angular brackets.}
  3153. TIMESTAMP @r{The first keyword-less time stamp in the entry.}
  3154. TIMESTAMP_IA @r{The first inactive time stamp in the entry.}
  3155. CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
  3156. @r{must be run first to compute the values.}
  3157. @end example
  3158. @node Property searches, Property inheritance, Special properties, Properties and Columns
  3159. @section Property searches
  3160. @cindex properties, searching
  3161. @cindex searching, of properties
  3162. To create sparse trees and special lists with selection based on
  3163. properties, the same commands are used as for tag searches (@pxref{Tag
  3164. searches}), and the same logic applies. For example, a search string
  3165. @example
  3166. +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort=""+With=@{Sarah\|Denny@}
  3167. @end example
  3168. @noindent
  3169. finds entries tagged @samp{:work:} but not @samp{:boss:}, which
  3170. also have a priority value @samp{A}, a @samp{:Coffee:} property with the
  3171. value @samp{unlimited}, an @samp{Effort} property that is undefined or
  3172. empty, and a @samp{:With:} property that is matched by
  3173. the regular expression @samp{Sarah\|Denny}.
  3174. You can configure Org mode to use property inheritance during a search,
  3175. see @ref{Property inheritance} for details.
  3176. There is also a special command for creating sparse trees based on a
  3177. single property:
  3178. @table @kbd
  3179. @kindex C-c / p
  3180. @item C-c / p
  3181. Create a sparse tree based on the value of a property. This first
  3182. prompts for the name of a property, and then for a value. A sparse tree
  3183. is created with all entries that define this property with the given
  3184. value. If you enclose the value into curly braces, it is interpreted as
  3185. a regular expression and matched against the property values.
  3186. @end table
  3187. @node Property inheritance, Column view, Property searches, Properties and Columns
  3188. @section Property Inheritance
  3189. @cindex properties, inheritance
  3190. @cindex inheritance, of properties
  3191. The outline structure of Org mode documents lends itself for an
  3192. inheritance model of properties: If the parent in a tree has a certain
  3193. property, the children can inherit this property. Org mode does not
  3194. turn this on by default, because it can slow down property searches
  3195. significantly and is often not needed. However, if you find inheritance
  3196. useful, you can turn it on by setting the variable
  3197. @code{org-use-property-inheritance}. It may be set to @code{t}, to make
  3198. all properties inherited from the parent, to a list of properties
  3199. that should be inherited, or to a regular expression that matches
  3200. inherited properties.
  3201. Org mode has a few properties for which inheritance is hard-coded, at
  3202. least for the special applications for which they are used:
  3203. @table @code
  3204. @item COLUMNS
  3205. The @code{:COLUMNS:} property defines the format of column view
  3206. (@pxref{Column view}). It is inherited in the sense that the level
  3207. where a @code{:COLUMNS:} property is defined is used as the starting
  3208. point for a column view table, independently of the location in the
  3209. subtree from where columns view is turned on.
  3210. @item CATEGORY
  3211. For agenda view, a category set through a @code{:CATEGORY:} property
  3212. applies to the entire subtree.
  3213. @item ARCHIVE
  3214. For archiving, the @code{:ARCHIVE:} property may define the archive
  3215. location for the entire subtree (@pxref{Moving subtrees}).
  3216. @item LOGGING
  3217. The LOGGING property may define logging settings for an entry or a
  3218. subtree (@pxref{Tracking TODO state changes}).
  3219. @end table
  3220. @node Column view, Property API, Property inheritance, Properties and Columns
  3221. @section Column view
  3222. A great way to view and edit properties in an outline tree is
  3223. @emph{column view}. In column view, each outline item is turned into a
  3224. table row. Columns in this table provide access to properties of the
  3225. entries. Org mode implements columns by overlaying a tabular structure
  3226. over the headline of each item. While the headlines have been turned
  3227. into a table row, you can still change the visibility of the outline
  3228. tree. For example, you get a compact table by switching to CONTENTS
  3229. view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
  3230. is active), but you can still open, read, and edit the entry below each
  3231. headline. Or, you can switch to column view after executing a sparse
  3232. tree command and in this way get a table only for the selected items.
  3233. Column view also works in agenda buffers (@pxref{Agenda Views}) where
  3234. queries have collected selected items, possibly from a number of files.
  3235. @menu
  3236. * Defining columns:: The COLUMNS format property
  3237. * Using column view:: How to create and use column view
  3238. * Capturing column view:: A dynamic block for column view
  3239. @end menu
  3240. @node Defining columns, Using column view, Column view, Column view
  3241. @subsection Defining columns
  3242. @cindex column view, for properties
  3243. @cindex properties, column view
  3244. Setting up a column view first requires defining the columns. This is
  3245. done by defining a column format line.
  3246. @menu
  3247. * Scope of column definitions:: Where defined, where valid?
  3248. * Column attributes:: Appearance and content of a column
  3249. @end menu
  3250. @node Scope of column definitions, Column attributes, Defining columns, Defining columns
  3251. @subsubsection Scope of column definitions
  3252. To define a column format for an entire file, use a line like
  3253. @example
  3254. #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3255. @end example
  3256. To specify a format that only applies to a specific tree, add a
  3257. @code{:COLUMNS:} property to the top node of that tree, for example:
  3258. @example
  3259. ** Top node for columns view
  3260. :PROPERTIES:
  3261. :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO
  3262. :END:
  3263. @end example
  3264. If a @code{:COLUMNS:} property is present in an entry, it defines columns
  3265. for the entry itself, and for the entire subtree below it. Since the
  3266. column definition is part of the hierarchical structure of the document,
  3267. you can define columns on level 1 that are general enough for all
  3268. sublevels, and more specific columns further down, when you edit a
  3269. deeper part of the tree.
  3270. @node Column attributes, , Scope of column definitions, Defining columns
  3271. @subsubsection Column attributes
  3272. A column definition sets the attributes of a column. The general
  3273. definition looks like this:
  3274. @example
  3275. %[width]property[(title)][@{summary-type@}]
  3276. @end example
  3277. @noindent
  3278. Except for the percent sign and the property name, all items are
  3279. optional. The individual parts have the following meaning:
  3280. @example
  3281. width @r{An integer specifying the width of the column in characters.}
  3282. @r{If omitted, the width will be determined automatically.}
  3283. property @r{The property that should be edited in this column.}
  3284. (title) @r{The header text for the column. If omitted, the}
  3285. @r{property name is used.}
  3286. @{summary-type@} @r{The summary type. If specified, the column values for}
  3287. @r{parent nodes are computed from the children.}
  3288. @r{Supported summary types are:}
  3289. @{+@} @r{Sum numbers in this column.}
  3290. @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
  3291. @{$@} @r{Currency, short for @samp{+;%.2f}.}
  3292. @{:@} @r{Sum times, HH:MM:SS, plain numbers are hours.}
  3293. @{X@} @r{Checkbox status, [X] if all children are [X].}
  3294. @{X/@} @r{Checkbox status, [n/m].}
  3295. @{X%@} @r{Checkbox status, [n%].}
  3296. @end example
  3297. @noindent
  3298. Here is an example for a complete columns definition, along with allowed
  3299. values.
  3300. @example
  3301. :COLUMNS: %20ITEM %9Approved(Approved?)@{X@} %Owner %11Status \@footnote{Please note that the COLUMNS definition must be on a single line - it is wrapped here only because of formatting constraints.}
  3302. %10Time_Estimate@{:@} %CLOCKSUM
  3303. :Owner_ALL: Tammy Mark Karl Lisa Don
  3304. :Status_ALL: "In progress" "Not started yet" "Finished" ""
  3305. :Approved_ALL: "[ ]" "[X]"
  3306. @end example
  3307. The first column, @samp{%25ITEM}, means the first 25 characters of the
  3308. item itself, i.e. of the headline. You probably always should start the
  3309. column definition with the @samp{ITEM} specifier. The other specifiers
  3310. create columns @samp{Owner} with a list of names as allowed values, for
  3311. @samp{Status} with four different possible values, and for a checkbox
  3312. field @samp{Approved}. When no width is given after the @samp{%}
  3313. character, the column will be exactly as wide as it needs to be in order
  3314. to fully display all values. The @samp{Approved} column does have a
  3315. modified title (@samp{Approved?}, with a question mark). Summaries will
  3316. be created for the @samp{Time_Estimate} column by adding time duration
  3317. expressions like HH:MM, and for the @samp{Approved} column, by providing
  3318. an @samp{[X]} status if all children have been checked. The
  3319. @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals
  3320. in the subtree.
  3321. @node Using column view, Capturing column view, Defining columns, Column view
  3322. @subsection Using column view
  3323. @table @kbd
  3324. @tsubheading{Turning column view on and off}
  3325. @kindex C-c C-x C-c
  3326. @item C-c C-x C-c
  3327. Create the column view for the local environment. This command searches
  3328. the hierarchy, up from point, for a @code{:COLUMNS:} property that defines
  3329. a format. When one is found, the column view table is established for
  3330. the entire tree, starting from the entry that contains the @code{:COLUMNS:}
  3331. property. If none is found, the format is taken from the @code{#+COLUMNS}
  3332. line or from the variable @code{org-columns-default-format}, and column
  3333. view is established for the current entry and its subtree.
  3334. @kindex r
  3335. @item r
  3336. Recreate the column view, to include recent changes made in the buffer.
  3337. @kindex g
  3338. @item g
  3339. Same as @kbd{r}.
  3340. @kindex q
  3341. @item q
  3342. Exit column view.
  3343. @tsubheading{Editing values}
  3344. @item @key{left} @key{right} @key{up} @key{down}
  3345. Move through the column view from field to field.
  3346. @kindex S-@key{left}
  3347. @kindex S-@key{right}
  3348. @item S-@key{left}/@key{right}
  3349. Switch to the next/previous allowed value of the field. For this, you
  3350. have to have specified allowed values for a property.
  3351. @kindex n
  3352. @kindex p
  3353. @itemx n / p
  3354. Same as @kbd{S-@key{left}/@key{right}}
  3355. @kindex e
  3356. @item e
  3357. Edit the property at point. For the special properties, this will
  3358. invoke the same interface that you normally use to change that
  3359. property. For example, when editing a TAGS property, the tag completion
  3360. or fast selection interface will pop up.
  3361. @kindex C-c C-c
  3362. @item C-c C-c
  3363. When there is a checkbox at point, toggle it.
  3364. @kindex v
  3365. @item v
  3366. View the full value of this property. This is useful if the width of
  3367. the column is smaller than that of the value.
  3368. @kindex a
  3369. @item a
  3370. Edit the list of allowed values for this property. If the list is found
  3371. in the hierarchy, the modified values is stored there. If no list is
  3372. found, the new value is stored in the first entry that is part of the
  3373. current column view.
  3374. @tsubheading{Modifying the table structure}
  3375. @kindex <
  3376. @kindex >
  3377. @item < / >
  3378. Make the column narrower/wider by one character.
  3379. @kindex S-M-@key{right}
  3380. @item S-M-@key{right}
  3381. Insert a new column, to the right of the current column.
  3382. @kindex S-M-@key{left}
  3383. @item S-M-@key{left}
  3384. Delete the current column.
  3385. @end table
  3386. @node Capturing column view, , Using column view, Column view
  3387. @subsection Capturing column view
  3388. Since column view is just an overlay over a buffer, it cannot be
  3389. exported or printed directly. If you want to capture a column view, use
  3390. this @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame
  3391. of this block looks like this:
  3392. @example
  3393. * The column view
  3394. #+BEGIN: columnview :hlines 1 :id "label"
  3395. #+END:
  3396. @end example
  3397. @noindent This dynamic block has the following parameters:
  3398. @table @code
  3399. @item :id
  3400. This is most important parameter. Column view is a feature that is
  3401. often localized to a certain (sub)tree, and the capture block might be
  3402. in a different location in the file. To identify the tree whose view to
  3403. capture, you can use 3 values:
  3404. @example
  3405. local @r{use the tree in which the capture block is located}
  3406. global @r{make a global view, including all headings in the file}
  3407. "label" @r{call column view in the tree that has and @code{:ID:}}
  3408. @r{property with the value @i{label}}
  3409. @end example
  3410. @item :hlines
  3411. When @code{t}, insert a hline after every line. When a number N, insert
  3412. a hline before each headline with level @code{<= N}.
  3413. @item :vlines
  3414. When set to @code{t}, enforce column groups to get vertical lines.
  3415. @item :maxlevel
  3416. When set to a number, don't capture entries below this level.
  3417. @item :skip-empty-rows
  3418. When set to @code{t}, skip row where the only non-empty specifier of the
  3419. column view is @code{ITEM}.
  3420. @end table
  3421. @noindent
  3422. The following commands insert or update the dynamic block:
  3423. @table @kbd
  3424. @kindex C-c C-x r
  3425. @item C-c C-x r
  3426. Insert a dynamic block capturing a column view. You will be prompted
  3427. for the scope or id of the view.
  3428. @kindex C-c C-c
  3429. @item C-c C-c
  3430. @kindex C-c C-x C-u
  3431. @itemx C-c C-x C-u
  3432. Update dynamical block at point. The cursor needs to be in the
  3433. @code{#+BEGIN} line of the dynamic block.
  3434. @kindex C-u C-c C-x C-u
  3435. @item C-u C-c C-x C-u
  3436. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  3437. you have several clock table blocks in a buffer.
  3438. @end table
  3439. @node Property API, , Column view, Properties and Columns
  3440. @section The Property API
  3441. @cindex properties, API
  3442. @cindex API, for properties
  3443. There is a full API for accessing and changing properties. This API can
  3444. be used by Emacs Lisp programs to work with properties and to implement
  3445. features based on them. For more information see @ref{Using the
  3446. property API}.
  3447. @node Dates and Times, Remember, Properties and Columns, Top
  3448. @chapter Dates and Times
  3449. @cindex dates
  3450. @cindex times
  3451. @cindex time stamps
  3452. @cindex date stamps
  3453. To assist project planning, TODO items can be labeled with a date and/or
  3454. a time. The specially formatted string carrying the date and time
  3455. information is called a @emph{timestamp} in Org mode. This may be a
  3456. little confusing because timestamp is often used as indicating when
  3457. something was created or last changed. However, in Org mode this term
  3458. is used in a much wider sense.
  3459. @menu
  3460. * Timestamps:: Assigning a time to a tree entry
  3461. * Creating timestamps:: Commands which insert timestamps
  3462. * Deadlines and scheduling:: Planning your work
  3463. * Clocking work time:: Tracking how long you spend on a task
  3464. @end menu
  3465. @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
  3466. @section Timestamps, deadlines and scheduling
  3467. @cindex time stamps
  3468. @cindex ranges, time
  3469. @cindex date stamps
  3470. @cindex deadlines
  3471. @cindex scheduling
  3472. A time stamp is a specification of a date (possibly with time or a range
  3473. of times) in a special format, either @samp{<2003-09-16 Tue>} or
  3474. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue
  3475. 12:00-12:30>}@footnote{This is the standard ISO date/time format. To
  3476. use an alternative format, see @ref{Custom time format}.}. A time stamp
  3477. can appear anywhere in the headline or body of an Org tree entry. Its
  3478. presence causes entries to be shown on specific dates in the agenda
  3479. (@pxref{Weekly/daily agenda}). We distinguish:
  3480. @table @var
  3481. @item Plain time stamp; Event; Appointment
  3482. @cindex timestamp
  3483. A simple time stamp just assigns a date/time to an item. This is just
  3484. like writing down an appointment or event in a paper agenda. In the
  3485. timeline and agenda displays, the headline of an entry associated with a
  3486. plain time stamp will be shown exactly on that date.
  3487. @example
  3488. * Meet Peter at the movies <2006-11-01 Wed 19:15>
  3489. * Discussion on climate change <2006-11-02 Thu 20:00-22:00>
  3490. @end example
  3491. @item Time stamp with repeater interval
  3492. @cindex timestamp, with repeater interval
  3493. A time stamp may contain a @emph{repeater interval}, indicating that it
  3494. applies not only on the given date, but again and again after a certain
  3495. interval of N days (d), weeks (w), months(m), or years(y). The
  3496. following will show up in the agenda every Wednesday:
  3497. @example
  3498. * Pick up Sam at school <2007-05-16 Wed 12:30 +1w>
  3499. @end example
  3500. @item Diary-style sexp entries
  3501. For more complex date specifications, Org mode supports using the
  3502. special sexp diary entries implemented in the Emacs calendar/diary
  3503. package. For example
  3504. @example
  3505. * The nerd meeting on every 2nd Thursday of the month
  3506. <%%(diary-float t 4 2)>
  3507. @end example
  3508. @item Time/Date range
  3509. @cindex timerange
  3510. @cindex date range
  3511. Two time stamps connected by @samp{--} denote a range. The headline
  3512. will be shown on the first and last day of the range, and on any dates
  3513. that are displayed and fall in the range. Here is an example:
  3514. @example
  3515. ** Meeting in Amsterdam
  3516. <2004-08-23 Mon>--<2004-08-26 Thu>
  3517. @end example
  3518. @item Inactive time stamp
  3519. @cindex timestamp, inactive
  3520. @cindex inactive timestamp
  3521. Just like a plain time stamp, but with square brackets instead of
  3522. angular ones. These time stamps are inactive in the sense that they do
  3523. @emph{not} trigger an entry to show up in the agenda.
  3524. @example
  3525. * Gillian comes late for the fifth time [2006-11-01 Wed]
  3526. @end example
  3527. @end table
  3528. @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
  3529. @section Creating timestamps
  3530. @cindex creating timestamps
  3531. @cindex timestamps, creating
  3532. For Org mode to recognize time stamps, they need to be in the specific
  3533. format. All commands listed below produce time stamps in the correct
  3534. format.
  3535. @table @kbd
  3536. @kindex C-c .
  3537. @item C-c .
  3538. Prompt for a date and insert a corresponding time stamp. When the
  3539. cursor is at a previously used time stamp, it is updated to NOW. When
  3540. this command is used twice in succession, a time range is inserted.
  3541. @c
  3542. @kindex C-u C-c .
  3543. @item C-u C-c .
  3544. Like @kbd{C-c .}, but use the alternative format which contains date
  3545. and time. The default time can be rounded to multiples of 5 minutes,
  3546. see the option @code{org-time-stamp-rounding-minutes}.
  3547. @c
  3548. @kindex C-c !
  3549. @item C-c !
  3550. Like @kbd{C-c .}, but insert an inactive time stamp that will not cause
  3551. an agenda entry.
  3552. @c
  3553. @kindex C-c <
  3554. @item C-c <
  3555. Insert a time stamp corresponding to the cursor date in the Calendar.
  3556. @c
  3557. @kindex C-c >
  3558. @item C-c >
  3559. Access the Emacs calendar for the current date. If there is a
  3560. timestamp in the current line, go to the corresponding date
  3561. instead.
  3562. @c
  3563. @kindex C-c C-o
  3564. @item C-c C-o
  3565. Access the agenda for the date given by the time stamp or -range at
  3566. point (@pxref{Weekly/daily agenda}).
  3567. @c
  3568. @kindex S-@key{left}
  3569. @kindex S-@key{right}
  3570. @item S-@key{left}
  3571. @itemx S-@key{right}
  3572. Change date at cursor by one day. These key bindings conflict with
  3573. CUA mode (@pxref{Conflicts}).
  3574. @c
  3575. @kindex S-@key{up}
  3576. @kindex S-@key{down}
  3577. @item S-@key{up}
  3578. @itemx S-@key{down}
  3579. Change the item under the cursor in a timestamp. The cursor can be on a
  3580. year, month, day, hour or minute. Note that if the cursor is in a
  3581. headline and not at a time stamp, these same keys modify the priority of
  3582. an item. (@pxref{Priorities}). The key bindings also conflict with
  3583. CUA mode (@pxref{Conflicts}).
  3584. @c
  3585. @kindex C-c C-y
  3586. @cindex evaluate time range
  3587. @item C-c C-y
  3588. Evaluate a time range by computing the difference between start and end.
  3589. With a prefix argument, insert result after the time range (in a table: into
  3590. the following column).
  3591. @end table
  3592. @menu
  3593. * The date/time prompt:: How Org mode helps you entering date and time
  3594. * Custom time format:: Making dates look different
  3595. @end menu
  3596. @node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps
  3597. @subsection The date/time prompt
  3598. @cindex date, reading in minibuffer
  3599. @cindex time, reading in minibuffer
  3600. When Org mode prompts for a date/time, the default is shown as an ISO
  3601. date, and the prompt therefore seems to ask for an ISO date. But it
  3602. will in fact accept any string containing some date and/or time
  3603. information, and it is really smart about interpreting your input. You
  3604. can, for example, use @kbd{C-y} to paste a (possibly multi-line) string
  3605. copied from an email message. Org mode will find whatever information
  3606. is in there and derive anything you have not specified from the
  3607. @emph{default date and time}. The default is usually the current date
  3608. and time, but when modifying an existing time stamp, or when entering
  3609. the second stamp of a range, it is taken from the stamp in the buffer.
  3610. When filling in information, Org mode assumes that most of the time you
  3611. will want to enter a date in the future: If you omit the month/year and
  3612. the given day/month is @i{before} today, it will assume that you mean a
  3613. future date@footnote{See the variable
  3614. @code{org-read-date-prefer-future}.}.
  3615. For example, lets assume that today is @b{June 13, 2006}. Here is how
  3616. various inputs will be interpreted, the items filled in by Org mode are
  3617. in @b{bold}.
  3618. @example
  3619. 3-2-5 --> 2003-02-05
  3620. 14 --> @b{2006}-@b{06}-14
  3621. 12 --> @b{2006}-@b{07}-12
  3622. Fri --> nearest Friday (defaultdate or later)
  3623. sep 15 --> @b{2006}-11-15
  3624. feb 15 --> @b{2007}-02-15
  3625. sep 12 9 --> 2009-09-12
  3626. 12:45 --> @b{2006}-@b{06}-@b{13} 12:45
  3627. 22 sept 0:34 --> @b{2006}-09-22 0:34
  3628. w4 --> ISO week for of the current year @b{2006}
  3629. 2012 w4 fri --> Friday of ISO week 4 in 2012
  3630. 2012-w04-5 --> Same as above
  3631. @end example
  3632. Furthermore you can specify a relative date by giving, as the
  3633. @emph{first} thing in the input: a plus/minus sign, a number and a
  3634. letter [dwmy] to indicate change in days weeks, months, years. With a
  3635. single plus or minus, the date is always relative to today. With a
  3636. double plus or minus, it is relative to the default date. If instead of
  3637. a single letter, you use the abbreviation of day name, the date will be
  3638. the nth such day. E.g.
  3639. @example
  3640. +4d --> four days from today
  3641. +4 --> same as above
  3642. +2w --> two weeks from today
  3643. ++5 --> five days from default date
  3644. +2tue --> second tuesday from now.
  3645. @end example
  3646. The function understands English month and weekday abbreviations. If
  3647. you want to use unabbreviated names and/or other languages, configure
  3648. the variables @code{parse-time-months} and @code{parse-time-weekdays}.
  3649. @cindex calendar, for selecting date
  3650. Parallel to the minibuffer prompt, a calendar is popped up@footnote{If
  3651. you don't need/want the calendar, configure the variable
  3652. @code{org-popup-calendar-for-date-prompt}.}. When you exit the date
  3653. prompt, either by clicking on a date in the calendar, or by pressing
  3654. @key{RET}, the date selected in the calendar will be combined with the
  3655. information entered at the prompt. You can control the calendar fully
  3656. from the minibuffer:
  3657. @kindex <
  3658. @kindex >
  3659. @kindex mouse-1
  3660. @kindex S-@key{right}
  3661. @kindex S-@key{left}
  3662. @kindex S-@key{down}
  3663. @kindex S-@key{up}
  3664. @kindex M-S-@key{right}
  3665. @kindex M-S-@key{left}
  3666. @kindex @key{RET}
  3667. @example
  3668. > / < @r{Scroll calendar forward/backward by one month.}
  3669. mouse-1 @r{Select date by clicking on it.}
  3670. S-@key{right}/@key{left} @r{One day forward/backward.}
  3671. S-@key{down}/@key{up} @r{One week forward/backward.}
  3672. M-S-@key{right}/@key{left} @r{One month forward/backward.}
  3673. @key{RET} @r{Choose date in calendar.}
  3674. @end example
  3675. The actions of the date/time prompt may seem complex, but I assure you
  3676. they will grow on you. To help you understand what is going on, the
  3677. current interpretation of your input will be displayed live in the
  3678. minibuffer@footnote{If you find this distracting, turn the display of
  3679. with @code{org-read-date-display-live}.}.
  3680. @node Custom time format, , The date/time prompt, Creating timestamps
  3681. @subsection Custom time format
  3682. @cindex custom date/time format
  3683. @cindex time format, custom
  3684. @cindex date format, custom
  3685. Org mode uses the standard ISO notation for dates and times as it is
  3686. defined in ISO 8601. If you cannot get used to this and require another
  3687. representation of date and time to keep you happy, you can get it by
  3688. customizing the variables @code{org-display-custom-times} and
  3689. @code{org-time-stamp-custom-formats}.
  3690. @table @kbd
  3691. @kindex C-c C-x C-t
  3692. @item C-c C-x C-t
  3693. Toggle the display of custom formats for dates and times.
  3694. @end table
  3695. @noindent
  3696. Org mode needs the default format for scanning, so the custom date/time
  3697. format does not @emph{replace} the default format - instead it is put
  3698. @emph{over} the default format using text properties. This has the
  3699. following consequences:
  3700. @itemize @bullet
  3701. @item
  3702. You cannot place the cursor onto a time stamp anymore, only before or
  3703. after.
  3704. @item
  3705. The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust
  3706. each component of a time stamp. If the cursor is at the beginning of
  3707. the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day,
  3708. just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the
  3709. time will be changed by one minute.
  3710. @item
  3711. If the time stamp contains a range of clock times or a repeater, these
  3712. will not be overlayed, but remain in the buffer as they were.
  3713. @item
  3714. When you delete a time stamp character-by-character, it will only
  3715. disappear from the buffer after @emph{all} (invisible) characters
  3716. belonging to the ISO timestamp have been removed.
  3717. @item
  3718. If the custom time stamp format is longer than the default and you are
  3719. using dates in tables, table alignment will be messed up. If the custom
  3720. format is shorter, things do work as expected.
  3721. @end itemize
  3722. @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
  3723. @section Deadlines and scheduling
  3724. A time stamp may be preceded by special keywords to facilitate planning:
  3725. @table @var
  3726. @item DEADLINE
  3727. @cindex DEADLINE keyword
  3728. Meaning: the task (most likely a TODO item, though not necessarily) is supposed
  3729. to be finished on that date.
  3730. On the deadline date, the task will be listed in the agenda. In
  3731. addition, the agenda for @emph{today} will carry a warning about the
  3732. approaching or missed deadline, starting
  3733. @code{org-deadline-warning-days} before the due date, and continuing
  3734. until the entry is marked DONE. An example:
  3735. @example
  3736. *** TODO write article about the Earth for the Guide
  3737. The editor in charge is [[bbdb:Ford Prefect]]
  3738. DEADLINE: <2004-02-29 Sun>
  3739. @end example
  3740. You can specify a different lead time for warnings for a specific
  3741. deadlines using the following syntax. Here is an example with a warning
  3742. period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}.
  3743. @item SCHEDULED
  3744. @cindex SCHEDULED keyword
  3745. Meaning: you are planning to start working on that task on the given
  3746. date.
  3747. The headline will be listed under the given date@footnote{It will still
  3748. be listed on that date after it has been marked DONE. If you don't like
  3749. this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
  3750. addition, a reminder that the scheduled date has passed will be present
  3751. in the compilation for @emph{today}, until the entry is marked DONE.
  3752. I.e., the task will automatically be forwarded until completed.
  3753. @example
  3754. *** TODO Call Trillian for a date on New Years Eve.
  3755. SCHEDULED: <2004-12-25 Sat>
  3756. @end example
  3757. @noindent
  3758. @b{Important:} Scheduling an item in Org mode should @i{not} be
  3759. understood in the same way that we understand @i{scheduling a meeting}.
  3760. Setting a date for a meeting is just a simple appointment, you should
  3761. mark this entry with a simple plain time stamp, to get this item shown
  3762. on the date where it applies. This is a frequent mis-understanding from
  3763. Org-users. In Org mode, @i{scheduling} means setting a date when you
  3764. want to start working on an action item.
  3765. @end table
  3766. You may use time stamps with repeaters in scheduling and deadline
  3767. entries. Org mode will issue early and late warnings based on the
  3768. assumption that the time stamp represents the @i{nearest instance} of
  3769. the repeater. However, the use of diary sexp entries like
  3770. @c
  3771. @code{<%%(diary-float t 42)>}
  3772. @c
  3773. in scheduling and deadline timestamps is limited. Org mode does not
  3774. know enough about the internals of each sexp function to issue early and
  3775. late warnings. However, it will show the item on each day where the
  3776. sexp entry matches.
  3777. @menu
  3778. * Inserting deadline/schedule:: Planning items
  3779. * Repeated tasks:: Items that show up again and again
  3780. @end menu
  3781. @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling
  3782. @subsection Inserting deadlines or schedules
  3783. The following commands allow to quickly insert a deadline or to schedule
  3784. an item:
  3785. @table @kbd
  3786. @c
  3787. @kindex C-c C-d
  3788. @item C-c C-d
  3789. Insert @samp{DEADLINE} keyword along with a stamp. The insertion will
  3790. happen in the line directly following the headline. When called with a
  3791. prefix arg, an existing deadline will be removed from the entry.
  3792. @c FIXME Any CLOSED timestamp will be removed.????????
  3793. @c
  3794. @kindex C-c / d
  3795. @cindex sparse tree, for deadlines
  3796. @item C-c / d
  3797. Create a sparse tree with all deadlines that are either past-due, or
  3798. which will become due within @code{org-deadline-warning-days}.
  3799. With @kbd{C-u} prefix, show all deadlines in the file. With a numeric
  3800. prefix, check that many days. For example, @kbd{C-1 C-c / d} shows
  3801. all deadlines due tomorrow.
  3802. @c
  3803. @kindex C-c C-s
  3804. @item C-c C-s
  3805. Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will
  3806. happen in the line directly following the headline. Any CLOSED
  3807. timestamp will be removed. When called with a prefix argument, remove
  3808. the scheduling date from the entry.
  3809. @end table
  3810. @node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling
  3811. @subsection Repeated tasks
  3812. Some tasks need to be repeated again and again. Org mode helps to
  3813. organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
  3814. or plain time stamp. In the following example
  3815. @example
  3816. ** TODO Pay the rent
  3817. DEADLINE: <2005-10-01 Sat +1m>
  3818. @end example
  3819. the @code{+1m} is a repeater; the intended interpretation is that the
  3820. task has a deadline on <2005-10-01> and repeats itself every (one) month
  3821. starting from that time. If you need both a repeater and a special
  3822. warning period in a deadline entry, the repeater comes first and the
  3823. warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}.
  3824. Deadlines and scheduled items produce entries in the agenda when they
  3825. are over-due, so it is important to be able to mark such an entry as
  3826. completed once you have done so. When you mark a DEADLINE or a SCHEDULE
  3827. with the TODO keyword DONE, it will no longer produce entries in the
  3828. agenda. The problem with this is, however, that then also the
  3829. @emph{next} instance of the repeated entry will not be active. Org mode
  3830. deals with this in the following way: When you try to mark such an entry
  3831. DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating
  3832. time stamp by the repeater interval, and immediately set the entry state
  3833. back to TODO. In the example above, setting the state to DONE would
  3834. actually switch the date like this:
  3835. @example
  3836. ** TODO Pay the rent
  3837. DEADLINE: <2005-11-01 Tue +1m>
  3838. @end example
  3839. You will also be prompted for a note@footnote{You can change this using
  3840. the option @code{org-log-repeat}, or the @code{#+STARTUP} options
  3841. @code{logrepeat}, @code{lognoterepeat}, and @code{nologrepeat}.} that
  3842. will be put under the DEADLINE line to keep a record that you actually
  3843. acted on the previous instance of this deadline.
  3844. As a consequence of shifting the base date, this entry will no longer be
  3845. visible in the agenda when checking past dates, but all future instances
  3846. will be visible.
  3847. With the @samp{+1m} cookie, the date shift will always be exactly one
  3848. month. So if you have not payed the rent for three months, marking this
  3849. entry DONE will still keep it as an overdue deadline. Depending on the
  3850. task, this may not be the best way to handle it. For example, if you
  3851. forgot to call you father for 3 weeks, it does not make sense to call
  3852. her 3 times in a single day to make up for it. Finally, there are tasks
  3853. like changing batteries which should always repeat a certain time
  3854. @i{after} the last time you did it. For these tasks, Org mode has
  3855. special repeaters markers with @samp{++} and @samp{.+}. For example:
  3856. @example
  3857. ** TODO Call Father
  3858. DEADLINE: <2008-02-10 Sun ++1w>
  3859. Marking this DONE will shift the date by at least one week,
  3860. but also by as many weeks as it takes to get this date into
  3861. the future. However, it stays on a Sunday, even if you called
  3862. and marked it done on Saturday.
  3863. ** TODO Check the batteries in the smoke detectors
  3864. DEADLINE: <2005-11-01 Tue .+1m>
  3865. Marking this DONE will shift the date to one month after
  3866. today.
  3867. @end example
  3868. You may have both scheduling and deadline information for a specific
  3869. task - just make sure that the repeater intervals on both are the same.
  3870. @node Clocking work time, , Deadlines and scheduling, Dates and Times
  3871. @section Clocking work time
  3872. Org mode allows you to clock the time you spent on specific tasks in a
  3873. project. When you start working on an item, you can start the clock.
  3874. When you stop working on that task, or when you mark the task done, the
  3875. clock is stopped and the corresponding time interval is recorded. It
  3876. also computes the total time spent on each subtree of a project.
  3877. @table @kbd
  3878. @kindex C-c C-x C-i
  3879. @item C-c C-x C-i
  3880. Start the clock on the current item (clock-in). This inserts the CLOCK
  3881. keyword together with a timestamp. If this is not the first clocking of
  3882. this item, the multiple CLOCK lines will be wrapped into a
  3883. @code{:CLOCK:} drawer (see also the variable
  3884. @code{org-clock-into-drawer}).
  3885. @kindex C-c C-x C-o
  3886. @item C-c C-x C-o
  3887. Stop the clock (clock-out). The inserts another timestamp at the same
  3888. location where the clock was last started. It also directly computes
  3889. the resulting time in inserts it after the time range as @samp{=>
  3890. HH:MM}. See the variable @code{org-log-note-clock-out} for the
  3891. possibility to record an additional note together with the clock-out
  3892. time stamp@footnote{The corresponding in-buffer setting is:
  3893. @code{#+STARTUP: lognoteclock-out}}.
  3894. @kindex C-c C-y
  3895. @item C-c C-y
  3896. Recompute the time interval after changing one of the time stamps. This
  3897. is only necessary if you edit the time stamps directly. If you change
  3898. them with @kbd{S-@key{cursor}} keys, the update is automatic.
  3899. @kindex C-c C-t
  3900. @item C-c C-t
  3901. Changing the TODO state of an item to DONE automatically stops the clock
  3902. if it is running in this same item.
  3903. @kindex C-c C-x C-x
  3904. @item C-c C-x C-x
  3905. Cancel the current clock. This is useful if a clock was started by
  3906. mistake, or if you ended up working on something else.
  3907. @kindex C-c C-x C-j
  3908. @item C-c C-x C-j
  3909. Jump to the entry that contains the currently running clock, an another
  3910. window.
  3911. @kindex C-c C-x C-d
  3912. @item C-c C-x C-d
  3913. Display time summaries for each subtree in the current buffer. This
  3914. puts overlays at the end of each headline, showing the total time
  3915. recorded under that heading, including the time of any subheadings. You
  3916. can use visibility cycling to study the tree, but the overlays disappear
  3917. when you change the buffer (see variable
  3918. @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}.
  3919. @kindex C-c C-x C-r
  3920. @item C-c C-x C-r
  3921. Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock
  3922. report as an Org mode table into the current file. When the cursor is
  3923. at an existing clock table, just update it. When called with a prefix
  3924. argument, jump to the first clock report in the current document and
  3925. update it.
  3926. @example
  3927. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  3928. #+END: clocktable
  3929. @end example
  3930. @noindent
  3931. If such a block already exists at point, its content is replaced by the
  3932. new table. The @samp{BEGIN} line can specify options:
  3933. @example
  3934. :maxlevel @r{Maximum level depth to which times are listed in the table.}
  3935. :emphasize @r{When @code{t}, emphasize level one and level two items}
  3936. :scope @r{The scope to consider. This can be any of the following:}
  3937. nil @r{the current buffer or narrowed region}
  3938. file @r{the full current buffer}
  3939. subtree @r{the subtree where the clocktable is located}
  3940. treeN @r{the surrounding level N tree, for example @code{tree3}}
  3941. tree @r{the surrounding level 1 tree}
  3942. agenda @r{all agenda files}
  3943. ("file"..) @r{scan these files}
  3944. :block @r{The time block to consider. This block is specified either}
  3945. @r{absolute, or relative to the current time and may be any of}
  3946. @r{these formats:}
  3947. 2007-12-31 @r{New year eve 2007}
  3948. 2007-12 @r{December 2007}
  3949. 2007-W50 @r{ISO-week 50 in 2007}
  3950. 2007 @r{the year 2007}
  3951. today, yesterday, today-N @r{a relative day}
  3952. thisweek, lastweek, thisweek-N @r{a relative week}
  3953. thismonth, lastmonth, thismonth-N @r{a relative month}
  3954. thisyear, lastyear, thisyear-N @r{a relative year}
  3955. @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
  3956. :tstart @r{A time string specifying when to start considering times}
  3957. :tend @r{A time string specifying when to stop considering times}
  3958. :step @r{@code{week} or @code{day}, to split the table into chunks}
  3959. :link @r{Link the item headlines in the table to their origins}
  3960. @end example
  3961. So to get a clock summary of the current level 1 tree, for the current
  3962. day, you could write
  3963. @example
  3964. #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
  3965. #+END: clocktable
  3966. @end example
  3967. and to use a specific time range you could write@footnote{Note that all
  3968. parameters must be specified in a single line - the line is broken here
  3969. only to fit it onto the manual.}
  3970. @example
  3971. #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
  3972. :tend "<2006-08-10 Thu 12:00>"
  3973. #+END: clocktable
  3974. @end example
  3975. @kindex C-c C-c
  3976. @item C-c C-c
  3977. @kindex C-c C-x C-u
  3978. @itemx C-c C-x C-u
  3979. Update dynamical block at point. The cursor needs to be in the
  3980. @code{#+BEGIN} line of the dynamic block.
  3981. @kindex C-u C-c C-x C-u
  3982. @item C-u C-c C-x C-u
  3983. Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if
  3984. you have several clock table blocks in a buffer.
  3985. @kindex S-@key{left}
  3986. @kindex S-@key{right}
  3987. @item S-@key{left}
  3988. @itemx S-@key{right}
  3989. Shift the current @code{:block} interval and update the table. The cursor
  3990. needs to be in the @code{#+BEGIN: clocktable} line for this command. If
  3991. @code{:block} is @code{today}, it will be shifted to @code{today-1} etc.
  3992. @end table
  3993. The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
  3994. the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
  3995. worked on or closed during a day.
  3996. @node Remember, Agenda Views, Dates and Times, Top
  3997. @chapter Remember
  3998. @cindex @file{remember.el}
  3999. The @i{Remember} package by John Wiegley lets you store quick notes with
  4000. little interruption of your work flow. See
  4001. @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
  4002. information. It is an excellent way to add new notes and tasks to
  4003. Org files. Org significantly expands the possibilities of
  4004. @i{remember}: You may define templates for different note types, and
  4005. associate target files and headlines with specific templates. It also
  4006. allows you to select the location where a note should be stored
  4007. interactively, on the fly.
  4008. @menu
  4009. * Setting up Remember:: Some code for .emacs to get things going
  4010. * Remember templates:: Define the outline of different note types
  4011. * Storing notes:: Directly get the note to where it belongs
  4012. * Refiling notes:: Moving a note or task to a project
  4013. @end menu
  4014. @node Setting up Remember, Remember templates, Remember, Remember
  4015. @section Setting up Remember
  4016. The following customization will tell @i{remember} to use org files as
  4017. target, and to create annotations compatible with Org links.
  4018. @example
  4019. (org-remember-insinuate)
  4020. (setq org-directory "~/path/to/my/orgfiles/")
  4021. (setq org-default-notes-file (concat org-directory "/notes.org"))
  4022. (define-key global-map "\C-cr" 'org-remember)
  4023. @end example
  4024. The last line binds the command @code{org-remember} to a global
  4025. key@footnote{Please select your own key, @kbd{C-c r} is only a
  4026. suggestion.}. @code{org-remember} basically just calls @code{remember},
  4027. but it makes a few things easier: If there is an active region, it will
  4028. automatically copy the region into the remember buffer. It also allows
  4029. to jump to the buffer and location where remember notes are being
  4030. stored: Just call @code{org-remember} with a prefix argument. If you
  4031. use two prefix arguments, Org jumps to the location where the last
  4032. remember note was stored.
  4033. @node Remember templates, Storing notes, Setting up Remember, Remember
  4034. @section Remember templates
  4035. @cindex templates, for remember
  4036. In combination with Org, you can use templates to generate
  4037. different types of @i{remember} notes. For example, if you would like
  4038. to use one template to create general TODO entries, another one for
  4039. journal entries, and a third one for collecting random ideas, you could
  4040. use:
  4041. @example
  4042. (setq org-remember-templates
  4043. '(("Todo" ?t "* TODO %?\n %i\n %a" "~/org/TODO.org" "Tasks")
  4044. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
  4045. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  4046. @end example
  4047. @noindent In these entries, the first string is just a name, and the
  4048. character specifies how to select the template. It is useful if the
  4049. character is also the first letter of the name. The next string
  4050. specifies the template. Two more (optional) strings give the file in
  4051. which, and the headline under which the new note should be stored. The
  4052. file (if not present or @code{nil}) defaults to
  4053. @code{org-default-notes-file}, the heading to
  4054. @code{org-remember-default-headline}. If the file name is not an
  4055. absolute path, it will be interpreted relative to @code{org-directory}.
  4056. An optional sixth element specifies the contexts in which the user can
  4057. select the template. This element can be either a list of major modes
  4058. or a function. @code{org-remember} will first check whether the function
  4059. returns @code{t} or if we are in any of the listed major mode, and select
  4060. the template accordingly.
  4061. So for example:
  4062. @example
  4063. (setq org-remember-templates
  4064. '(("Bug" ?b "* BUG %?\n %i\n %a" "~/org/BUGS.org" "Bugs" (emacs-lisp-mode))
  4065. ("Journal" ?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org" my-check)
  4066. ("Idea" ?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
  4067. @end example
  4068. The first template will only be available when invoking @code{org-remember}
  4069. from an buffer in @code{emacs-lisp-mode}. The second template will only be
  4070. available when the function @code{my-check} returns @code{t}. The third
  4071. template will be proposed in any context.
  4072. When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
  4073. something, org will prompt for a key to select the template (if you have
  4074. more than one template) and then prepare the buffer like
  4075. @example
  4076. * TODO
  4077. [[file:link to where you called remember]]
  4078. @end example
  4079. @noindent
  4080. During expansion of the template, special @kbd{%}-escapes allow dynamic
  4081. insertion of content:
  4082. @example
  4083. %^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
  4084. @r{You may specify a default value and a completion table with}
  4085. @r{%^@{prompt|default|completion2|completion3...@}}
  4086. @r{The arrow keys access a prompt-specific history.}
  4087. %t @r{time stamp, date only}
  4088. %T @r{time stamp with date and time}
  4089. %u, %U @r{like the above, but inactive time stamps}
  4090. %^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
  4091. @r{You may define a prompt like @code{%^@{Birthday@}t}}
  4092. %n @r{user name (taken from @code{user-full-name})}
  4093. %a @r{annotation, normally the link created with @code{org-store-link}}
  4094. %A @r{like @code{%a}, but prompt for the description part}
  4095. %i @r{initial content, the region when remember is called with C-u.}
  4096. @r{The entire text will be indented like @code{%i} itself.}
  4097. %c @r{Content of the clipboard, or current kill ring head.}
  4098. %^g @r{prompt for tags, with completion on tags in target file.}
  4099. %^G @r{prompt for tags, with completion all tags in all agenda files.}
  4100. %:keyword @r{specific information for certain link types, see below}
  4101. %[pathname] @r{insert the contents of the file given by @code{pathname}}
  4102. %(sexp) @r{evaluate elisp @code{(sexp)} and replace with the result}
  4103. %! @r{immediately store note after completing the template}
  4104. @r{(skipping the @kbd{C-c C-c} that normally triggers storing)}
  4105. @end example
  4106. @noindent
  4107. For specific link types, the following keywords will be
  4108. defined@footnote{If you define your own link types (@pxref{Adding
  4109. hyperlink types}), any property you store with
  4110. @code{org-store-link-props} can be accessed in remember templates in a
  4111. similar way.}:
  4112. @example
  4113. Link type | Available keywords
  4114. -------------------+----------------------------------------------
  4115. bbdb | %:name %:company
  4116. bbdb | %::server %:port %:nick
  4117. vm, wl, mh, rmail | %:type %:subject %:message-id
  4118. | %:from %:fromname %:fromaddress
  4119. | %:to %:toname %:toaddress
  4120. | %: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}.}}
  4121. gnus | %:group, @r{for messages also all email fields}
  4122. w3, w3m | %:url
  4123. info | %:file %:node
  4124. calendar | %:date"
  4125. @end example
  4126. @noindent
  4127. To place the cursor after template expansion use:
  4128. @example
  4129. %? @r{After completing the template, position cursor here.}
  4130. @end example
  4131. @noindent
  4132. If you change your mind about which template to use, call
  4133. @code{org-remember} in the remember buffer. You may then select a new
  4134. template that will be filled with the previous context information.
  4135. @node Storing notes, Refiling notes, Remember templates, Remember
  4136. @section Storing notes
  4137. When you are finished preparing a note with @i{remember}, you have to
  4138. press @kbd{C-c C-c} to file the note away. The handler will store the
  4139. note in the file and under the headline specified in the template, or it
  4140. will use the default file and headlines. The window configuration will
  4141. be restored, sending you back to the working context before the call to
  4142. @code{remember}. To re-use the location found during the last call to
  4143. @code{remember}, exit the remember buffer with @kbd{C-u C-u C-c C-c},
  4144. i.e. specify a double prefix argument to @kbd{C-c C-c}.
  4145. If you want to store the note directly to a different place, use
  4146. @kbd{C-u C-c C-c} instead to exit remember@footnote{Configure the
  4147. variable @code{org-remember-store-without-prompt} to make this behavior
  4148. the default.}. The handler will then first prompt for a target file -
  4149. if you press @key{RET}, the value specified for the template is used.
  4150. Then the command offers the headings tree of the selected file, with the
  4151. cursor position at the default headline (if you had specified one in the
  4152. template). You can either immediately press @key{RET} to get the note
  4153. placed there. Or you can use the following keys to find a different
  4154. location:
  4155. @example
  4156. @key{TAB} @r{Cycle visibility.}
  4157. @key{down} / @key{up} @r{Next/previous visible headline.}
  4158. n / p @r{Next/previous visible headline.}
  4159. f / b @r{Next/previous headline same level.}
  4160. u @r{One level up.}
  4161. @c 0-9 @r{Digit argument.}
  4162. @end example
  4163. @noindent
  4164. Pressing @key{RET} or @key{left} or @key{right}
  4165. then leads to the following result.
  4166. @multitable @columnfractions 0.2 0.15 0.65
  4167. @item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
  4168. @item on headline @tab @key{RET} @tab as sublevel of the heading at cursor, first or last
  4169. @item @tab @tab depending on @code{org-reverse-note-order}.
  4170. @item @tab @key{left}/@key{right} @tab as same level, before/after current heading
  4171. @item buffer-start @tab @key{RET} @tab as level 2 heading at end of file or level 1 at beginning
  4172. @item @tab @tab depending on @code{org-reverse-note-order}.
  4173. @item not on headline @tab @key{RET}
  4174. @tab at cursor position, level taken from context.
  4175. @end multitable
  4176. Before inserting the text into a tree, the function ensures that the
  4177. text has a headline, i.e. a first line that starts with a @samp{*}. If
  4178. not, a headline is constructed from the current date and some additional
  4179. data. If you have indented the text of the note below the headline, the
  4180. indentation will be adapted if inserting the note into the tree requires
  4181. demotion from level 1.
  4182. @node Refiling notes, , Storing notes, Remember
  4183. @section Refiling notes
  4184. @cindex refiling notes
  4185. Remember is usually used to quickly capture notes and tasks into one or
  4186. a few capture lists. When reviewing the captured data, you may want to
  4187. refile some of the entries into a different list, for example into a
  4188. project. Cutting, finding the right location and then pasting the note
  4189. is cumbersome. To simplify this process, you can use the following
  4190. special command:
  4191. @table @kbd
  4192. @kindex C-c C-w
  4193. @item C-c C-w
  4194. Refile the entry at point. This command offers possible locations for
  4195. refiling the entry and lets you select one with completion. The item is
  4196. filed below the target heading as a subitem. Depending on
  4197. @code{org-reverse-note-order}, it will be either the first of last
  4198. subitem.@* By default, all level 1 headlines in the current buffer are
  4199. considered to be targets, but you can have more complex definitions
  4200. across a number of files. See the variable @code{org-refile-targets}
  4201. for details.
  4202. @kindex C-u C-c C-w
  4203. @item C-u C-c C-w
  4204. Use the refile interface to jump to a heading.
  4205. @kindex C-u C-u C-c C-w
  4206. @item C- C-u C-c C-w
  4207. Jump to the location where @code{org-refile} last moved a tree to.
  4208. @end table
  4209. @node Agenda Views, Embedded LaTeX, Remember, Top
  4210. @chapter Agenda Views
  4211. @cindex agenda views
  4212. Due to the way Org works, TODO items, time-stamped items, and
  4213. tagged headlines can be scattered throughout a file or even a number of
  4214. files. To get an overview of open action items, or of events that are
  4215. important for a particular date, this information must be collected,
  4216. sorted and displayed in an organized way.
  4217. Org can select items based on various criteria, and display them
  4218. in a separate buffer. Seven different view types are provided:
  4219. @itemize @bullet
  4220. @item
  4221. an @emph{agenda} that is like a calendar and shows information
  4222. for specific dates,
  4223. @item
  4224. a @emph{TODO list} that covers all unfinished
  4225. action items,
  4226. @item
  4227. a @emph{tags view}, showings headlines based on
  4228. the tags associated with them,
  4229. @item
  4230. a @emph{timeline view} that shows all events in a single Org file,
  4231. in time-sorted view,
  4232. @item
  4233. a @emph{keyword search view} that shows all entries from multiple files
  4234. that contain specified keywords.
  4235. @item
  4236. a @emph{stuck projects view} showing projects that currently don't move
  4237. along, and
  4238. @item
  4239. @emph{custom views} that are special tag/keyword searches and
  4240. combinations of different views.
  4241. @end itemize
  4242. @noindent
  4243. The extracted information is displayed in a special @emph{agenda
  4244. buffer}. This buffer is read-only, but provides commands to visit the
  4245. corresponding locations in the original Org files, and even to
  4246. edit these files remotely.
  4247. Two variables control how the agenda buffer is displayed and whether the
  4248. window configuration is restored when the agenda exits:
  4249. @code{org-agenda-window-setup} and
  4250. @code{org-agenda-restore-windows-after-quit}.
  4251. @menu
  4252. * Agenda files:: Files being searched for agenda information
  4253. * Agenda dispatcher:: Keyboard access to agenda views
  4254. * Built-in agenda views:: What is available out of the box?
  4255. * Presentation and sorting:: How agenda items are prepared for display
  4256. * Agenda commands:: Remote editing of Org trees
  4257. * Custom agenda views:: Defining special searches and views
  4258. @end menu
  4259. @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
  4260. @section Agenda files
  4261. @cindex agenda files
  4262. @cindex files for agenda
  4263. The information to be shown is normally collected from all @emph{agenda
  4264. files}, the files listed in the variable
  4265. @code{org-agenda-files}@footnote{If the value of that variable is not a
  4266. list, but a single file name, then the list of agenda files will be
  4267. maintained in that external file.}. If a directory is part of this list,
  4268. all files with the extension @file{.org} in this directory will be part
  4269. of the list.
  4270. Thus even if you only work with a single Org file, this file should
  4271. be put into that list@footnote{When using the dispatcher, pressing
  4272. @kbd{<} before selecting a command will actually limit the command to
  4273. the current file, and ignore @code{org-agenda-files} until the next
  4274. dispatcher command.}. You can customize @code{org-agenda-files}, but
  4275. the easiest way to maintain it is through the following commands
  4276. @cindex files, adding to agenda list
  4277. @table @kbd
  4278. @kindex C-c [
  4279. @item C-c [
  4280. Add current file to the list of agenda files. The file is added to
  4281. the front of the list. If it was already in the list, it is moved to
  4282. the front. With a prefix argument, file is added/moved to the end.
  4283. @kindex C-c ]
  4284. @item C-c ]
  4285. Remove current file from the list of agenda files.
  4286. @kindex C-,
  4287. @kindex C-'
  4288. @item C-,
  4289. @itemx C-'
  4290. Cycle through agenda file list, visiting one file after the other.
  4291. @end table
  4292. @noindent
  4293. The Org menu contains the current list of files and can be used
  4294. to visit any of them.
  4295. If you would like to focus the agenda temporarily onto a file not in
  4296. this list, or onto just one file in the list or even only a subtree in a
  4297. file, this can be done in different ways. For a single agenda command,
  4298. you may press @kbd{<} once or several times in the dispatcher
  4299. (@pxref{Agenda dispatcher}). To restrict the agenda scope for an
  4300. extended period, use the following commands:
  4301. @table @kbd
  4302. @kindex C-c C-x <
  4303. @item C-c C-x <
  4304. Permanently restrict the agenda to the current subtree. When with a
  4305. prefix argument, or with the cursor before the first headline in a file,
  4306. the agenda scope is set to the entire file. This restriction remains in
  4307. effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<}
  4308. or @kbd{>} in the agenda dispatcher. If there is a window displaying an
  4309. agenda view, the new restriction takes effect immediately.
  4310. @kindex C-c C-x <
  4311. @item C-c C-x <
  4312. Remove the permanent restriction created by @kbd{C-c C-x <}.
  4313. @end table
  4314. @noindent
  4315. When working with @file{Speedbar}, you can use the following commands in
  4316. the Speedbar frame:
  4317. @table @kbd
  4318. @kindex <
  4319. @item < @r{in the speedbar frame}
  4320. Permanently restrict the agenda to the item at the cursor in the
  4321. Speedbar frame, either an Org file or a subtree in such a file.
  4322. If there is a window displaying an agenda view, the new restriction takes
  4323. effect immediately.
  4324. @kindex <
  4325. @item > @r{in the speedbar frame}
  4326. Lift the restriction again.
  4327. @end table
  4328. @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
  4329. @section The agenda dispatcher
  4330. @cindex agenda dispatcher
  4331. @cindex dispatching agenda commands
  4332. The views are created through a dispatcher that should be bound to a
  4333. global key, for example @kbd{C-c a} (@pxref{Installation}). In the
  4334. following we will assume that @kbd{C-c a} is indeed how the dispatcher
  4335. is accessed and list keyboard access to commands accordingly. After
  4336. pressing @kbd{C-c a}, an additional letter is required to execute a
  4337. command. The dispatcher offers the following default commands:
  4338. @table @kbd
  4339. @item a
  4340. Create the calendar-like agenda (@pxref{Weekly/daily agenda}).
  4341. @item t @r{/} T
  4342. Create a list of all TODO items (@pxref{Global TODO list}).
  4343. @item m @r{/} M
  4344. Create a list of headlines matching a TAGS expression (@pxref{Matching
  4345. tags and properties}).
  4346. @item L
  4347. Create the timeline view for the current buffer (@pxref{Timeline}).
  4348. @item s
  4349. Create a list of entries selected by a boolean expression of keywords
  4350. and/or regular expressions that must or must not occur in the entry.
  4351. @item /
  4352. Search for a regular expression in all agenda files and additionally in
  4353. the files listed in @code{org-agenda-multi-occur-extra-files}. This
  4354. uses the Emacs command @code{multi-occur}. A prefix argument can be
  4355. used to specify the number of context lines for each match, default is
  4356. 1.
  4357. @item # @r{/} !
  4358. Create a list of stuck projects (@pxref{Stuck projects}).
  4359. @item <
  4360. Restrict an agenda command to the current buffer@footnote{For backward
  4361. compatibility, you can also press @kbd{1} to restrict to the current
  4362. buffer.}. After pressing @kbd{<}, you still need to press the character
  4363. selecting the command.
  4364. @item < <
  4365. If there is an active region, restrict the following agenda command to
  4366. the region. Otherwise, restrict it to the current subtree@footnote{For
  4367. backward compatibility, you can also press @kbd{0} to restrict to the
  4368. current buffer.}. After pressing @kbd{< <}, you still need to press the
  4369. character selecting the command.
  4370. @end table
  4371. You can also define custom commands that will be accessible through the
  4372. dispatcher, just like the default commands. This includes the
  4373. possibility to create extended agenda buffers that contain several
  4374. blocks together, for example the weekly agenda, the global TODO list and
  4375. a number of special tags matches. @xref{Custom agenda views}.
  4376. @node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views
  4377. @section The built-in agenda views
  4378. In this section we describe the built-in views.
  4379. @menu
  4380. * Weekly/daily agenda:: The calendar page with current tasks
  4381. * Global TODO list:: All unfinished action items
  4382. * Matching tags and properties:: Structured information with fine-tuned search
  4383. * Timeline:: Time-sorted view for single file
  4384. * Keyword search:: Finding entries by keyword
  4385. * Stuck projects:: Find projects you need to review
  4386. @end menu
  4387. @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
  4388. @subsection The weekly/daily agenda
  4389. @cindex agenda
  4390. @cindex weekly agenda
  4391. @cindex daily agenda
  4392. The purpose of the weekly/daily @emph{agenda} is to act like a page of a
  4393. paper agenda, showing all the tasks for the current week or day.
  4394. @table @kbd
  4395. @cindex org-agenda, command
  4396. @kindex C-c a a
  4397. @item C-c a a
  4398. Compile an agenda for the current week from a list of org files. The
  4399. agenda shows the entries for each day. With a numeric
  4400. prefix@footnote{For backward compatibility, the universal prefix
  4401. @kbd{C-u} causes all TODO entries to be listed before the agenda. This
  4402. feature is deprecated, use the dedicated TODO list, or a block agenda
  4403. instead.} (like @kbd{C-u 2 1 C-c a a}) you may set the number of days
  4404. to be displayed (see also the variable @code{org-agenda-ndays})
  4405. @end table
  4406. Remote editing from the agenda buffer means, for example, that you can
  4407. change the dates of deadlines and appointments from the agenda buffer.
  4408. The commands available in the Agenda buffer are listed in @ref{Agenda
  4409. commands}.
  4410. @subsubheading Calendar/Diary integration
  4411. @cindex calendar integration
  4412. @cindex diary integration
  4413. Emacs contains the calendar and diary by Edward M. Reingold. The
  4414. calendar displays a three-month calendar with holidays from different
  4415. countries and cultures. The diary allows you to keep track of
  4416. anniversaries, lunar phases, sunrise/set, recurrent appointments
  4417. (weekly, monthly) and more. In this way, it is quite complementary to
  4418. Org. It can be very useful to combine output from Org with
  4419. the diary.
  4420. In order to include entries from the Emacs diary into Org mode's
  4421. agenda, you only need to customize the variable
  4422. @lisp
  4423. (setq org-agenda-include-diary t)
  4424. @end lisp
  4425. @noindent After that, everything will happen automatically. All diary
  4426. entries including holidays, anniversaries etc will be included in the
  4427. agenda buffer created by Org mode. @key{SPC}, @key{TAB}, and
  4428. @key{RET} can be used from the agenda buffer to jump to the diary
  4429. file in order to edit existing diary entries. The @kbd{i} command to
  4430. insert new entries for the current date works in the agenda buffer, as
  4431. well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
  4432. Sunrise/Sunset times, show lunar phases and to convert to other
  4433. calendars, respectively. @kbd{c} can be used to switch back and forth
  4434. between calendar and agenda.
  4435. If you are using the diary only for sexp entries and holidays, it is
  4436. faster to not use the above setting, but instead to copy or even move
  4437. the entries into an Org file. Org mode evaluates diary-style sexp
  4438. entries, and does it faster because there is no overhead for first
  4439. creating the diary display. Note that the sexp entries must start at
  4440. the left margin, no white space is allowed before them. For example,
  4441. the following segment of an Org file will be processed and entries
  4442. will be made in the agenda:
  4443. @example
  4444. * Birthdays and similar stuff
  4445. #+CATEGORY: Holiday
  4446. %%(org-calendar-holiday) ; special function for holiday names
  4447. #+CATEGORY: Ann
  4448. %%(diary-anniversary 14 5 1956) Arthur Dent is %d years old
  4449. %%(diary-anniversary 2 10 1869) Mahatma Gandhi would be %d years old
  4450. @end example
  4451. @subsubheading Appointment reminders
  4452. @cindex @file{appt.el}
  4453. @cindex appointment reminders
  4454. Org can interact with Emacs appointments notification facility.
  4455. To add all the appointments of your agenda files, use the command
  4456. @code{org-agenda-to-appt}. This commands also lets you filter through
  4457. the list of your appointments and add only those belonging to a specific
  4458. category or matching a regular expression. See the docstring for
  4459. details.
  4460. @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
  4461. @subsection The global TODO list
  4462. @cindex global TODO list
  4463. @cindex TODO list, global
  4464. The global TODO list contains all unfinished TODO items, formatted and
  4465. collected into a single place.
  4466. @table @kbd
  4467. @kindex C-c a t
  4468. @item C-c a t
  4469. Show the global TODO list. This collects the TODO items from all
  4470. agenda files (@pxref{Agenda Views}) into a single buffer. The buffer is in
  4471. @code{agenda-mode}, so there are commands to examine and manipulate
  4472. the TODO entries directly from that buffer (@pxref{Agenda commands}).
  4473. @kindex C-c a T
  4474. @item C-c a T
  4475. @cindex TODO keyword matching
  4476. Like the above, but allows selection of a specific TODO keyword. You
  4477. can also do this by specifying a prefix argument to @kbd{C-c a t}. With
  4478. a @kbd{C-u} prefix you are prompted for a keyword, and you may also
  4479. specify several keywords by separating them with @samp{|} as boolean OR
  4480. operator. With a numeric prefix, the Nth keyword in
  4481. @code{org-todo-keywords} is selected.
  4482. @kindex r
  4483. The @kbd{r} key in the agenda buffer regenerates it, and you can give
  4484. a prefix argument to this command to change the selected TODO keyword,
  4485. for example @kbd{3 r}. If you often need a search for a specific
  4486. keyword, define a custom command for it (@pxref{Agenda dispatcher}).@*
  4487. Matching specific TODO keywords can also be done as part of a tags
  4488. search (@pxref{Tag searches}).
  4489. @end table
  4490. Remote editing of TODO items means that you can change the state of a
  4491. TODO entry with a single key press. The commands available in the
  4492. TODO list are described in @ref{Agenda commands}.
  4493. @cindex sublevels, inclusion into TODO list
  4494. Normally the global TODO list simply shows all headlines with TODO
  4495. keywords. This list can become very long. There are two ways to keep
  4496. it more compact:
  4497. @itemize @minus
  4498. @item
  4499. Some people view a TODO item that has been @emph{scheduled} for
  4500. execution (@pxref{Timestamps}) as no longer @emph{open}. Configure the
  4501. variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled
  4502. items from the global TODO list.
  4503. @item
  4504. TODO items may have sublevels to break up the task into subtasks. In
  4505. such cases it may be enough to list only the highest level TODO headline
  4506. and omit the sublevels from the global list. Configure the variable
  4507. @code{org-agenda-todo-list-sublevels} to get this behavior.
  4508. @end itemize
  4509. @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
  4510. @subsection Matching tags and properties
  4511. @cindex matching, of tags
  4512. @cindex matching, of properties
  4513. @cindex tags view
  4514. If headlines in the agenda files are marked with @emph{tags}
  4515. (@pxref{Tags}), you can select headlines based on the tags that apply
  4516. to them and collect them into an agenda buffer.
  4517. @table @kbd
  4518. @kindex C-c a m
  4519. @item C-c a m
  4520. Produce a list of all headlines that match a given set of tags. The
  4521. command prompts for a selection criterion, which is a boolean logic
  4522. expression with tags, like @samp{+work+urgent-withboss} or
  4523. @samp{work|home} (@pxref{Tags}). If you often need a specific search,
  4524. define a custom command for it (@pxref{Agenda dispatcher}).
  4525. @kindex C-c a M
  4526. @item C-c a M
  4527. Like @kbd{C-c a m}, but only select headlines that are also TODO items
  4528. and force checking subitems (see variable
  4529. @code{org-tags-match-list-sublevels}). Matching specific TODO keywords
  4530. together with a tags match is also possible, see @ref{Tag searches}.
  4531. @end table
  4532. The commands available in the tags list are described in @ref{Agenda
  4533. commands}.
  4534. @node Timeline, Keyword search, Matching tags and properties, Built-in agenda views
  4535. @subsection Timeline for a single file
  4536. @cindex timeline, single file
  4537. @cindex time-sorted view
  4538. The timeline summarizes all time-stamped items from a single Org mode
  4539. file in a @emph{time-sorted view}. The main purpose of this command is
  4540. to give an overview over events in a project.
  4541. @table @kbd
  4542. @kindex C-c a L
  4543. @item C-c a L
  4544. Show a time-sorted view of the org file, with all time-stamped items.
  4545. When called with a @kbd{C-u} prefix, all unfinished TODO entries
  4546. (scheduled or not) are also listed under the current date.
  4547. @end table
  4548. @noindent
  4549. The commands available in the timeline buffer are listed in
  4550. @ref{Agenda commands}.
  4551. @node Keyword search, Stuck projects, Timeline, Built-in agenda views
  4552. @subsection Keyword search
  4553. @cindex keyword search
  4554. @cindex searching, for keywords
  4555. This agenda view is a general text search facility for Org mode entries.
  4556. It is particularly useful to find notes.
  4557. @table @kbd
  4558. @kindex C-c a s
  4559. @item C-c a s
  4560. This is a special search that lets you select entries by keywords or
  4561. regular expression, using a boolean logic. For example, the search
  4562. string
  4563. @example
  4564. +computer +wifi -ethernet -@{8\.11[bg]@}
  4565. @end example
  4566. @noindent
  4567. will search for note entries that contain the keywords @code{computer}
  4568. and @code{wifi}, but not the keyword @code{ethernet}, and which are also
  4569. not matched by the regular expression @code{8\.11[bg]}, meaning to
  4570. exclude both 8.11b and 8.11g.
  4571. Note that in addition to the agenda files, this command will also search
  4572. the files listed in @code{org-agenda-text-search-extra-files}.
  4573. @end table
  4574. @node Stuck projects, , Keyword search, Built-in agenda views
  4575. @subsection Stuck projects
  4576. If you are following a system like David Allen's GTD to organize your
  4577. work, one of the ``duties'' you have is a regular review to make sure
  4578. that all projects move along. A @emph{stuck} project is a project that
  4579. has no defined next actions, so it will never show up in the TODO lists
  4580. Org mode produces. During the review, you need to identify such
  4581. projects and define next actions for them.
  4582. @table @kbd
  4583. @kindex C-c a #
  4584. @item C-c a #
  4585. List projects that are stuck.
  4586. @kindex C-c a !
  4587. @item C-c a !
  4588. Customize the variable @code{org-stuck-projects} to define what a stuck
  4589. project is and how to find it.
  4590. @end table
  4591. You almost certainly will have to configure this view before it will
  4592. work for you. The built-in default assumes that all your projects are
  4593. level-2 headlines, and that a project is not stuck if it has at least
  4594. one entry marked with a TODO keyword TODO or NEXT or NEXTACTION.
  4595. Lets assume that you, in your own way of using Org mode, identify
  4596. projects with a tag PROJECT, and that you use a TODO keyword MAYBE to
  4597. indicate a project that should not be considered yet. Lets further
  4598. assume that the TODO keyword DONE marks finished projects, and that NEXT
  4599. and TODO indicate next actions. The tag @@SHOP indicates shopping and
  4600. is a next action even without the NEXT tag. Finally, if the project
  4601. contains the special word IGNORE anywhere, it should not be listed
  4602. either. In this case you would start by identifying eligible projects
  4603. with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for
  4604. TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that
  4605. are not stuck. The correct customization for this is
  4606. @lisp
  4607. (setq org-stuck-projects
  4608. '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@SHOP")
  4609. "\\<IGNORE\\>"))
  4610. @end lisp
  4611. @node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views
  4612. @section Presentation and sorting
  4613. @cindex presentation, of agenda items
  4614. Before displaying items in an agenda view, Org mode visually prepares
  4615. the items and sorts them. Each item occupies a single line. The line
  4616. starts with a @emph{prefix} that contains the @emph{category}
  4617. (@pxref{Categories}) of the item and other important information. You can
  4618. customize the prefix using the option @code{org-agenda-prefix-format}.
  4619. The prefix is followed by a cleaned-up version of the outline headline
  4620. associated with the item.
  4621. @menu
  4622. * Categories:: Not all tasks are equal
  4623. * Time-of-day specifications:: How the agenda knows the time
  4624. * Sorting of agenda items:: The order of things
  4625. @end menu
  4626. @node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting
  4627. @subsection Categories
  4628. @cindex category
  4629. The category is a broad label assigned to each agenda item. By default,
  4630. the category is simply derived from the file name, but you can also
  4631. specify it with a special line in the buffer, like this@footnote{For
  4632. backward compatibility, the following also works: If there are several
  4633. such lines in a file, each specifies the category for the text below it.
  4634. The first category also applies to any text before the first CATEGORY
  4635. line. However, using this method is @emph{strongly} deprecated as it is
  4636. incompatible with the outline structure of the document. The correct
  4637. method for setting multiple categories in a buffer is using a
  4638. property.}:
  4639. @example
  4640. #+CATEGORY: Thesis
  4641. @end example
  4642. @noindent
  4643. If you would like to have a special CATEGORY for a single entry or a
  4644. (sub)tree, give the entry a @code{:CATEGORY:} property with the location
  4645. as the value (@pxref{Properties and Columns}).
  4646. @noindent
  4647. The display in the agenda buffer looks best if the category is not
  4648. longer than 10 characters.
  4649. @node Time-of-day specifications, Sorting of agenda items, Categories, Presentation and sorting
  4650. @subsection Time-of-day specifications
  4651. @cindex time-of-day specification
  4652. Org mode checks each agenda item for a time-of-day specification. The
  4653. time can be part of the time stamp that triggered inclusion into the
  4654. agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time
  4655. ranges can be specified with two time stamps, like
  4656. @c
  4657. @w{@samp{<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>}}.
  4658. In the headline of the entry itself, a time(range) may also appear as
  4659. plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda
  4660. integrates the Emacs diary (@pxref{Weekly/daily agenda}), time
  4661. specifications in diary entries are recognized as well.
  4662. For agenda display, Org mode extracts the time and displays it in a
  4663. standard 24 hour format as part of the prefix. The example times in
  4664. the previous paragraphs would end up in the agenda like this:
  4665. @example
  4666. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4667. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4668. 19:00...... The Vogon reads his poem
  4669. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4670. @end example
  4671. @cindex time grid
  4672. If the agenda is in single-day mode, or for the display of today, the
  4673. timed entries are embedded in a time grid, like
  4674. @example
  4675. 8:00...... ------------------
  4676. 8:30-13:00 Arthur Dent lies in front of the bulldozer
  4677. 10:00...... ------------------
  4678. 12:00...... ------------------
  4679. 12:45...... Ford Prefect arrives and takes Arthur to the pub
  4680. 14:00...... ------------------
  4681. 16:00...... ------------------
  4682. 18:00...... ------------------
  4683. 19:00...... The Vogon reads his poem
  4684. 20:00...... ------------------
  4685. 20:30-22:15 Marwin escorts the Hitchhikers to the bridge
  4686. @end example
  4687. The time grid can be turned on and off with the variable
  4688. @code{org-agenda-use-time-grid}, and can be configured with
  4689. @code{org-agenda-time-grid}.
  4690. @node Sorting of agenda items, , Time-of-day specifications, Presentation and sorting
  4691. @subsection Sorting of agenda items
  4692. @cindex sorting, of agenda items
  4693. @cindex priorities, of agenda items
  4694. Before being inserted into a view, the items are sorted. How this is
  4695. done depends on the type of view.
  4696. @itemize @bullet
  4697. @item
  4698. For the daily/weekly agenda, the items for each day are sorted. The
  4699. default order is to first collect all items containing an explicit
  4700. time-of-day specification. These entries will be shown at the beginning
  4701. of the list, as a @emph{schedule} for the day. After that, items remain
  4702. grouped in categories, in the sequence given by @code{org-agenda-files}.
  4703. Within each category, items are sorted by priority (@pxref{Priorities}),
  4704. which is composed of the base priority (2000 for priority @samp{A}, 1000
  4705. for @samp{B}, and 0 for @samp{C}), plus additional increments for
  4706. overdue scheduled or deadline items.
  4707. @item
  4708. For the TODO list, items remain in the order of categories, but within
  4709. each category, sorting takes place according to priority
  4710. (@pxref{Priorities}).
  4711. @item
  4712. For tags matches, items are not sorted at all, but just appear in the
  4713. sequence in which they are found in the agenda files.
  4714. @end itemize
  4715. Sorting can be customized using the variable
  4716. @code{org-agenda-sorting-strategy}.
  4717. @node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views
  4718. @section Commands in the agenda buffer
  4719. @cindex commands, in agenda buffer
  4720. Entries in the agenda buffer are linked back to the org file or diary
  4721. file where they originate. You are not allowed to edit the agenda
  4722. buffer itself, but commands are provided to show and jump to the
  4723. original entry location, and to edit the org-files ``remotely'' from
  4724. the agenda buffer. In this way, all information is stored only once,
  4725. removing the risk that your agenda and note files may diverge.
  4726. Some commands can be executed with mouse clicks on agenda lines. For
  4727. the other commands, the cursor needs to be in the desired line.
  4728. @table @kbd
  4729. @tsubheading{Motion}
  4730. @cindex motion commands in agenda
  4731. @kindex n
  4732. @item n
  4733. Next line (same as @key{up} and @kbd{C-p}).
  4734. @kindex p
  4735. @item p
  4736. Previous line (same as @key{down} and @kbd{C-n}).
  4737. @tsubheading{View/Go to org file}
  4738. @kindex mouse-3
  4739. @kindex @key{SPC}
  4740. @item mouse-3
  4741. @itemx @key{SPC}
  4742. Display the original location of the item in another window.
  4743. @c
  4744. @kindex L
  4745. @item L
  4746. Display original location and recenter that window.
  4747. @c
  4748. @kindex mouse-2
  4749. @kindex mouse-1
  4750. @kindex @key{TAB}
  4751. @item mouse-2
  4752. @itemx mouse-1
  4753. @itemx @key{TAB}
  4754. Go to the original location of the item in another window. Under Emacs
  4755. 22, @kbd{mouse-1} will also works for this.
  4756. @c
  4757. @kindex @key{RET}
  4758. @itemx @key{RET}
  4759. Go to the original location of the item and delete other windows.
  4760. @c
  4761. @kindex f
  4762. @item f
  4763. Toggle Follow mode. In Follow mode, as you move the cursor through
  4764. the agenda buffer, the other window always shows the corresponding
  4765. location in the org file. The initial setting for this mode in new
  4766. agenda buffers can be set with the variable
  4767. @code{org-agenda-start-with-follow-mode}.
  4768. @c
  4769. @kindex b
  4770. @item b
  4771. Display the entire subtree of the current item in an indirect buffer. With a
  4772. numeric prefix argument N, go up to level N and then take that tree. If N is
  4773. negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the
  4774. previously used indirect buffer.
  4775. @c
  4776. @kindex l
  4777. @item l
  4778. Toggle Logbook mode. In Logbook mode, entries that where marked DONE while
  4779. logging was on (variable @code{org-log-done}) are shown in the agenda,
  4780. as are entries that have been clocked on that day.
  4781. @c
  4782. @kindex R
  4783. @item R
  4784. Toggle Clockreport mode. In clockreport mode, the daily/weekly agenda will
  4785. always show a table with the clocked times for the timespan and file scope
  4786. covered by the current agenda view. The initial setting for this mode in new
  4787. agenda buffers can be set with the variable
  4788. @code{org-agenda-start-with-follow-mode}.
  4789. @tsubheading{Change display}
  4790. @cindex display changing, in agenda
  4791. @kindex o
  4792. @item o
  4793. Delete other windows.
  4794. @c
  4795. @kindex d
  4796. @kindex w
  4797. @kindex m
  4798. @kindex y
  4799. @item d w m y
  4800. Switch to day/week/month/year view. When switching to day or week view,
  4801. this setting becomes the default for subsequent agenda commands. Since
  4802. month and year views are slow to create, they do not become the default.
  4803. A numeric prefix argument may be used to jump directly to a specific day
  4804. of the year, ISO week, month, or year, respectively. For example,
  4805. @kbd{32 d} jumps to February 1st, @kbd{9 w} to ISO week number 9. When
  4806. setting day, week, or month view, a year may be encoded in the prefix
  4807. argument as well. For example, @kbd{200712 w} will jump to week 12 in
  4808. 2007. If such a year specification has only one or two digits, it will
  4809. be mapped to the interval 1938-2037.
  4810. @c
  4811. @kindex D
  4812. @item D
  4813. Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}.
  4814. @c
  4815. @kindex G
  4816. @item G
  4817. Toggle the time grid on and off. See also the variables
  4818. @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}.
  4819. @c
  4820. @kindex r
  4821. @item r
  4822. Recreate the agenda buffer, for example to reflect the changes
  4823. after modification of the time stamps of items with S-@key{left} and
  4824. S-@key{right}. When the buffer is the global TODO list, a prefix
  4825. argument is interpreted to create a selective list for a specific TODO
  4826. keyword.
  4827. @kindex g
  4828. @item g
  4829. Same as @kbd{r}.
  4830. @c
  4831. @kindex s
  4832. @kindex C-x C-s
  4833. @item s
  4834. @itemx C-x C-s
  4835. Save all Org buffers in the current Emacs session.
  4836. @c
  4837. @kindex @key{right}
  4838. @item @key{right}
  4839. Display the following @code{org-agenda-ndays} days. For example, if
  4840. the display covers a week, switch to the following week. With prefix
  4841. arg, go forward that many times @code{org-agenda-ndays} days.
  4842. @c
  4843. @kindex @key{left}
  4844. @item @key{left}
  4845. Display the previous dates.
  4846. @c
  4847. @kindex .
  4848. @item .
  4849. Go to today.
  4850. @c
  4851. @kindex C-c C-x C-c
  4852. @item C-c C-x C-c
  4853. Invoke column view (@pxref{Column view}) in the agenda buffer. The column
  4854. view format is taken from the entry at point, or (if there is no entry at
  4855. point), from the first entry in the agenda view. So whatever the format for
  4856. that entry would be in the original buffer (taken from a property, from a
  4857. @code{#+COLUMNS} line, or from the default variable
  4858. @code{org-columns-default-format}), will be used in the agenda.
  4859. @tsubheading{Query editing}
  4860. @cindex query editing, in agenda
  4861. @kindex [
  4862. @kindex ]
  4863. @kindex @{
  4864. @kindex @}
  4865. @item [ ] @{ @}
  4866. In the @i{search view} (@pxref{Keyword search}), these keys add new
  4867. search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{}
  4868. and @kbd{@}}) to the query string. The opening bracket/brace will add a
  4869. positive search term prefixed by @samp{+}, indicating that this search
  4870. term @i{must} occur/match in the entry. Closing bracket/brace add a
  4871. negative search term which @i{must not} occur/match in the entry for it
  4872. to be selected.
  4873. @tsubheading{Remote editing}
  4874. @cindex remote editing, from agenda
  4875. @item 0-9
  4876. Digit argument.
  4877. @c
  4878. @cindex undoing remote-editing events
  4879. @cindex remote editing, undo
  4880. @kindex C-_
  4881. @item C-_
  4882. Undo a change due to a remote editing command. The change is undone
  4883. both in the agenda buffer and in the remote buffer.
  4884. @c
  4885. @kindex t
  4886. @item t
  4887. Change the TODO state of the item, both in the agenda and in the
  4888. original org file.
  4889. @c
  4890. @kindex C-k
  4891. @item C-k
  4892. Delete the current agenda item along with the entire subtree belonging
  4893. to it in the original Org file. If the text to be deleted remotely
  4894. is longer than one line, the kill needs to be confirmed by the user. See
  4895. variable @code{org-agenda-confirm-kill}.
  4896. @c
  4897. @kindex a
  4898. @item a
  4899. Toggle the ARCHIVE tag for the current headline.
  4900. @c
  4901. @kindex A
  4902. @item A
  4903. Move the subtree correspoding to the current entry to its @emph{Attic
  4904. Sibling}.
  4905. @c
  4906. @kindex $
  4907. @item $
  4908. Archive the subtree corresponding to the current headline. This means the
  4909. entry will be moved to the configured archive locatin, most likely a
  4910. different file.
  4911. @c
  4912. @kindex T
  4913. @item T
  4914. Show all tags associated with the current item. Because of
  4915. inheritance, this may be more than the tags listed in the line itself.
  4916. @c
  4917. @kindex :
  4918. @item :
  4919. Set tags for the current headline. If there is an active region in the
  4920. agenda, change a tag for all headings in the region.
  4921. @c
  4922. @kindex ,
  4923. @item ,
  4924. Set the priority for the current item. Org mode prompts for the
  4925. priority character. If you reply with @key{SPC}, the priority cookie
  4926. is removed from the entry.
  4927. @c
  4928. @kindex P
  4929. @item P
  4930. Display weighted priority of current item.
  4931. @c
  4932. @kindex +
  4933. @kindex S-@key{up}
  4934. @item +
  4935. @itemx S-@key{up}
  4936. Increase the priority of the current item. The priority is changed in
  4937. the original buffer, but the agenda is not resorted. Use the @kbd{r}
  4938. key for this.
  4939. @c
  4940. @kindex -
  4941. @kindex S-@key{down}
  4942. @item -
  4943. @itemx S-@key{down}
  4944. Decrease the priority of the current item.
  4945. @c
  4946. @kindex C-c C-s
  4947. @item C-c C-s
  4948. Schedule this item
  4949. @c
  4950. @kindex C-c C-d
  4951. @item C-c C-d
  4952. Set a deadline for this item.
  4953. @c
  4954. @kindex S-@key{right}
  4955. @item S-@key{right}
  4956. Change the time stamp associated with the current line by one day into the
  4957. future. With a numeric prefix argument, change it by that many days. For
  4958. example, @kbd{3 6 5 S-@key{right}} will change it by a year. The stamp is
  4959. changed in the original org file, but the change is not directly reflected in
  4960. the agenda buffer. Use the @kbd{r} key to update the buffer.
  4961. @c
  4962. @kindex S-@key{left}
  4963. @item S-@key{left}
  4964. Change the time stamp associated with the current line by one day
  4965. into the past.
  4966. @c
  4967. @kindex >
  4968. @item >
  4969. Change the time stamp associated with the current line to today.
  4970. The key @kbd{>} has been chosen, because it is the same as @kbd{S-.}
  4971. on my keyboard.
  4972. @c
  4973. @kindex I
  4974. @item I
  4975. Start the clock on the current item. If a clock is running already, it
  4976. is stopped first.
  4977. @c
  4978. @kindex O
  4979. @item O
  4980. Stop the previously started clock.
  4981. @c
  4982. @kindex X
  4983. @item X
  4984. Cancel the currently running clock.
  4985. @kindex J
  4986. @item J
  4987. Jump to the running clock in another window.
  4988. @tsubheading{Calendar commands}
  4989. @cindex calendar commands, from agenda
  4990. @kindex c
  4991. @item c
  4992. Open the Emacs calendar and move to the date at the agenda cursor.
  4993. @c
  4994. @item c
  4995. When in the calendar, compute and show the Org mode agenda for the
  4996. date at the cursor.
  4997. @c
  4998. @cindex diary entries, creating from agenda
  4999. @kindex i
  5000. @item i
  5001. Insert a new entry into the diary. Prompts for the type of entry
  5002. (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new
  5003. entry in the diary, just as @kbd{i d} etc. would do in the calendar.
  5004. The date is taken from the cursor position.
  5005. @c
  5006. @kindex M
  5007. @item M
  5008. Show the phases of the moon for the three months around current date.
  5009. @c
  5010. @kindex S
  5011. @item S
  5012. Show sunrise and sunset times. The geographical location must be set
  5013. with calendar variables, see documentation of the Emacs calendar.
  5014. @c
  5015. @kindex C
  5016. @item C
  5017. Convert the date at cursor into many other cultural and historic
  5018. calendars.
  5019. @c
  5020. @kindex H
  5021. @item H
  5022. Show holidays for three month around the cursor date.
  5023. @item M-x org-export-icalendar-combine-agenda-files
  5024. Export a single iCalendar file containing entries from all agenda files.
  5025. This is a globally available command, and also available in the agenda menu.
  5026. @tsubheading{Exporting to a file}
  5027. @kindex C-x C-w
  5028. @item C-x C-w
  5029. @cindex exporting agenda views
  5030. @cindex agenda views, exporting
  5031. Write the agenda view to a file. Depending on the extension of the
  5032. selected file name, the view will be exported as HTML (extension
  5033. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or
  5034. plain text (any other extension). Use the variable
  5035. @code{org-agenda-exporter-settings} to set options for @file{ps-print}
  5036. and for @file{htmlize} to be used during export.
  5037. @tsubheading{Quit and Exit}
  5038. @kindex q
  5039. @item q
  5040. Quit agenda, remove the agenda buffer.
  5041. @c
  5042. @kindex x
  5043. @cindex agenda files, removing buffers
  5044. @item x
  5045. Exit agenda, remove the agenda buffer and all buffers loaded by Emacs
  5046. for the compilation of the agenda. Buffers created by the user to
  5047. visit org files will not be removed.
  5048. @end table
  5049. @node Custom agenda views, , Agenda commands, Agenda Views
  5050. @section Custom agenda views
  5051. @cindex custom agenda views
  5052. @cindex agenda views, custom
  5053. Custom agenda commands serve two purposes: to store and quickly access
  5054. frequently used TODO and tags searches, and to create special composite
  5055. agenda buffers. Custom agenda commands will be accessible through the
  5056. dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
  5057. @menu
  5058. * Storing searches:: Type once, use often
  5059. * Block agenda:: All the stuff you need in a single buffer
  5060. * Setting Options:: Changing the rules
  5061. * Exporting Agenda Views:: Writing agendas to files
  5062. * Using the agenda elsewhere:: Using agenda information in other programs
  5063. @end menu
  5064. @node Storing searches, Block agenda, Custom agenda views, Custom agenda views
  5065. @subsection Storing searches
  5066. The first application of custom searches is the definition of keyboard
  5067. shortcuts for frequently used searches, either creating an agenda
  5068. buffer, or a sparse tree (the latter covering of course only the current
  5069. buffer).
  5070. @kindex C-c a C
  5071. Custom commands are configured in the variable
  5072. @code{org-agenda-custom-commands}. You can customize this variable, for
  5073. example by pressing @kbd{C-c a C}. You can also directly set it with
  5074. Emacs Lisp in @file{.emacs}. The following example contains all valid
  5075. search types:
  5076. @lisp
  5077. @group
  5078. (setq org-agenda-custom-commands
  5079. '(("w" todo "WAITING")
  5080. ("W" todo-tree "WAITING")
  5081. ("u" tags "+boss-urgent")
  5082. ("v" tags-todo "+boss-urgent")
  5083. ("U" tags-tree "+boss-urgent")
  5084. ("f" occur-tree "\\<FIXME\\>")
  5085. ("h" . "HOME+Name tags searches") ; description for "h" prefix
  5086. ("hl" tags "+home+Lisa")
  5087. ("hp" tags "+home+Peter")
  5088. ("hk" tags "+home+Kim")))
  5089. @end group
  5090. @end lisp
  5091. @noindent
  5092. The initial string in each entry defines the keys you have to press
  5093. after the dispatcher command @kbd{C-c a} in order to access the command.
  5094. Usually this will be just a single character, but if you have many
  5095. similar commands, you can also define two-letter combinations where the
  5096. first character is the same in several combinations and serves as a
  5097. prefix key@footnote{You can provide a description for a prefix key by
  5098. inserting a cons cell with the prefix and the description.}. The second
  5099. parameter is the search type, followed by the string or regular
  5100. expression to be used for the matching. The example above will
  5101. therefore define:
  5102. @table @kbd
  5103. @item C-c a w
  5104. as a global search for TODO entries with @samp{WAITING} as the TODO
  5105. keyword
  5106. @item C-c a W
  5107. as the same search, but only in the current buffer and displaying the
  5108. results as a sparse tree
  5109. @item C-c a u
  5110. as a global tags search for headlines marked @samp{:boss:} but not
  5111. @samp{:urgent:}
  5112. @item C-c a v
  5113. as the same search as @kbd{C-c a u}, but limiting the search to
  5114. headlines that are also TODO items
  5115. @item C-c a U
  5116. as the same search as @kbd{C-c a u}, but only in the current buffer and
  5117. displaying the result as a sparse tree
  5118. @item C-c a f
  5119. to create a sparse tree (again: current buffer only) with all entries
  5120. containing the word @samp{FIXME}
  5121. @item C-c a h
  5122. as a prefix command for a HOME tags search where you have to press an
  5123. additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa,
  5124. Peter, or Kim) as additional tag to match.
  5125. @end table
  5126. @node Block agenda, Setting Options, Storing searches, Custom agenda views
  5127. @subsection Block agenda
  5128. @cindex block agenda
  5129. @cindex agenda, with block views
  5130. Another possibility is the construction of agenda views that comprise
  5131. the results of @emph{several} commands, each of which creates a block in
  5132. the agenda buffer. The available commands include @code{agenda} for the
  5133. daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo}
  5134. for the global TODO list (as constructed with @kbd{C-c a t}), and the
  5135. matching commands discussed above: @code{todo}, @code{tags}, and
  5136. @code{tags-todo}. Here are two examples:
  5137. @lisp
  5138. @group
  5139. (setq org-agenda-custom-commands
  5140. '(("h" "Agenda and Home-related tasks"
  5141. ((agenda "")
  5142. (tags-todo "home")
  5143. (tags "garden")))
  5144. ("o" "Agenda and Office-related tasks"
  5145. ((agenda "")
  5146. (tags-todo "work")
  5147. (tags "office")))))
  5148. @end group
  5149. @end lisp
  5150. @noindent
  5151. This will define @kbd{C-c a h} to create a multi-block view for stuff
  5152. you need to attend to at home. The resulting agenda buffer will contain
  5153. your agenda for the current week, all TODO items that carry the tag
  5154. @samp{home}, and also all lines tagged with @samp{garden}. Finally the
  5155. command @kbd{C-c a o} provides a similar view for office tasks.
  5156. @node Setting Options, Exporting Agenda Views, Block agenda, Custom agenda views
  5157. @subsection Setting options for custom commands
  5158. @cindex options, for custom agenda views
  5159. Org mode contains a number of variables regulating agenda construction
  5160. and display. The global variables define the behavior for all agenda
  5161. commands, including the custom commands. However, if you want to change
  5162. some settings just for a single custom view, you can do so. Setting
  5163. options requires inserting a list of variable names and values at the
  5164. right spot in @code{org-agenda-custom-commands}. For example:
  5165. @lisp
  5166. @group
  5167. (setq org-agenda-custom-commands
  5168. '(("w" todo "WAITING"
  5169. ((org-agenda-sorting-strategy '(priority-down))
  5170. (org-agenda-prefix-format " Mixed: ")))
  5171. ("U" tags-tree "+boss-urgent"
  5172. ((org-show-following-heading nil)
  5173. (org-show-hierarchy-above nil)))
  5174. ("N" search ""
  5175. ((org-agenda-files '("~org/notes.org"))
  5176. (org-agenda-text-search-extra-files nil)))))
  5177. @end group
  5178. @end lisp
  5179. @noindent
  5180. Now the @kbd{C-c a w} command will sort the collected entries only by
  5181. priority, and the prefix format is modified to just say @samp{ Mixed: }
  5182. instead of giving the category of the entry. The sparse tags tree of
  5183. @kbd{C-c a U} will now turn out ultra-compact, because neither the
  5184. headline hierarchy above the match, nor the headline following the match
  5185. will be shown. The command @kbd{C-c a N} will do a text search limited
  5186. to only a single file.
  5187. For command sets creating a block agenda,
  5188. @code{org-agenda-custom-commands} has two separate spots for setting
  5189. options. You can add options that should be valid for just a single
  5190. command in the set, and options that should be valid for all commands in
  5191. the set. The former are just added to the command entry, the latter
  5192. must come after the list of command entries. Going back to the block
  5193. agenda example (@pxref{Block agenda}), let's change the sorting strategy
  5194. for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort
  5195. the results for GARDEN tags query in the opposite order,
  5196. @code{priority-up}. This would look like this:
  5197. @lisp
  5198. @group
  5199. (setq org-agenda-custom-commands
  5200. '(("h" "Agenda and Home-related tasks"
  5201. ((agenda)
  5202. (tags-todo "home")
  5203. (tags "garden"
  5204. ((org-agenda-sorting-strategy '(priority-up)))))
  5205. ((org-agenda-sorting-strategy '(priority-down))))
  5206. ("o" "Agenda and Office-related tasks"
  5207. ((agenda)
  5208. (tags-todo "work")
  5209. (tags "office")))))
  5210. @end group
  5211. @end lisp
  5212. As you see, the values and parenthesis setting is a little complex.
  5213. When in doubt, use the customize interface to set this variable - it
  5214. fully supports its structure. Just one caveat: When setting options in
  5215. this interface, the @emph{values} are just lisp expressions. So if the
  5216. value is a string, you need to add the double quotes around the value
  5217. yourself.
  5218. @node Exporting Agenda Views, Using the agenda elsewhere, Setting Options, Custom agenda views
  5219. @subsection Exporting Agenda Views
  5220. @cindex agenda views, exporting
  5221. If you are away from your computer, it can be very useful to have a
  5222. printed version of some agenda views to carry around. Org mode can
  5223. export custom agenda views as plain text, HTML@footnote{You need to
  5224. install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar
  5225. files. If you want to do this only occasionally, use the command
  5226. @table @kbd
  5227. @kindex C-x C-w
  5228. @item C-x C-w
  5229. @cindex exporting agenda views
  5230. @cindex agenda views, exporting
  5231. Write the agenda view to a file. Depending on the extension of the
  5232. selected file name, the view will be exported as HTML (extension
  5233. @file{.html} or @file{.htm}), Postscript (extension @file{.ps}),
  5234. iCalendar (extension @file{.ics}), or plain text (any other extension).
  5235. Use the variable @code{org-agenda-exporter-settings} to
  5236. set options for @file{ps-print} and for @file{htmlize} to be used during
  5237. export, for example
  5238. @lisp
  5239. (setq org-agenda-exporter-settings
  5240. '((ps-number-of-columns 2)
  5241. (ps-landscape-mode t)
  5242. (htmlize-output-type 'css)))
  5243. @end lisp
  5244. @end table
  5245. If you need to export certain agenda views frequently, you can associate
  5246. any custom agenda command with a list of output file names
  5247. @footnote{If you want to store standard views like the weekly agenda
  5248. or the global TODO list as well, you need to define custom commands for
  5249. them in order to be able to specify file names.}. Here is an example
  5250. that first does define custom commands for the agenda and the global
  5251. todo list, together with a number of files to which to export them.
  5252. Then we define two block agenda commands and specify file names for them
  5253. as well. File names can be relative to the current working directory,
  5254. or absolute.
  5255. @lisp
  5256. @group
  5257. (setq org-agenda-custom-commands
  5258. '(("X" agenda "" nil ("agenda.html" "agenda.ps"))
  5259. ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps"))
  5260. ("h" "Agenda and Home-related tasks"
  5261. ((agenda "")
  5262. (tags-todo "home")
  5263. (tags "garden"))
  5264. nil
  5265. ("~/views/home.html"))
  5266. ("o" "Agenda and Office-related tasks"
  5267. ((agenda)
  5268. (tags-todo "work")
  5269. (tags "office"))
  5270. nil
  5271. ("~/views/office.ps" "~/calendars/office.ics"))))
  5272. @end group
  5273. @end lisp
  5274. The extension of the file name determines the type of export. If it is
  5275. @file{.html}, Org mode will use the @file{htmlize.el} package to convert
  5276. the buffer to HTML and save it to this file name. If the extension is
  5277. @file{.ps}, @code{ps-print-buffer-with-faces} is used to produce
  5278. postscript output. If the extension is @file{.ics}, iCalendar export is
  5279. run export over all files that were used to construct the agenda, and
  5280. limit the export to entries listed in the agenda now. Any other
  5281. extension produces a plain ASCII file.
  5282. The export files are @emph{not} created when you use one of those
  5283. commands interactively because this might use too much overhead.
  5284. Instead, there is a special command to produce @emph{all} specified
  5285. files in one step:
  5286. @table @kbd
  5287. @kindex C-c a e
  5288. @item C-c a e
  5289. Export all agenda views that have export file names associated with
  5290. them.
  5291. @end table
  5292. You can use the options section of the custom agenda commands to also
  5293. set options for the export commands. For example:
  5294. @lisp
  5295. (setq org-agenda-custom-commands
  5296. '(("X" agenda ""
  5297. ((ps-number-of-columns 2)
  5298. (ps-landscape-mode t)
  5299. (org-agenda-prefix-format " [ ] ")
  5300. (org-agenda-with-colors nil)
  5301. (org-agenda-remove-tags t))
  5302. ("theagenda.ps"))))
  5303. @end lisp
  5304. @noindent
  5305. This command sets two options for the postscript exporter, to make it
  5306. print in two columns in landscape format - the resulting page can be cut
  5307. in two and then used in a paper agenda. The remaining settings modify
  5308. the agenda prefix to omit category and scheduling information, and
  5309. instead include a checkbox to check off items. We also remove the tags
  5310. to make the lines compact, and we don't want to use colors for the
  5311. black-and-white printer. Settings specified in
  5312. @code{org-agenda-exporter-settings} will also apply, but the settings
  5313. in @code{org-agenda-custom-commands} take precedence.
  5314. @noindent
  5315. From the command line you may also use
  5316. @example
  5317. emacs -f org-batch-store-agenda-views -kill
  5318. @end example
  5319. @noindent
  5320. or, if you need to modify some parameters
  5321. @example
  5322. emacs -eval '(org-batch-store-agenda-views \
  5323. org-agenda-ndays 30 \
  5324. org-agenda-start-day "2007-11-01" \
  5325. org-agenda-include-diary nil \
  5326. org-agenda-files (quote ("~/org/project.org")))' \
  5327. -kill
  5328. @end example
  5329. @noindent
  5330. which will create the agenda views restricted to the file
  5331. @file{~/org/project.org}, without diary entries and with 30 days
  5332. extent.
  5333. @node Using the agenda elsewhere, , Exporting Agenda Views, Custom agenda views
  5334. @subsection Using agenda information outside of Org
  5335. @cindex agenda, pipe
  5336. @cindex Scripts, for agenda processing
  5337. Org provides commands to access agenda information for the command
  5338. line in emacs batch mode. This extracted information can be sent
  5339. directly to a printer, or it can be read by a program that does further
  5340. processing of the data. The first of these commands is the function
  5341. @code{org-batch-agenda}, that produces an agenda view and sends it as
  5342. ASCII text to STDOUT. The command takes a single string as parameter.
  5343. If the string has length 1, it is used as a key to one of the commands
  5344. you have configured in @code{org-agenda-custom-commands}, basically any
  5345. key you can use after @kbd{C-c a}. For example, to directly print the
  5346. current TODO list, you could use
  5347. @example
  5348. emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
  5349. @end example
  5350. If the parameter is a string with 2 or more characters, it is used as a
  5351. tags/todo match string. For example, to print your local shopping list
  5352. (all items with the tag @samp{shop}, but excluding the tag
  5353. @samp{NewYork}), you could use
  5354. @example
  5355. emacs -batch -l ~/.emacs \
  5356. -eval '(org-batch-agenda "+shop-NewYork")' | lpr
  5357. @end example
  5358. @noindent
  5359. You may also modify parameters on the fly like this:
  5360. @example
  5361. emacs -batch -l ~/.emacs \
  5362. -eval '(org-batch-agenda "a" \
  5363. org-agenda-ndays 30 \
  5364. org-agenda-include-diary nil \
  5365. org-agenda-files (quote ("~/org/project.org")))' \
  5366. | lpr
  5367. @end example
  5368. @noindent
  5369. which will produce a 30 day agenda, fully restricted to the Org file
  5370. @file{~/org/projects.org}, not even including the diary.
  5371. If you want to process the agenda data in more sophisticated ways, you
  5372. can use the command @code{org-batch-agenda-csv} to get a comma-separated
  5373. list of values for each agenda item. Each line in the output will
  5374. contain a number of fields separated by commas. The fields in a line
  5375. are:
  5376. @example
  5377. category @r{The category of the item}
  5378. head @r{The headline, without TODO kwd, TAGS and PRIORITY}
  5379. type @r{The type of the agenda entry, can be}
  5380. todo @r{selected in TODO match}
  5381. tagsmatch @r{selected in tags match}
  5382. diary @r{imported from diary}
  5383. deadline @r{a deadline}
  5384. scheduled @r{scheduled}
  5385. timestamp @r{appointment, selected by timestamp}
  5386. closed @r{entry was closed on date}
  5387. upcoming-deadline @r{warning about nearing deadline}
  5388. past-scheduled @r{forwarded scheduled item}
  5389. block @r{entry has date block including date}
  5390. todo @r{The TODO keyword, if any}
  5391. tags @r{All tags including inherited ones, separated by colons}
  5392. date @r{The relevant date, like 2007-2-14}
  5393. time @r{The time, like 15:00-16:50}
  5394. extra @r{String with extra planning info}
  5395. priority-l @r{The priority letter if any was given}
  5396. priority-n @r{The computed numerical priority}
  5397. @end example
  5398. @noindent
  5399. Time and date will only be given if a timestamp (or deadline/scheduled)
  5400. lead to the selection of the item.
  5401. A CSV list like this is very easy to use in a post processing script.
  5402. For example, here is a Perl program that gets the TODO list from
  5403. Emacs/Org and prints all the items, preceded by a checkbox:
  5404. @example
  5405. @group
  5406. #!/usr/bin/perl
  5407. # define the Emacs command to run
  5408. $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'";
  5409. # run it and capture the output
  5410. $agenda = qx@{$cmd 2>/dev/null@};
  5411. # loop over all lines
  5412. foreach $line (split(/\n/,$agenda)) @{
  5413. # get the individual values
  5414. ($category,$head,$type,$todo,$tags,$date,$time,$extra,
  5415. $priority_l,$priority_n) = split(/,/,$line);
  5416. # proccess and print
  5417. print "[ ] $head\n";
  5418. @}
  5419. @end group
  5420. @end example
  5421. @node Embedded LaTeX, Exporting, Agenda Views, Top
  5422. @chapter Embedded LaTeX
  5423. @cindex @TeX{} interpretation
  5424. @cindex La@TeX{} interpretation
  5425. Plain ASCII is normally sufficient for almost all note taking. One
  5426. exception, however, are scientific notes which need to be able to contain
  5427. mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{}
  5428. is a macro system based on Donald E. Knuth's @TeX{} system. Many of the
  5429. features described here as ``La@TeX{}'' are really from @TeX{}, but for
  5430. simplicity I am blurring this distinction.} is widely used to typeset
  5431. scientific documents. Org mode supports embedding La@TeX{} code into its
  5432. files, because many academics are used to reading La@TeX{} source code, and
  5433. because it can be readily processed into images for HTML production.
  5434. It is not necessary to mark La@TeX{} macros and code in any special way.
  5435. If you observe a few conventions, Org mode knows how to find it and what
  5436. to do with it.
  5437. @menu
  5438. * Math symbols:: TeX macros for symbols and Greek letters
  5439. * Subscripts and superscripts:: Simple syntax for raising/lowering text
  5440. * LaTeX fragments:: Complex formulas made easy
  5441. * Processing LaTeX fragments:: Previewing LaTeX processing
  5442. * CDLaTeX mode:: Speed up entering of formulas
  5443. @end menu
  5444. @node Math symbols, Subscripts and superscripts, Embedded LaTeX, Embedded LaTeX
  5445. @section Math symbols
  5446. @cindex math symbols
  5447. @cindex TeX macros
  5448. You can use La@TeX{} macros to insert special symbols like @samp{\alpha}
  5449. to indicate the Greek letter, or @samp{\to} to indicate an arrow.
  5450. Completion for these macros is available, just type @samp{\} and maybe a
  5451. few letters, and press @kbd{M-@key{TAB}} to see possible completions.
  5452. Unlike La@TeX{} code, Org mode allows these macros to be present
  5453. without surrounding math delimiters, for example:
  5454. @example
  5455. Angles are written as Greek letters \alpha, \beta and \gamma.
  5456. @end example
  5457. During HTML export (@pxref{HTML export}), these symbols are translated
  5458. into the proper syntax for HTML, for the above examples this is
  5459. @samp{&alpha;} and @samp{&rarr;}, respectively.
  5460. @node Subscripts and superscripts, LaTeX fragments, Math symbols, Embedded LaTeX
  5461. @section Subscripts and superscripts
  5462. @cindex subscript
  5463. @cindex superscript
  5464. Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super-
  5465. and subscripts. Again, these can be used without embedding them in
  5466. math-mode delimiters. To increase the readability of ASCII text, it is
  5467. not necessary (but OK) to surround multi-character sub- and superscripts
  5468. with curly braces. For example
  5469. @example
  5470. The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of
  5471. the sun is R_@{sun@} = 6.96 x 10^8 m.
  5472. @end example
  5473. To avoid interpretation as raised or lowered text, you can quote
  5474. @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}.
  5475. During HTML export (@pxref{HTML export}), subscript and superscripts
  5476. are surrounded with @code{<sub>} and @code{<sup>} tags, respectively.
  5477. @node LaTeX fragments, Processing LaTeX fragments, Subscripts and superscripts, Embedded LaTeX
  5478. @section LaTeX fragments
  5479. @cindex LaTeX fragments
  5480. With symbols, sub- and superscripts, HTML is pretty much at its end when
  5481. it comes to representing mathematical formulas@footnote{Yes, there is
  5482. MathML, but that is not yet fully supported by many browsers, and there
  5483. is no decent converter for turning La@TeX{} or ASCII representations of
  5484. formulas into MathML. So for the time being, converting formulas into
  5485. images seems the way to go.}. More complex expressions need a dedicated
  5486. formula processor. To this end, Org mode can contain arbitrary La@TeX{}
  5487. fragments. It provides commands to preview the typeset result of these
  5488. fragments, and upon export to HTML, all fragments will be converted to
  5489. images and inlined into the HTML document@footnote{The La@TeX{} export
  5490. will not use images for displaying La@TeX{} fragments but include these
  5491. fragments directly into the La@TeX{} code.}. For this to work you
  5492. need to be on a system with a working La@TeX{} installation. You also
  5493. need the @file{dvipng} program, available at
  5494. @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that
  5495. will be used when processing a fragment can be configured with the
  5496. variable @code{org-format-latex-header}.
  5497. La@TeX{} fragments don't need any special marking at all. The following
  5498. snippets will be identified as La@TeX{} source code:
  5499. @itemize @bullet
  5500. @item
  5501. Environments of any kind. The only requirement is that the
  5502. @code{\begin} statement appears on a new line, preceded by only
  5503. whitespace.
  5504. @item
  5505. Text within the usual La@TeX{} math delimiters. To avoid conflicts with
  5506. currency specifications, single @samp{$} characters are only recognized
  5507. as math delimiters if the enclosed text contains at most two line breaks,
  5508. is directly attached to the @samp{$} characters with no whitespace in
  5509. between, and if the closing @samp{$} is followed by whitespace or
  5510. punctuation. For the other delimiters, there is no such restriction, so
  5511. when in doubt, use @samp{\(...\)} as inline math delimiters.
  5512. @end itemize
  5513. @noindent For example:
  5514. @example
  5515. \begin@{equation@} % arbitrary environments,
  5516. x=\sqrt@{b@} % even tables, figures
  5517. \end@{equation@} % etc
  5518. If $a^2=b$ and \( b=2 \), then the solution must be
  5519. either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
  5520. @end example
  5521. @noindent
  5522. If you need any of the delimiter ASCII sequences for other purposes, you
  5523. can configure the option @code{org-format-latex-options} to deselect the
  5524. ones you do not wish to have interpreted by the La@TeX{} converter.
  5525. @node Processing LaTeX fragments, CDLaTeX mode, LaTeX fragments, Embedded LaTeX
  5526. @section Processing LaTeX fragments
  5527. @cindex LaTeX fragments, preview
  5528. La@TeX{} fragments can be processed to produce a preview images of the
  5529. typeset expressions:
  5530. @table @kbd
  5531. @kindex C-c C-x C-l
  5532. @item C-c C-x C-l
  5533. Produce a preview image of the La@TeX{} fragment at point and overlay it
  5534. over the source code. If there is no fragment at point, process all
  5535. fragments in the current entry (between two headlines). When called
  5536. with a prefix argument, process the entire subtree. When called with
  5537. two prefix arguments, or when the cursor is before the first headline,
  5538. process the entire buffer.
  5539. @kindex C-c C-c
  5540. @item C-c C-c
  5541. Remove the overlay preview images.
  5542. @end table
  5543. During HTML export (@pxref{HTML export}), all La@TeX{} fragments are
  5544. converted into images and inlined into the document if the following
  5545. setting is active:
  5546. @lisp
  5547. (setq org-export-with-LaTeX-fragments t)
  5548. @end lisp
  5549. @node CDLaTeX mode, , Processing LaTeX fragments, Embedded LaTeX
  5550. @section Using CDLaTeX to enter math
  5551. @cindex CDLaTeX
  5552. CDLaTeX mode is a minor mode that is normally used in combination with a
  5553. major La@TeX{} mode like AUCTeX in order to speed-up insertion of
  5554. environments and math templates. Inside Org mode, you can make use of
  5555. some of the features of CDLaTeX mode. You need to install
  5556. @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with
  5557. AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}.
  5558. Don't turn CDLaTeX mode itself under Org mode, but use the light
  5559. version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it
  5560. on for the current buffer with @code{M-x org-cdlatex-mode}, or for all
  5561. Org files with
  5562. @lisp
  5563. (add-hook 'org-mode-hook 'turn-on-org-cdlatex)
  5564. @end lisp
  5565. When this mode is enabled, the following features are present (for more
  5566. details see the documentation of CDLaTeX mode):
  5567. @itemize @bullet
  5568. @kindex C-c @{
  5569. @item
  5570. Environment templates can be inserted with @kbd{C-c @{}.
  5571. @item
  5572. @kindex @key{TAB}
  5573. The @key{TAB} key will do template expansion if the cursor is inside a
  5574. La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is
  5575. inside such a fragment, see the documentation of the function
  5576. @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will
  5577. expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor
  5578. correctly inside the first brace. Another @key{TAB} will get you into
  5579. the second brace. Even outside fragments, @key{TAB} will expand
  5580. environment abbreviations at the beginning of a line. For example, if
  5581. you write @samp{equ} at the beginning of a line and press @key{TAB},
  5582. this abbreviation will be expanded to an @code{equation} environment.
  5583. To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}.
  5584. @item
  5585. @kindex _
  5586. @kindex ^
  5587. Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these
  5588. characters together with a pair of braces. If you use @key{TAB} to move
  5589. out of the braces, and if the braces surround only a single character or
  5590. macro, they are removed again (depending on the variable
  5591. @code{cdlatex-simplify-sub-super-scripts}).
  5592. @item
  5593. @kindex `
  5594. Pressing the backquote @kbd{`} followed by a character inserts math
  5595. macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds
  5596. after the backquote, a help window will pop up.
  5597. @item
  5598. @kindex '
  5599. Pressing the normal quote @kbd{'} followed by another character modifies
  5600. the symbol before point with an accent or a font. If you wait more than
  5601. 1.5 seconds after the backquote, a help window will pop up. Character
  5602. modification will work only inside La@TeX{} fragments, outside the quote
  5603. is normal.
  5604. @end itemize
  5605. @node Exporting, Publishing, Embedded LaTeX, Top
  5606. @chapter Exporting
  5607. @cindex exporting
  5608. Org mode documents can be exported into a variety of other formats. For
  5609. printing and sharing of notes, ASCII export produces a readable and
  5610. simple version of an Org file. HTML export allows you to publish a
  5611. notes file on the web, while the XOXO format provides a solid base for
  5612. exchange with a broad range of other applications. La@TeX{} export lets
  5613. you use Org mode and its structured editing functions to easily create
  5614. La@TeX{} files. To incorporate entries with associated times like
  5615. deadlines or appointments into a desktop calendar program like iCal,
  5616. Org mode can also produce extracts in the iCalendar format. Currently
  5617. Org mode only supports export, not import of these different formats.
  5618. When exporting, Org mode uses special conventions to enrich the output
  5619. produced. @xref{Text interpretation}, for more details.
  5620. @table @kbd
  5621. @kindex C-c C-e
  5622. @item C-c C-e
  5623. Dispatcher for export and publishing commands. Displays a help-window
  5624. listing the additional key(s) needed to launch an export or publishing
  5625. command.
  5626. @end table
  5627. @menu
  5628. * ASCII export:: Exporting to plain ASCII
  5629. * HTML export:: Exporting to HTML
  5630. * LaTeX export:: Exporting to LaTeX
  5631. * XOXO export:: Exporting to XOXO
  5632. * iCalendar export:: Exporting in iCalendar format
  5633. * Text interpretation:: How the exporter looks at the file
  5634. @end menu
  5635. @node ASCII export, HTML export, Exporting, Exporting
  5636. @section ASCII export
  5637. @cindex ASCII export
  5638. ASCII export produces a simple and very readable version of an Org mode
  5639. file.
  5640. @cindex region, active
  5641. @cindex active region
  5642. @cindex Transient mark mode
  5643. @table @kbd
  5644. @kindex C-c C-e a
  5645. @item C-c C-e a
  5646. Export as ASCII file. For an org file @file{myfile.org}, the ASCII file
  5647. will be @file{myfile.txt}. The file will be overwritten without
  5648. warning. If there is an active region, only the region will be
  5649. exported. If the selected region is a single tree, the tree head will
  5650. become the document title. If the tree head entry has or inherits an
  5651. @code{:EXPORT_FILE_NAME:} property, that name will be used for the
  5652. export.
  5653. @kindex C-c C-e v a
  5654. @item C-c C-e v a
  5655. Export only the visible part of the document.
  5656. @end table
  5657. @cindex headline levels, for exporting
  5658. In the exported version, the first 3 outline levels will become
  5659. headlines, defining a general document structure. Additional levels
  5660. will be exported as itemized lists. If you want that transition to occur
  5661. at a different level, specify it with a prefix argument. For example,
  5662. @example
  5663. @kbd{C-1 C-c C-e a}
  5664. @end example
  5665. @noindent
  5666. creates only top level headlines and does the rest as items. When
  5667. headlines are converted to items, the indentation of the text following
  5668. the headline is changed to fit nicely under the item. This is done with
  5669. the assumption that the first body line indicates the base indentation of
  5670. the body text. Any indentation larger than this is adjusted to preserve
  5671. the layout relative to the first line. Should there be lines with less
  5672. indentation than the first, these are left alone.
  5673. @node HTML export, LaTeX export, ASCII export, Exporting
  5674. @section HTML export
  5675. @cindex HTML export
  5676. Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive
  5677. HTML formatting, in ways similar to John Grubers @emph{markdown}
  5678. language, but with additional support for tables.
  5679. @menu
  5680. * HTML Export commands:: How to invoke LaTeX export
  5681. * Quoting HTML tags:: Using direct HTML in Org mode
  5682. * Links:: Transformation of links for HTML
  5683. * Images:: How to include images
  5684. * CSS support:: Changing the appearance of the output
  5685. @end menu
  5686. @node HTML Export commands, Quoting HTML tags, HTML export, HTML export
  5687. @subsection HTML export commands
  5688. @cindex region, active
  5689. @cindex active region
  5690. @cindex Transient mark mode
  5691. @table @kbd
  5692. @kindex C-c C-e h
  5693. @item C-c C-e h
  5694. Export as HTML file @file{myfile.html}. For an org file
  5695. @file{myfile.org}, the ASCII file will be @file{myfile.html}. The file
  5696. will be overwritten without warning. If there is an active region, only
  5697. the region will be exported. If the selected region is a single tree,
  5698. the tree head will become the document title. If the tree head entry
  5699. has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be
  5700. used for the export.
  5701. @kindex C-c C-e b
  5702. @item C-c C-e b
  5703. Export as HTML file and immediately open it with a browser.
  5704. @kindex C-c C-e H
  5705. @item C-c C-e H
  5706. Export to a temporary buffer, do not create a file.
  5707. @kindex C-c C-e R
  5708. @item C-c C-e R
  5709. Export the active region to a temporary buffer. With a prefix argument, do
  5710. not produce the file header and footer, but just the plain HTML section for
  5711. the region. This is good for cut-and-paste operations.
  5712. @kindex C-c C-e v h
  5713. @kindex C-c C-e v b
  5714. @kindex C-c C-e v H
  5715. @kindex C-c C-e v R
  5716. @item C-c C-e v h
  5717. @item C-c C-e v b
  5718. @item C-c C-e v H
  5719. @item C-c C-e v R
  5720. Export only the visible part of the document.
  5721. @item M-x org-export-region-as-html
  5722. Convert the region to HTML under the assumption that it was Org mode
  5723. syntax before. This is a global command that can be invoked in any
  5724. buffer.
  5725. @item M-x org-replace-region-by-HTML
  5726. Replace the active region (assumed to be in Org mode syntax) by HTML
  5727. code.
  5728. @end table
  5729. @cindex headline levels, for exporting
  5730. In the exported version, the first 3 outline levels will become headlines,
  5731. defining a general document structure. Additional levels will be exported as
  5732. itemized lists. If you want that transition to occur at a different level,
  5733. specify it with a numeric prefix argument. For example,
  5734. @example
  5735. @kbd{C-2 C-c C-e b}
  5736. @end example
  5737. @noindent
  5738. creates two levels of headings and does the rest as items.
  5739. @node Quoting HTML tags, Links, HTML Export commands, HTML export
  5740. @subsection Quoting HTML tags
  5741. Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and
  5742. @samp{&gt;} in HTML export. If you want to include simple HTML tags
  5743. which should be interpreted as such, mark them with @samp{@@} as in
  5744. @samp{@@<b>bold text@@</b>}. Note that this really works only for
  5745. simple tags. For more extensive HTML that should be copied verbatim to
  5746. the exported file use either
  5747. @example
  5748. #+HTML: Literal HTML code for export
  5749. @end example
  5750. @noindent or
  5751. @example
  5752. #+BEGIN_HTML
  5753. All lines between these markers are exported literally
  5754. #+END_HTML
  5755. @end example
  5756. @node Links, Images, Quoting HTML tags, HTML export
  5757. @subsection Links
  5758. @cindex links, in HTML export
  5759. @cindex internal links, in HTML export
  5760. @cindex external links, in HTML export
  5761. Internal links (@pxref{Internal links}) will continue to work in HTML
  5762. files only if they match a dedicated @samp{<<target>>}. Automatic links
  5763. created by radio targets (@pxref{Radio targets}) will also work in the
  5764. HTML file. Links to external files will still work if the HTML file is
  5765. in the same directory as the Org file. Links to other @file{.org}
  5766. files will be translated into HTML links under the assumption that an
  5767. HTML version also exists of the linked file. For information related to
  5768. linking files while publishing them to a publishing directory see
  5769. @ref{Publishing links}.
  5770. @node Images, CSS support, Links, HTML export
  5771. @subsection Images
  5772. @cindex images, inline in HTML
  5773. @cindex inlining images in HTML
  5774. HTML export can inline images given as links in the Org file, and
  5775. it can make an image the clickable part of a link. By
  5776. default@footnote{but see the variable
  5777. @code{org-export-html-inline-images}}, images are inlined if a link does
  5778. not have a description. So @samp{[[file:myimg.jpg]]} will be inlined,
  5779. while @samp{[[file:myimg.jpg][the image]]} will just produce a link
  5780. @samp{the image} that points to the image. If the description part
  5781. itself is a @code{file:} link or a @code{http:} URL pointing to an
  5782. image, this image will be inlined and activated so that clicking on the
  5783. image will activate the link. For example, to include a thumbnail that
  5784. will link to a high resolution version of the image, you could use:
  5785. @example
  5786. [[file:highres.jpg][file:thumb.jpg]]
  5787. @end example
  5788. @noindent
  5789. and you could use @code{http} addresses just as well.
  5790. @node CSS support, , Images, HTML export
  5791. @subsection CSS support
  5792. You can also give style information for the exported file. The HTML
  5793. exporter assigns the following CSS classes to appropriate parts of the
  5794. document - your style specifications may change these:
  5795. @example
  5796. .todo @r{TODO keywords}
  5797. .done @r{the DONE keyword}
  5798. .timestamp @r{time stamp}
  5799. .timestamp-kwd @r{keyword associated with a time stamp, like SCHEDULED}
  5800. .tag @r{tag in a headline}
  5801. .target @r{target for links}
  5802. @end example
  5803. The default style specification can be configured through the option
  5804. @code{org-export-html-style}. If you want to use a file-local style,
  5805. you may use file variables, best wrapped into a COMMENT section at the
  5806. end of the outline tree. For example@footnote{Under Emacs 21, the
  5807. continuation lines for a variable value should have no @samp{#} at the
  5808. start of the line.}:
  5809. @example
  5810. * COMMENT html style specifications
  5811. # Local Variables:
  5812. # org-export-html-style: " <style type=\"text/css\">
  5813. # p @{font-weight: normal; color: gray; @}
  5814. # h1 @{color: black; @}
  5815. # </style>"
  5816. # End:
  5817. @end example
  5818. Remember to execute @kbd{M-x normal-mode} after changing this to make
  5819. the new style visible to Emacs. This command restarts Org mode for the
  5820. current buffer and forces Emacs to re-evaluate the local variables
  5821. section in the buffer.
  5822. @c FIXME: More about header and footer styles
  5823. @c FIXME: Talk about links and targets.
  5824. @node LaTeX export, XOXO export, HTML export, Exporting
  5825. @section LaTeX export
  5826. @cindex LaTeX export
  5827. Org mode contains a La@TeX{} exporter written by Bastien Guerry.
  5828. @menu
  5829. * LaTeX export commands:: How to invoke LaTeX export
  5830. * Quoting LaTeX code:: Incorporating literal LaTeX code
  5831. * Sectioning structure:: Changing sectioning in LaTeX output
  5832. @end menu
  5833. @node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export
  5834. @subsection LaTeX export commands
  5835. @table @kbd
  5836. @kindex C-c C-e l
  5837. @item C-c C-e l
  5838. Export as La@TeX{} file @file{myfile.tex}.
  5839. @kindex C-c C-e L
  5840. @item C-c C-e L
  5841. Export to a temporary buffer, do not create a file.
  5842. @kindex C-c C-e v l
  5843. @kindex C-c C-e v L
  5844. @item C-c C-e v l
  5845. @item C-c C-e v L
  5846. Export only the visible part of the document.
  5847. @item M-x org-export-region-as-latex
  5848. Convert the region to La@TeX{} under the assumption that it was Org mode
  5849. syntax before. This is a global command that can be invoked in any
  5850. buffer.
  5851. @item M-x org-replace-region-by-latex
  5852. Replace the active region (assumed to be in Org mode syntax) by La@TeX{}
  5853. code.
  5854. @end table
  5855. @cindex headline levels, for exporting
  5856. In the exported version, the first 3 outline levels will become
  5857. headlines, defining a general document structure. Additional levels
  5858. will be exported as description lists. The exporter can ignore them or
  5859. convert them to a custom string depending on
  5860. @code{org-latex-low-levels}.
  5861. If you want that transition to occur at a different level, specify it
  5862. with a numeric prefix argument. For example,
  5863. @example
  5864. @kbd{C-2 C-c C-e l}
  5865. @end example
  5866. @noindent
  5867. creates two levels of headings and does the rest as items.
  5868. @node Quoting LaTeX code, Sectioning structure, LaTeX export commands, LaTeX export
  5869. @subsection Quoting LaTeX code
  5870. Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly
  5871. inserted into the La@TeX{} file. Furthermore, you can add special code
  5872. that should only be present in La@TeX{} export with the following
  5873. constructs:
  5874. @example
  5875. #+LaTeX: Literal LaTeX code for export
  5876. @end example
  5877. @noindent or
  5878. @example
  5879. #+BEGIN_LaTeX
  5880. All lines between these markers are exported literally
  5881. #+END_LaTeX
  5882. @end example
  5883. @node Sectioning structure, , Quoting LaTeX code, LaTeX export
  5884. @subsection Sectioning structure
  5885. @cindex LaTeX class
  5886. @cindex LaTeX sectioning structure
  5887. By default, the La@TeX{} output uses the class @code{article}.
  5888. You can change this globally by setting a different value for
  5889. @code{org-export-latex-default-class} or locally by adding an option
  5890. like @code{#+LaTeX_CLASS: myclass} in your file. The class should be
  5891. listed in @code{org-export-latex-classes}, where you can also define the
  5892. sectioning structure for each class.
  5893. @node XOXO export, iCalendar export, LaTeX export, Exporting
  5894. @section XOXO export
  5895. @cindex XOXO export
  5896. Org mode contains an exporter that produces XOXO-style output.
  5897. Currently, this exporter only handles the general outline structure and
  5898. does not interpret any additional Org mode features.
  5899. @table @kbd
  5900. @kindex C-c C-e x
  5901. @item C-c C-e x
  5902. Export as XOXO file @file{myfile.html}.
  5903. @kindex C-c C-e v
  5904. @item C-c C-e v x
  5905. Export only the visible part of the document.
  5906. @end table
  5907. @node iCalendar export, Text interpretation, XOXO export, Exporting
  5908. @section iCalendar export
  5909. @cindex iCalendar export
  5910. Some people like to use Org mode for keeping track of projects, but
  5911. still prefer a standard calendar application for anniversaries and
  5912. appointments. In this case it can be useful to have deadlines and
  5913. other time-stamped items in Org files show up in the calendar
  5914. application. Org mode can export calendar information in the standard
  5915. iCalendar format. If you also want to have TODO entries included in the
  5916. export, configure the variable @code{org-icalendar-include-todo}.
  5917. @table @kbd
  5918. @kindex C-c C-e i
  5919. @item C-c C-e i
  5920. Create iCalendar entries for the current file and store them in the same
  5921. directory, using a file extension @file{.ics}.
  5922. @kindex C-c C-e I
  5923. @item C-c C-e I
  5924. Like @kbd{C-c C-e i}, but do this for all files in
  5925. @code{org-agenda-files}. For each of these files, a separate iCalendar
  5926. file will be written.
  5927. @kindex C-c C-e c
  5928. @item C-c C-e c
  5929. Create a single large iCalendar file from all files in
  5930. @code{org-agenda-files} and write it to the file given by
  5931. @code{org-combined-agenda-icalendar-file}.
  5932. @end table
  5933. The export will honor SUMMARY, DESCRIPTION and LOCATION properties if
  5934. the selected entries have them. If not, the summary will be derived
  5935. from the headline, and the description from the body (limited to
  5936. @code{org-icalendar-include-body} characters).
  5937. How this calendar is best read and updated, depends on the application
  5938. you are using. The FAQ covers this issue.
  5939. @node Text interpretation, , iCalendar export, Exporting
  5940. @section Text interpretation by the exporter
  5941. The exporter backends interpret additional structure in the Org file
  5942. in order to produce better output.
  5943. @menu
  5944. * Comment lines:: Some lines will not be exported
  5945. * Initial text:: Text before the first headline
  5946. * Footnotes:: Numbers like [1]
  5947. * Quoted examples:: Inserting quoted chunks of text
  5948. * Enhancing text:: Subscripts, symbols and more
  5949. * Export options:: How to influence the export settings
  5950. @end menu
  5951. @node Comment lines, Initial text, Text interpretation, Text interpretation
  5952. @subsection Comment lines
  5953. @cindex comment lines
  5954. @cindex exporting, not
  5955. Lines starting with @samp{#} in column zero are treated as comments
  5956. and will never be exported. Also entire subtrees starting with the
  5957. word @samp{COMMENT} will never be exported.
  5958. @table @kbd
  5959. @kindex C-c ;
  5960. @item C-c ;
  5961. Toggle the COMMENT keyword at the beginning of an entry.
  5962. @end table
  5963. @node Initial text, Footnotes, Comment lines, Text interpretation
  5964. @subsection Text before the first headline
  5965. Org mode normally ignores any text before the first headline when
  5966. exporting, leaving this region for internal links to speed up navigation
  5967. etc. However, in publishing-oriented files, you might want to have some
  5968. text before the first headline, like a small introduction, special HTML
  5969. code with a navigation bar, etc. You can ask to have this part of the
  5970. file exported as well by setting the variable
  5971. @code{org-export-skip-text-before-1st-heading} to @code{nil}. On a
  5972. per-file basis, you can get the same effect with
  5973. @example
  5974. #+OPTIONS: skip:nil
  5975. @end example
  5976. The text before the first headline will be fully processed
  5977. (@pxref{Enhancing text}), and the first non-comment line becomes the
  5978. title of the exported document. If you need to include literal HTML,
  5979. use the special constructs described in @ref{Quoting HTML tags}. The
  5980. table of contents is normally inserted directly before the first
  5981. headline of the file. If you would like to get it to a different
  5982. location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by
  5983. itself at the desired location.
  5984. Finally, if you want to use the space before the first headline for
  5985. internal purposes, but @emph{still} want to place something before the
  5986. first headline when exporting the file, you can use the @code{#+TEXT}
  5987. construct:
  5988. @example
  5989. #+OPTIONS: skip:t
  5990. #+TEXT: This text will go before the *first* headline.
  5991. #+TEXT: We place the table of contents here:
  5992. #+TEXT: [TABLE-OF-CONTENTS]
  5993. #+TEXT: This goes between the table of contents and the first headline
  5994. @end example
  5995. @node Footnotes, Quoted examples, Initial text, Text interpretation
  5996. @subsection Footnotes
  5997. @cindex footnotes
  5998. @cindex @file{footnote.el}
  5999. Numbers in square brackets are treated as footnotes, so that you can use
  6000. the Emacs package @file{footnote.el} to create footnotes. For example:
  6001. @example
  6002. The Org homepage[1] clearly needs help from
  6003. a good web designer.
  6004. [1] The link is: http://orgmode.org
  6005. @end example
  6006. @noindent
  6007. @kindex C-c !
  6008. Note that the @file{footnote} package uses @kbd{C-c !} to invoke its
  6009. commands. This binding conflicts with the Org mode command for
  6010. inserting inactive time stamps. You could use the variable
  6011. @code{footnote-prefix} to switch footnotes commands to another key. Or,
  6012. if you are too used to this binding, you could use
  6013. @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change
  6014. the settings in Org.
  6015. @node Quoted examples, Enhancing text, Footnotes, Text interpretation
  6016. @subsection Quoted examples
  6017. @cindex quoted examples
  6018. @cindex examples, quoted
  6019. @cindex text, fixed width
  6020. @cindex fixed width text
  6021. When writing technical documents, you often need to insert examples that
  6022. are not further interpreted by Org mode. For historical reasons, there
  6023. are several ways to do this:
  6024. @itemize @bullet
  6025. @item
  6026. If a headline starts with the word @samp{QUOTE}, the text below the
  6027. headline will be typeset as fixed-width, to allow quoting of computer
  6028. codes etc.
  6029. @item
  6030. Lines starting with @samp{:} are also typeset in fixed-width font.
  6031. @table @kbd
  6032. @kindex C-c :
  6033. @item C-c :
  6034. Toggle fixed-width for entry (QUOTE) or region, see below.
  6035. @end table
  6036. @item
  6037. Finally, text between
  6038. @example
  6039. #+BEGIN_EXAMPLE
  6040. quoted text
  6041. #+END_EXAMPLE
  6042. @end example
  6043. will also be exported in this way.
  6044. @end itemize
  6045. @node Enhancing text, Export options, Quoted examples, Text interpretation
  6046. @subsection Enhancing text for export
  6047. @cindex enhancing text
  6048. @cindex richer text
  6049. Some of the export backends of Org mode allow for sophisticated text
  6050. formatting, this is true in particular for the HTML and La@TeX{}
  6051. backends. Org mode has a number of typing conventions that allow to
  6052. produce a richly formatted output.
  6053. @itemize @bullet
  6054. @cindex hand-formatted lists
  6055. @cindex lists, hand-formatted
  6056. @item
  6057. Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.}
  6058. or @samp{2)} as enumerator will be recognized and transformed if the
  6059. backend supports lists. See @xref{Plain lists}.
  6060. @cindex underlined text
  6061. @cindex bold text
  6062. @cindex italic text
  6063. @cindex verbatim text
  6064. @item
  6065. You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
  6066. and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}. Text
  6067. in the code and verbatim string is not processed for Org mode specific
  6068. syntax, it is exported verbatim.
  6069. @cindex horizontal rules, in exported files
  6070. @item
  6071. A line consisting of only dashes, and at least 5 of them, will be
  6072. exported as a horizontal line (@samp{<hr/>} in HTML).
  6073. @cindex LaTeX fragments, export
  6074. @cindex TeX macros, export
  6075. @item
  6076. Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML
  6077. entities or images (@pxref{Embedded LaTeX}).
  6078. @cindex tables, export
  6079. @item
  6080. Tables are transformed into native tables under the exporter, if the
  6081. export backend supports this. Data fields before the first horizontal
  6082. separator line will be formatted as table header fields.
  6083. @cindex fixed width
  6084. @item
  6085. If a headline starts with the word @samp{QUOTE}, the text below the
  6086. headline will be typeset as fixed-width, to allow quoting of computer
  6087. codes etc. Lines starting with @samp{:} are also typeset in fixed-width
  6088. font.
  6089. @table @kbd
  6090. @kindex C-c :
  6091. @item C-c :
  6092. Toggle fixed-width for entry (QUOTE) or region, see below.
  6093. @end table
  6094. Finally, text between
  6095. @example
  6096. #+BEGIN_EXAMPLE
  6097. quoted text
  6098. #+END_EXAMPLE
  6099. @end example
  6100. will also be exported in this way.
  6101. @cindex linebreak, forced
  6102. @item
  6103. A double backslash @emph{at the end of a line} enforces a line break at
  6104. this position.
  6105. @cindex HTML entities, LaTeX entities
  6106. @item
  6107. Strings like @code{\alpha} will be exported as @code{&alpha;}, in the
  6108. HTML output. These strings are exported as @code{$\alpha$} in the
  6109. La@TeX{} output. Similarly, @code{\nbsp} will become @code{&nbsp;} in
  6110. HTML and in La@TeX{}. This applies for a long list of entities, see
  6111. the variable @code{org-html-entities} for the complete list.
  6112. @c FIXME
  6113. @end itemize
  6114. If these conversions conflict with your habits of typing ASCII text,
  6115. they can all be turned off with corresponding variables. See the
  6116. customization group @code{org-export-general}, and the following section
  6117. which explains how to set export options with special lines in a
  6118. buffer.
  6119. @node Export options, , Enhancing text, Text interpretation
  6120. @subsection Export options
  6121. @cindex options, for export
  6122. @cindex completion, of option keywords
  6123. The exporter recognizes special lines in the buffer which provide
  6124. additional information. These lines may be put anywhere in the file.
  6125. The whole set of lines can be inserted into the buffer with @kbd{C-c
  6126. C-e t}. For individual lines, a good way to make sure the keyword is
  6127. correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
  6128. (@pxref{Completion}).
  6129. @table @kbd
  6130. @kindex C-c C-e t
  6131. @item C-c C-e t
  6132. Insert template with export options, see example below.
  6133. @end table
  6134. @example
  6135. #+TITLE: the title to be shown (default is the buffer name)
  6136. #+AUTHOR: the author (default taken from @code{user-full-name})
  6137. #+DATE: A date, fixed, of a format string for @code{format-time-string}
  6138. #+EMAIL: his/her email address (default from @code{user-mail-address})
  6139. #+LANGUAGE: language for HTML, e.g. @samp{en} (@code{org-export-default-language})
  6140. #+TEXT: Some descriptive text to be inserted at the beginning.
  6141. #+TEXT: Several lines may be given.
  6142. #+OPTIONS: H:2 num:t toc:t \n:nil @@:t ::t |:t ^:t f:t TeX:t ...
  6143. @end example
  6144. @noindent
  6145. The OPTIONS line is a compact form to specify export settings. Here
  6146. you can:
  6147. @cindex headline levels
  6148. @cindex section-numbers
  6149. @cindex table of contents
  6150. @cindex linebreak preservation
  6151. @cindex quoted HTML tags
  6152. @cindex fixed-width sections
  6153. @cindex tables
  6154. @cindex @TeX{}-like syntax for sub- and superscripts
  6155. @cindex footnotes
  6156. @cindex special strings
  6157. @cindex emphasized text
  6158. @cindex @TeX{} macros
  6159. @cindex La@TeX{} fragments
  6160. @cindex author info, in export
  6161. @cindex time info, in export
  6162. @example
  6163. H: @r{set the number of headline levels for export}
  6164. num: @r{turn on/off section-numbers}
  6165. toc: @r{turn on/off table of contents, or set level limit (integer)}
  6166. \n: @r{turn on/off linebreak-preservation}
  6167. @@: @r{turn on/off quoted HTML tags}
  6168. :: @r{turn on/off fixed-width sections}
  6169. |: @r{turn on/off tables}
  6170. ^: @r{turn on/off @TeX{}-like syntax for sub- and superscripts. If}
  6171. @r{you write "^:@{@}", @code{a_@{b@}} will be interpreted, but}
  6172. @r{the simple @code{a_b} will be left as it is.}
  6173. -: @r{turn on/off conversion of special strings.}
  6174. f: @r{turn on/off foototes like this[1].}
  6175. *: @r{turn on/off emphasized text (bold, italic, underlined)}
  6176. TeX: @r{turn on/off simple @TeX{} macros in plain text}
  6177. LaTeX: @r{turn on/off La@TeX{} fragments}
  6178. skip: @r{turn on/off skipping the text before the first heading}
  6179. author: @r{turn on/off inclusion of author name/email into exported file}
  6180. timestamp: @r{turn on/off inclusion creation time into exported file}
  6181. d: @r{turn on/off inclusion of drawers}
  6182. @end example
  6183. These options take effect in both the HTML and La@TeX{} export, except
  6184. for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and
  6185. @code{nil} for the La@TeX{} export.
  6186. @node Publishing, Miscellaneous, Exporting, Top
  6187. @chapter Publishing
  6188. @cindex publishing
  6189. Org includes@footnote{@file{org-publish.el} is not distributed with
  6190. Emacs 21, if you are still using Emacs 21, you need you need to download
  6191. this file separately.} a publishing management system that allows you to
  6192. configure automatic HTML conversion of @emph{projects} composed of
  6193. interlinked org files. This system is called @emph{org-publish}. You can
  6194. also configure org-publish to automatically upload your exported HTML
  6195. pages and related attachments, such as images and source code files, to
  6196. a web server. Org-publish turns Org into a web-site authoring tool.
  6197. You can also use Org-publish to convert files into La@TeX{}, or even
  6198. combine HTML and La@TeX{} conversion so that files are available in both
  6199. formats on the server@footnote{Since La@TeX{} files on a server are not
  6200. that helpful, you surely want to perform further conversion on them --
  6201. e.g. convert them to @code{PDF} format.}.
  6202. Org-publish has been contributed to Org by David O'Toole.
  6203. @menu
  6204. * Configuration:: Defining projects
  6205. * Sample configuration:: Example projects
  6206. * Triggering publication:: Publication commands
  6207. @end menu
  6208. @node Configuration, Sample configuration, Publishing, Publishing
  6209. @section Configuration
  6210. Publishing needs significant configuration to specify files, destination
  6211. and many other properties of a project.
  6212. @menu
  6213. * Project alist:: The central configuration variable
  6214. * Sources and destinations:: From here to there
  6215. * Selecting files:: What files are part of the project?
  6216. * Publishing action:: Setting the function doing the publishing
  6217. * Publishing options:: Tweaking HTML export
  6218. * Publishing links:: Which links keep working after publishing?
  6219. * Project page index:: Publishing a list of project files
  6220. @end menu
  6221. @node Project alist, Sources and destinations, Configuration, Configuration
  6222. @subsection The variable @code{org-publish-project-alist}
  6223. @cindex org-publish-project-alist
  6224. @cindex projects, for publishing
  6225. Org-publish is configured almost entirely through setting the value of
  6226. one variable, called @code{org-publish-project-alist}.
  6227. Each element of the list configures one project, and may be in one of
  6228. the two following forms:
  6229. @lisp
  6230. ("project-name" :property value :property value ...)
  6231. @r{or}
  6232. ("project-name" :components ("project-name" "project-name" ...))
  6233. @end lisp
  6234. In both cases, projects are configured by specifying property values.
  6235. A project defines the set of files that will be published, as well as
  6236. the publishing configuration to use when publishing those files. When
  6237. a project takes the second form listed above, the individual members
  6238. of the ``components'' property are taken to be components of the
  6239. project, which group together files requiring different publishing
  6240. options. When you publish such a ``meta-project'' all the components
  6241. will also publish.
  6242. @node Sources and destinations, Selecting files, Project alist, Configuration
  6243. @subsection Sources and destinations for files
  6244. @cindex directories, for publishing
  6245. Most properties are optional, but some should always be set. In
  6246. particular, org-publish needs to know where to look for source files,
  6247. and where to put published files.
  6248. @multitable @columnfractions 0.3 0.7
  6249. @item @code{:base-directory}
  6250. @tab Directory containing publishing source files
  6251. @item @code{:publishing-directory}
  6252. @tab Directory (possibly remote) where output files will be published.
  6253. @item @code{:preparation-function}
  6254. @tab Function called before starting publishing process, for example to
  6255. run @code{make} for updating files to be published.
  6256. @end multitable
  6257. @noindent
  6258. @node Selecting files, Publishing action, Sources and destinations, Configuration
  6259. @subsection Selecting files
  6260. @cindex files, selecting for publishing
  6261. By default, all files with extension @file{.org} in the base directory
  6262. are considered part of the project. This can be modified by setting the
  6263. properties
  6264. @multitable @columnfractions 0.25 0.75
  6265. @item @code{:base-extension}
  6266. @tab Extension (without the dot!) of source files. This actually is a
  6267. regular expression.
  6268. @item @code{:exclude}
  6269. @tab Regular expression to match file names that should not be
  6270. published, even though they have been selected on the basis of their
  6271. extension.
  6272. @item @code{:include}
  6273. @tab List of files to be included regardless of @code{:base-extension}
  6274. and @code{:exclude}.
  6275. @end multitable
  6276. @node Publishing action, Publishing options, Selecting files, Configuration
  6277. @subsection Publishing action
  6278. @cindex action, for publishing
  6279. Publishing means that a file is copied to the destination directory and
  6280. possibly transformed in the process. The default transformation is to
  6281. export Org files as HTML files, and this is done by the function
  6282. @code{org-publish-org-to-html} which calls the HTML exporter
  6283. (@pxref{HTML export}). But you also can publish your files in La@TeX{} by
  6284. using the function @code{org-publish-org-to-latex} instead. Other files
  6285. like images only need to be copied to the publishing destination. For
  6286. non-Org files, you need to specify the publishing function.
  6287. @multitable @columnfractions 0.3 0.7
  6288. @item @code{:publishing-function}
  6289. @tab Function executing the publication of a file. This may also be a
  6290. list of functions, which will all be called in turn.
  6291. @end multitable
  6292. The function must accept two arguments: a property list containing at
  6293. least a @code{:publishing-directory} property, and the name of the file
  6294. to be published. It should take the specified file, make the necessary
  6295. transformation (if any) and place the result into the destination folder.
  6296. You can write your own publishing function, but @code{org-publish}
  6297. provides one for attachments (files that only need to be copied):
  6298. @code{org-publish-attachment}.
  6299. @node Publishing options, Publishing links, Publishing action, Configuration
  6300. @subsection Options for the HTML/LaTeX exporters
  6301. @cindex options, for publishing
  6302. The property list can be used to set many export options for the HTML
  6303. and La@TeX{} exporters. In most cases, these properties correspond to user
  6304. variables in Org. The table below lists these properties along
  6305. with the variable they belong to. See the documentation string for the
  6306. respective variable for details.
  6307. @multitable @columnfractions 0.3 0.7
  6308. @item @code{:language} @tab @code{org-export-default-language}
  6309. @item @code{:headline-levels} @tab @code{org-export-headline-levels}
  6310. @item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
  6311. @item @code{:table-of-contents} @tab @code{org-export-with-toc}
  6312. @item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
  6313. @item @code{:emphasize} @tab @code{org-export-with-emphasize}
  6314. @item @code{:sub-superscript} @tab @code{org-export-with-sub-superscripts}
  6315. @item @code{:special-strings} @tab @code{org-export-with-special-strings}
  6316. @item @code{:TeX-macros} @tab @code{org-export-with-TeX-macros}
  6317. @item @code{:LaTeX-fragments} @tab @code{org-export-with-LaTeX-fragments}
  6318. @item @code{:fixed-width} @tab @code{org-export-with-fixed-width}
  6319. @item @code{:timestamps} .@tab @code{org-export-with-timestamps}
  6320. @item @code{:tags} .@tab @code{org-export-with-tags}
  6321. @item @code{:tables} @tab @code{org-export-with-tables}
  6322. @item @code{:table-auto-headline} @tab @code{org-export-highlight-first-table-line}
  6323. @item @code{:style} @tab @code{org-export-html-style}
  6324. @item @code{:convert-org-links} @tab @code{org-export-html-link-org-files-as-html}
  6325. @item @code{:inline-images} @tab @code{org-export-html-inline-images}
  6326. @item @code{:expand-quoted-html} @tab @code{org-export-html-expand}
  6327. @item @code{:timestamp} @tab @code{org-export-html-with-timestamp}
  6328. @item @code{:publishing-directory} @tab @code{org-export-publishing-directory}
  6329. @item @code{:preamble} @tab @code{org-export-html-preamble}
  6330. @item @code{:postamble} @tab @code{org-export-html-postamble}
  6331. @item @code{:auto-preamble} @tab @code{org-export-html-auto-preamble}
  6332. @item @code{:auto-postamble} @tab @code{org-export-html-auto-postamble}
  6333. @item @code{:author} @tab @code{user-full-name}
  6334. @item @code{:email} @tab @code{user-mail-address}
  6335. @end multitable
  6336. If you use several email addresses, separate them by a semi-column.
  6337. Most of the @code{org-export-with-*} variables have the same effect in
  6338. both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and
  6339. @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the
  6340. La@TeX{} export.
  6341. When a property is given a value in @code{org-publish-project-alist},
  6342. its setting overrides the value of the corresponding user variable (if
  6343. any) during publishing. Options set within a file (@pxref{Export
  6344. options}), however, override everything.
  6345. @node Publishing links, Project page index, Publishing options, Configuration
  6346. @subsection Links between published files
  6347. @cindex links, publishing
  6348. To create a link from one Org file to another, you would use
  6349. something like @samp{[[file:foo.org][The foo]]} or simply
  6350. @samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link
  6351. becomes a link to @file{foo.html}. In this way, you can interlink the
  6352. pages of your "org web" project and the links will work as expected when
  6353. you publish them to HTML.
  6354. You may also link to related files, such as images. Provided you are
  6355. careful with relative pathnames, and provided you have also configured
  6356. @code{org-publish} to upload the related files, these links will work
  6357. too. @ref{Complex example} for an example of this usage.
  6358. Sometime an Org file to be published may contain links that are
  6359. only valid in your production environment, but not in the publishing
  6360. location. In this case, use the property
  6361. @multitable @columnfractions 0.4 0.6
  6362. @item @code{:link-validation-function}
  6363. @tab Function to validate links
  6364. @end multitable
  6365. @noindent
  6366. to define a function for checking link validity. This function must
  6367. accept two arguments, the file name and a directory relative to which
  6368. the file name is interpreted in the production environment. If this
  6369. function returns @code{nil}, then the HTML generator will only insert a
  6370. description into the HTML file, but no link. One option for this
  6371. function is @code{org-publish-validate-link} which checks if the given
  6372. file is part of any project in @code{org-publish-project-alist}.
  6373. @node Project page index, , Publishing links, Configuration
  6374. @subsection Project page index
  6375. @cindex index, of published pages
  6376. The following properties may be used to control publishing of an
  6377. index of files or summary page for a given project.
  6378. @multitable @columnfractions 0.25 0.75
  6379. @item @code{:auto-index}
  6380. @tab When non-nil, publish an index during org-publish-current-project or
  6381. org-publish-all.
  6382. @item @code{:index-filename}
  6383. @tab Filename for output of index. Defaults to @file{index.org} (which
  6384. becomes @file{index.html}).
  6385. @item @code{:index-title}
  6386. @tab Title of index page. Defaults to name of file.
  6387. @item @code{:index-function}
  6388. @tab Plug-in function to use for generation of index.
  6389. Defaults to @code{org-publish-org-index}, which generates a plain list
  6390. of links to all files in the project.
  6391. @end multitable
  6392. @node Sample configuration, Triggering publication, Configuration, Publishing
  6393. @section Sample configuration
  6394. Below we provide two example configurations. The first one is a simple
  6395. project publishing only a set of Org files. The second example is
  6396. more complex, with a multi-component project.
  6397. @menu
  6398. * Simple example:: One-component publishing
  6399. * Complex example:: A multi-component publishing example
  6400. @end menu
  6401. @node Simple example, Complex example, Sample configuration, Sample configuration
  6402. @subsection Example: simple publishing configuration
  6403. This example publishes a set of Org files to the @file{public_html}
  6404. directory on the local machine.
  6405. @lisp
  6406. (setq org-publish-project-alist
  6407. '(("org"
  6408. :base-directory "~/org/"
  6409. :publishing-directory "~/public_html"
  6410. :section-numbers nil
  6411. :table-of-contents nil
  6412. :style "<link rel=stylesheet
  6413. href=\"../other/mystyle.css\"
  6414. type=\"text/css\">")))
  6415. @end lisp
  6416. @node Complex example, , Simple example, Sample configuration
  6417. @subsection Example: complex publishing configuration
  6418. This more complicated example publishes an entire website, including
  6419. org files converted to HTML, image files, emacs lisp source code, and
  6420. style sheets. The publishing-directory is remote and private files are
  6421. excluded.
  6422. To ensure that links are preserved, care should be taken to replicate
  6423. your directory structure on the web server, and to use relative file
  6424. paths. For example, if your org files are kept in @file{~/org} and your
  6425. publishable images in @file{~/images}, you'd link to an image with
  6426. @c
  6427. @example
  6428. file:../images/myimage.png
  6429. @end example
  6430. @c
  6431. On the web server, the relative path to the image should be the
  6432. same. You can accomplish this by setting up an "images" folder in the
  6433. right place on the web server, and publishing images to it.
  6434. @lisp
  6435. (setq org-publish-project-alist
  6436. '(("orgfiles"
  6437. :base-directory "~/org/"
  6438. :base-extension "org"
  6439. :publishing-directory "/ssh:user@@host:~/html/notebook/"
  6440. :publishing-function org-publish-org-to-html
  6441. :exclude "PrivatePage.org" ;; regexp
  6442. :headline-levels 3
  6443. :section-numbers nil
  6444. :table-of-contents nil
  6445. :style "<link rel=stylesheet
  6446. href=\"../other/mystyle.css\" type=\"text/css\">"
  6447. :auto-preamble t
  6448. :auto-postamble nil)
  6449. ("images"
  6450. :base-directory "~/images/"
  6451. :base-extension "jpg\\|gif\\|png"
  6452. :publishing-directory "/ssh:user@@host:~/html/images/"
  6453. :publishing-function org-publish-attachment)
  6454. ("other"
  6455. :base-directory "~/other/"
  6456. :base-extension "css\\|el"
  6457. :publishing-directory "/ssh:user@@host:~/html/other/"
  6458. :publishing-function org-publish-attachment)
  6459. ("website" :components ("orgfiles" "images" "other"))))
  6460. @end lisp
  6461. @node Triggering publication, , Sample configuration, Publishing
  6462. @section Triggering publication
  6463. Once org-publish is properly configured, you can publish with the
  6464. following functions:
  6465. @table @kbd
  6466. @item C-c C-e C
  6467. Prompt for a specific project and publish all files that belong to it.
  6468. @item C-c C-e P
  6469. Publish the project containing the current file.
  6470. @item C-c C-e F
  6471. Publish only the current file.
  6472. @item C-c C-e A
  6473. Publish all projects.
  6474. @end table
  6475. Org uses timestamps to track when a file has changed. The above
  6476. functions normally only publish changed files. You can override this and
  6477. force publishing of all files by giving a prefix argument.
  6478. @node Miscellaneous, Extensions and Hacking, Publishing, Top
  6479. @chapter Miscellaneous
  6480. @menu
  6481. * Completion:: M-TAB knows what you need
  6482. * Customization:: Adapting Org to your taste
  6483. * In-buffer settings:: Overview of the #+KEYWORDS
  6484. * The very busy C-c C-c key:: When in doubt, press C-c C-c
  6485. * Clean view:: Getting rid of leading stars in the outline
  6486. * TTY keys:: Using Org on a tty
  6487. * Interaction:: Other Emacs packages
  6488. * Bugs:: Things which do not work perfectly
  6489. @end menu
  6490. @node Completion, Customization, Miscellaneous, Miscellaneous
  6491. @section Completion
  6492. @cindex completion, of @TeX{} symbols
  6493. @cindex completion, of TODO keywords
  6494. @cindex completion, of dictionary words
  6495. @cindex completion, of option keywords
  6496. @cindex completion, of tags
  6497. @cindex completion, of property keys
  6498. @cindex completion, of link abbreviations
  6499. @cindex @TeX{} symbol completion
  6500. @cindex TODO keywords completion
  6501. @cindex dictionary word completion
  6502. @cindex option keyword completion
  6503. @cindex tag completion
  6504. @cindex link abbreviations, completion of
  6505. Org supports in-buffer completion. This type of completion does
  6506. not make use of the minibuffer. You simply type a few letters into
  6507. the buffer and use the key to complete text right there.
  6508. @table @kbd
  6509. @kindex M-@key{TAB}
  6510. @item M-@key{TAB}
  6511. Complete word at point
  6512. @itemize @bullet
  6513. @item
  6514. At the beginning of a headline, complete TODO keywords.
  6515. @item
  6516. After @samp{\}, complete @TeX{} symbols supported by the exporter.
  6517. @item
  6518. After @samp{*}, complete headlines in the current buffer so that they
  6519. can be used in search links like @samp{[[*find this headline]]}.
  6520. @item
  6521. After @samp{:} in a headline, complete tags. The list of tags is taken
  6522. from the variable @code{org-tag-alist} (possibly set through the
  6523. @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created
  6524. dynamically from all tags used in the current buffer.
  6525. @item
  6526. After @samp{:} and not in a headline, complete property keys. The list
  6527. of keys is constructed dynamically from all keys used in the current
  6528. buffer.
  6529. @item
  6530. After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
  6531. @item
  6532. After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
  6533. @samp{OPTIONS} which set file-specific options for Org mode. When the
  6534. option keyword is already complete, pressing @kbd{M-@key{TAB}} again
  6535. will insert example settings for this keyword.
  6536. @item
  6537. In the line after @samp{#+STARTUP: }, complete startup keywords,
  6538. i.e. valid keys for this line.
  6539. @item
  6540. Elsewhere, complete dictionary words using Ispell.
  6541. @end itemize
  6542. @end table
  6543. @node Customization, In-buffer settings, Completion, Miscellaneous
  6544. @section Customization
  6545. @cindex customization
  6546. @cindex options, for customization
  6547. @cindex variables, for customization
  6548. There are more than 180 variables that can be used to customize
  6549. Org. For the sake of compactness of the manual, I am not
  6550. describing the variables here. A structured overview of customization
  6551. variables is available with @kbd{M-x org-customize}. Or select
  6552. @code{Browse Org Group} from the @code{Org->Customization} menu. Many
  6553. settings can also be activated on a per-file basis, by putting special
  6554. lines into the buffer (@pxref{In-buffer settings}).
  6555. @node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous
  6556. @section Summary of in-buffer settings
  6557. @cindex in-buffer settings
  6558. @cindex special keywords
  6559. Org mode uses special lines in the buffer to define settings on a
  6560. per-file basis. These lines start with a @samp{#+} followed by a
  6561. keyword, a colon, and then individual words defining a setting. Several
  6562. setting words can be in the same line, but you can also have multiple
  6563. lines for the keyword. While these settings are described throughout
  6564. the manual, here is a summary. After changing any of those lines in the
  6565. buffer, press @kbd{C-c C-c} with the cursor still in the line to
  6566. activate the changes immediately. Otherwise they become effective only
  6567. when the file is visited again in a new Emacs session.
  6568. @table @kbd
  6569. @item #+ARCHIVE: %s_done::
  6570. This line sets the archive location for the agenda file. It applies for
  6571. all subsequent lines until the next @samp{#+ARCHIVE} line, or the end
  6572. of the file. The first such line also applies to any entries before it.
  6573. The corresponding variable is @code{org-archive-location}.
  6574. @item #+CATEGORY:
  6575. This line sets the category for the agenda file. The category applies
  6576. for all subsequent lines until the next @samp{#+CATEGORY} line, or the
  6577. end of the file. The first such line also applies to any entries before it.
  6578. @item #+COLUMNS: %25ITEM .....
  6579. Set the default format for columns view. This format applies when
  6580. columns view is invoked in location where no @code{COLUMNS} property
  6581. applies.
  6582. @item #+CONSTANTS: name1=value1 ...
  6583. Set file-local values for constants to be used in table formulas. This
  6584. line set the local variable @code{org-table-formula-constants-local}.
  6585. The global version of this variable is
  6586. @code{org-table-formula-constants}.
  6587. @item #+DRAWERS: NAME1 .....
  6588. Set the file-local set of drawers. The corresponding global variable is
  6589. @code{org-drawers}.
  6590. @item #+LINK: linkword replace
  6591. These lines (several are allowed) specify link abbreviations.
  6592. @xref{Link abbreviations}. The corresponding variable is
  6593. @code{org-link-abbrev-alist}.
  6594. @item #+PRIORITIES: highest lowest default
  6595. This line sets the limits and the default for the priorities. All three
  6596. must be either letters A-Z or numbers 0-9. The highest priority must
  6597. have a lower ASCII number that the lowest priority.
  6598. @item #+PROPERTY: Property_Name Value
  6599. This line sets a default inheritance value for entries in the current
  6600. buffer, most useful for specifying the allowed values of a property.
  6601. @item #+STARTUP:
  6602. This line sets options to be used at startup of Org mode, when an
  6603. Org file is being visited. The first set of options deals with the
  6604. initial visibility of the outline tree. The corresponding variable for
  6605. global default settings is @code{org-startup-folded}, with a default
  6606. value @code{t}, which means @code{overview}.
  6607. @cindex @code{overview}, STARTUP keyword
  6608. @cindex @code{content}, STARTUP keyword
  6609. @cindex @code{showall}, STARTUP keyword
  6610. @example
  6611. overview @r{top-level headlines only}
  6612. content @r{all headlines}
  6613. showall @r{no folding at all, show everything}
  6614. @end example
  6615. Then there are options for aligning tables upon visiting a file. This
  6616. is useful in files containing narrowed table columns. The corresponding
  6617. variable is @code{org-startup-align-all-tables}, with a default value
  6618. @code{nil}.
  6619. @cindex @code{align}, STARTUP keyword
  6620. @cindex @code{noalign}, STARTUP keyword
  6621. @example
  6622. align @r{align all tables}
  6623. noalign @r{don't align tables on startup}
  6624. @end example
  6625. Logging closing and reinstating TODO items, and clock intervals
  6626. (variables @code{org-log-done}, @code{org-log-note-clock-out}, and
  6627. @code{org-log-repeat}) can be configured using these options.
  6628. @cindex @code{logdone}, STARTUP keyword
  6629. @cindex @code{lognotedone}, STARTUP keyword
  6630. @cindex @code{nologdone}, STARTUP keyword
  6631. @cindex @code{lognoteclock-out}, STARTUP keyword
  6632. @cindex @code{nolognoteclock-out}, STARTUP keyword
  6633. @cindex @code{logrepeat}, STARTUP keyword
  6634. @cindex @code{lognoterepeat}, STARTUP keyword
  6635. @cindex @code{nologrepeat}, STARTUP keyword
  6636. @example
  6637. logdone @r{record a timestamp when an item is marked DONE}
  6638. lognotedone @r{record timestamp and a note when DONE}
  6639. nologdone @r{don't record when items are marked DONE}
  6640. logrepeat @r{record a time when reinstating a repeating item}
  6641. lognoterepeat @r{record a note when reinstating a repeating item}
  6642. nologrepeat @r{do not record when reinstating repeating item}
  6643. lognoteclock-out @r{record a note when clocking out}
  6644. nolognoteclock-out @r{don't record a note when clocking out}
  6645. @end example
  6646. Here are the options for hiding leading stars in outline headings. The
  6647. corresponding variables are @code{org-hide-leading-stars} and
  6648. @code{org-odd-levels-only}, both with a default setting @code{nil}
  6649. (meaning @code{showstars} and @code{oddeven}).
  6650. @cindex @code{hidestars}, STARTUP keyword
  6651. @cindex @code{showstars}, STARTUP keyword
  6652. @cindex @code{odd}, STARTUP keyword
  6653. @cindex @code{even}, STARTUP keyword
  6654. @example
  6655. hidestars @r{make all but one of the stars starting a headline invisible.}
  6656. showstars @r{show all stars starting a headline}
  6657. odd @r{allow only odd outline levels (1,3,...)}
  6658. oddeven @r{allow all outline levels}
  6659. @end example
  6660. To turn on custom format overlays over time stamps (variables
  6661. @code{org-put-time-stamp-overlays} and
  6662. @code{org-time-stamp-overlay-formats}), use
  6663. @cindex @code{customtime}, STARTUP keyword
  6664. @example
  6665. customtime @r{overlay custom time format}
  6666. @end example
  6667. The following options influence the table spreadsheet (variable
  6668. @code{constants-unit-system}).
  6669. @cindex @code{constcgs}, STARTUP keyword
  6670. @cindex @code{constSI}, STARTUP keyword
  6671. @example
  6672. constcgs @r{@file{constants.el} should use the c-g-s unit system}
  6673. constSI @r{@file{constants.el} should use the SI unit system}
  6674. @end example
  6675. @item #+TAGS: TAG1(c1) TAG2(c2)
  6676. These lines (several such lines are allowed) specify the valid tags in
  6677. this file, and (potentially) the corresponding @emph{fast tag selection}
  6678. keys. The corresponding variable is @code{org-tag-alist}.
  6679. @item #+TBLFM:
  6680. This line contains the formulas for the table directly above the line.
  6681. @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE:
  6682. These lines provide settings for exporting files. For more details see
  6683. @ref{Export options}.
  6684. @item #+SEQ_TODO: #+TYP_TODO:
  6685. These lines set the TODO keywords and their interpretation in the
  6686. current file. The corresponding variables are @code{org-todo-keywords}
  6687. and @code{org-todo-interpretation}.
  6688. @end table
  6689. @node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous
  6690. @section The very busy C-c C-c key
  6691. @kindex C-c C-c
  6692. @cindex C-c C-c, overview
  6693. The key @kbd{C-c C-c} has many purposes in Org, which are all
  6694. mentioned scattered throughout this manual. One specific function of
  6695. this key is to add @emph{tags} to a headline (@pxref{Tags}). In many
  6696. other circumstances it means something like @emph{Hey Org, look
  6697. here and update according to what you see here}. Here is a summary of
  6698. what this means in different contexts.
  6699. @itemize @minus
  6700. @item
  6701. If there are highlights in the buffer from the creation of a sparse
  6702. tree, or from clock display, remove these highlights.
  6703. @item
  6704. If the cursor is in one of the special @code{#+KEYWORD} lines, this
  6705. triggers scanning the buffer for these lines and updating the
  6706. information.
  6707. @item
  6708. If the cursor is inside a table, realign the table. This command
  6709. works even if the automatic table editor has been turned off.
  6710. @item
  6711. If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
  6712. the entire table.
  6713. @item
  6714. If the cursor is inside a table created by the @file{table.el} package,
  6715. activate that table.
  6716. @item
  6717. If the current buffer is a remember buffer, close the note and file it.
  6718. With a prefix argument, file it, without further interaction, to the
  6719. default location.
  6720. @item
  6721. If the cursor is on a @code{<<<target>>>}, update radio targets and
  6722. corresponding links in this buffer.
  6723. @item
  6724. If the cursor is in a property line or at the start or end of a property
  6725. drawer, offer property commands.
  6726. @item
  6727. If the cursor is in a plain list item with a checkbox, toggle the status
  6728. of the checkbox.
  6729. @item
  6730. If the cursor is on a numbered item in a plain list, renumber the
  6731. ordered list.
  6732. @item
  6733. If the cursor is on the @code{#+BEGIN} line of a dynamical block, the
  6734. block is updated.
  6735. @end itemize
  6736. @node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous
  6737. @section A cleaner outline view
  6738. @cindex hiding leading stars
  6739. @cindex clean outline view
  6740. Some people find it noisy and distracting that the Org headlines
  6741. are starting with a potentially large number of stars. For example
  6742. the tree from @ref{Headlines}:
  6743. @example
  6744. * Top level headline
  6745. ** Second level
  6746. *** 3rd level
  6747. some text
  6748. *** 3rd level
  6749. more text
  6750. * Another top level headline
  6751. @end example
  6752. @noindent
  6753. Unfortunately this is deeply ingrained into the code of Org and
  6754. cannot be easily changed. You can, however, modify the display in such
  6755. a way that all leading stars become invisible and the outline more easy
  6756. to read. To do this, customize the variable
  6757. @code{org-hide-leading-stars} like this:
  6758. @lisp
  6759. (setq org-hide-leading-stars t)
  6760. @end lisp
  6761. @noindent
  6762. or change this on a per-file basis with one of the lines (anywhere in
  6763. the buffer)
  6764. @example
  6765. #+STARTUP: showstars
  6766. #+STARTUP: hidestars
  6767. @end example
  6768. @noindent
  6769. Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
  6770. the modifications.
  6771. With stars hidden, the tree becomes:
  6772. @example
  6773. * Top level headline
  6774. * Second level
  6775. * 3rd level
  6776. some text
  6777. * 3rd level
  6778. more text
  6779. * Another top level headline
  6780. @end example
  6781. @noindent
  6782. Note that the leading stars are not truly replaced by whitespace, they
  6783. are only fontified with the face @code{org-hide} that uses the
  6784. background color as font color. If you are not using either white or
  6785. black background, you may have to customize this face to get the wanted
  6786. effect. Another possibility is to set this font such that the extra
  6787. stars are @i{almost} invisible, for example using the color
  6788. @code{grey90} on a white background.
  6789. Things become cleaner still if you skip all the even levels and use only
  6790. odd levels 1, 3, 5..., effectively adding two stars to go from one
  6791. outline level to the next:
  6792. @example
  6793. * Top level headline
  6794. * Second level
  6795. * 3rd level
  6796. some text
  6797. * 3rd level
  6798. more text
  6799. * Another top level headline
  6800. @end example
  6801. @noindent
  6802. In order to make the structure editing and export commands handle this
  6803. convention correctly, use
  6804. @lisp
  6805. (setq org-odd-levels-only t)
  6806. @end lisp
  6807. @noindent
  6808. or set this on a per-file basis with one of the following lines (don't
  6809. forget to press @kbd{C-c C-c} with the cursor in the startup line to
  6810. activate changes immediately).
  6811. @example
  6812. #+STARTUP: odd
  6813. #+STARTUP: oddeven
  6814. @end example
  6815. You can convert an Org file from single-star-per-level to the
  6816. double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
  6817. RET} in that file. The reverse operation is @kbd{M-x
  6818. org-convert-to-oddeven-levels}.
  6819. @node TTY keys, Interaction, Clean view, Miscellaneous
  6820. @section Using Org on a tty
  6821. @cindex tty key bindings
  6822. Because Org contains a large number of commands, by default much of
  6823. Org's core commands are bound to keys that are generally not
  6824. accessible on a tty, such as the cursor keys (@key{left}, @key{right},
  6825. @key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used
  6826. together with modifiers like @key{Meta} and/or @key{Shift}. To access
  6827. these commands on a tty when special keys are unavailable, the following
  6828. alternative bindings can be used. The tty bindings below will likely be
  6829. more cumbersome; you may find for some of the bindings below that a
  6830. customized work-around suits you better. For example, changing a time
  6831. stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
  6832. tty you would rather use @kbd{C-c .} to re-insert the timestamp.
  6833. @multitable @columnfractions 0.15 0.2 0.2
  6834. @item @b{Default} @tab @b{Alternative 1} @tab @b{Alternative 2}
  6835. @item @kbd{S-@key{TAB}} @tab @kbd{C-u @key{TAB}} @tab
  6836. @item @kbd{M-@key{left}} @tab @kbd{C-c C-x l} @tab @kbd{@key{Esc} @key{left}}
  6837. @item @kbd{M-S-@key{left}} @tab @kbd{C-c C-x L} @tab
  6838. @item @kbd{M-@key{right}} @tab @kbd{C-c C-x r} @tab @kbd{@key{Esc} @key{right}}
  6839. @item @kbd{M-S-@key{right}} @tab @kbd{C-c C-x R} @tab
  6840. @item @kbd{M-@key{up}} @tab @kbd{C-c C-x u} @tab @kbd{@key{Esc} @key{up}}
  6841. @item @kbd{M-S-@key{up}} @tab @kbd{C-c C-x U} @tab
  6842. @item @kbd{M-@key{down}} @tab @kbd{C-c C-x d} @tab @kbd{@key{Esc} @key{down}}
  6843. @item @kbd{M-S-@key{down}} @tab @kbd{C-c C-x D} @tab
  6844. @item @kbd{S-@key{RET}} @tab @kbd{C-c C-x c} @tab
  6845. @item @kbd{M-@key{RET}} @tab @kbd{C-c C-x m} @tab @kbd{@key{Esc} @key{RET}}
  6846. @item @kbd{M-S-@key{RET}} @tab @kbd{C-c C-x M} @tab
  6847. @item @kbd{S-@key{left}} @tab @kbd{C-c @key{left}} @tab
  6848. @item @kbd{S-@key{right}} @tab @kbd{C-c @key{right}} @tab
  6849. @item @kbd{S-@key{up}} @tab @kbd{C-c @key{up}} @tab
  6850. @item @kbd{S-@key{down}} @tab @kbd{C-c @key{down}} @tab
  6851. @item @kbd{C-S-@key{left}} @tab @kbd{C-c C-x @key{left}} @tab
  6852. @item @kbd{C-S-@key{right}} @tab @kbd{C-c C-x @key{right}} @tab
  6853. @end multitable
  6854. @node Interaction, Bugs, TTY keys, Miscellaneous
  6855. @section Interaction with other packages
  6856. @cindex packages, interaction with other
  6857. Org lives in the world of GNU Emacs and interacts in various ways
  6858. with other code out there.
  6859. @menu
  6860. * Cooperation:: Packages Org cooperates with
  6861. * Conflicts:: Packages that lead to conflicts
  6862. @end menu
  6863. @node Cooperation, Conflicts, Interaction, Interaction
  6864. @subsection Packages that Org cooperates with
  6865. @table @asis
  6866. @cindex @file{calc.el}
  6867. @item @file{calc.el} by Dave Gillespie
  6868. Org uses the Calc package for implementing spreadsheet
  6869. functionality in its tables (@pxref{The spreadsheet}). Org
  6870. checks for the availability of Calc by looking for the function
  6871. @code{calc-eval} which should be autoloaded in your setup if Calc has
  6872. been installed properly. As of Emacs 22, Calc is part of the Emacs
  6873. distribution. Another possibility for interaction between the two
  6874. packages is using Calc for embedded calculations. @xref{Embedded Mode,
  6875. , Embedded Mode, Calc, GNU Emacs Calc Manual}.
  6876. @cindex @file{constants.el}
  6877. @item @file{constants.el} by Carsten Dominik
  6878. In a table formula (@pxref{The spreadsheet}), it is possible to use
  6879. names for natural constants or units. Instead of defining your own
  6880. constants in the variable @code{org-table-formula-constants}, install
  6881. the @file{constants} package which defines a large number of constants
  6882. and units, and lets you use unit prefixes like @samp{M} for
  6883. @samp{Mega} etc. You will need version 2.0 of this package, available
  6884. at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for
  6885. the function @code{constants-get}, which has to be autoloaded in your
  6886. setup. See the installation instructions in the file
  6887. @file{constants.el}.
  6888. @item @file{cdlatex.el} by Carsten Dominik
  6889. @cindex @file{cdlatex.el}
  6890. Org mode can make use of the CDLaTeX package to efficiently enter
  6891. La@TeX{} fragments into Org files. See @ref{CDLaTeX mode}.
  6892. @item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
  6893. @cindex @file{imenu.el}
  6894. Imenu allows menu access to an index of items in a file. Org mode
  6895. supports Imenu - all you need to do to get the index is the following:
  6896. @lisp
  6897. (add-hook 'org-mode-hook
  6898. (lambda () 'imenu-add-to-menubar "Imenu"))
  6899. @end lisp
  6900. By default the index is two levels deep - you can modify the depth using
  6901. the option @code{org-imenu-depth}.
  6902. @item @file{remember.el} by John Wiegley
  6903. @cindex @file{remember.el}
  6904. Org cooperates with remember, see @ref{Remember}.
  6905. @file{Remember.el} is not part of Emacs, find it on the web.
  6906. @item @file{speedbar.el} by Eric M. Ludlam
  6907. @cindex @file{speedbar.el}
  6908. Speedbar is a package that creates a special frame displaying files and
  6909. index items in files. Org mode supports Speedbar and allows you to
  6910. drill into Org files directly from the Speedbar. It also allows to
  6911. restrict the scope of agenda commands to a file or a subtree by using
  6912. the command @kbd{<} in the Speedbar frame.
  6913. @cindex @file{table.el}
  6914. @item @file{table.el} by Takaaki Ota
  6915. @kindex C-c C-c
  6916. @cindex table editor, @file{table.el}
  6917. @cindex @file{table.el}
  6918. Complex ASCII tables with automatic line wrapping, column- and
  6919. row-spanning, and alignment can be created using the Emacs table
  6920. package by Takaaki Ota (@uref{http://sourceforge.net/projects/table},
  6921. and also part of Emacs 22).
  6922. When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode
  6923. will call @command{table-recognize-table} and move the cursor into the
  6924. table. Inside a table, the keymap of Org mode is inactive. In order
  6925. to execute Org mode-related commands, leave the table.
  6926. @table @kbd
  6927. @kindex C-c C-c
  6928. @item C-c C-c
  6929. Recognize @file{table.el} table. Works when the cursor is in a
  6930. table.el table.
  6931. @c
  6932. @kindex C-c ~
  6933. @item C-c ~
  6934. Insert a table.el table. If there is already a table at point, this
  6935. command converts it between the table.el format and the Org mode
  6936. format. See the documentation string of the command
  6937. @code{org-convert-table} for the restrictions under which this is
  6938. possible.
  6939. @end table
  6940. @file{table.el} is part of Emacs 22.
  6941. @cindex @file{footnote.el}
  6942. @item @file{footnote.el} by Steven L. Baur
  6943. Org mode recognizes numerical footnotes as provided by this package
  6944. (@pxref{Footnotes}).
  6945. @end table
  6946. @node Conflicts, , Cooperation, Interaction
  6947. @subsection Packages that lead to conflicts with Org mode
  6948. @table @asis
  6949. @cindex @file{allout.el}
  6950. @item @file{allout.el} by Ken Manheimer
  6951. Startup of Org may fail with the error message
  6952. @code{(wrong-type-argument keymapp nil)} when there is an outdated
  6953. version @file{allout.el} on the load path, for example the version
  6954. distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will
  6955. disappear. If for some reason you cannot do this, make sure that org.el
  6956. is loaded @emph{before} @file{allout.el}, for example by putting
  6957. @code{(require 'org)} early enough into your @file{.emacs} file.
  6958. @cindex @file{CUA.el}
  6959. @item @file{CUA.el} by Kim. F. Storm
  6960. Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by
  6961. CUA mode (as well as pc-select-mode and s-region-mode) to select and
  6962. extend the region. If you want to use one of these packages along with
  6963. Org, configure the variable @code{org-replace-disputed-keys}. When
  6964. set, Org will move the following key bindings in Org files, and
  6965. in the agenda buffer (but not during date selection).
  6966. @example
  6967. S-UP -> M-p S-DOWN -> M-n
  6968. S-LEFT -> M-- S-RIGHT -> M-+
  6969. @end example
  6970. Yes, these are unfortunately more difficult to remember. If you want
  6971. to have other replacement keys, look at the variable
  6972. @code{org-disputed-keys}.
  6973. @item @file{windmove.el} by Hovav Shacham
  6974. @cindex @file{windmove.el}
  6975. Also this package uses the @kbd{S-<cursor>} keys, so everything written
  6976. in the paragraph above about CUA mode also applies here.
  6977. @cindex @file{footnote.el}
  6978. @item @file{footnote.el} by Steven L. Baur
  6979. Org supports the syntax of the footnote package, but only the
  6980. numerical footnote markers. Also, the default key for footnote
  6981. commands, @kbd{C-c !} is already used by Org. You could use the
  6982. variable @code{footnote-prefix} to switch footnotes commands to another
  6983. key. Or, you could use @code{org-replace-disputed-keys} and
  6984. @code{org-disputed-keys} to change the settings in Org.
  6985. @end table
  6986. @node Bugs, , Interaction, Miscellaneous
  6987. @section Bugs
  6988. @cindex bugs
  6989. Here is a list of things that should work differently, but which I
  6990. have found too hard to fix.
  6991. @itemize @bullet
  6992. @item
  6993. If a table field starts with a link, and if the corresponding table
  6994. column is narrowed (@pxref{Narrow columns}) to a width too small to
  6995. display the link, the field would look entirely empty even though it is
  6996. not. To prevent this, Org throws an error. The work-around is to
  6997. make the column wide enough to fit the link, or to add some text (at
  6998. least 2 characters) before the link in the same field.
  6999. @item
  7000. Narrowing table columns does not work on XEmacs, because the
  7001. @code{format} function does not transport text properties.
  7002. @item
  7003. Text in an entry protected with the @samp{QUOTE} keyword should not
  7004. autowrap.
  7005. @item
  7006. When the application called by @kbd{C-c C-o} to open a file link fails
  7007. (for example because the application does not exist or refuses to open
  7008. the file), it does so silently. No error message is displayed.
  7009. @item
  7010. Recalculating a table line applies the formulas from left to right.
  7011. If a formula uses @emph{calculated} fields further down the row,
  7012. multiple recalculation may be needed to get all fields consistent. You
  7013. may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to
  7014. recalculate until convergence.
  7015. @item
  7016. A single letter cannot be made bold, for example @samp{*a*}.
  7017. @item
  7018. The exporters work well, but could be made more efficient.
  7019. @end itemize
  7020. @node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top
  7021. @appendix Extensions, Hooks and Hacking
  7022. This appendix lists extensions for Org written by other authors.
  7023. It also covers some aspects where users can extend the functionality of
  7024. Org.
  7025. @menu
  7026. * Extensions:: Existing 3rd-party extensions
  7027. * Adding hyperlink types:: New custom link types
  7028. * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs
  7029. * Dynamic blocks:: Automatically filled blocks
  7030. * Special agenda views:: Customized views
  7031. * Using the property API:: Writing programs that use entry properties
  7032. @end menu
  7033. @node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking
  7034. @section Third-party extensions for Org
  7035. @cindex extension, third-party
  7036. The following extensions for Org have been written by other people:
  7037. @table @asis
  7038. @cindex @file{org-publish.el}
  7039. @item @file{org-publish.el} by David O'Toole
  7040. This package provides facilities for publishing related sets of Org
  7041. files together with linked files like images as web pages. It is
  7042. highly configurable and can be used for other publishing purposes as
  7043. well. As of Org version 4.30, @file{org-publish.el} is part of the
  7044. Org distribution. It is not yet part of Emacs, however, a delay
  7045. caused by the preparations for the 22.1 release. In the mean time,
  7046. @file{org-publish.el} can be downloaded from David's site:
  7047. @url{http://dto.freeshell.org/e/org-publish.el}.
  7048. @cindex @file{org-mouse.el}
  7049. @item @file{org-mouse.el} by Piotr Zielinski
  7050. This package implements extended mouse functionality for Org. It
  7051. allows you to cycle visibility and to edit the document structure with
  7052. the mouse. Best of all, it provides a context-sensitive menu on
  7053. @key{mouse-3} that changes depending on the context of a mouse-click.
  7054. As of Org version 4.53, @file{org-mouse.el} is part of the
  7055. Org distribution. It is not yet part of Emacs, however, a delay
  7056. caused by the preparations for the 22.1 release. In the mean time,
  7057. @file{org-mouse.el} can be downloaded from Piotr's site:
  7058. @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}.
  7059. @cindex @file{org-blog.el}
  7060. @item @file{org-blog.el} by David O'Toole
  7061. A blogging plug-in for @file{org-publish.el}.@*
  7062. @url{http://dto.freeshell.org/notebook/OrgMode.html}.
  7063. @cindex @file{blorg.el}
  7064. @item @file{blorg.el} by Bastien Guerry
  7065. Publish Org files as
  7066. blogs. @url{http://www.cognition.ens.fr/~guerry/blorg.html}.
  7067. @cindex @file{org2rem.el}
  7068. @item @file{org2rem.el} by Bastien Guerry
  7069. Translates Org files into something readable by
  7070. Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
  7071. @item @file{org-toc.el} by Bastien Guerry
  7072. Produces a simple table of contents of an Org file, for easy
  7073. navigation. @url{http://www.cognition.ens.fr/~guerry/u/org-registry.el}.
  7074. @item @file{org-registry.el} by Bastien Guerry
  7075. Find which Org-file link to a certain document.
  7076. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}.
  7077. @end table
  7078. @page
  7079. @node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking
  7080. @section Adding hyperlink types
  7081. @cindex hyperlinks, adding new types
  7082. Org has a large number of hyperlink types built-in
  7083. (@pxref{Hyperlinks}). If you would like to add new link types, it
  7084. provides an interface for doing so. Lets look at an example file
  7085. @file{org-man.el} that will add support for creating links like
  7086. @samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
  7087. emacs:
  7088. @lisp
  7089. ;;; org-man.el - Support for links to manpages in Org
  7090. (require 'org)
  7091. (org-add-link-type "man" 'org-man-open)
  7092. (add-hook 'org-store-link-functions 'org-man-store-link)
  7093. (defcustom org-man-command 'man
  7094. "The Emacs command to be used to display a man page."
  7095. :group 'org-link
  7096. :type '(choice (const man) (const woman)))
  7097. (defun org-man-open (path)
  7098. "Visit the manpage on PATH.
  7099. PATH should be a topic that can be thrown at the man command."
  7100. (funcall org-man-command path))
  7101. (defun org-man-store-link ()
  7102. "Store a link to a manpage."
  7103. (when (memq major-mode '(Man-mode woman-mode))
  7104. ;; This is a man page, we do make this link
  7105. (let* ((page (org-man-get-page-name))
  7106. (link (concat "man:" page))
  7107. (description (format "Manpage for %s" page)))
  7108. (org-store-link-props
  7109. :type "man"
  7110. :link link
  7111. :description description))))
  7112. (defun org-man-get-page-name ()
  7113. "Extract the page name from the buffer name."
  7114. ;; This works for both `Man-mode' and `woman-mode'.
  7115. (if (string-match " \\(\\S-+\\)\\*" (buffer-name))
  7116. (match-string 1 (buffer-name))
  7117. (error "Cannot create link to this man page")))
  7118. (provide 'org-man)
  7119. ;;; org-man.el ends here
  7120. @end lisp
  7121. @noindent
  7122. You would activate this new link type in @file{.emacs} with
  7123. @lisp
  7124. (require 'org-man)
  7125. @end lisp
  7126. @noindent
  7127. Lets go through the file and see what it does.
  7128. @enumerate
  7129. @item
  7130. It does @code{(require 'org)} to make sure that @file{org.el} has been
  7131. loaded.
  7132. @item
  7133. The next line calls @code{org-add-link-type} to define a new link type
  7134. with prefix @samp{man}. The call also contains the name of a function
  7135. that will be called to follow such a link.
  7136. @item
  7137. The next line adds a function to @code{org-store-link-functions}, in
  7138. order to allow the command @kbd{C-c l} to record a useful link in a
  7139. buffer displaying a man page.
  7140. @end enumerate
  7141. The rest of the file defines the necessary variables and functions.
  7142. First there is a customization variable that determines which emacs
  7143. command should be used to display man pages. There are two options,
  7144. @code{man} and @code{woman}. Then the function to follow a link is
  7145. defined. It gets the link path as an argument - in this case the link
  7146. path is just a topic for the manual command. The function calls the
  7147. value of @code{org-man-command} to display the man page.
  7148. Finally the function @code{org-man-store-link} is defined. When you try
  7149. to store a link with @kbd{C-c l}, also this function will be called to
  7150. try to make a link. The function must first decide if it is supposed to
  7151. create the link for this buffer type, we do this by checking the value
  7152. of the variable @code{major-mode}. If not, the function must exit and
  7153. return the value @code{nil}. If yes, the link is created by getting the
  7154. manual topic from the buffer name and prefixing it with the string
  7155. @samp{man:}. Then it must call the command @code{org-store-link-props}
  7156. and set the @code{:type} and @code{:link} properties. Optionally you
  7157. can also set the @code{:description} property to provide a default for
  7158. the link description when the link is later inserted into an Org
  7159. buffer with @kbd{C-c C-l}.
  7160. @node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking
  7161. @section Tables and lists in arbitrary syntax
  7162. @cindex tables, in other modes
  7163. @cindex lists, in other modes
  7164. @cindex Orgtbl mode
  7165. Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a
  7166. frequent feature request has been to make it work with native tables in
  7167. specific languages, for example La@TeX{}. However, this is extremely
  7168. hard to do in a general way, would lead to a customization nightmare,
  7169. and would take away much of the simplicity of the Orgtbl mode table
  7170. editor.
  7171. This appendix describes a different approach. We keep the Orgtbl mode
  7172. table in its native format (the @i{source table}), and use a custom
  7173. function to @i{translate} the table to the correct syntax, and to
  7174. @i{install} it in the right location (the @i{target table}). This puts
  7175. the burden of writing conversion functions on the user, but it allows
  7176. for a very flexible system.
  7177. Bastien added the ability to do the same with lists. You can use Org's
  7178. facilities to edit and structure lists by turning @code{orgstruct-mode}
  7179. on, then locally exporting such lists in another format (HTML, La@TeX{}
  7180. or Texinfo.)
  7181. @menu
  7182. * Radio tables:: Sending and receiving
  7183. * A LaTeX example:: Step by step, almost a tutorial
  7184. * Translator functions:: Copy and modify
  7185. * Radio lists:: Doing the same for lists
  7186. @end menu
  7187. @node Radio tables, A LaTeX example, Tables in arbitrary syntax, Tables in arbitrary syntax
  7188. @subsection Radio tables
  7189. @cindex radio tables
  7190. To define the location of the target table, you first need to create two
  7191. lines that are comments in the current mode, but contain magic words for
  7192. Orgtbl mode to find. Orgtbl mode will insert the translated table
  7193. between these lines, replacing whatever was there before. For example:
  7194. @example
  7195. /* BEGIN RECEIVE ORGTBL table_name */
  7196. /* END RECEIVE ORGTBL table_name */
  7197. @end example
  7198. @noindent
  7199. Just above the source table, we put a special line that tells
  7200. Orgtbl mode how to translate this table and where to install it. For
  7201. example:
  7202. @example
  7203. #+ORGTBL: SEND table_name translation_function arguments....
  7204. @end example
  7205. @noindent
  7206. @code{table_name} is the reference name for the table that is also used
  7207. in the receiver lines. @code{translation_function} is the Lisp function
  7208. that does the translation. Furthermore, the line can contain a list of
  7209. arguments (alternating key and value) at the end. The arguments will be
  7210. passed as a property list to the translation function for
  7211. interpretation. A few standard parameters are already recognized and
  7212. acted upon before the translation function is called:
  7213. @table @code
  7214. @item :skip N
  7215. Skip the first N lines of the table. Hlines do count!
  7216. @item :skipcols (n1 n2 ...)
  7217. List of columns that should be skipped. If the table has a column with
  7218. calculation marks, that column is automatically discarded as well.
  7219. Please note that the translator function sees the table @emph{after} the
  7220. removal of these columns, the function never knows that there have been
  7221. additional columns.
  7222. @end table
  7223. @noindent
  7224. The one problem remaining is how to keep the source table in the buffer
  7225. without disturbing the normal workings of the file, for example during
  7226. compilation of a C file or processing of a La@TeX{} file. There are a
  7227. number of different solutions:
  7228. @itemize @bullet
  7229. @item
  7230. The table could be placed in a block comment if that is supported by the
  7231. language. For example, in C mode you could wrap the table between
  7232. @samp{/*} and @samp{*/} lines.
  7233. @item
  7234. Sometimes it is possible to put the table after some kind of @i{END}
  7235. statement, for example @samp{\bye} in TeX and @samp{\end@{document@}}
  7236. in La@TeX{}.
  7237. @item
  7238. You can just comment the table line by line whenever you want to process
  7239. the file, and uncomment it whenever you need to edit the table. This
  7240. only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does
  7241. make this comment-toggling very easy, in particular if you bind it to a
  7242. key.
  7243. @end itemize
  7244. @node A LaTeX example, Translator functions, Radio tables, Tables in arbitrary syntax
  7245. @subsection A LaTeX example of radio tables
  7246. @cindex LaTeX, and Orgtbl mode
  7247. The best way to wrap the source table in La@TeX{} is to use the
  7248. @code{comment} environment provided by @file{comment.sty}. It has to be
  7249. activated by placing @code{\usepackage@{comment@}} into the document
  7250. header. Orgtbl mode can insert a radio table skeleton@footnote{By
  7251. default this works only for La@TeX{}, HTML, and Texinfo. Configure the
  7252. variable @code{orgtbl-radio-tables} to install templates for other
  7253. modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will
  7254. be prompted for a table name, lets say we use @samp{salesfigures}. You
  7255. will then get the following template:
  7256. @example
  7257. % BEGIN RECEIVE ORGTBL salesfigures
  7258. % END RECEIVE ORGTBL salesfigures
  7259. \begin@{comment@}
  7260. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  7261. | | |
  7262. \end@{comment@}
  7263. @end example
  7264. @noindent
  7265. The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function
  7266. @code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it
  7267. into the receiver location with name @code{salesfigures}. You may now
  7268. fill in the table, feel free to use the spreadsheet features@footnote{If
  7269. the @samp{#+TBLFM} line contains an odd number of dollar characters,
  7270. this may cause problems with font-lock in LaTeX mode. As shown in the
  7271. example you can fix this by adding an extra line inside the
  7272. @code{comment} environment that is used to balance the dollar
  7273. expressions. If you are using AUCTeX with the font-latex library, a
  7274. much better solution is to add the @code{comment} environment to the
  7275. variable @code{LaTeX-verbatim-environments}.}:
  7276. @example
  7277. % BEGIN RECEIVE ORGTBL salesfigures
  7278. % END RECEIVE ORGTBL salesfigures
  7279. \begin@{comment@}
  7280. #+ORGTBL: SEND salesfigures orgtbl-to-latex
  7281. | Month | Days | Nr sold | per day |
  7282. |-------+------+---------+---------|
  7283. | Jan | 23 | 55 | 2.4 |
  7284. | Feb | 21 | 16 | 0.8 |
  7285. | March | 22 | 278 | 12.6 |
  7286. #+TBLFM: $4=$3/$2;%.1f
  7287. % $ (optional extra dollar to keep font-lock happy, see footnote)
  7288. \end@{comment@}
  7289. @end example
  7290. @noindent
  7291. When you are done, press @kbd{C-c C-c} in the table to get the converted
  7292. table inserted between the two marker lines.
  7293. Now lets assume you want to make the table header by hand, because you
  7294. want to control how columns are aligned etc. In this case we make sure
  7295. that the table translator does skip the first 2 lines of the source
  7296. table, and tell the command to work as a @i{splice}, i.e. to not produce
  7297. header and footer commands of the target table:
  7298. @example
  7299. \begin@{tabular@}@{lrrr@}
  7300. Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
  7301. % BEGIN RECEIVE ORGTBL salesfigures
  7302. % END RECEIVE ORGTBL salesfigures
  7303. \end@{tabular@}
  7304. %
  7305. \begin@{comment@}
  7306. #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2
  7307. | Month | Days | Nr sold | per day |
  7308. |-------+------+---------+---------|
  7309. | Jan | 23 | 55 | 2.4 |
  7310. | Feb | 21 | 16 | 0.8 |
  7311. | March | 22 | 278 | 12.6 |
  7312. #+TBLFM: $4=$3/$2;%.1f
  7313. \end@{comment@}
  7314. @end example
  7315. The La@TeX{} translator function @code{orgtbl-to-latex} is already part of
  7316. Orgtbl mode. It uses a @code{tabular} environment to typeset the table
  7317. and marks horizontal lines with @code{\hline}. Furthermore, it
  7318. interprets the following parameters:
  7319. @table @code
  7320. @item :splice nil/t
  7321. When set to t, return only table body lines, don't wrap them into a
  7322. tabular environment. Default is nil.
  7323. @item :fmt fmt
  7324. A format to be used to wrap each field, should contain @code{%s} for the
  7325. original field value. For example, to wrap each field value in dollars,
  7326. you could use @code{:fmt "$%s$"}. This may also be a property list with
  7327. column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
  7328. @item :efmt efmt
  7329. Use this format to print numbers with exponentials. The format should
  7330. have @code{%s} twice for inserting mantissa and exponent, for example
  7331. @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This
  7332. may also be a property list with column numbers and formats, for example
  7333. @code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
  7334. @code{efmt} has been applied to a value, @code{fmt} will also be
  7335. applied.
  7336. @end table
  7337. @node Translator functions, Radio lists, A LaTeX example, Tables in arbitrary syntax
  7338. @subsection Translator functions
  7339. @cindex HTML, and Orgtbl mode
  7340. @cindex translator function
  7341. Orgtbl mode has several translator functions built-in:
  7342. @code{orgtbl-to-latex}, @code{orgtbl-to-html}, and
  7343. @code{orgtbl-to-texinfo}. Except for @code{orgtbl-to-html}@footnote{The
  7344. HTML translator uses the same code that produces tables during HTML
  7345. export.}, these all use a generic translator, @code{orgtbl-to-generic}.
  7346. For example, @code{orgtbl-to-latex} itself is a very short function that
  7347. computes the column definitions for the @code{tabular} environment,
  7348. defines a few field and line separators and then hands over to the
  7349. generic translator. Here is the entire code:
  7350. @lisp
  7351. @group
  7352. (defun orgtbl-to-latex (table params)
  7353. "Convert the Orgtbl mode TABLE to LaTeX."
  7354. (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
  7355. org-table-last-alignment ""))
  7356. (params2
  7357. (list
  7358. :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
  7359. :tend "\\end@{tabular@}"
  7360. :lstart "" :lend " \\\\" :sep " & "
  7361. :efmt "%s\\,(%s)" :hline "\\hline")))
  7362. (orgtbl-to-generic table (org-combine-plists params2 params))))
  7363. @end group
  7364. @end lisp
  7365. As you can see, the properties passed into the function (variable
  7366. @var{PARAMS}) are combined with the ones newly defined in the function
  7367. (variable @var{PARAMS2}). The ones passed into the function (i.e. the
  7368. ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
  7369. would like to use the La@TeX{} translator, but wanted the line endings to
  7370. be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
  7371. overrule the default with
  7372. @example
  7373. #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
  7374. @end example
  7375. For a new language, you can either write your own converter function in
  7376. analogy with the La@TeX{} translator, or you can use the generic function
  7377. directly. For example, if you have a language where a table is started
  7378. with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are
  7379. started with @samp{!BL!}, ended with @samp{!EL!} and where the field
  7380. separator is a TAB, you could call the generic translator like this (on
  7381. a single line!):
  7382. @example
  7383. #+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!"
  7384. :lstart "!BL! " :lend " !EL!" :sep "\t"
  7385. @end example
  7386. @noindent
  7387. Please check the documentation string of the function
  7388. @code{orgtbl-to-generic} for a full list of parameters understood by
  7389. that function and remember that you can pass each of them into
  7390. @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
  7391. using the generic function.
  7392. Of course you can also write a completely new function doing complicated
  7393. things the generic translator cannot do. A translator function takes
  7394. two arguments. The first argument is the table, a list of lines, each
  7395. line either the symbol @code{hline} or a list of fields. The second
  7396. argument is the property list containing all parameters specified in the
  7397. @samp{#+ORGTBL: SEND} line. The function must return a single string
  7398. containing the formatted table. If you write a generally useful
  7399. translator, please post it on @code{emacs-orgmode@@gnu.org} so that
  7400. others can benefit from your work.
  7401. @node Radio lists, , Translator functions, Tables in arbitrary syntax
  7402. @subsection Radio lists
  7403. @cindex radio lists
  7404. @cindex org-list-insert-radio-list
  7405. Sending and receiving radio lists works exactly the same way than
  7406. sending and receiving radio tables (@pxref{Radio tables}) @footnote{You
  7407. need to load the @code{org-export-latex.el} package to use radio lists
  7408. since the relevant code is there for now.}. As for radio tables, you
  7409. can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by
  7410. calling @code{org-list-insert-radio-list}.
  7411. Here are the differences with radio tables:
  7412. @itemize @minus
  7413. @item
  7414. Use @code{ORGLST} instead of @code{ORGTBL}.
  7415. @item
  7416. The available translation functions for radio lists don't take
  7417. parameters.
  7418. @item
  7419. `C-c C-c' will work when pressed on the first item of the list.
  7420. @end itemize
  7421. Here is a La@TeX{} example. Let's say that you have this in your
  7422. La@TeX{} file:
  7423. @example
  7424. % BEGIN RECEIVE ORGLST to-buy
  7425. % END RECEIVE ORGLST to-buy
  7426. \begin@{comment@}
  7427. #+ORGLIST: SEND to-buy orgtbl-to-latex
  7428. - a new house
  7429. - a new computer
  7430. + a new keyboard
  7431. + a new mouse
  7432. - a new life
  7433. \end@{comment@}
  7434. @end example
  7435. Pressing `C-c C-c' on @code{a new house} and will insert the converted
  7436. La@TeX{} list between the two marker lines.
  7437. @node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Extensions and Hacking
  7438. @section Dynamic blocks
  7439. @cindex dynamic blocks
  7440. Org documents can contain @emph{dynamic blocks}. These are
  7441. specially marked regions that are updated by some user-written function.
  7442. A good example for such a block is the clock table inserted by the
  7443. command @kbd{C-c C-x C-r} (@pxref{Clocking work time}).
  7444. Dynamic block are enclosed by a BEGIN-END structure that assigns a name
  7445. to the block and can also specify parameters for the function producing
  7446. the content of the block.
  7447. @example
  7448. #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ...
  7449. #+END:
  7450. @end example
  7451. Dynamic blocks are updated with the following commands
  7452. @table @kbd
  7453. @kindex C-c C-x C-u
  7454. @item C-c C-x C-u
  7455. Update dynamic block at point.
  7456. @kindex C-u C-c C-x C-u
  7457. @item C-u C-c C-x C-u
  7458. Update all dynamic blocks in the current file.
  7459. @end table
  7460. Updating a dynamic block means to remove all the text between BEGIN and
  7461. END, parse the BEGIN line for parameters and then call the specific
  7462. writer function for this block to insert the new content. If you want
  7463. to use the original content in the writer function, you can use the
  7464. extra parameter @code{:content}.
  7465. For a block with name @code{myblock}, the writer function is
  7466. @code{org-dblock-write:myblock} with as only parameter a property list
  7467. with the parameters given in the begin line. Here is a trivial example
  7468. of a block that keeps track of when the block update function was last
  7469. run:
  7470. @example
  7471. #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
  7472. #+END:
  7473. @end example
  7474. @noindent
  7475. The corresponding block writer function could look like this:
  7476. @lisp
  7477. (defun org-dblock-write:block-update-time (params)
  7478. (let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  7479. (insert "Last block update at: "
  7480. (format-time-string fmt (current-time)))))
  7481. @end lisp
  7482. If you want to make sure that all dynamic blocks are always up-to-date,
  7483. you could add the function @code{org-update-all-dblocks} to a hook, for
  7484. example @code{before-save-hook}. @code{org-update-all-dblocks} is
  7485. written in a way that is does nothing in buffers that are not in Org.
  7486. @node Special agenda views, Using the property API, Dynamic blocks, Extensions and Hacking
  7487. @section Special agenda views
  7488. @cindex agenda views, user-defined
  7489. Org provides a special hook that can be used to narrow down the
  7490. selection made by any of the agenda views. You may specify a function
  7491. that is used at each match to verify if the match should indeed be part
  7492. of the agenda view, and if not, how much should be skipped.
  7493. Let's say you want to produce a list of projects that contain a WAITING
  7494. tag anywhere in the project tree. Let's further assume that you have
  7495. marked all tree headings that define a project with the TODO keyword
  7496. PROJECT. In this case you would run a TODO search for the keyword
  7497. PROJECT, but skip the match unless there is a WAITING tag anywhere in
  7498. the subtree belonging to the project line.
  7499. To achieve this, you must write a function that searches the subtree for
  7500. the tag. If the tag is found, the function must return @code{nil} to
  7501. indicate that this match should not be skipped. If there is no such
  7502. tag, return the location of the end of the subtree, to indicate that
  7503. search should continue from there.
  7504. @lisp
  7505. (defun my-skip-unless-waiting ()
  7506. "Skip trees that are not waiting"
  7507. (let ((subtree-end (save-excursion (org-end-of-subtree t))))
  7508. (if (re-search-forward ":waiting:" subtree-end t)
  7509. nil ; tag found, do not skip
  7510. subtree-end))) ; tag not found, continue after end of subtree
  7511. @end lisp
  7512. Now you may use this function in an agenda custom command, for example
  7513. like this:
  7514. @lisp
  7515. (org-add-agenda-custom-command
  7516. '("b" todo "PROJECT"
  7517. ((org-agenda-skip-function 'my-org-waiting-projects)
  7518. (org-agenda-overriding-header "Projects waiting for something: "))))
  7519. @end lisp
  7520. Note that this also binds @code{org-agenda-overriding-header} to get a
  7521. meaningful header in the agenda view.
  7522. You may also put a Lisp form into @code{org-agenda-skip-function}. In
  7523. particular, you may use the functions @code{org-agenda-skip-entry-if}
  7524. and @code{org-agenda-skip-subtree-if} in this form, for example:
  7525. @table @code
  7526. @item '(org-agenda-skip-entry-if 'scheduled)
  7527. Skip current entry if it has been scheduled.
  7528. @item '(org-agenda-skip-entry-if 'notscheduled)
  7529. Skip current entry if it has not been scheduled.
  7530. @item '(org-agenda-skip-entry-if 'deadline)
  7531. Skip current entry if it has a deadline.
  7532. @item '(org-agenda-skip-entry-if 'scheduled 'deadline)
  7533. Skip current entry if it has a deadline, or if it is scheduled.
  7534. @item '(org-agenda-skip-entry 'regexp "regular expression")
  7535. Skip current entry if the regular expression matches in the entry.
  7536. @item '(org-agenda-skip-entry 'notregexp "regular expression")
  7537. Skip current entry unless the regular expression matches.
  7538. @item '(org-agenda-skip-subtree-if 'regexp "regular expression")
  7539. Same as above, but check and skip the entire subtree.
  7540. @end table
  7541. Therefore we could also have written the search for WAITING projects
  7542. like this, even without defining a special function:
  7543. @lisp
  7544. (org-add-agenda-custom-command
  7545. '("b" todo "PROJECT"
  7546. ((org-agenda-skip-function '(org-agenda-skip-subtree-if
  7547. 'regexp ":waiting:"))
  7548. (org-agenda-overriding-header "Projects waiting for something: "))))
  7549. @end lisp
  7550. @node Using the property API, , Special agenda views, Extensions and Hacking
  7551. @section Using the property API
  7552. @cindex API, for properties
  7553. @cindex properties, API
  7554. Here is a description of the functions that can be used to work with
  7555. properties.
  7556. @defun org-entry-properties &optional pom which
  7557. Get all properties of the entry at point-or-marker POM.
  7558. This includes the TODO keyword, the tags, time strings for deadline,
  7559. scheduled, and clocking, and any additional properties defined in the
  7560. entry. The return value is an alist, keys may occur multiple times
  7561. if the property key was used several times.
  7562. POM may also be nil, in which case the current entry is used.
  7563. If WHICH is nil or `all', get all properties. If WHICH is
  7564. `special' or `standard', only get that subclass.
  7565. @end defun
  7566. @defun org-entry-get pom property &optional inherit
  7567. Get value of PROPERTY for entry at point-or-marker POM. By default,
  7568. this only looks at properties defined locally in the entry. If INHERIT
  7569. is non-nil and the entry does not have the property, then also check
  7570. higher levels of the hierarchy. If INHERIT is the symbol
  7571. @code{selective}, use inheritance if and only if the setting of
  7572. @code{org-use-property-inheritance} selects PROPERTY for inheritance.
  7573. @end defun
  7574. @defun org-entry-delete pom property
  7575. Delete the property PROPERTY from entry at point-or-marker POM.
  7576. @end defun
  7577. @defun org-entry-put pom property value
  7578. Set PROPERTY to VALUE for entry at point-or-marker POM.
  7579. @end defun
  7580. @defun org-buffer-property-keys &optional include-specials
  7581. Get all property keys in the current buffer.
  7582. @end defun
  7583. @defun org-insert-property-drawer
  7584. Insert a property drawer at point.
  7585. @end defun
  7586. @defun org-entry-add-to-multivalued-property pom property value
  7587. Treat the value of the property PROPERTY as a whitespace-separated list of
  7588. values and make sure that VALUE is in this list.
  7589. @end defun
  7590. @defun org-entry-remove-from-multivalued-property pom property value
  7591. Treat the value of the property PROPERTY as a whitespace-separated list of
  7592. values and make sure that VALUE is @emph{not} in this list.
  7593. @end defun
  7594. @defun org-entry-member-in-multivalued-property pom property value
  7595. Treat the value of the property PROPERTY as a whitespace-separated list of
  7596. values and check if VALUE is in this list.
  7597. @end defun
  7598. @node History and Acknowledgments, Main Index, Extensions and Hacking, Top
  7599. @appendix History and Acknowledgments
  7600. @cindex acknowledgments
  7601. @cindex history
  7602. @cindex thanks
  7603. Org was borne in 2003, out of frustration over the user interface
  7604. of the Emacs Outline mode. I was trying to organize my notes and
  7605. projects, and using Emacs seemed to be the natural way to go. However,
  7606. having to remember eleven different commands with two or three keys per
  7607. command, only to hide and show parts of the outline tree, that seemed
  7608. entirely unacceptable to me. Also, when using outlines to take notes, I
  7609. constantly want to restructure the tree, organizing it parallel to my
  7610. thoughts and plans. @emph{Visibility cycling} and @emph{structure
  7611. editing} were originally implemented in the package
  7612. @file{outline-magic.el}, but quickly moved to the more general
  7613. @file{org.el}. As this environment became comfortable for project
  7614. planning, the next step was adding @emph{TODO entries}, basic @emph{time
  7615. stamps}, and @emph{table support}. These areas highlight the two main
  7616. goals that Org still has today: To create a new, outline-based,
  7617. plain text mode with innovative and intuitive editing features, and to
  7618. incorporate project planning functionality directly into a notes file.
  7619. Since the first release, literally thousands of emails to me or on
  7620. @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug
  7621. reports, feedback, new ideas, and sometimes patches and add-on code.
  7622. Many thanks to everyone who has helped to improve this package. I am
  7623. trying to keep here a list of the people who had significant influence
  7624. in shaping one or more aspects of Org. The list may not be
  7625. complete, if I have forgotten someone, please accept my apologies and
  7626. let me know.
  7627. @itemize @bullet
  7628. @item
  7629. @i{Russel Adams} came up with the idea for drawers.
  7630. @item
  7631. @i{Thomas Baumann} contributed the code for links to the MH-E email
  7632. system.
  7633. @item
  7634. @i{Alex Bochannek} provided a patch for rounding time stamps.
  7635. @item
  7636. @i{Charles Cave}'s suggestion sparked the implementation of templates
  7637. for Remember.
  7638. @item
  7639. @i{Pavel Chalmoviansky} influenced the agenda treatment of items with
  7640. specified time.
  7641. @item
  7642. @i{Gregory Chernov} patched support for lisp forms into table
  7643. calculations and improved XEmacs compatibility, in particular by porting
  7644. @file{nouline.el} to XEmacs.
  7645. @item
  7646. @i{Sacha Chua} suggested to copy some linking code from Planner.
  7647. @item
  7648. @i{Eddward DeVilla} proposed and tested checkbox statistics. He also
  7649. came up with the idea of properties, and that there should be an API for
  7650. them.
  7651. @item
  7652. @i{Kees Dullemond} used to edit projects lists directly in HTML and so
  7653. inspired some of the early development, including HTML export. He also
  7654. asked for a way to narrow wide table columns.
  7655. @item
  7656. @i{Christian Egli} converted the documentation into Texinfo format,
  7657. patched CSS formatting into the HTML exporter, and inspired the agenda.
  7658. @item
  7659. @i{David Emery} provided a patch for custom CSS support in exported
  7660. HTML agendas.
  7661. @item
  7662. @i{Nic Ferrier} contributed mailcap and XOXO support.
  7663. @item
  7664. @i{Miguel A. Figueroa-Villanueva} implemented hierarchical checkboxes.
  7665. @item
  7666. @i{John Foerch} figured out how to make incremental search show context
  7667. around a match in a hidden outline tree.
  7668. @item
  7669. @i{Niels Giesen} had the idea to automatically archive DONE trees.
  7670. @item
  7671. @i{Bastien Guerry} wrote the La@TeX{} exporter and has been prolific
  7672. with patches, ideas, and bug reports.
  7673. @item
  7674. @i{Kai Grossjohann} pointed out key-binding conflicts with other packages.
  7675. @item
  7676. @i{Scott Jaderholm} proposed footnotes, control over whitespace between
  7677. folded entries, and column view for properties.
  7678. @item
  7679. @i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also
  7680. provided frequent feedback and some patches.
  7681. @item
  7682. @i{Jason F. McBrayer} suggested agenda export to CSV format.
  7683. @item
  7684. @i{Max Mikhanosha} came up with the idea of refiling.
  7685. @item
  7686. @i{Dmitri Minaev} sent a patch to set priority limits on a per-file
  7687. basis.
  7688. @item
  7689. @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
  7690. happy.
  7691. @item
  7692. @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file
  7693. and to be able to quickly restrict the agenda to a subtree.
  7694. @item
  7695. @i{Todd Neal} provided patches for links to Info files and elisp forms.
  7696. @item
  7697. @i{Tim O'Callaghan} suggested in-file links, search options for general
  7698. file links, and TAGS.
  7699. @item
  7700. @i{Takeshi Okano} translated the manual and David O'Toole's tutorial
  7701. into Japanese.
  7702. @item
  7703. @i{Oliver Oppitz} suggested multi-state TODO items.
  7704. @item
  7705. @i{Scott Otterson} sparked the introduction of descriptive text for
  7706. links, among other things.
  7707. @item
  7708. @i{Pete Phillips} helped during the development of the TAGS feature, and
  7709. provided frequent feedback.
  7710. @item
  7711. @i{T.V. Raman} reported bugs and suggested improvements.
  7712. @item
  7713. @i{Matthias Rempe} (Oelde) provided ideas, Windows support, and quality
  7714. control.
  7715. @item
  7716. @i{Kevin Rogers} contributed code to access VM files on remote hosts.
  7717. @item
  7718. @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
  7719. conflict with @file{allout.el}.
  7720. @item
  7721. @i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords.
  7722. @item
  7723. @i{Philip Rooke} created the Org reference card and provided lots
  7724. of feedback.
  7725. @item
  7726. @i{Christian Schlauer} proposed angular brackets around links, among
  7727. other things.
  7728. @item
  7729. Linking to VM/BBDB/Gnus was inspired by @i{Tom Shannon}'s
  7730. @file{organizer-mode.el}.
  7731. @item
  7732. @i{Ilya Shlyakhter} proposed the Attic Sibling.
  7733. @item
  7734. @i{Daniel Sinder} came up with the idea of internal archiving by locking
  7735. subtrees.
  7736. @item
  7737. @i{Dale Smith} proposed link abbreviations.
  7738. @item
  7739. @i{Adam Spiers} asked for global linking commands and inspired the link
  7740. extension system. support mairix.
  7741. @item
  7742. @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
  7743. chapter about publishing.
  7744. @item
  7745. @i{J@"urgen Vollmer} contributed code generating the table of contents
  7746. in HTML output.
  7747. @item
  7748. @i{Chris Wallace} provided a patch implementing the @samp{QUOTE}
  7749. keyword.
  7750. @item
  7751. @i{David Wainberg} suggested archiving, and improvements to the linking
  7752. system.
  7753. @item
  7754. @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The
  7755. development of Org was fully independent, and both systems are
  7756. really different beasts in their basic ideas and implementation details.
  7757. I later looked at John's code, however, and learned from his
  7758. implementation of (i) links where the link itself is hidden and only a
  7759. description is shown, and (ii) popping up a calendar to select a date.
  7760. John has also contributed a number of great ideas directly to Org.
  7761. @item
  7762. @i{Carsten Wimmer} suggested some changes and helped fix a bug in
  7763. linking to Gnus.
  7764. @item
  7765. @i{Roland Winkler} requested additional key bindings to make Org
  7766. work on a tty.
  7767. @item
  7768. @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
  7769. and contributed various ideas and code snippets.
  7770. @end itemize
  7771. @node Main Index, Key Index, History and Acknowledgments, Top
  7772. @unnumbered The Main Index
  7773. @printindex cp
  7774. @node Key Index, , Main Index, Top
  7775. @unnumbered Key Index
  7776. @printindex ky
  7777. @bye
  7778. @ignore
  7779. arch-tag: 7893d1Fe-cc57-4d13-b5e5-f494a1CBC7ac
  7780. @end ignore
  7781. @c Local variables:
  7782. @c ispell-local-dictionary: "en_US-w_accents"
  7783. @c ispell-local-pdict: "./.aspell.org.pws"
  7784. @c fill-column: 77
  7785. @c End: