commit | author | age
|
76bbd0
|
1 |
This is org, produced by makeinfo version 6.3 from org.texi. |
C |
2 |
|
|
3 |
This manual is for Org version 9.1.14 (release_9.1.14-1-g4931fc). |
|
4 |
|
|
5 |
Copyright © 2004–2018 Free Software Foundation, Inc. |
|
6 |
|
|
7 |
Permission is granted to copy, distribute and/or modify this |
|
8 |
document under the terms of the GNU Free Documentation License, |
|
9 |
Version 1.3 or any later version published by the Free Software |
|
10 |
Foundation; with no Invariant Sections, with the Front-Cover Texts |
|
11 |
being “A GNU Manual,” and with the Back-Cover Texts as in (a) |
|
12 |
below. A copy of the license is included in the section entitled |
|
13 |
“GNU Free Documentation License.” |
|
14 |
|
|
15 |
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and |
|
16 |
modify this GNU manual.” |
|
17 |
INFO-DIR-SECTION Emacs editing modes |
|
18 |
START-INFO-DIR-ENTRY |
|
19 |
* Org Mode: (org). Outline-based notes management and organizer |
|
20 |
END-INFO-DIR-ENTRY |
|
21 |
|
|
22 |
|
|
23 |
File: org, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) |
|
24 |
|
|
25 |
Org Mode Manual |
|
26 |
*************** |
|
27 |
|
|
28 |
This manual is for Org version 9.1.14 (release_9.1.14-1-g4931fc). |
|
29 |
|
|
30 |
Copyright © 2004–2018 Free Software Foundation, Inc. |
|
31 |
|
|
32 |
Permission is granted to copy, distribute and/or modify this |
|
33 |
document under the terms of the GNU Free Documentation License, |
|
34 |
Version 1.3 or any later version published by the Free Software |
|
35 |
Foundation; with no Invariant Sections, with the Front-Cover Texts |
|
36 |
being “A GNU Manual,” and with the Back-Cover Texts as in (a) |
|
37 |
below. A copy of the license is included in the section entitled |
|
38 |
“GNU Free Documentation License.” |
|
39 |
|
|
40 |
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and |
|
41 |
modify this GNU manual.” |
|
42 |
|
|
43 |
* Menu: |
|
44 |
|
|
45 |
* Introduction:: Getting started |
|
46 |
* Document structure:: A tree works like your brain |
|
47 |
* Tables:: Pure magic for quick formatting |
|
48 |
* Hyperlinks:: Notes in context |
|
49 |
* TODO items:: Every tree branch can be a TODO item |
|
50 |
* Tags:: Tagging headlines and matching sets of tags |
|
51 |
* Properties and columns:: Storing information about an entry |
|
52 |
* Dates and times:: Making items useful for planning |
|
53 |
* Capture - Refile - Archive:: The ins and outs for projects |
|
54 |
* Agenda views:: Collecting information into views |
|
55 |
* Markup:: Prepare text for rich export |
|
56 |
* Exporting:: Sharing and publishing notes |
|
57 |
* Publishing:: Create a web site of linked Org files |
|
58 |
* Working with source code:: Export, evaluate, and tangle code blocks |
|
59 |
* Miscellaneous:: All the rest which did not fit elsewhere |
|
60 |
* Hacking:: How to hack your way around |
|
61 |
* MobileOrg:: Viewing and capture on a mobile device |
|
62 |
* History and acknowledgments:: How Org came into being |
|
63 |
* GNU Free Documentation License:: The license for this documentation. |
|
64 |
* Main Index:: An index of Org’s concepts and features |
|
65 |
* Key Index:: Key bindings and where they are described |
|
66 |
* Command and Function Index:: Command names and some internal functions |
|
67 |
* Variable Index:: Variables mentioned in the manual |
|
68 |
|
|
69 |
— The Detailed Node Listing — |
|
70 |
|
|
71 |
Introduction |
|
72 |
|
|
73 |
* Summary:: Brief summary of what Org does |
|
74 |
* Installation:: Installing Org |
|
75 |
* Activation:: How to activate Org for certain buffers |
|
76 |
* Feedback:: Bug reports, ideas, patches etc. |
|
77 |
* Conventions:: Typesetting conventions in the manual |
|
78 |
|
|
79 |
Document structure |
|
80 |
|
|
81 |
* Outlines:: Org is based on Outline mode |
|
82 |
* Headlines:: How to typeset Org tree headlines |
|
83 |
* Visibility cycling:: Show and hide, much simplified |
|
84 |
* Motion:: Jumping to other headlines |
|
85 |
* Structure editing:: Changing sequence and level of headlines |
|
86 |
* Sparse trees:: Matches embedded in context |
|
87 |
* Plain lists:: Additional structure within an entry |
|
88 |
* Drawers:: Tucking stuff away |
|
89 |
* Blocks:: Folding blocks |
|
90 |
* Footnotes:: How footnotes are defined in Org’s syntax |
|
91 |
* Orgstruct mode:: Structure editing outside Org |
|
92 |
* Org syntax:: Formal description of Org’s syntax |
|
93 |
|
|
94 |
Visibility cycling |
|
95 |
|
|
96 |
* Global and local cycling:: Cycling through various visibility states |
|
97 |
* Initial visibility:: Setting the initial visibility state |
|
98 |
* Catching invisible edits:: Preventing mistakes when editing invisible parts |
|
99 |
|
|
100 |
Tables |
|
101 |
|
|
102 |
* Built-in table editor:: Simple tables |
|
103 |
* Column width and alignment:: Overrule the automatic settings |
|
104 |
* Column groups:: Grouping to trigger vertical lines |
|
105 |
* Orgtbl mode:: The table editor as minor mode |
|
106 |
* The spreadsheet:: The table editor has spreadsheet capabilities |
|
107 |
* Org-Plot:: Plotting from org tables |
|
108 |
|
|
109 |
The spreadsheet |
|
110 |
|
|
111 |
* References:: How to refer to another field or range |
|
112 |
* Formula syntax for Calc:: Using Calc to compute stuff |
|
113 |
* Formula syntax for Lisp:: Writing formulas in Emacs Lisp |
|
114 |
* Durations and time values:: How to compute durations and time values |
|
115 |
* Field and range formulas:: Formula for specific (ranges of) fields |
|
116 |
* Column formulas:: Formulas valid for an entire column |
|
117 |
* Lookup functions:: Lookup functions for searching tables |
|
118 |
* Editing and debugging formulas:: Fixing formulas |
|
119 |
* Updating the table:: Recomputing all dependent fields |
|
120 |
* Advanced features:: Field and column names, parameters and automatic recalc |
|
121 |
|
|
122 |
Hyperlinks |
|
123 |
|
|
124 |
* Link format:: How links in Org are formatted |
|
125 |
* Internal links:: Links to other places in the current file |
|
126 |
* External links:: URL-like links to the world |
|
127 |
* Handling links:: Creating, inserting and following |
|
128 |
* Using links outside Org:: Linking from my C source code? |
|
129 |
* Link abbreviations:: Shortcuts for writing complex links |
|
130 |
* Search options:: Linking to a specific location |
|
131 |
* Custom searches:: When the default search is not enough |
|
132 |
|
|
133 |
Internal links |
|
134 |
|
|
135 |
* Radio targets:: Make targets trigger links in plain text |
|
136 |
|
|
137 |
TODO items |
|
138 |
|
|
139 |
* TODO basics:: Marking and displaying TODO entries |
|
140 |
* TODO extensions:: Workflow and assignments |
|
141 |
* Progress logging:: Dates and notes for progress |
|
142 |
* Priorities:: Some things are more important than others |
|
143 |
* Breaking down tasks:: Splitting a task into manageable pieces |
|
144 |
* Checkboxes:: Tick-off lists |
|
145 |
|
|
146 |
Extended use of TODO keywords |
|
147 |
|
|
148 |
* Workflow states:: From TODO to DONE in steps |
|
149 |
* TODO types:: I do this, Fred does the rest |
|
150 |
* Multiple sets in one file:: Mixing it all, and still finding your way |
|
151 |
* Fast access to TODO states:: Single letter selection of a state |
|
152 |
* Per-file keywords:: Different files, different requirements |
|
153 |
* Faces for TODO keywords:: Highlighting states |
|
154 |
* TODO dependencies:: When one task needs to wait for others |
|
155 |
|
|
156 |
Progress logging |
|
157 |
|
|
158 |
* Closing items:: When was this entry marked DONE? |
|
159 |
* Tracking TODO state changes:: When did the status change? |
|
160 |
* Tracking your habits:: How consistent have you been? |
|
161 |
|
|
162 |
Tags |
|
163 |
|
|
164 |
* Tag inheritance:: Tags use the tree structure of the outline |
|
165 |
* Setting tags:: How to assign tags to a headline |
|
166 |
* Tag hierarchy:: Create a hierarchy of tags |
|
167 |
* Tag searches:: Searching for combinations of tags |
|
168 |
|
|
169 |
Properties and columns |
|
170 |
|
|
171 |
* Property syntax:: How properties are spelled out |
|
172 |
* Special properties:: Access to other Org mode features |
|
173 |
* Property searches:: Matching property values |
|
174 |
* Property inheritance:: Passing values down the tree |
|
175 |
* Column view:: Tabular viewing and editing |
|
176 |
* Property API:: Properties for Lisp programmers |
|
177 |
|
|
178 |
Column view |
|
179 |
|
|
180 |
* Defining columns:: The COLUMNS format property |
|
181 |
* Using column view:: How to create and use column view |
|
182 |
* Capturing column view:: A dynamic block for column view |
|
183 |
|
|
184 |
Defining columns |
|
185 |
|
|
186 |
* Scope of column definitions:: Where defined, where valid? |
|
187 |
* Column attributes:: Appearance and content of a column |
|
188 |
|
|
189 |
Dates and times |
|
190 |
|
|
191 |
* Timestamps:: Assigning a time to a tree entry |
|
192 |
* Creating timestamps:: Commands which insert timestamps |
|
193 |
* Deadlines and scheduling:: Planning your work |
|
194 |
* Clocking work time:: Tracking how long you spend on a task |
|
195 |
* Effort estimates:: Planning work effort in advance |
|
196 |
* Timers:: Notes with a running timer |
|
197 |
|
|
198 |
Creating timestamps |
|
199 |
|
|
200 |
* The date/time prompt:: How Org mode helps you entering date and time |
|
201 |
* Custom time format:: Making dates look different |
|
202 |
|
|
203 |
Deadlines and scheduling |
|
204 |
|
|
205 |
* Inserting deadline/schedule:: Planning items |
|
206 |
* Repeated tasks:: Items that show up again and again |
|
207 |
|
|
208 |
Clocking work time |
|
209 |
|
|
210 |
* Clocking commands:: Starting and stopping a clock |
|
211 |
* The clock table:: Detailed reports |
|
212 |
* Resolving idle time:: Resolving time when you’ve been idle |
|
213 |
|
|
214 |
Capture - Refile - Archive |
|
215 |
|
|
216 |
* Capture:: Capturing new stuff |
|
217 |
* Attachments:: Add files to tasks |
|
218 |
* RSS feeds:: Getting input from RSS feeds |
|
219 |
* Protocols:: External (e.g., Browser) access to Emacs and Org |
|
220 |
* Refile and copy:: Moving/copying a tree from one place to another |
|
221 |
* Archiving:: What to do with finished projects |
|
222 |
|
|
223 |
Capture |
|
224 |
|
|
225 |
* Setting up capture:: Where notes will be stored |
|
226 |
* Using capture:: Commands to invoke and terminate capture |
|
227 |
* Capture templates:: Define the outline of different note types |
|
228 |
|
|
229 |
Capture templates |
|
230 |
|
|
231 |
* Template elements:: What is needed for a complete template entry |
|
232 |
* Template expansion:: Filling in information about time and context |
|
233 |
* Templates in contexts:: Only show a template in a specific context |
|
234 |
|
|
235 |
Protocols for external access |
|
236 |
|
|
237 |
* store-link protocol:: Store a link, push URL to kill-ring. |
|
238 |
* capture protocol:: Fill a buffer with external information. |
|
239 |
* open-source protocol:: Edit published contents. |
|
240 |
|
|
241 |
Archiving |
|
242 |
|
|
243 |
* Moving subtrees:: Moving a tree to an archive file |
|
244 |
* Internal archiving:: Switch off a tree but keep it in the file |
|
245 |
|
|
246 |
Agenda views |
|
247 |
|
|
248 |
* Agenda files:: Files being searched for agenda information |
|
249 |
* Agenda dispatcher:: Keyboard access to agenda views |
|
250 |
* Built-in agenda views:: What is available out of the box? |
|
251 |
* Presentation and sorting:: How agenda items are prepared for display |
|
252 |
* Agenda commands:: Remote editing of Org trees |
|
253 |
* Custom agenda views:: Defining special searches and views |
|
254 |
* Exporting agenda views:: Writing a view to a file |
|
255 |
* Agenda column view:: Using column view for collected entries |
|
256 |
|
|
257 |
The built-in agenda views |
|
258 |
|
|
259 |
* Weekly/daily agenda:: The calendar page with current tasks |
|
260 |
* Global TODO list:: All unfinished action items |
|
261 |
* Matching tags and properties:: Structured information with fine-tuned search |
|
262 |
* Search view:: Find entries by searching for text |
|
263 |
* Stuck projects:: Find projects you need to review |
|
264 |
|
|
265 |
Presentation and sorting |
|
266 |
|
|
267 |
* Categories:: Not all tasks are equal |
|
268 |
* Time-of-day specifications:: How the agenda knows the time |
|
269 |
* Sorting agenda items:: The order of things |
|
270 |
* Filtering/limiting agenda items:: Dynamically narrow the agenda |
|
271 |
|
|
272 |
Custom agenda views |
|
273 |
|
|
274 |
* Storing searches:: Type once, use often |
|
275 |
* Block agenda:: All the stuff you need in a single buffer |
|
276 |
* Setting options:: Changing the rules |
|
277 |
|
|
278 |
Markup for rich export |
|
279 |
|
|
280 |
* Paragraphs:: The basic unit of text |
|
281 |
* Emphasis and monospace:: Bold, italic, etc. |
|
282 |
* Horizontal rules:: Make a line |
|
283 |
* Images and tables:: Images, tables and caption mechanism |
|
284 |
* Literal examples:: Source code examples with special formatting |
|
285 |
* Special symbols:: Greek letters and other symbols |
|
286 |
* Subscripts and superscripts:: Simple syntax for raising/lowering text |
|
287 |
* Embedded LaTeX:: LaTeX can be freely used inside Org documents |
|
288 |
|
|
289 |
Embedded LaTeX |
|
290 |
|
|
291 |
* LaTeX fragments:: Complex formulas made easy |
|
292 |
* Previewing LaTeX fragments:: What will this snippet look like? |
|
293 |
* CDLaTeX mode:: Speed up entering of formulas |
|
294 |
|
|
295 |
Exporting |
|
296 |
|
|
297 |
* The export dispatcher:: The main interface |
|
298 |
* Export settings:: Common export settings |
|
299 |
* Table of contents:: The if and where of the table of contents |
|
300 |
* Include files:: Include additional files into a document |
|
301 |
* Macro replacement:: Use macros to create templates |
|
302 |
* Comment lines:: What will not be exported |
|
303 |
* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding |
|
304 |
* Beamer export:: Exporting as a Beamer presentation |
|
305 |
* HTML export:: Exporting to HTML |
|
306 |
* LaTeX export:: Exporting to LaTeX, and processing to PDF |
|
307 |
* Markdown export:: Exporting to Markdown |
|
308 |
* OpenDocument Text export:: Exporting to OpenDocument Text |
|
309 |
* Org export:: Exporting to Org |
|
310 |
* Texinfo export:: Exporting to Texinfo |
|
311 |
* iCalendar export:: Exporting to iCalendar |
|
312 |
* Other built-in back-ends:: Exporting to a man page |
|
313 |
* Advanced configuration:: Fine-tuning the export output |
|
314 |
* Export in foreign buffers:: Author tables and lists in Org syntax |
|
315 |
|
|
316 |
Beamer export |
|
317 |
|
|
318 |
* Beamer export commands:: For creating Beamer documents. |
|
319 |
* Beamer specific export settings:: For customizing Beamer export. |
|
320 |
* Sectioning Frames and Blocks in Beamer:: For composing Beamer slides. |
|
321 |
* Beamer specific syntax:: For using in Org documents. |
|
322 |
* Editing support:: For using helper functions. |
|
323 |
* A Beamer example:: A complete presentation. |
|
324 |
|
|
325 |
HTML export |
|
326 |
|
|
327 |
* HTML Export commands:: Invoking HTML export |
|
328 |
* HTML Specific export settings:: Settings for HTML export |
|
329 |
* HTML doctypes:: Exporting various (X)HTML flavors |
|
330 |
* HTML preamble and postamble:: Inserting preamble and postamble |
|
331 |
* Quoting HTML tags:: Using direct HTML in Org files |
|
332 |
* Links in HTML export:: Interpreting and formatting links |
|
333 |
* Tables in HTML export:: Formatting and modifying tables |
|
334 |
* Images in HTML export:: Inserting figures with HTML output |
|
335 |
* Math formatting in HTML export:: Handling math equations |
|
336 |
* Text areas in HTML export:: Showing an alternate approach, an example |
|
337 |
* CSS support:: Styling HTML output |
|
338 |
* JavaScript support:: Folding scripting in the web browser |
|
339 |
|
|
340 |
LaTeX export |
|
341 |
|
|
342 |
* LaTeX export commands:: For producing LaTeX and PDF documents. |
|
343 |
* LaTeX specific export settings:: Unique to this LaTeX back-end. |
|
344 |
* LaTeX header and sectioning:: For file structure. |
|
345 |
* Quoting LaTeX code:: Directly in the Org document. |
|
346 |
* Tables in LaTeX export:: Attributes specific to tables. |
|
347 |
* Images in LaTeX export:: Attributes specific to images. |
|
348 |
* Plain lists in LaTeX export:: Attributes specific to lists. |
|
349 |
* Source blocks in LaTeX export:: Attributes specific to source code blocks. |
|
350 |
* Example blocks in LaTeX export:: Attributes specific to example blocks. |
|
351 |
* Special blocks in LaTeX export:: Attributes specific to special blocks. |
|
352 |
* Horizontal rules in LaTeX export:: Attributes specific to horizontal rules. |
|
353 |
|
|
354 |
OpenDocument Text export |
|
355 |
|
|
356 |
* Pre-requisites for ODT export:: Required packages. |
|
357 |
* ODT export commands:: Invoking export. |
|
358 |
* ODT specific export settings:: Configuration options. |
|
359 |
* Extending ODT export:: Producing ‘.doc’, ‘.pdf’ files. |
|
360 |
* Applying custom styles:: Styling the output. |
|
361 |
* Links in ODT export:: Handling and formatting links. |
|
362 |
* Tables in ODT export:: Org table conversions. |
|
363 |
* Images in ODT export:: Inserting images. |
|
364 |
* Math formatting in ODT export:: Formatting LaTeX fragments. |
|
365 |
* Labels and captions in ODT export:: Rendering objects. |
|
366 |
* Literal examples in ODT export:: For source code and example blocks. |
|
367 |
* Advanced topics in ODT export:: For power users. |
|
368 |
|
|
369 |
Math formatting in ODT export |
|
370 |
|
|
371 |
* Working with LaTeX math snippets:: Embedding in LaTeX format. |
|
372 |
* Working with MathML or OpenDocument formula files:: Embedding in native format. |
|
373 |
|
|
374 |
Advanced topics in ODT export |
|
375 |
|
|
376 |
* Configuring a document converter:: Registering a document converter. |
|
377 |
* Working with OpenDocument style files:: Exploring internals. |
|
378 |
* Creating one-off styles:: Customizing styles, highlighting. |
|
379 |
* Customizing tables in ODT export:: Defining table templates. |
|
380 |
* Validating OpenDocument XML:: Debugging corrupted OpenDocument files. |
|
381 |
|
|
382 |
Texinfo export |
|
383 |
|
|
384 |
* Texinfo export commands:: Invoking commands. |
|
385 |
* Texinfo specific export settings:: Setting the environment. |
|
386 |
* Texinfo file header:: Generating the header. |
|
387 |
* Texinfo title and copyright page:: Creating preamble pages. |
|
388 |
* Info directory file:: Installing a manual in Info file hierarchy. |
|
389 |
* Headings and sectioning structure:: Building document structure. |
|
390 |
* Indices:: Creating indices. |
|
391 |
* Quoting Texinfo code:: Incorporating literal Texinfo code. |
|
392 |
* Plain lists in Texinfo export:: List attributes. |
|
393 |
* Tables in Texinfo export:: Table attributes. |
|
394 |
* Images in Texinfo export:: Image attributes. |
|
395 |
* Special blocks in Texinfo export:: Special block attributes. |
|
396 |
* A Texinfo example:: Processing Org to Texinfo. |
|
397 |
|
|
398 |
Publishing |
|
399 |
|
|
400 |
* Configuration:: Defining projects |
|
401 |
* Uploading files:: How to get files up on the server |
|
402 |
* Sample configuration:: Example projects |
|
403 |
* Triggering publication:: Publication commands |
|
404 |
|
|
405 |
Configuration |
|
406 |
|
|
407 |
* Project alist:: The central configuration variable |
|
408 |
* Sources and destinations:: From here to there |
|
409 |
* Selecting files:: What files are part of the project? |
|
410 |
* Publishing action:: Setting the function doing the publishing |
|
411 |
* Publishing options:: Tweaking HTML/LaTeX export |
|
412 |
* Publishing links:: Which links keep working after publishing? |
|
413 |
* Sitemap:: Generating a list of all pages |
|
414 |
* Generating an index:: An index that reaches across pages |
|
415 |
|
|
416 |
Sample configuration |
|
417 |
|
|
418 |
* Simple example:: One-component publishing |
|
419 |
* Complex example:: A multi-component publishing example |
|
420 |
|
|
421 |
Working with source code |
|
422 |
|
|
423 |
* Structure of code blocks:: Code block syntax described |
|
424 |
* Editing source code:: Language major-mode editing |
|
425 |
* Exporting code blocks:: Export contents and/or results |
|
426 |
* Extracting source code:: Create pure source code files |
|
427 |
* Evaluating code blocks:: Place results of evaluation in the Org mode buffer |
|
428 |
* Library of Babel:: Use and contribute to a library of useful code blocks |
|
429 |
* Languages:: List of supported code block languages |
|
430 |
* Header arguments:: Configure code block functionality |
|
431 |
* Results of evaluation:: How evaluation results are handled |
|
432 |
* Noweb reference syntax:: Literate programming in Org mode |
|
433 |
* Key bindings and useful functions:: Work quickly with code blocks |
|
434 |
* Batch execution:: Call functions from the command line |
|
435 |
|
|
436 |
Header arguments |
|
437 |
|
|
438 |
* Using header arguments:: Different ways to set header arguments |
|
439 |
* Specific header arguments:: List of header arguments |
|
440 |
|
|
441 |
Using header arguments |
|
442 |
|
|
443 |
* System-wide header arguments:: Set globally, language-specific |
|
444 |
* Language-specific header arguments:: Set in the Org file’s headers |
|
445 |
* Header arguments in Org mode properties:: Set in the Org file |
|
446 |
* Language-specific mode properties:: |
|
447 |
* Code block specific header arguments:: The most commonly used method |
|
448 |
* Arguments in function calls:: The most specific level, takes highest priority |
|
449 |
|
|
450 |
Specific header arguments |
|
451 |
|
|
452 |
* var:: Pass arguments to ‘src’ code blocks |
|
453 |
* results:: Specify results type; how to collect |
|
454 |
* file:: Specify a path for output file |
|
455 |
* file-desc:: Specify a description for file results |
|
456 |
* file-ext:: Specify an extension for file output |
|
457 |
* output-dir:: Specify a directory for output file |
|
458 |
* dir:: Specify the default directory for code block execution |
|
459 |
* exports:: Specify exporting code, results, both, none |
|
460 |
* tangle:: Toggle tangling; or specify file name |
|
461 |
* mkdirp:: Toggle for parent directory creation for target files during tangling |
|
462 |
* comments:: Toggle insertion of comments in tangled code files |
|
463 |
* padline:: Control insertion of padding lines in tangled code files |
|
464 |
* no-expand:: Turn off variable assignment and noweb expansion during tangling |
|
465 |
* session:: Preserve the state of code evaluation |
|
466 |
* noweb:: Toggle expansion of noweb references |
|
467 |
* noweb-ref:: Specify block’s noweb reference resolution target |
|
468 |
* noweb-sep:: String to separate noweb references |
|
469 |
* cache:: Avoid re-evaluating unchanged code blocks |
|
470 |
* sep:: Delimiter for writing tabular results outside Org |
|
471 |
* hlines:: Handle horizontal lines in tables |
|
472 |
* colnames:: Handle column names in tables |
|
473 |
* rownames:: Handle row names in tables |
|
474 |
* shebang:: Make tangled files executable |
|
475 |
* tangle-mode:: Set permission of tangled files |
|
476 |
* eval:: Limit evaluation of specific code blocks |
|
477 |
* wrap:: Mark source block evaluation results |
|
478 |
* post:: Post processing of results of code block evaluation |
|
479 |
* prologue:: Text to prepend to body of code block |
|
480 |
* epilogue:: Text to append to body of code block |
|
481 |
|
|
482 |
Miscellaneous |
|
483 |
|
|
484 |
* Completion:: M-<TAB> guesses completions |
|
485 |
* Easy templates:: Quick insertion of structural elements |
|
486 |
* Speed keys:: Electric commands at the beginning of a headline |
|
487 |
* Code evaluation security:: Org mode files evaluate inline code |
|
488 |
* Customization:: Adapting Org to changing tastes |
|
489 |
* In-buffer settings:: Overview of the #+KEYWORDS |
|
490 |
* The very busy C-c C-c key:: When in doubt, press C-c C-c |
|
491 |
* Clean view:: Getting rid of leading stars in the outline |
|
492 |
* TTY keys:: Using Org on a tty |
|
493 |
* Interaction:: With other Emacs packages |
|
494 |
* org-crypt:: Encrypting Org files |
|
495 |
|
|
496 |
Interaction with other packages |
|
497 |
|
|
498 |
* Cooperation:: Packages Org cooperates with |
|
499 |
* Conflicts:: Packages that lead to conflicts |
|
500 |
|
|
501 |
Hacking |
|
502 |
|
|
503 |
* Hooks:: How to reach into Org’s internals |
|
504 |
* Add-on packages:: Available extensions |
|
505 |
* Adding hyperlink types:: New custom link types |
|
506 |
* Adding export back-ends:: How to write new export back-ends |
|
507 |
* Context-sensitive commands:: How to add functionality to such commands |
|
508 |
* Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs |
|
509 |
* Dynamic blocks:: Automatically filled blocks |
|
510 |
* Special agenda views:: Customized views |
|
511 |
* Speeding up your agendas:: Tips on how to speed up your agendas |
|
512 |
* Extracting agenda information:: Post-processing of agenda information |
|
513 |
* Using the property API:: Writing programs that use entry properties |
|
514 |
* Using the mapping API:: Mapping over all or selected entries |
|
515 |
|
|
516 |
Tables and lists in arbitrary syntax |
|
517 |
|
|
518 |
* Radio tables:: Sending and receiving radio tables |
|
519 |
* A LaTeX example:: Step by step, almost a tutorial |
|
520 |
* Translator functions:: Copy and modify |
|
521 |
* Radio lists:: Sending and receiving lists |
|
522 |
|
|
523 |
MobileOrg |
|
524 |
|
|
525 |
* Setting up the staging area:: For the mobile device |
|
526 |
* Pushing to MobileOrg:: Uploading Org files and agendas |
|
527 |
* Pulling from MobileOrg:: Integrating captured and flagged items |
|
528 |
|
|
529 |
|
|
530 |
|
|
531 |
File: org, Node: Introduction, Next: Document structure, Up: Top |
|
532 |
|
|
533 |
1 Introduction |
|
534 |
************** |
|
535 |
|
|
536 |
* Menu: |
|
537 |
|
|
538 |
* Summary:: Brief summary of what Org does |
|
539 |
* Installation:: Installing Org |
|
540 |
* Activation:: How to activate Org for certain buffers |
|
541 |
* Feedback:: Bug reports, ideas, patches etc. |
|
542 |
* Conventions:: Typesetting conventions in the manual |
|
543 |
|
|
544 |
|
|
545 |
File: org, Node: Summary, Next: Installation, Up: Introduction |
|
546 |
|
|
547 |
1.1 Summary |
|
548 |
=========== |
|
549 |
|
|
550 |
Org is a mode for keeping notes, maintaining TODO lists, and project |
|
551 |
planning with a fast and effective plain-text system. It also is an |
|
552 |
authoring system with unique support for literate programming and |
|
553 |
reproducible research. |
|
554 |
|
|
555 |
Org is implemented on top of Outline mode, which makes it possible to |
|
556 |
keep the content of large files well structured. Visibility cycling and |
|
557 |
structure editing help to work with the tree. Tables are easily created |
|
558 |
with a built-in table editor. Plain text URL-like links connect to |
|
559 |
websites, emails, Usenet messages, BBDB entries, and any files related |
|
560 |
to the projects. |
|
561 |
|
|
562 |
Org develops organizational tasks around notes files that contain |
|
563 |
lists or information about projects as plain text. Project planning and |
|
564 |
task management makes use of metadata which is part of an outline node. |
|
565 |
Based on this data, specific entries can be extracted in queries and |
|
566 |
create dynamic agenda views that also integrate the Emacs calendar and |
|
567 |
diary. Org can be used to implement many different project planning |
|
568 |
schemes, such as David Allen’s GTD system. |
|
569 |
|
|
570 |
Org files can serve as a single source authoring system with export |
|
571 |
to many different formats such as HTML, LaTeX, Open Document, and |
|
572 |
Markdown. New export backends can be derived from existing ones, or |
|
573 |
defined from scratch. |
|
574 |
|
|
575 |
Org files can include source code blocks, which makes Org uniquely |
|
576 |
suited for authoring technical documents with code examples. Org source |
|
577 |
code blocks are fully functional; they can be evaluated in place and |
|
578 |
their results can be captured in the file. This makes it possible to |
|
579 |
create a single file reproducible research compendium. |
|
580 |
|
|
581 |
Org keeps simple things simple. When first fired up, it should feel |
|
582 |
like a straightforward, easy to use outliner. Complexity is not |
|
583 |
imposed, but a large amount of functionality is available when needed. |
|
584 |
Org is a toolbox. Many users actually run only a (very personal) |
|
585 |
fraction of Org’s capabilities, and know that there is more whenever |
|
586 |
they need it. |
|
587 |
|
|
588 |
All of this is achieved with strictly plain text files, the most |
|
589 |
portable and future-proof file format. Org runs in Emacs. Emacs is one |
|
590 |
of the most widely ported programs, so that Org mode is available on |
|
591 |
every major platform. |
|
592 |
|
|
593 |
There is a website for Org which provides links to the newest version |
|
594 |
of Org, as well as additional information, frequently asked questions |
|
595 |
(FAQ), links to tutorials, etc. This page is located at |
|
596 |
<https://orgmode.org>. |
|
597 |
|
|
598 |
An earlier version (7.3) of this manual is available as a paperback |
|
599 |
book from Network Theory Ltd. |
|
600 |
(http://www.network-theory.co.uk/org/manual/) |
|
601 |
|
|
602 |
|
|
603 |
File: org, Node: Installation, Next: Activation, Prev: Summary, Up: Introduction |
|
604 |
|
|
605 |
1.2 Installation |
|
606 |
================ |
|
607 |
|
|
608 |
Org is part of recent distributions of GNU Emacs, so you normally don’t |
|
609 |
need to install it. If, for one reason or another, you want to install |
|
610 |
Org on top of this pre-packaged version, there are three ways to do it: |
|
611 |
|
|
612 |
• By using Emacs package system. |
|
613 |
• By downloading Org as an archive. |
|
614 |
• By using Org’s git repository. |
|
615 |
|
|
616 |
We strongly recommend to stick to a single installation method. |
|
617 |
|
|
618 |
Using Emacs packaging system |
|
619 |
............................ |
|
620 |
|
|
621 |
Recent Emacs distributions include a packaging system which lets you |
|
622 |
install Elisp libraries. You can install Org with ‘M-x package-install |
|
623 |
<RET> org’. |
|
624 |
|
|
625 |
Important: you need to do this in a session where no ‘.org’ file has |
|
626 |
been visited, i.e., where no Org built-in function have been loaded. |
|
627 |
Otherwise autoload Org functions will mess up the installation. |
|
628 |
|
|
629 |
Then, to make sure your Org configuration is taken into account, |
|
630 |
initialize the package system with ‘(package-initialize)’ in your Emacs |
|
631 |
init file before setting any Org option. If you want to use Org’s |
|
632 |
package repository, check out the Org ELPA page |
|
633 |
(https://orgmode.org/elpa.html). |
|
634 |
|
|
635 |
Downloading Org as an archive |
|
636 |
............................. |
|
637 |
|
|
638 |
You can download Org latest release from Org’s website |
|
639 |
(https://orgmode.org/). In this case, make sure you set the load-path |
|
640 |
correctly in your Emacs init file: |
|
641 |
|
|
642 |
(add-to-list 'load-path "~/path/to/orgdir/lisp") |
|
643 |
|
|
644 |
The downloaded archive contains contributed libraries that are not |
|
645 |
included in Emacs. If you want to use them, add the ‘contrib’ directory |
|
646 |
to your load-path: |
|
647 |
|
|
648 |
(add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t) |
|
649 |
|
|
650 |
Optionally, you can compile the files and/or install them in your |
|
651 |
system. Run ‘make help’ to list compilation and installation options. |
|
652 |
|
|
653 |
Using Org’s git repository |
|
654 |
.......................... |
|
655 |
|
|
656 |
You can clone Org’s repository and install Org like this: |
|
657 |
|
|
658 |
$ cd ~/src/ |
|
659 |
$ git clone https://code.orgmode.org/bzg/org-mode.git |
|
660 |
$ cd org-mode/ |
|
661 |
$ make autoloads |
|
662 |
|
|
663 |
Note that in this case, ‘make autoloads’ is mandatory: it defines |
|
664 |
Org’s version in ‘org-version.el’ and Org’s autoloads in |
|
665 |
‘org-loaddefs.el’. |
|
666 |
|
|
667 |
Remember to add the correct load-path as described in the method |
|
668 |
above. |
|
669 |
|
|
670 |
You can also compile with ‘make’, generate the documentation with |
|
671 |
‘make doc’, create a local configuration with ‘make config’ and install |
|
672 |
Org with ‘make install’. Please run ‘make help’ to get the list of |
|
673 |
compilation/installation options. |
|
674 |
|
|
675 |
For more detailed explanations on Org’s build system, please check |
|
676 |
the Org Build System page on Worg |
|
677 |
(https://orgmode.org/worg/dev/org-build-system.html). |
|
678 |
|
|
679 |
|
|
680 |
File: org, Node: Activation, Next: Feedback, Prev: Installation, Up: Introduction |
|
681 |
|
|
682 |
1.3 Activation |
|
683 |
============== |
|
684 |
|
|
685 |
Org mode buffers need font-lock to be turned on: this is the default in |
|
686 |
Emacs(1). |
|
687 |
|
|
688 |
There are compatibility issues between Org mode and some other Elisp |
|
689 |
packages, please take the time to check the list (*note Conflicts::). |
|
690 |
|
|
691 |
The four Org commands ‘org-store-link’, ‘org-capture’, ‘org-agenda’, |
|
692 |
and ‘org-switchb’ should be accessible through global keys (i.e., |
|
693 |
anywhere in Emacs, not just in Org buffers). Here are suggested |
|
694 |
bindings for these keys, please modify the keys to your own liking. |
|
695 |
(global-set-key "\C-cl" 'org-store-link) |
|
696 |
(global-set-key "\C-ca" 'org-agenda) |
|
697 |
(global-set-key "\C-cc" 'org-capture) |
|
698 |
(global-set-key "\C-cb" 'org-switchb) |
|
699 |
|
|
700 |
Files with the ‘.org’ extension use Org mode by default. To turn on |
|
701 |
Org mode in a file that does not have the extension ‘.org’, make the |
|
702 |
first line of a file look like this: |
|
703 |
|
|
704 |
MY PROJECTS -*- mode: org; -*- |
|
705 |
|
|
706 |
which will select Org mode for this buffer no matter what the file’s |
|
707 |
name is. See also the variable ‘org-insert-mode-line-in-empty-file’. |
|
708 |
|
|
709 |
Many commands in Org work on the region if the region is active. To |
|
710 |
make use of this, you need to have ‘transient-mark-mode’ turned on, |
|
711 |
which is the default. If you do not like ‘transient-mark-mode’, you can |
|
712 |
create an active region by using the mouse to select a region, or |
|
713 |
pressing ‘C-<SPC>’ twice before moving the cursor. |
|
714 |
|
|
715 |
---------- Footnotes ---------- |
|
716 |
|
|
717 |
(1) If you don’t use font-lock globally, turn it on in Org buffer |
|
718 |
with ‘(add-hook 'org-mode-hook 'turn-on-font-lock)’ |
|
719 |
|
|
720 |
|
|
721 |
File: org, Node: Feedback, Next: Conventions, Prev: Activation, Up: Introduction |
|
722 |
|
|
723 |
1.4 Feedback |
|
724 |
============ |
|
725 |
|
|
726 |
If you find problems with Org, or if you have questions, remarks, or |
|
727 |
ideas about it, please mail to the Org mailing list |
|
728 |
<emacs-orgmode@gnu.org>. You can subscribe to the list on this web page |
|
729 |
(https://lists.gnu.org/mailman/listinfo/emacs-orgmode). If you are not |
|
730 |
a member of the mailing list, your mail will be passed to the list after |
|
731 |
a moderator has approved it(1). |
|
732 |
|
|
733 |
For bug reports, please first try to reproduce the bug with the |
|
734 |
latest version of Org available—if you are running an outdated version, |
|
735 |
it is quite possible that the bug has been fixed already. If the bug |
|
736 |
persists, prepare a report and provide as much information as possible, |
|
737 |
including the version information of Emacs (‘M-x emacs-version <RET>’) |
|
738 |
and Org (‘M-x org-version <RET>’), as well as the Org related setup in |
|
739 |
the Emacs init file. The easiest way to do this is to use the command |
|
740 |
M-x org-submit-bug-report <RET> |
|
741 |
which will put all this information into an Emacs mail buffer so that |
|
742 |
you only need to add your description. If you are not sending the Email |
|
743 |
from within Emacs, please copy and paste the content into your Email |
|
744 |
program. |
|
745 |
|
|
746 |
Sometimes you might face a problem due to an error in your Emacs or |
|
747 |
Org mode setup. Before reporting a bug, it is very helpful to start |
|
748 |
Emacs with minimal customizations and reproduce the problem. Doing so |
|
749 |
often helps you determine if the problem is with your customization or |
|
750 |
with Org mode itself. You can start a typical minimal session with a |
|
751 |
command like the example below. |
|
752 |
|
|
753 |
$ emacs -Q -l /path/to/minimal-org.el |
|
754 |
|
|
755 |
However if you are using Org mode as distributed with Emacs, a |
|
756 |
minimal setup is not necessary. In that case it is sufficient to start |
|
757 |
Emacs as ‘emacs -Q’. The ‘minimal-org.el’ setup file can have contents |
|
758 |
as shown below. |
|
759 |
|
|
760 |
;;; Minimal setup to load latest 'org-mode' |
|
761 |
|
|
762 |
;; activate debugging |
|
763 |
(setq debug-on-error t |
|
764 |
debug-on-signal nil |
|
765 |
debug-on-quit nil) |
|
766 |
|
|
767 |
;; add latest org-mode to load path |
|
768 |
(add-to-list 'load-path "/path/to/org-mode/lisp") |
|
769 |
(add-to-list 'load-path "/path/to/org-mode/contrib/lisp" t) |
|
770 |
|
|
771 |
If an error occurs, a backtrace can be very useful (see below on how |
|
772 |
to create one). Often a small example file helps, along with clear |
|
773 |
information about: |
|
774 |
|
|
775 |
1. What exactly did you do? |
|
776 |
2. What did you expect to happen? |
|
777 |
3. What happened instead? |
|
778 |
Thank you for helping to improve this program. |
|
779 |
|
|
780 |
How to create a useful backtrace |
|
781 |
................................ |
|
782 |
|
|
783 |
If working with Org produces an error with a message you don’t |
|
784 |
understand, you may have hit a bug. The best way to report this is by |
|
785 |
providing, in addition to what was mentioned above, a _backtrace_. This |
|
786 |
is information from the built-in debugger about where and how the error |
|
787 |
occurred. Here is how to produce a useful backtrace: |
|
788 |
|
|
789 |
1. Reload uncompiled versions of all Org mode Lisp files. The |
|
790 |
backtrace contains much more information if it is produced with |
|
791 |
uncompiled code. To do this, use |
|
792 |
C-u M-x org-reload <RET> |
|
793 |
or select ‘Org -> Refresh/Reload -> Reload Org uncompiled’ from the |
|
794 |
menu. |
|
795 |
2. Go to the ‘Options’ menu and select ‘Enter Debugger on Error’. |
|
796 |
3. Do whatever you have to do to hit the error. Don’t forget to |
|
797 |
document the steps you take. |
|
798 |
4. When you hit the error, a ‘*Backtrace*’ buffer will appear on the |
|
799 |
screen. Save this buffer to a file (for example using ‘C-x C-w’) |
|
800 |
and attach it to your bug report. |
|
801 |
|
|
802 |
---------- Footnotes ---------- |
|
803 |
|
|
804 |
(1) Please consider subscribing to the mailing list, in order to |
|
805 |
minimize the work the mailing list moderators have to do. |
|
806 |
|
|
807 |
|
|
808 |
File: org, Node: Conventions, Prev: Feedback, Up: Introduction |
|
809 |
|
|
810 |
1.5 Typesetting conventions used in this manual |
|
811 |
=============================================== |
|
812 |
|
|
813 |
TODO keywords, tags, properties, etc. |
|
814 |
..................................... |
|
815 |
|
|
816 |
Org mainly uses three types of keywords: TODO keywords, tags and |
|
817 |
property names. In this manual we use the following conventions: |
|
818 |
|
|
819 |
‘TODO’ |
|
820 |
‘WAITING’ |
|
821 |
TODO keywords are written with all capitals, even if they are |
|
822 |
user-defined. |
|
823 |
‘boss’ |
|
824 |
‘ARCHIVE’ |
|
825 |
User-defined tags are written in lowercase; built-in tags with |
|
826 |
special meaning are written with all capitals. |
|
827 |
‘Release’ |
|
828 |
‘PRIORITY’ |
|
829 |
User-defined properties are capitalized; built-in properties with |
|
830 |
special meaning are written with all capitals. |
|
831 |
|
|
832 |
Moreover, Org uses option keywords (like ‘#+TITLE’ to set the title) |
|
833 |
and environment keywords (like ‘#+BEGIN_EXPORT html’ to start a ‘HTML’ |
|
834 |
environment). They are written in uppercase in the manual to enhance |
|
835 |
its readability, but you can use lowercase in your Org file. |
|
836 |
|
|
837 |
Key bindings and commands |
|
838 |
......................... |
|
839 |
|
|
840 |
The manual suggests a few global key bindings, in particular ‘C-c a’ for |
|
841 |
‘org-agenda’ and ‘C-c c’ for ‘org-capture’. These are only suggestions, |
|
842 |
but the rest of the manual assumes that these key bindings are in place |
|
843 |
in order to list commands by key access. |
|
844 |
|
|
845 |
Also, the manual lists both the keys and the corresponding commands |
|
846 |
for accessing a functionality. Org mode often uses the same key for |
|
847 |
different functions, depending on context. The command that is bound to |
|
848 |
such keys has a generic name, like ‘org-metaright’. In the manual we |
|
849 |
will, wherever possible, give the function that is internally called by |
|
850 |
the generic command. For example, in the chapter on document structure, |
|
851 |
‘M-<RIGHT>’ will be listed to call ‘org-do-demote’, while in the chapter |
|
852 |
on tables, it will be listed to call ‘org-table-move-column-right’. If |
|
853 |
you prefer, you can compile the manual without the command names by |
|
854 |
unsetting the flag ‘cmdnames’ in ‘org.texi’. |
|
855 |
|
|
856 |
|
|
857 |
File: org, Node: Document structure, Next: Tables, Prev: Introduction, Up: Top |
|
858 |
|
|
859 |
2 Document structure |
|
860 |
******************** |
|
861 |
|
|
862 |
Org is based on Outline mode and provides flexible commands to edit the |
|
863 |
structure of the document. |
|
864 |
|
|
865 |
* Menu: |
|
866 |
|
|
867 |
* Outlines:: Org is based on Outline mode |
|
868 |
* Headlines:: How to typeset Org tree headlines |
|
869 |
* Visibility cycling:: Show and hide, much simplified |
|
870 |
* Motion:: Jumping to other headlines |
|
871 |
* Structure editing:: Changing sequence and level of headlines |
|
872 |
* Sparse trees:: Matches embedded in context |
|
873 |
* Plain lists:: Additional structure within an entry |
|
874 |
* Drawers:: Tucking stuff away |
|
875 |
* Blocks:: Folding blocks |
|
876 |
* Footnotes:: How footnotes are defined in Org’s syntax |
|
877 |
* Orgstruct mode:: Structure editing outside Org |
|
878 |
* Org syntax:: Formal description of Org’s syntax |
|
879 |
|
|
880 |
|
|
881 |
File: org, Node: Outlines, Next: Headlines, Up: Document structure |
|
882 |
|
|
883 |
2.1 Outlines |
|
884 |
============ |
|
885 |
|
|
886 |
Org is implemented on top of Outline mode. Outlines allow a document to |
|
887 |
be organized in a hierarchical structure, which (at least for me) is the |
|
888 |
best representation of notes and thoughts. An overview of this |
|
889 |
structure is achieved by folding (hiding) large parts of the document to |
|
890 |
show only the general document structure and the parts currently being |
|
891 |
worked on. Org greatly simplifies the use of outlines by compressing |
|
892 |
the entire show/hide functionality into a single command, ‘org-cycle’, |
|
893 |
which is bound to the <TAB> key. |
|
894 |
|
|
895 |
|
|
896 |
File: org, Node: Headlines, Next: Visibility cycling, Prev: Outlines, Up: Document structure |
|
897 |
|
|
898 |
2.2 Headlines |
|
899 |
============= |
|
900 |
|
|
901 |
Headlines define the structure of an outline tree. The headlines in Org |
|
902 |
start with one or more stars, on the left margin(1) (2). For example: |
|
903 |
|
|
904 |
* Top level headline |
|
905 |
** Second level |
|
906 |
*** 3rd level |
|
907 |
some text |
|
908 |
*** 3rd level |
|
909 |
more text |
|
910 |
|
|
911 |
* Another top level headline |
|
912 |
|
|
913 |
Note that a headline named after ‘org-footnote-section’, which defaults |
|
914 |
to ‘Footnotes’, is considered as special. A subtree with this headline |
|
915 |
will be silently ignored by exporting functions. |
|
916 |
|
|
917 |
Some people find the many stars too noisy and would prefer an outline |
|
918 |
that has whitespace followed by a single star as headline starters. |
|
919 |
*note Clean view::, describes a setup to realize this. |
|
920 |
|
|
921 |
An empty line after the end of a subtree is considered part of it and |
|
922 |
will be hidden when the subtree is folded. However, if you leave at |
|
923 |
least two empty lines, one empty line will remain visible after folding |
|
924 |
the subtree, in order to structure the collapsed view. See the variable |
|
925 |
‘org-cycle-separator-lines’ to modify this behavior. |
|
926 |
|
|
927 |
---------- Footnotes ---------- |
|
928 |
|
|
929 |
(1) See the variables ‘org-special-ctrl-a/e’, ‘org-special-ctrl-k’, |
|
930 |
and ‘org-ctrl-k-protect-subtree’ to configure special behavior of ‘C-a’, |
|
931 |
‘C-e’, and ‘C-k’ in headlines. |
|
932 |
|
|
933 |
(2) Clocking only works with headings indented less than 30 stars. |
|
934 |
|
|
935 |
|
|
936 |
File: org, Node: Visibility cycling, Next: Motion, Prev: Headlines, Up: Document structure |
|
937 |
|
|
938 |
2.3 Visibility cycling |
|
939 |
====================== |
|
940 |
|
|
941 |
* Menu: |
|
942 |
|
|
943 |
* Global and local cycling:: Cycling through various visibility states |
|
944 |
* Initial visibility:: Setting the initial visibility state |
|
945 |
* Catching invisible edits:: Preventing mistakes when editing invisible parts |
|
946 |
|
|
947 |
|
|
948 |
File: org, Node: Global and local cycling, Next: Initial visibility, Up: Visibility cycling |
|
949 |
|
|
950 |
2.3.1 Global and local cycling |
|
951 |
------------------------------ |
|
952 |
|
|
953 |
Outlines make it possible to hide parts of the text in the buffer. Org |
|
954 |
uses just two commands, bound to <TAB> and ‘S-<TAB>’ to change the |
|
955 |
visibility in the buffer. |
|
956 |
|
|
957 |
‘<TAB>’ (‘org-cycle’) |
|
958 |
_Subtree cycling_: Rotate current subtree among the states |
|
959 |
|
|
960 |
,-> FOLDED -> CHILDREN -> SUBTREE --. |
|
961 |
'-----------------------------------' |
|
962 |
|
|
963 |
The cursor must be on a headline for this to work(1). |
|
964 |
|
|
965 |
‘S-<TAB>’ (‘org-global-cycle’) |
|
966 |
C-u <TAB> |
|
967 |
_Global cycling_: Rotate the entire buffer among the states |
|
968 |
|
|
969 |
,-> OVERVIEW -> CONTENTS -> SHOW ALL --. |
|
970 |
'--------------------------------------' |
|
971 |
|
|
972 |
When ‘S-<TAB>’ is called with a numeric prefix argument N, the |
|
973 |
CONTENTS view up to headlines of level N will be shown. Note that |
|
974 |
inside tables, ‘S-<TAB>’ jumps to the previous field. |
|
975 |
|
|
976 |
You can run global cycling using <TAB> only if point is at the very |
|
977 |
beginning of the buffer, but not on a headline, and |
|
978 |
‘org-cycle-global-at-bob’ is set to a non-‘nil’ value. |
|
979 |
|
|
980 |
‘C-u C-u <TAB>’ (‘org-set-startup-visibility’) |
|
981 |
Switch back to the startup visibility of the buffer (*note Initial |
|
982 |
visibility::). |
|
983 |
‘C-u C-u C-u <TAB>’ (‘outline-show-all’) |
|
984 |
Show all, including drawers. |
|
985 |
‘C-c C-r’ (‘org-reveal’) |
|
986 |
Reveal context around point, showing the current entry, the |
|
987 |
following heading and the hierarchy above. Useful for working near |
|
988 |
a location that has been exposed by a sparse tree command (*note |
|
989 |
Sparse trees::) or an agenda command (*note Agenda commands::). |
|
990 |
With a prefix argument show, on each level, all sibling headings. |
|
991 |
With a double prefix argument, also show the entire subtree of the |
|
992 |
parent. |
|
993 |
‘C-c C-k’ (‘outline-show-branches’) |
|
994 |
Expose all the headings of the subtree, CONTENTS view for just one |
|
995 |
subtree. |
|
996 |
‘C-c <TAB>’ (‘outline-show-children’) |
|
997 |
Expose all direct children of the subtree. With a numeric prefix |
|
998 |
argument N, expose all children down to level N. |
|
999 |
‘C-c C-x b’ (‘org-tree-to-indirect-buffer’) |
|
1000 |
Show the current subtree in an indirect buffer(2). With a numeric |
|
1001 |
prefix argument N, go up to level N and then take that tree. If N |
|
1002 |
is negative then go up that many levels. With a ‘C-u’ prefix, do |
|
1003 |
not remove the previously used indirect buffer. |
|
1004 |
‘C-c C-x v’ (‘org-copy-visible’) |
|
1005 |
Copy the visible text in the region into the kill ring. |
|
1006 |
|
|
1007 |
---------- Footnotes ---------- |
|
1008 |
|
|
1009 |
(1) see, however, the option ‘org-cycle-emulate-tab’. |
|
1010 |
|
|
1011 |
(2) The indirect buffer (*note (emacs)Indirect Buffers::) will |
|
1012 |
contain the entire buffer, but will be narrowed to the current tree. |
|
1013 |
Editing the indirect buffer will also change the original buffer, but |
|
1014 |
without affecting visibility in that buffer. |
|
1015 |
|
|
1016 |
|
|
1017 |
File: org, Node: Initial visibility, Next: Catching invisible edits, Prev: Global and local cycling, Up: Visibility cycling |
|
1018 |
|
|
1019 |
2.3.2 Initial visibility |
|
1020 |
------------------------ |
|
1021 |
|
|
1022 |
When Emacs first visits an Org file, the global state is set to |
|
1023 |
OVERVIEW, i.e., only the top level headlines are visible(1). This can |
|
1024 |
be configured through the variable ‘org-startup-folded’, or on a |
|
1025 |
per-file basis by adding one of the following lines anywhere in the |
|
1026 |
buffer: |
|
1027 |
|
|
1028 |
#+STARTUP: overview |
|
1029 |
#+STARTUP: content |
|
1030 |
#+STARTUP: showall |
|
1031 |
#+STARTUP: showeverything |
|
1032 |
|
|
1033 |
Furthermore, any entries with a ‘VISIBILITY’ property (*note Properties |
|
1034 |
and columns::) will get their visibility adapted accordingly. Allowed |
|
1035 |
values for this property are ‘folded’, ‘children’, ‘content’, and ‘all’. |
|
1036 |
|
|
1037 |
‘C-u C-u <TAB>’ (‘org-set-startup-visibility’) |
|
1038 |
Switch back to the startup visibility of the buffer, i.e., whatever |
|
1039 |
is requested by startup options and ‘VISIBILITY’ properties in |
|
1040 |
individual entries. |
|
1041 |
|
|
1042 |
---------- Footnotes ---------- |
|
1043 |
|
|
1044 |
(1) When ‘org-agenda-inhibit-startup’ is non-‘nil’, Org will not |
|
1045 |
honor the default visibility state when first opening a file for the |
|
1046 |
agenda (*note Speeding up your agendas::). |
|
1047 |
|
|
1048 |
|
|
1049 |
File: org, Node: Catching invisible edits, Prev: Initial visibility, Up: Visibility cycling |
|
1050 |
|
|
1051 |
2.3.3 Catching invisible edits |
|
1052 |
------------------------------ |
|
1053 |
|
|
1054 |
Sometimes you may inadvertently edit an invisible part of the buffer and |
|
1055 |
be confused on what has been edited and how to undo the mistake. |
|
1056 |
Setting ‘org-catch-invisible-edits’ to non-‘nil’ will help prevent this. |
|
1057 |
See the docstring of this option on how Org should catch invisible edits |
|
1058 |
and process them. |
|
1059 |
|
|
1060 |
|
|
1061 |
File: org, Node: Motion, Next: Structure editing, Prev: Visibility cycling, Up: Document structure |
|
1062 |
|
|
1063 |
2.4 Motion |
|
1064 |
========== |
|
1065 |
|
|
1066 |
The following commands jump to other headlines in the buffer. |
|
1067 |
|
|
1068 |
‘C-c C-n’ (‘org-next-visible-heading’) |
|
1069 |
Next heading. |
|
1070 |
‘C-c C-p’ (‘org-previous-visible-heading’) |
|
1071 |
Previous heading. |
|
1072 |
‘C-c C-f’ (‘org-forward-same-level’) |
|
1073 |
Next heading same level. |
|
1074 |
‘C-c C-b’ (‘org-backward-same-level’) |
|
1075 |
Previous heading same level. |
|
1076 |
‘C-c C-u’ (‘outline-up-heading’) |
|
1077 |
Backward to higher level heading. |
|
1078 |
‘C-c C-j’ (‘org-goto’) |
|
1079 |
Jump to a different place without changing the current outline |
|
1080 |
visibility. Shows the document structure in a temporary buffer, |
|
1081 |
where you can use the following keys to find your destination: |
|
1082 |
<TAB> Cycle visibility. |
|
1083 |
<DOWN> / <UP> Next/previous visible headline. |
|
1084 |
<RET> Select this location. |
|
1085 |
/ Do a Sparse-tree search |
|
1086 |
The following keys work if you turn off ‘org-goto-auto-isearch’ |
|
1087 |
n / p Next/previous visible headline. |
|
1088 |
f / b Next/previous headline same level. |
|
1089 |
u One level up. |
|
1090 |
0-9 Digit argument. |
|
1091 |
q Quit |
|
1092 |
See also the option ‘org-goto-interface’. |
|
1093 |
|
|
1094 |
|
|
1095 |
File: org, Node: Structure editing, Next: Sparse trees, Prev: Motion, Up: Document structure |
|
1096 |
|
|
1097 |
2.5 Structure editing |
|
1098 |
===================== |
|
1099 |
|
|
1100 |
‘M-<RET>’ (‘org-meta-return’) |
|
1101 |
Insert a new heading, item or row. |
|
1102 |
|
|
1103 |
If the command is used at the _beginning_ of a line, and if there |
|
1104 |
is a heading or a plain list item (*note Plain lists::) at point, |
|
1105 |
the new heading/item is created _before_ the current line. When |
|
1106 |
used at the beginning of a regular line of text, turn that line |
|
1107 |
into a heading. |
|
1108 |
|
|
1109 |
When this command is used in the middle of a line, the line is |
|
1110 |
split and the rest of the line becomes the new item or headline. |
|
1111 |
If you do not want the line to be split, customize |
|
1112 |
‘org-M-RET-may-split-line’. |
|
1113 |
|
|
1114 |
Calling the command with a ‘C-u’ prefix unconditionally inserts a |
|
1115 |
new heading at the end of the current subtree, thus preserving its |
|
1116 |
contents. With a double ‘C-u C-u’ prefix, the new heading is |
|
1117 |
created at the end of the parent subtree instead. |
|
1118 |
‘C-<RET>’ (‘org-insert-heading-respect-content’) |
|
1119 |
Insert a new heading at the end of the current subtree. |
|
1120 |
‘M-S-<RET>’ (‘org-insert-todo-heading’) |
|
1121 |
Insert new TODO entry with same level as current heading. See also |
|
1122 |
the variable ‘org-treat-insert-todo-heading-as-state-change’. |
|
1123 |
‘C-S-<RET>’ (‘org-insert-todo-heading-respect-content’) |
|
1124 |
Insert new TODO entry with same level as current heading. Like |
|
1125 |
‘C-<RET>’, the new headline will be inserted after the current |
|
1126 |
subtree. |
|
1127 |
‘<TAB>’ (‘org-cycle’) |
|
1128 |
In a new entry with no text yet, the first <TAB> demotes the entry |
|
1129 |
to become a child of the previous one. The next <TAB> makes it a |
|
1130 |
parent, and so on, all the way to top level. Yet another <TAB>, |
|
1131 |
and you are back to the initial level. |
|
1132 |
‘M-<LEFT>’ (‘org-do-promote’) |
|
1133 |
Promote current heading by one level. |
|
1134 |
‘M-<RIGHT>’ (‘org-do-demote’) |
|
1135 |
Demote current heading by one level. |
|
1136 |
‘M-S-<LEFT>’ (‘org-promote-subtree’) |
|
1137 |
Promote the current subtree by one level. |
|
1138 |
‘M-S-<RIGHT>’ (‘org-demote-subtree’) |
|
1139 |
Demote the current subtree by one level. |
|
1140 |
‘M-<UP>’ (‘org-move-subtree-up’) |
|
1141 |
Move subtree up (swap with previous subtree of same level). |
|
1142 |
‘M-<DOWN>’ (‘org-move-subtree-down’) |
|
1143 |
Move subtree down (swap with next subtree of same level). |
|
1144 |
‘M-h’ (‘org-mark-element’) |
|
1145 |
Mark the element at point. Hitting repeatedly will mark subsequent |
|
1146 |
elements of the one just marked. E.g., hitting ‘M-h’ on a |
|
1147 |
paragraph will mark it, hitting ‘M-h’ immediately again will mark |
|
1148 |
the next one. |
|
1149 |
‘C-c @’ (‘org-mark-subtree’) |
|
1150 |
Mark the subtree at point. Hitting repeatedly will mark subsequent |
|
1151 |
subtrees of the same level than the marked subtree. |
|
1152 |
‘C-c C-x C-w’ (‘org-cut-subtree’) |
|
1153 |
Kill subtree, i.e., remove it from buffer but save in kill ring. |
|
1154 |
With a numeric prefix argument N, kill N sequential subtrees. |
|
1155 |
‘C-c C-x M-w’ (‘org-copy-subtree’) |
|
1156 |
Copy subtree to kill ring. With a numeric prefix argument N, copy |
|
1157 |
the N sequential subtrees. |
|
1158 |
‘C-c C-x C-y’ (‘org-paste-subtree’) |
|
1159 |
Yank subtree from kill ring. This does modify the level of the |
|
1160 |
subtree to make sure the tree fits in nicely at the yank position. |
|
1161 |
The yank level can also be specified with a numeric prefix |
|
1162 |
argument, or by yanking after a headline marker like ‘****’. |
|
1163 |
‘C-y’ (‘org-yank’) |
|
1164 |
Depending on the options ‘org-yank-adjusted-subtrees’ and |
|
1165 |
‘org-yank-folded-subtrees’, Org’s internal ‘yank’ command will |
|
1166 |
paste subtrees folded and in a clever way, using the same command |
|
1167 |
as ‘C-c C-x C-y’. With the default settings, no level adjustment |
|
1168 |
will take place, but the yanked tree will be folded unless doing so |
|
1169 |
would swallow text previously visible. Any prefix argument to this |
|
1170 |
command will force a normal ‘yank’ to be executed, with the prefix |
|
1171 |
passed along. A good way to force a normal yank is ‘C-u C-y’. If |
|
1172 |
you use ‘yank-pop’ after a yank, it will yank previous kill items |
|
1173 |
plainly, without adjustment and folding. |
|
1174 |
‘C-c C-x c’ (‘org-clone-subtree-with-time-shift’) |
|
1175 |
Clone a subtree by making a number of sibling copies of it. You |
|
1176 |
will be prompted for the number of copies to make, and you can also |
|
1177 |
specify if any timestamps in the entry should be shifted. This can |
|
1178 |
be useful, for example, to create a number of tasks related to a |
|
1179 |
series of lectures to prepare. For more details, see the docstring |
|
1180 |
of the command ‘org-clone-subtree-with-time-shift’. |
|
1181 |
‘C-c C-w’ (‘org-refile’) |
|
1182 |
Refile entry or region to a different location. *Note Refile and |
|
1183 |
copy::. |
|
1184 |
‘C-c ^’ (‘org-sort’) |
|
1185 |
Sort same-level entries. When there is an active region, all |
|
1186 |
entries in the region will be sorted. Otherwise the children of |
|
1187 |
the current headline are sorted. The command prompts for the |
|
1188 |
sorting method, which can be alphabetically, numerically, by time |
|
1189 |
(first timestamp with active preferred, creation time, scheduled |
|
1190 |
time, deadline time), by priority, by TODO keyword (in the sequence |
|
1191 |
the keywords have been defined in the setup) or by the value of a |
|
1192 |
property. Reverse sorting is possible as well. You can also |
|
1193 |
supply your own function to extract the sorting key. With a ‘C-u’ |
|
1194 |
prefix, sorting will be case-sensitive. |
|
1195 |
‘C-x n s’ (‘org-narrow-to-subtree’) |
|
1196 |
Narrow buffer to current subtree. |
|
1197 |
‘C-x n b’ (‘org-narrow-to-block’) |
|
1198 |
Narrow buffer to current block. |
|
1199 |
‘C-x n w’ (‘widen’) |
|
1200 |
Widen buffer to remove narrowing. |
|
1201 |
‘C-c *’ (‘org-toggle-heading’) |
|
1202 |
Turn a normal line or plain list item into a headline (so that it |
|
1203 |
becomes a subheading at its location). Also turn a headline into a |
|
1204 |
normal line by removing the stars. If there is an active region, |
|
1205 |
turn all lines in the region into headlines. If the first line in |
|
1206 |
the region was an item, turn only the item lines into headlines. |
|
1207 |
Finally, if the first line is a headline, remove the stars from all |
|
1208 |
headlines in the region. |
|
1209 |
|
|
1210 |
When there is an active region (Transient Mark mode), promotion and |
|
1211 |
demotion work on all headlines in the region. To select a region of |
|
1212 |
headlines, it is best to place both point and mark at the beginning of a |
|
1213 |
line, mark at the beginning of the first headline, and point at the line |
|
1214 |
just after the last headline to change. Note that when the cursor is |
|
1215 |
inside a table (*note Tables::), the Meta-Cursor keys have different |
|
1216 |
functionality. |
|
1217 |
|
|
1218 |
|
|
1219 |
File: org, Node: Sparse trees, Next: Plain lists, Prev: Structure editing, Up: Document structure |
|
1220 |
|
|
1221 |
2.6 Sparse trees |
|
1222 |
================ |
|
1223 |
|
|
1224 |
An important feature of Org mode is the ability to construct _sparse |
|
1225 |
trees_ for selected information in an outline tree, so that the entire |
|
1226 |
document is folded as much as possible, but the selected information is |
|
1227 |
made visible along with the headline structure above it(1). Just try it |
|
1228 |
out and you will see immediately how it works. |
|
1229 |
|
|
1230 |
Org mode contains several commands for creating such trees, all these |
|
1231 |
commands can be accessed through a dispatcher: |
|
1232 |
|
|
1233 |
‘C-c /’ (‘org-sparse-tree’) |
|
1234 |
This prompts for an extra key to select a sparse-tree creating |
|
1235 |
command. |
|
1236 |
‘C-c / r’ or ‘C-c / /’ (‘org-occur’) |
|
1237 |
Prompts for a regexp and shows a sparse tree with all matches. If |
|
1238 |
the match is in a headline, the headline is made visible. If the |
|
1239 |
match is in the body of an entry, headline and body are made |
|
1240 |
visible. In order to provide minimal context, also the full |
|
1241 |
hierarchy of headlines above the match is shown, as well as the |
|
1242 |
headline following the match. Each match is also highlighted; the |
|
1243 |
highlights disappear when the buffer is changed by an editing |
|
1244 |
command(2), or by pressing ‘C-c C-c’. When called with a ‘C-u’ |
|
1245 |
prefix argument, previous highlights are kept, so several calls to |
|
1246 |
this command can be stacked. |
|
1247 |
‘M-g n’ or ‘M-g M-n’ (‘next-error’) |
|
1248 |
Jump to the next sparse tree match in this buffer. |
|
1249 |
‘M-g p’ or ‘M-g M-p’ (‘previous-error’) |
|
1250 |
Jump to the previous sparse tree match in this buffer. |
|
1251 |
|
|
1252 |
For frequently used sparse trees of specific search strings, you can use |
|
1253 |
the option ‘org-agenda-custom-commands’ to define fast keyboard access |
|
1254 |
to specific sparse trees. These commands will then be accessible |
|
1255 |
through the agenda dispatcher (*note Agenda dispatcher::). For example: |
|
1256 |
|
|
1257 |
(setq org-agenda-custom-commands |
|
1258 |
'(("f" occur-tree "FIXME"))) |
|
1259 |
|
|
1260 |
will define the key ‘C-c a f’ as a shortcut for creating a sparse tree |
|
1261 |
matching the string ‘FIXME’. |
|
1262 |
|
|
1263 |
The other sparse tree commands select headings based on TODO |
|
1264 |
keywords, tags, or properties and will be discussed later in this |
|
1265 |
manual. |
|
1266 |
|
|
1267 |
To print a sparse tree, you can use the Emacs command |
|
1268 |
‘ps-print-buffer-with-faces’ which does not print invisible parts of the |
|
1269 |
document. Or you can use ‘C-c C-e C-v’ to export only the visible part |
|
1270 |
of the document and print the resulting file. |
|
1271 |
|
|
1272 |
---------- Footnotes ---------- |
|
1273 |
|
|
1274 |
(1) See also the variable ‘org-show-context-detail’ to decide how |
|
1275 |
much context is shown around each match. |
|
1276 |
|
|
1277 |
(2) This depends on the option ‘org-remove-highlights-with-change’ |
|
1278 |
|
|
1279 |
|
|
1280 |
File: org, Node: Plain lists, Next: Drawers, Prev: Sparse trees, Up: Document structure |
|
1281 |
|
|
1282 |
2.7 Plain lists |
|
1283 |
=============== |
|
1284 |
|
|
1285 |
Within an entry of the outline tree, hand-formatted lists can provide |
|
1286 |
additional structure. They also provide a way to create lists of |
|
1287 |
checkboxes (*note Checkboxes::). Org supports editing such lists, and |
|
1288 |
every exporter (*note Exporting::) can parse and format them. |
|
1289 |
|
|
1290 |
Org knows ordered lists, unordered lists, and description lists. |
|
1291 |
• _Unordered_ list items start with ‘-’, ‘+’, or ‘*’(1) as bullets. |
|
1292 |
• _Ordered_ list items start with a numeral followed by either a |
|
1293 |
period or a right parenthesis(2), such as ‘1.’ or ‘1)’(3). If you |
|
1294 |
want a list to start with a different value (e.g., 20), start the |
|
1295 |
text of the item with ‘[@20]’(4). Those constructs can be used in |
|
1296 |
any item of the list in order to enforce a particular numbering. |
|
1297 |
• _Description_ list items are unordered list items, and contain the |
|
1298 |
separator ‘ :: ’ to distinguish the description _term_ from the |
|
1299 |
description. |
|
1300 |
|
|
1301 |
Items belonging to the same list must have the same indentation on |
|
1302 |
the first line. In particular, if an ordered list reaches number ‘10.’, |
|
1303 |
then the 2–digit numbers must be written left-aligned with the other |
|
1304 |
numbers in the list. An item ends before the next line that is less or |
|
1305 |
equally indented than its bullet/number. |
|
1306 |
|
|
1307 |
A list ends whenever every item has ended, which means before any |
|
1308 |
line less or equally indented than items at top level. It also ends |
|
1309 |
before two blank lines. In that case, all items are closed. Here is an |
|
1310 |
example: |
|
1311 |
|
|
1312 |
** Lord of the Rings |
|
1313 |
My favorite scenes are (in this order) |
|
1314 |
1. The attack of the Rohirrim |
|
1315 |
2. Eowyn's fight with the witch king |
|
1316 |
+ this was already my favorite scene in the book |
|
1317 |
+ I really like Miranda Otto. |
|
1318 |
3. Peter Jackson being shot by Legolas |
|
1319 |
- on DVD only |
|
1320 |
He makes a really funny face when it happens. |
|
1321 |
But in the end, no individual scenes matter but the film as a whole. |
|
1322 |
Important actors in this film are: |
|
1323 |
- Elijah Wood :: He plays Frodo |
|
1324 |
- Sean Astin :: He plays Sam, Frodo's friend. I still remember |
|
1325 |
him very well from his role as Mikey Walsh in The Goonies. |
|
1326 |
|
|
1327 |
Org supports these lists by tuning filling and wrapping commands to |
|
1328 |
deal with them correctly, and by exporting them properly (*note |
|
1329 |
Exporting::). Since indentation is what governs the structure of these |
|
1330 |
lists, many structural constructs like ‘#+BEGIN_...’ blocks can be |
|
1331 |
indented to signal that they belong to a particular item. |
|
1332 |
|
|
1333 |
If you find that using a different bullet for a sub-list (than that |
|
1334 |
used for the current list-level) improves readability, customize the |
|
1335 |
variable ‘org-list-demote-modify-bullet’. To get a greater difference |
|
1336 |
of indentation between items and their sub-items, customize |
|
1337 |
‘org-list-indent-offset’. |
|
1338 |
|
|
1339 |
The following commands act on items when the cursor is in the first |
|
1340 |
line of an item (the line with the bullet or number). Some of them |
|
1341 |
imply the application of automatic rules to keep list structure intact. |
|
1342 |
If some of these actions get in your way, configure |
|
1343 |
‘org-list-automatic-rules’ to disable them individually. |
|
1344 |
|
|
1345 |
‘<TAB>’ (‘org-cycle’) |
|
1346 |
Items can be folded just like headline levels. Normally this works |
|
1347 |
only if the cursor is on a plain list item. For more details, see |
|
1348 |
the variable ‘org-cycle-include-plain-lists’. If this variable is |
|
1349 |
set to ‘integrate’, plain list items will be treated like low-level |
|
1350 |
headlines. The level of an item is then given by the indentation |
|
1351 |
of the bullet/number. Items are always subordinate to real |
|
1352 |
headlines, however; the hierarchies remain completely separated. |
|
1353 |
In a new item with no text yet, the first <TAB> demotes the item to |
|
1354 |
become a child of the previous one. Subsequent <TAB>s move the |
|
1355 |
item to meaningful levels in the list and eventually get it back to |
|
1356 |
its initial position. |
|
1357 |
‘M-<RET>’ (‘org-insert-heading’) |
|
1358 |
Insert new item at current level. With a prefix argument, force a |
|
1359 |
new heading (*note Structure editing::). If this command is used |
|
1360 |
in the middle of an item, that item is _split_ in two, and the |
|
1361 |
second part becomes the new item(5). If this command is executed |
|
1362 |
_before item’s body_, the new item is created _before_ the current |
|
1363 |
one. |
|
1364 |
|
|
1365 |
‘M-S-<RET>’ |
|
1366 |
Insert a new item with a checkbox (*note Checkboxes::). |
|
1367 |
‘S-up’ |
|
1368 |
‘S-down’ |
|
1369 |
Jump to the previous/next item in the current list(6), but only if |
|
1370 |
‘org-support-shift-select’ is off. If not, you can still use |
|
1371 |
paragraph jumping commands like ‘C-<UP>’ and ‘C-<DOWN>’ to quite |
|
1372 |
similar effect. |
|
1373 |
‘M-up’ |
|
1374 |
‘M-down’ |
|
1375 |
Move the item including subitems up/down(7) (swap with |
|
1376 |
previous/next item of same indentation). If the list is ordered, |
|
1377 |
renumbering is automatic. |
|
1378 |
‘M-left’ |
|
1379 |
‘M-right’ |
|
1380 |
Decrease/increase the indentation of an item, leaving children |
|
1381 |
alone. |
|
1382 |
‘M-S-<LEFT>’ |
|
1383 |
‘M-S-<RIGHT>’ |
|
1384 |
Decrease/increase the indentation of the item, including subitems. |
|
1385 |
Initially, the item tree is selected based on current indentation. |
|
1386 |
When these commands are executed several times in direct |
|
1387 |
succession, the initially selected region is used, even if the new |
|
1388 |
indentation would imply a different hierarchy. To use the new |
|
1389 |
hierarchy, break the command chain with a cursor motion or so. |
|
1390 |
|
|
1391 |
As a special case, using this command on the very first item of a |
|
1392 |
list will move the whole list. This behavior can be disabled by |
|
1393 |
configuring ‘org-list-automatic-rules’. The global indentation of |
|
1394 |
a list has no influence on the text _after_ the list. |
|
1395 |
‘C-c C-c’ |
|
1396 |
If there is a checkbox (*note Checkboxes::) in the item line, |
|
1397 |
toggle the state of the checkbox. In any case, verify bullets and |
|
1398 |
indentation consistency in the whole list. |
|
1399 |
‘C-c -’ |
|
1400 |
Cycle the entire list level through the different itemize/enumerate |
|
1401 |
bullets (‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’) or a subset of them, depending |
|
1402 |
on ‘org-plain-list-ordered-item-terminator’, the type of list, and |
|
1403 |
its indentation. With a numeric prefix argument N, select the Nth |
|
1404 |
bullet from this list. If there is an active region when calling |
|
1405 |
this, all selected lines are converted to list items. With a |
|
1406 |
prefix argument, selected text is changed into a single item. If |
|
1407 |
the first line already was a list item, any item marker will be |
|
1408 |
removed from the list. Finally, even without an active region, a |
|
1409 |
normal line will be converted into a list item. |
|
1410 |
‘C-c *’ |
|
1411 |
Turn a plain list item into a headline (so that it becomes a |
|
1412 |
subheading at its location). *Note Structure editing::, for a |
|
1413 |
detailed explanation. |
|
1414 |
‘C-c C-*’ |
|
1415 |
Turn the whole plain list into a subtree of the current heading. |
|
1416 |
Checkboxes (*note Checkboxes::) will become TODO (resp. DONE) |
|
1417 |
keywords when unchecked (resp. checked). |
|
1418 |
‘S-<LEFT>/<RIGHT>’ |
|
1419 |
This command also cycles bullet styles when the cursor in on the |
|
1420 |
bullet or anywhere in an item line, details depending on |
|
1421 |
‘org-support-shift-select’. |
|
1422 |
‘C-c ^’ |
|
1423 |
Sort the plain list. You will be prompted for the sorting method: |
|
1424 |
numerically, alphabetically, by time, by checked status for check |
|
1425 |
lists, or by a custom function. |
|
1426 |
|
|
1427 |
---------- Footnotes ---------- |
|
1428 |
|
|
1429 |
(1) When using ‘*’ as a bullet, lines must be indented or they will |
|
1430 |
be seen as top-level headlines. Also, when you are hiding leading stars |
|
1431 |
to get a clean outline view, plain list items starting with a star may |
|
1432 |
be hard to distinguish from true headlines. In short: even though ‘*’ |
|
1433 |
is supported, it may be better to not use it for plain list items. |
|
1434 |
|
|
1435 |
(2) You can filter out any of them by configuring |
|
1436 |
‘org-plain-list-ordered-item-terminator’. |
|
1437 |
|
|
1438 |
(3) You can also get ‘a.’, ‘A.’, ‘a)’ and ‘A)’ by configuring |
|
1439 |
‘org-list-allow-alphabetical’. To minimize confusion with normal text, |
|
1440 |
those are limited to one character only. Beyond that limit, bullets |
|
1441 |
will automatically fallback to numbers. |
|
1442 |
|
|
1443 |
(4) If there’s a checkbox in the item, the cookie must be put |
|
1444 |
_before_ the checkbox. If you have activated alphabetical lists, you |
|
1445 |
can also use counters like ‘[@b]’. |
|
1446 |
|
|
1447 |
(5) If you do not want the item to be split, customize the variable |
|
1448 |
‘org-M-RET-may-split-line’. |
|
1449 |
|
|
1450 |
(6) If you want to cycle around items that way, you may customize |
|
1451 |
‘org-list-use-circular-motion’. |
|
1452 |
|
|
1453 |
(7) See ‘org-list-use-circular-motion’ for a cyclic behavior. |
|
1454 |
|
|
1455 |
|
|
1456 |
File: org, Node: Drawers, Next: Blocks, Prev: Plain lists, Up: Document structure |
|
1457 |
|
|
1458 |
2.8 Drawers |
|
1459 |
=========== |
|
1460 |
|
|
1461 |
Sometimes you want to keep information associated with an entry, but you |
|
1462 |
normally don’t want to see it. For this, Org mode has _drawers_. They |
|
1463 |
can contain anything but a headline and another drawer. Drawers look |
|
1464 |
like this: |
|
1465 |
|
|
1466 |
** This is a headline |
|
1467 |
Still outside the drawer |
|
1468 |
:DRAWERNAME: |
|
1469 |
This is inside the drawer. |
|
1470 |
:END: |
|
1471 |
After the drawer. |
|
1472 |
|
|
1473 |
You can interactively insert drawers at point by calling |
|
1474 |
‘org-insert-drawer’, which is bound to ‘C-c C-x d’. With an active |
|
1475 |
region, this command will put the region inside the drawer. With a |
|
1476 |
prefix argument, this command calls ‘org-insert-property-drawer’ and add |
|
1477 |
a property drawer right below the current headline. Completion over |
|
1478 |
drawer keywords is also possible using ‘M-<TAB>’(1). |
|
1479 |
|
|
1480 |
Visibility cycling (*note Visibility cycling::) on the headline will |
|
1481 |
hide and show the entry, but keep the drawer collapsed to a single line. |
|
1482 |
In order to look inside the drawer, you need to move the cursor to the |
|
1483 |
drawer line and press <TAB> there. Org mode uses the ‘PROPERTIES’ |
|
1484 |
drawer for storing properties (*note Properties and columns::), and you |
|
1485 |
can also arrange for state change notes (*note Tracking TODO state |
|
1486 |
changes::) and clock times (*note Clocking work time::) to be stored in |
|
1487 |
a drawer ‘LOGBOOK’. If you want to store a quick note in the LOGBOOK |
|
1488 |
drawer, in a similar way to state changes, use |
|
1489 |
|
|
1490 |
‘C-c C-z’ |
|
1491 |
Add a time-stamped note to the LOGBOOK drawer. |
|
1492 |
|
|
1493 |
You can select the name of the drawers which should be exported with |
|
1494 |
‘org-export-with-drawers’. In that case, drawer contents will appear in |
|
1495 |
export output. Property drawers are not affected by this variable: |
|
1496 |
configure ‘org-export-with-properties’ instead. |
|
1497 |
|
|
1498 |
---------- Footnotes ---------- |
|
1499 |
|
|
1500 |
(1) Many desktops intercept ‘M-<TAB>’ to switch windows. Use ‘C-M-i’ |
|
1501 |
or ‘<ESC> <TAB>’ instead for completion (*note Completion::). |
|
1502 |
|
|
1503 |
|
|
1504 |
File: org, Node: Blocks, Next: Footnotes, Prev: Drawers, Up: Document structure |
|
1505 |
|
|
1506 |
2.9 Blocks |
|
1507 |
========== |
|
1508 |
|
|
1509 |
Org mode uses begin...end blocks for various purposes from including |
|
1510 |
source code examples (*note Literal examples::) to capturing time |
|
1511 |
logging information (*note Clocking work time::). These blocks can be |
|
1512 |
folded and unfolded by pressing <TAB> in the begin line. You can also |
|
1513 |
get all blocks folded at startup by configuring the option |
|
1514 |
‘org-hide-block-startup’ or on a per-file basis by using |
|
1515 |
|
|
1516 |
#+STARTUP: hideblocks |
|
1517 |
#+STARTUP: nohideblocks |
|
1518 |
|
|
1519 |
|
|
1520 |
File: org, Node: Footnotes, Next: Orgstruct mode, Prev: Blocks, Up: Document structure |
|
1521 |
|
|
1522 |
2.10 Footnotes |
|
1523 |
============== |
|
1524 |
|
|
1525 |
Org mode supports the creation of footnotes. |
|
1526 |
|
|
1527 |
A footnote is started by a footnote marker in square brackets in |
|
1528 |
column 0, no indentation allowed. It ends at the next footnote |
|
1529 |
definition, headline, or after two consecutive empty lines. The |
|
1530 |
footnote reference is simply the marker in square brackets, inside text. |
|
1531 |
Markers always start with ‘fn:’. For example: |
|
1532 |
|
|
1533 |
The Org homepage[fn:1] now looks a lot better than it used to. |
|
1534 |
... |
|
1535 |
[fn:1] The link is: https://orgmode.org |
|
1536 |
|
|
1537 |
Org mode extends the number-based syntax to _named_ footnotes and |
|
1538 |
optional inline definition. Here are the valid references: |
|
1539 |
|
|
1540 |
‘[fn:name]’ |
|
1541 |
A named footnote reference, where ‘name’ is a unique label word, |
|
1542 |
or, for simplicity of automatic creation, a number. |
|
1543 |
‘[fn::This is the inline definition of this footnote]’ |
|
1544 |
A LaTeX-like anonymous footnote where the definition is given |
|
1545 |
directly at the reference point. |
|
1546 |
‘[fn:name:a definition]’ |
|
1547 |
An inline definition of a footnote, which also specifies a name for |
|
1548 |
the note. Since Org allows multiple references to the same note, |
|
1549 |
you can then use ‘[fn:name]’ to create additional references. |
|
1550 |
|
|
1551 |
Footnote labels can be created automatically, or you can create names |
|
1552 |
yourself. This is handled by the variable ‘org-footnote-auto-label’ and |
|
1553 |
its corresponding ‘#+STARTUP’ keywords. See the docstring of that |
|
1554 |
variable for details. |
|
1555 |
|
|
1556 |
The following command handles footnotes: |
|
1557 |
|
|
1558 |
‘C-c C-x f’ |
|
1559 |
The footnote action command. |
|
1560 |
|
|
1561 |
When the cursor is on a footnote reference, jump to the definition. |
|
1562 |
When it is at a definition, jump to the (first) reference. |
|
1563 |
|
|
1564 |
Otherwise, create a new footnote. Depending on the option |
|
1565 |
‘org-footnote-define-inline’(1), the definition will be placed |
|
1566 |
right into the text as part of the reference, or separately into |
|
1567 |
the location determined by the option ‘org-footnote-section’. |
|
1568 |
|
|
1569 |
When this command is called with a prefix argument, a menu of |
|
1570 |
additional options is offered: |
|
1571 |
s Sort the footnote definitions by reference sequence. During editing, |
|
1572 |
Org makes no effort to sort footnote definitions into a particular |
|
1573 |
sequence. If you want them sorted, use this command, which will |
|
1574 |
also move entries according to ‘org-footnote-section’. Automatic |
|
1575 |
sorting after each insertion/deletion can be configured using the |
|
1576 |
option ‘org-footnote-auto-adjust’. |
|
1577 |
r Renumber the simple ‘fn:N’ footnotes. Automatic renumbering |
|
1578 |
after each insertion/deletion can be configured using the option |
|
1579 |
‘org-footnote-auto-adjust’. |
|
1580 |
S Short for first ‘r’, then ‘s’ action. |
|
1581 |
n Normalize the footnotes by collecting all definitions (including |
|
1582 |
inline definitions) into a special section, and then numbering them |
|
1583 |
in sequence. The references will then also be numbers. |
|
1584 |
d Delete the footnote at point, and all definitions of and references |
|
1585 |
to it. |
|
1586 |
Depending on the variable ‘org-footnote-auto-adjust’(2), |
|
1587 |
renumbering and sorting footnotes can be automatic after each |
|
1588 |
insertion or deletion. |
|
1589 |
|
|
1590 |
‘C-c C-c’ |
|
1591 |
If the cursor is on a footnote reference, jump to the definition. |
|
1592 |
If it is a the definition, jump back to the reference. When called |
|
1593 |
at a footnote location with a prefix argument, offer the same menu |
|
1594 |
as ‘C-c C-x f’. |
|
1595 |
‘C-c C-o or mouse-1/2’ |
|
1596 |
Footnote labels are also links to the corresponding |
|
1597 |
definition/reference, and you can use the usual commands to follow |
|
1598 |
these links. |
|
1599 |
|
|
1600 |
‘C-c '’ |
|
1601 |
‘C-c '’ |
|
1602 |
Edit the footnote definition corresponding to the reference at |
|
1603 |
point in a separate window. The window can be closed by pressing |
|
1604 |
‘C-c '’. |
|
1605 |
|
|
1606 |
---------- Footnotes ---------- |
|
1607 |
|
|
1608 |
(1) The corresponding in-buffer setting is: ‘#+STARTUP: fninline’ or |
|
1609 |
‘#+STARTUP: nofninline’ |
|
1610 |
|
|
1611 |
(2) the corresponding in-buffer options are ‘fnadjust’ and |
|
1612 |
‘nofnadjust’. |
|
1613 |
|
|
1614 |
|
|
1615 |
File: org, Node: Orgstruct mode, Next: Org syntax, Prev: Footnotes, Up: Document structure |
|
1616 |
|
|
1617 |
2.11 The Orgstruct minor mode |
|
1618 |
============================= |
|
1619 |
|
|
1620 |
If you like the intuitive way the Org mode structure editing and list |
|
1621 |
formatting works, you might want to use these commands in other modes |
|
1622 |
like Text mode or Mail mode as well. The minor mode ‘orgstruct-mode’ |
|
1623 |
makes this possible. Toggle the mode with ‘M-x orgstruct-mode <RET>’, |
|
1624 |
or turn it on by default, for example in Message mode, with one of: |
|
1625 |
|
|
1626 |
(add-hook 'message-mode-hook 'turn-on-orgstruct) |
|
1627 |
(add-hook 'message-mode-hook 'turn-on-orgstruct++) |
|
1628 |
|
|
1629 |
When this mode is active and the cursor is on a line that looks to |
|
1630 |
Org like a headline or the first line of a list item, most structure |
|
1631 |
editing commands will work, even if the same keys normally have |
|
1632 |
different functionality in the major mode you are using. If the cursor |
|
1633 |
is not in one of those special lines, Orgstruct mode lurks silently in |
|
1634 |
the shadows. |
|
1635 |
|
|
1636 |
When you use ‘orgstruct++-mode’, Org will also export indentation and |
|
1637 |
autofill settings into that mode, and detect item context after the |
|
1638 |
first line of an item. |
|
1639 |
|
|
1640 |
You can also use Org structure editing to fold and unfold headlines |
|
1641 |
in _any_ file, provided you defined ‘orgstruct-heading-prefix-regexp’: |
|
1642 |
the regular expression must match the local prefix to use before Org’s |
|
1643 |
headlines. For example, if you set this variable to ‘";; "’ in Emacs |
|
1644 |
Lisp files, you will be able to fold and unfold headlines in Emacs Lisp |
|
1645 |
commented lines. Some commands like ‘org-demote’ are disabled when the |
|
1646 |
prefix is set, but folding/unfolding will work correctly. |
|
1647 |
|
|
1648 |
|
|
1649 |
File: org, Node: Org syntax, Prev: Orgstruct mode, Up: Document structure |
|
1650 |
|
|
1651 |
2.12 Org syntax |
|
1652 |
=============== |
|
1653 |
|
|
1654 |
A reference document providing a formal description of Org’s syntax is |
|
1655 |
available as a draft on Worg |
|
1656 |
(https://orgmode.org/worg/dev/org-syntax.html), written and maintained |
|
1657 |
by Nicolas Goaziou. It defines Org’s core internal concepts such as |
|
1658 |
‘headlines’, ‘sections’, ‘affiliated keywords’, ‘(greater) elements’ and |
|
1659 |
‘objects’. Each part of an Org file falls into one of the categories |
|
1660 |
above. |
|
1661 |
|
|
1662 |
To explore the abstract structure of an Org buffer, run this in a |
|
1663 |
buffer: |
|
1664 |
|
|
1665 |
M-: (org-element-parse-buffer) <RET> |
|
1666 |
|
|
1667 |
It will output a list containing the buffer’s content represented as |
|
1668 |
an abstract structure. The export engine relies on the information |
|
1669 |
stored in this list. Most interactive commands (e.g., for structure |
|
1670 |
editing) also rely on the syntactic meaning of the surrounding context. |
|
1671 |
|
|
1672 |
You can check syntax in your documents using ‘org-lint’ command. |
|
1673 |
|
|
1674 |
|
|
1675 |
File: org, Node: Tables, Next: Hyperlinks, Prev: Document structure, Up: Top |
|
1676 |
|
|
1677 |
3 Tables |
|
1678 |
******** |
|
1679 |
|
|
1680 |
Org comes with a fast and intuitive table editor. Spreadsheet-like |
|
1681 |
calculations are supported using the Emacs ‘calc’ package (*note Calc: |
|
1682 |
(calc)Top.). |
|
1683 |
|
|
1684 |
* Menu: |
|
1685 |
|
|
1686 |
* Built-in table editor:: Simple tables |
|
1687 |
* Column width and alignment:: Overrule the automatic settings |
|
1688 |
* Column groups:: Grouping to trigger vertical lines |
|
1689 |
* Orgtbl mode:: The table editor as minor mode |
|
1690 |
* The spreadsheet:: The table editor has spreadsheet capabilities |
|
1691 |
* Org-Plot:: Plotting from org tables |
|
1692 |
|
|
1693 |
|
|
1694 |
File: org, Node: Built-in table editor, Next: Column width and alignment, Up: Tables |
|
1695 |
|
|
1696 |
3.1 The built-in table editor |
|
1697 |
============================= |
|
1698 |
|
|
1699 |
Org makes it easy to format tables in plain ASCII. Any line with ‘|’ as |
|
1700 |
the first non-whitespace character is considered part of a table. ‘|’ |
|
1701 |
is also the column separator(1). A table might look like this: |
|
1702 |
|
|
1703 |
| Name | Phone | Age | |
|
1704 |
|-------+-------+-----| |
|
1705 |
| Peter | 1234 | 17 | |
|
1706 |
| Anna | 4321 | 25 | |
|
1707 |
|
|
1708 |
A table is re-aligned automatically each time you press <TAB> or |
|
1709 |
<RET> or ‘C-c C-c’ inside the table. <TAB> also moves to the next field |
|
1710 |
(<RET> to the next row) and creates new table rows at the end of the |
|
1711 |
table or before horizontal lines. The indentation of the table is set |
|
1712 |
by the first line. Any line starting with ‘|-’ is considered as a |
|
1713 |
horizontal separator line and will be expanded on the next re-align to |
|
1714 |
span the whole table width. So, to create the above table, you would |
|
1715 |
only type |
|
1716 |
|
|
1717 |
|Name|Phone|Age| |
|
1718 |
|- |
|
1719 |
|
|
1720 |
and then press <TAB> to align the table and start filling in fields. |
|
1721 |
Even faster would be to type ‘|Name|Phone|Age’ followed by ‘C-c <RET>’. |
|
1722 |
|
|
1723 |
When typing text into a field, Org treats <DEL>, <Backspace>, and all |
|
1724 |
character keys in a special way, so that inserting and deleting avoids |
|
1725 |
shifting other fields. Also, when typing _immediately after the cursor |
|
1726 |
was moved into a new field with ‘<TAB>’, ‘S-<TAB>’ or ‘<RET>’_, the |
|
1727 |
field is automatically made blank. If this behavior is too |
|
1728 |
unpredictable for you, configure the option |
|
1729 |
‘org-table-auto-blank-field’. |
|
1730 |
|
|
1731 |
Creation and conversion |
|
1732 |
....................... |
|
1733 |
|
|
1734 |
‘C-c | (org-table-create-or-convert-from-region)’ |
|
1735 |
Convert the active region to a table. If every line contains at |
|
1736 |
least one TAB character, the function assumes that the material is |
|
1737 |
tab separated. If every line contains a comma, comma-separated |
|
1738 |
values (CSV) are assumed. If not, lines are split at whitespace |
|
1739 |
into fields. You can use a prefix argument to force a specific |
|
1740 |
separator: ‘C-u’ forces CSV, ‘C-u C-u’ forces TAB, ‘C-u C-u C-u’ |
|
1741 |
will prompt for a regular expression to match the separator, and a |
|
1742 |
numeric argument N indicates that at least N consecutive spaces, or |
|
1743 |
alternatively a TAB will be the separator. |
|
1744 |
If there is no active region, this command creates an empty Org |
|
1745 |
table. But it is easier just to start typing, like |
|
1746 |
‘|Name|Phone|Age <RET> |- <TAB>’. |
|
1747 |
|
|
1748 |
Re-aligning and field motion |
|
1749 |
............................ |
|
1750 |
|
|
1751 |
‘C-c C-c (org-table-align)’ |
|
1752 |
Re-align the table and don’t move to another field. |
|
1753 |
‘C-c <SPC> (org-table-blank-field)’ |
|
1754 |
Blank the field at point. |
|
1755 |
‘<TAB> (org-table-next-field)’ |
|
1756 |
Re-align the table, move to the next field. Creates a new row if |
|
1757 |
necessary. |
|
1758 |
‘S-<TAB> (org-table-previous-field)’ |
|
1759 |
Re-align, move to previous field. |
|
1760 |
‘<RET> (org-table-next-row)’ |
|
1761 |
Re-align the table and move down to next row. Creates a new row if |
|
1762 |
necessary. At the beginning or end of a line, <RET> still does |
|
1763 |
NEWLINE, so it can be used to split a table. |
|
1764 |
‘M-a (org-table-beginning-of-field)’ |
|
1765 |
Move to beginning of the current table field, or on to the previous |
|
1766 |
field. |
|
1767 |
‘M-e (org-table-end-of-field)’ |
|
1768 |
Move to end of the current table field, or on to the next field. |
|
1769 |
|
|
1770 |
Column and row editing |
|
1771 |
...................... |
|
1772 |
|
|
1773 |
‘M-<LEFT> (org-table-move-column-left)’ |
|
1774 |
‘M-<RIGHT> (org-table-move-column-right)’ |
|
1775 |
Move the current column left/right. |
|
1776 |
‘M-S-<LEFT> (org-table-delete-column)’ |
|
1777 |
Kill the current column. |
|
1778 |
‘M-S-<RIGHT> (org-table-insert-column)’ |
|
1779 |
Insert a new column to the left of the cursor position. |
|
1780 |
‘M-<UP> (org-table-move-row-up)’ |
|
1781 |
‘M-<DOWN> (org-table-move-row-down)’ |
|
1782 |
Move the current row up/down. |
|
1783 |
‘M-S-<UP> (org-table-kill-row)’ |
|
1784 |
Kill the current row or horizontal line. |
|
1785 |
‘M-S-<DOWN> (org-table-insert-row)’ |
|
1786 |
Insert a new row above the current row. With a prefix argument, |
|
1787 |
the line is created below the current one. |
|
1788 |
‘C-c - (org-table-insert-hline)’ |
|
1789 |
Insert a horizontal line below current row. With a prefix |
|
1790 |
argument, the line is created above the current line. |
|
1791 |
‘C-c <RET> (org-table-hline-and-move)’ |
|
1792 |
Insert a horizontal line below current row, and move the cursor |
|
1793 |
into the row below that line. |
|
1794 |
‘C-c ^ (org-table-sort-lines)’ |
|
1795 |
Sort the table lines in the region. The position of point |
|
1796 |
indicates the column to be used for sorting, and the range of lines |
|
1797 |
is the range between the nearest horizontal separator lines, or the |
|
1798 |
entire table. If point is before the first column, you will be |
|
1799 |
prompted for the sorting column. If there is an active region, the |
|
1800 |
mark specifies the first line and the sorting column, while point |
|
1801 |
should be in the last line to be included into the sorting. The |
|
1802 |
command prompts for the sorting type (alphabetically, numerically, |
|
1803 |
or by time). You can sort in normal or reverse order. You can |
|
1804 |
also supply your own key extraction and comparison functions. When |
|
1805 |
called with a prefix argument, alphabetic sorting will be |
|
1806 |
case-sensitive. |
|
1807 |
|
|
1808 |
Regions |
|
1809 |
....... |
|
1810 |
|
|
1811 |
‘C-c C-x M-w (org-table-copy-region)’ |
|
1812 |
Copy a rectangular region from a table to a special clipboard. |
|
1813 |
Point and mark determine edge fields of the rectangle. If there is |
|
1814 |
no active region, copy just the current field. The process ignores |
|
1815 |
horizontal separator lines. |
|
1816 |
‘C-c C-x C-w (org-table-cut-region)’ |
|
1817 |
Copy a rectangular region from a table to a special clipboard, and |
|
1818 |
blank all fields in the rectangle. So this is the “cut” operation. |
|
1819 |
‘C-c C-x C-y (org-table-paste-rectangle)’ |
|
1820 |
Paste a rectangular region into a table. The upper left corner |
|
1821 |
ends up in the current field. All involved fields will be |
|
1822 |
overwritten. If the rectangle does not fit into the present table, |
|
1823 |
the table is enlarged as needed. The process ignores horizontal |
|
1824 |
separator lines. |
|
1825 |
‘M-<RET> (org-table-wrap-region)’ |
|
1826 |
Split the current field at the cursor position and move the rest to |
|
1827 |
the line below. If there is an active region, and both point and |
|
1828 |
mark are in the same column, the text in the column is wrapped to |
|
1829 |
minimum width for the given number of lines. A numeric prefix |
|
1830 |
argument may be used to change the number of desired lines. If |
|
1831 |
there is no region, but you specify a prefix argument, the current |
|
1832 |
field is made blank, and the content is appended to the field |
|
1833 |
above. |
|
1834 |
|
|
1835 |
Calculations |
|
1836 |
............ |
|
1837 |
|
|
1838 |
‘C-c + (org-table-sum)’ |
|
1839 |
Sum the numbers in the current column, or in the rectangle defined |
|
1840 |
by the active region. The result is shown in the echo area and can |
|
1841 |
be inserted with ‘C-y’. |
|
1842 |
‘S-<RET> (org-table-copy-down)’ |
|
1843 |
When current field is empty, copy from first non-empty field above. |
|
1844 |
When not empty, copy current field down to next row and move cursor |
|
1845 |
along with it. Depending on the option ‘org-table-copy-increment’, |
|
1846 |
integer field values will be incremented during copy. Integers |
|
1847 |
that are too large will not be incremented. Also, a ‘0’ prefix |
|
1848 |
argument temporarily disables the increment. This key is also used |
|
1849 |
by shift-selection and related modes (*note Conflicts::). |
|
1850 |
|
|
1851 |
Miscellaneous |
|
1852 |
............. |
|
1853 |
|
|
1854 |
‘C-c ` (org-table-edit-field)’ |
|
1855 |
Edit the current field in a separate window. This is useful for |
|
1856 |
fields that are not fully visible (*note Column width and |
|
1857 |
alignment::). When called with a ‘C-u’ prefix, just make the full |
|
1858 |
field visible, so that it can be edited in place. When called with |
|
1859 |
two ‘C-u’ prefixes, make the editor window follow the cursor |
|
1860 |
through the table and always show the current field. The follow |
|
1861 |
mode exits automatically when the cursor leaves the table, or when |
|
1862 |
you repeat this command with ‘C-u C-u C-c `’. |
|
1863 |
‘M-x org-table-import <RET>’ |
|
1864 |
Import a file as a table. The table should be TAB or whitespace |
|
1865 |
separated. Use, for example, to import a spreadsheet table or data |
|
1866 |
from a database, because these programs generally can write |
|
1867 |
TAB-separated text files. This command works by inserting the file |
|
1868 |
into the buffer and then converting the region to a table. Any |
|
1869 |
prefix argument is passed on to the converter, which uses it to |
|
1870 |
determine the separator. |
|
1871 |
‘C-c | (org-table-create-or-convert-from-region)’ |
|
1872 |
Tables can also be imported by pasting tabular text into the Org |
|
1873 |
buffer, selecting the pasted text with ‘C-x C-x’ and then using the |
|
1874 |
‘C-c |’ command (see above under Creation and conversion). |
|
1875 |
‘M-x org-table-export <RET>’ |
|
1876 |
Export the table, by default as a TAB-separated file. Use for data |
|
1877 |
exchange with, for example, spreadsheet or database programs. The |
|
1878 |
format used to export the file can be configured in the option |
|
1879 |
‘org-table-export-default-format’. You may also use properties |
|
1880 |
‘TABLE_EXPORT_FILE’ and ‘TABLE_EXPORT_FORMAT’ to specify the file |
|
1881 |
name and the format for table export in a subtree. Org supports |
|
1882 |
quite general formats for exported tables. The exporter format is |
|
1883 |
the same as the format used by Orgtbl radio tables, see *note |
|
1884 |
Translator functions::, for a detailed description. |
|
1885 |
|
|
1886 |
---------- Footnotes ---------- |
|
1887 |
|
|
1888 |
(1) To insert a vertical bar into a table field, use ‘\vert’ or, |
|
1889 |
inside a word ‘abc\vert{}def’. |
|
1890 |
|
|
1891 |
|
|
1892 |
File: org, Node: Column width and alignment, Next: Column groups, Prev: Built-in table editor, Up: Tables |
|
1893 |
|
|
1894 |
3.2 Column width and alignment |
|
1895 |
============================== |
|
1896 |
|
|
1897 |
The width of columns is automatically determined by the table editor. |
|
1898 |
And also the alignment of a column is determined automatically from the |
|
1899 |
fraction of number-like versus non-number fields in the column. |
|
1900 |
|
|
1901 |
Sometimes a single field or a few fields need to carry more text, |
|
1902 |
leading to inconveniently wide columns. Or maybe you want to make a |
|
1903 |
table with several columns having a fixed width, regardless of content. |
|
1904 |
To set the width of a column, one field anywhere in the column may |
|
1905 |
contain just the string ‘<N>’ where ‘N’ is an integer specifying the |
|
1906 |
width of the column in characters. The next re-align will then set the |
|
1907 |
width of this column to this value. |
|
1908 |
|
|
1909 |
|---+------------------------------| |---+--------| |
|
1910 |
| | | | | <6> | |
|
1911 |
| 1 | one | | 1 | one | |
|
1912 |
| 2 | two | ----\ | 2 | two | |
|
1913 |
| 3 | This is a long chunk of text | ----/ | 3 | This=> | |
|
1914 |
| 4 | four | | 4 | four | |
|
1915 |
|---+------------------------------| |---+--------| |
|
1916 |
|
|
1917 |
Fields that are wider become clipped and end in the string ‘=>’. Note |
|
1918 |
that the full text is still in the buffer but is hidden. To see the |
|
1919 |
full text, hold the mouse over the field—a tool-tip window will show the |
|
1920 |
full content. To edit such a field, use the command ‘C-c `’ (that is |
|
1921 |
‘C-c’ followed by the grave accent). This will open a new window with |
|
1922 |
the full field. Edit it and finish with ‘C-c C-c’. |
|
1923 |
|
|
1924 |
When visiting a file containing a table with narrowed columns, the |
|
1925 |
necessary character hiding has not yet happened, and the table needs to |
|
1926 |
be aligned before it looks nice. Setting the option |
|
1927 |
‘org-startup-align-all-tables’ will realign all tables in a file upon |
|
1928 |
visiting, but also slow down startup. You can also set this option on a |
|
1929 |
per-file basis with: |
|
1930 |
|
|
1931 |
#+STARTUP: align |
|
1932 |
#+STARTUP: noalign |
|
1933 |
|
|
1934 |
If you would like to overrule the automatic alignment of number-rich |
|
1935 |
columns to the right and of string-rich columns to the left, you can use |
|
1936 |
‘<r>’, ‘<c>’(1) or ‘<l>’ in a similar fashion. You may also combine |
|
1937 |
alignment and field width like this: ‘<r10>’. |
|
1938 |
|
|
1939 |
Lines which only contain these formatting cookies will be removed |
|
1940 |
automatically when exporting the document. |
|
1941 |
|
|
1942 |
---------- Footnotes ---------- |
|
1943 |
|
|
1944 |
(1) Centering does not work inside Emacs, but it does have an effect |
|
1945 |
when exporting to HTML. |
|
1946 |
|
|
1947 |
|
|
1948 |
File: org, Node: Column groups, Next: Orgtbl mode, Prev: Column width and alignment, Up: Tables |
|
1949 |
|
|
1950 |
3.3 Column groups |
|
1951 |
================= |
|
1952 |
|
|
1953 |
When Org exports tables, it does so by default without vertical lines |
|
1954 |
because that is visually more satisfying in general. Occasionally |
|
1955 |
however, vertical lines can be useful to structure a table into groups |
|
1956 |
of columns, much like horizontal lines can do for groups of rows. In |
|
1957 |
order to specify column groups, you can use a special row where the |
|
1958 |
first field contains only ‘/’. The further fields can either contain |
|
1959 |
‘<’ to indicate that this column should start a group, ‘>’ to indicate |
|
1960 |
the end of a group, or ‘<>’ (no space between ‘<’ and ‘>’) to make a |
|
1961 |
column a group of its own. Boundaries between column groups will upon |
|
1962 |
export be marked with vertical lines. Here is an example: |
|
1963 |
|
|
1964 |
| N | N^2 | N^3 | N^4 | ~sqrt(n)~ | ~sqrt[4](N)~ | |
|
1965 |
|---+-----+-----+-----+-----------+--------------| |
|
1966 |
| / | < | | > | < | > | |
|
1967 |
| 1 | 1 | 1 | 1 | 1 | 1 | |
|
1968 |
| 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | |
|
1969 |
| 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | |
|
1970 |
|---+-----+-----+-----+-----------+--------------| |
|
1971 |
#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1))) |
|
1972 |
|
|
1973 |
It is also sufficient to just insert the column group starters after |
|
1974 |
every vertical line you would like to have: |
|
1975 |
|
|
1976 |
| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | |
|
1977 |
|----+-----+-----+-----+---------+------------| |
|
1978 |
| / | < | | | < | | |
|
1979 |
|
|
1980 |
|
|
1981 |
File: org, Node: Orgtbl mode, Next: The spreadsheet, Prev: Column groups, Up: Tables |
|
1982 |
|
|
1983 |
3.4 The Orgtbl minor mode |
|
1984 |
========================= |
|
1985 |
|
|
1986 |
If you like the intuitive way the Org table editor works, you might also |
|
1987 |
want to use it in other modes like Text mode or Mail mode. The minor |
|
1988 |
mode Orgtbl mode makes this possible. You can always toggle the mode |
|
1989 |
with ‘M-x orgtbl-mode <RET>’. To turn it on by default, for example in |
|
1990 |
Message mode, use |
|
1991 |
|
|
1992 |
(add-hook 'message-mode-hook 'turn-on-orgtbl) |
|
1993 |
|
|
1994 |
Furthermore, with some special setup, it is possible to maintain |
|
1995 |
tables in arbitrary syntax with Orgtbl mode. For example, it is |
|
1996 |
possible to construct LaTeX tables with the underlying ease and power of |
|
1997 |
Orgtbl mode, including spreadsheet capabilities. For details, see *note |
|
1998 |
Tables in arbitrary syntax::. |
|
1999 |
|
|
2000 |
|
|
2001 |
File: org, Node: The spreadsheet, Next: Org-Plot, Prev: Orgtbl mode, Up: Tables |
|
2002 |
|
|
2003 |
3.5 The spreadsheet |
|
2004 |
=================== |
|
2005 |
|
|
2006 |
The table editor makes use of the Emacs ‘calc’ package to implement |
|
2007 |
spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to |
|
2008 |
derive fields from other fields. While fully featured, Org’s |
|
2009 |
implementation is not identical to other spreadsheets. For example, Org |
|
2010 |
knows the concept of a _column formula_ that will be applied to all |
|
2011 |
non-header fields in a column without having to copy the formula to each |
|
2012 |
relevant field. There is also a formula debugger, and a formula editor |
|
2013 |
with features for highlighting fields in the table corresponding to the |
|
2014 |
references at the point in the formula, moving these references by arrow |
|
2015 |
keys |
|
2016 |
|
|
2017 |
* Menu: |
|
2018 |
|
|
2019 |
* References:: How to refer to another field or range |
|
2020 |
* Formula syntax for Calc:: Using Calc to compute stuff |
|
2021 |
* Formula syntax for Lisp:: Writing formulas in Emacs Lisp |
|
2022 |
* Durations and time values:: How to compute durations and time values |
|
2023 |
* Field and range formulas:: Formula for specific (ranges of) fields |
|
2024 |
* Column formulas:: Formulas valid for an entire column |
|
2025 |
* Lookup functions:: Lookup functions for searching tables |
|
2026 |
* Editing and debugging formulas:: Fixing formulas |
|
2027 |
* Updating the table:: Recomputing all dependent fields |
|
2028 |
* Advanced features:: Field and column names, parameters and automatic recalc |
|
2029 |
|
|
2030 |
|
|
2031 |
File: org, Node: References, Next: Formula syntax for Calc, Up: The spreadsheet |
|
2032 |
|
|
2033 |
3.5.1 References |
|
2034 |
---------------- |
|
2035 |
|
|
2036 |
To compute fields in the table from other fields, formulas must |
|
2037 |
reference other fields or ranges. In Org, fields can be referenced by |
|
2038 |
name, by absolute coordinates, and by relative coordinates. To find out |
|
2039 |
what the coordinates of a field are, press ‘C-c ?’ in that field, or |
|
2040 |
press ‘C-c }’ to toggle the display of a grid. |
|
2041 |
|
|
2042 |
Field references |
|
2043 |
................ |
|
2044 |
|
|
2045 |
Formulas can reference the value of another field in two ways. Like in |
|
2046 |
any other spreadsheet, you may reference fields with a letter/number |
|
2047 |
combination like ‘B3’, meaning the 2nd field in the 3rd row. However, |
|
2048 |
Org prefers(1) to use another, more general representation that looks |
|
2049 |
like this: |
|
2050 |
@ROW$COLUMN |
|
2051 |
|
|
2052 |
Column specifications can be absolute like ‘$1’, ‘$2’,...‘$N’, or |
|
2053 |
relative to the current column (i.e., the column of the field which is |
|
2054 |
being computed) like ‘$+1’ or ‘$-2’. ‘$<’ and ‘$>’ are immutable |
|
2055 |
references to the first and last column, respectively, and you can use |
|
2056 |
‘$>>>’ to indicate the third column from the right. |
|
2057 |
|
|
2058 |
The row specification only counts data lines and ignores horizontal |
|
2059 |
separator lines (hlines). Like with columns, you can use absolute row |
|
2060 |
numbers ‘@1’, ‘@2’,...‘@N’, and row numbers relative to the current row |
|
2061 |
like ‘@+3’ or ‘@-1’. ‘@<’ and ‘@>’ are immutable references the first |
|
2062 |
and last(2) row in the table, respectively. You may also specify the |
|
2063 |
row relative to one of the hlines: ‘@I’ refers to the first hline, ‘@II’ |
|
2064 |
to the second, etc. ‘@-I’ refers to the first such line above the |
|
2065 |
current line, ‘@+I’ to the first such line below the current line. You |
|
2066 |
can also write ‘@III+2’ which is the second data line after the third |
|
2067 |
hline in the table. |
|
2068 |
|
|
2069 |
‘@0’ and ‘$0’ refer to the current row and column, respectively, |
|
2070 |
i.e., to the row/column for the field being computed. Also, if you omit |
|
2071 |
either the column or the row part of the reference, the current |
|
2072 |
row/column is implied. |
|
2073 |
|
|
2074 |
Org’s references with _unsigned_ numbers are fixed references in the |
|
2075 |
sense that if you use the same reference in the formula for two |
|
2076 |
different fields, the same field will be referenced each time. Org’s |
|
2077 |
references with _signed_ numbers are floating references because the |
|
2078 |
same reference operator can reference different fields depending on the |
|
2079 |
field being calculated by the formula. |
|
2080 |
|
|
2081 |
Here are a few examples: |
|
2082 |
|
|
2083 |
@2$3 2nd row, 3rd column (same as ‘C2’) |
|
2084 |
$5 column 5 in the current row (same as ‘E&’) |
|
2085 |
@2 current column, row 2 |
|
2086 |
@-1$-3 the field one row up, three columns to the left |
|
2087 |
@-I$2 field just under hline above current row, column 2 |
|
2088 |
@>$5 field in the last row, in column 5 |
|
2089 |
|
|
2090 |
Range references |
|
2091 |
................ |
|
2092 |
|
|
2093 |
You may reference a rectangular range of fields by specifying two field |
|
2094 |
references connected by two dots ‘..’. If both fields are in the |
|
2095 |
current row, you may simply use ‘$2..$7’, but if at least one field is |
|
2096 |
in a different row, you need to use the general ‘@row$column’ format at |
|
2097 |
least for the first field (i.e the reference must start with ‘@’ in |
|
2098 |
order to be interpreted correctly). Examples: |
|
2099 |
|
|
2100 |
$1..$3 first three fields in the current row |
|
2101 |
$P..$Q range, using column names (see under Advanced) |
|
2102 |
$<<<..$>> start in third column, continue to the last but one |
|
2103 |
@2$1..@4$3 6 fields between these two fields (same as ‘A2..C4’) |
|
2104 |
@-1$-2..@-1 3 fields in the row above, starting from 2 columns on the left |
|
2105 |
@I..II between first and second hline, short for ‘@I..@II’ |
|
2106 |
|
|
2107 |
Range references return a vector of values that can be fed into Calc |
|
2108 |
vector functions. Empty fields in ranges are normally suppressed, so |
|
2109 |
that the vector contains only the non-empty fields. For other options |
|
2110 |
with the mode switches ‘E’, ‘N’ and examples *note Formula syntax for |
|
2111 |
Calc::. |
|
2112 |
|
|
2113 |
Field coordinates in formulas |
|
2114 |
............................. |
|
2115 |
|
|
2116 |
One of the very first actions during evaluation of Calc formulas and |
|
2117 |
Lisp formulas is to substitute ‘@#’ and ‘$#’ in the formula with the row |
|
2118 |
or column number of the field where the current result will go to. The |
|
2119 |
traditional Lisp formula equivalents are ‘org-table-current-dline’ and |
|
2120 |
‘org-table-current-column’. Examples: |
|
2121 |
|
|
2122 |
‘if(@# % 2, $#, string(""))’ |
|
2123 |
Insert column number on odd rows, set field to empty on even rows. |
|
2124 |
‘$2 = '(identity remote(FOO, @@#$1))’ |
|
2125 |
Copy text or values of each row of column 1 of the table named |
|
2126 |
‘FOO’ into column 2 of the current table. |
|
2127 |
‘@3 = 2 * remote(FOO, @1$$#)’ |
|
2128 |
Insert the doubled value of each column of row 1 of the table named |
|
2129 |
‘FOO’ into row 3 of the current table. |
|
2130 |
|
|
2131 |
For the second/third example, the table named ‘FOO’ must have at least |
|
2132 |
as many rows/columns as the current table. Note that this is |
|
2133 |
inefficient(3) for large number of rows/columns. |
|
2134 |
|
|
2135 |
Named references |
|
2136 |
................ |
|
2137 |
|
|
2138 |
‘$name’ is interpreted as the name of a column, parameter or constant. |
|
2139 |
Constants are defined globally through the option |
|
2140 |
‘org-table-formula-constants’, and locally (for the file) through a line |
|
2141 |
like |
|
2142 |
|
|
2143 |
#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6 |
|
2144 |
|
|
2145 |
Also properties (*note Properties and columns::) can be used as |
|
2146 |
constants in table formulas: for a property ‘:Xyz:’ use the name |
|
2147 |
‘$PROP_Xyz’, and the property will be searched in the current outline |
|
2148 |
entry and in the hierarchy above it. If you have the ‘constants.el’ |
|
2149 |
package, it will also be used to resolve constants, including natural |
|
2150 |
constants like ‘$h’ for Planck’s constant, and units like ‘$km’ for |
|
2151 |
kilometers(4). Column names and parameters can be specified in special |
|
2152 |
table lines. These are described below, see *note Advanced features::. |
|
2153 |
All names must start with a letter, and further consist of letters and |
|
2154 |
numbers. |
|
2155 |
|
|
2156 |
Remote references |
|
2157 |
................. |
|
2158 |
|
|
2159 |
You may also reference constants, fields and ranges from a different |
|
2160 |
table, either in the current file or even in a different file. The |
|
2161 |
syntax is |
|
2162 |
|
|
2163 |
remote(NAME-OR-ID,REF) |
|
2164 |
|
|
2165 |
where NAME can be the name of a table in the current file as set by a |
|
2166 |
‘#+NAME: Name’ line before the table. It can also be the ID of an |
|
2167 |
entry, even in a different file, and the reference then refers to the |
|
2168 |
first table in that entry. REF is an absolute field or range reference |
|
2169 |
as described above for example ‘@3$3’ or ‘$somename’, valid in the |
|
2170 |
referenced table. |
|
2171 |
|
|
2172 |
Indirection of NAME-OR-ID: When NAME-OR-ID has the format |
|
2173 |
‘@ROW$COLUMN’ it will be substituted with the name or ID found in this |
|
2174 |
field of the current table. For example ‘remote($1, @>$2)’ => |
|
2175 |
‘remote(year_2013, @>$1)’. The format ‘B3’ is not supported because it |
|
2176 |
can not be distinguished from a plain table name or ID. |
|
2177 |
|
|
2178 |
---------- Footnotes ---------- |
|
2179 |
|
|
2180 |
(1) Org will understand references typed by the user as ‘B4’, but it |
|
2181 |
will not use this syntax when offering a formula for editing. You can |
|
2182 |
customize this behavior using the option |
|
2183 |
‘org-table-use-standard-references’. |
|
2184 |
|
|
2185 |
(2) For backward compatibility you can also use special names like |
|
2186 |
‘$LR5’ and ‘$LR12’ to refer in a stable way to the 5th and 12th field in |
|
2187 |
the last row of the table. However, this syntax is deprecated, it |
|
2188 |
should not be used for new documents. Use ‘@>$’ instead. |
|
2189 |
|
|
2190 |
(3) The computation time scales as O(N^2) because the table named |
|
2191 |
‘FOO’ is parsed for each field to be read. |
|
2192 |
|
|
2193 |
(4) ‘constants.el’ can supply the values of constants in two |
|
2194 |
different unit systems, ‘SI’ and ‘cgs’. Which one is used depends on |
|
2195 |
the value of the variable ‘constants-unit-system’. You can use the |
|
2196 |
‘#+STARTUP’ options ‘constSI’ and ‘constcgs’ to set this value for the |
|
2197 |
current buffer. |
|
2198 |
|
|
2199 |
|
|
2200 |
File: org, Node: Formula syntax for Calc, Next: Formula syntax for Lisp, Prev: References, Up: The spreadsheet |
|
2201 |
|
|
2202 |
3.5.2 Formula syntax for Calc |
|
2203 |
----------------------------- |
|
2204 |
|
|
2205 |
A formula can be any algebraic expression understood by the Emacs ‘Calc’ |
|
2206 |
package. Note that ‘calc’ has the non-standard convention that ‘/’ has |
|
2207 |
lower precedence than ‘*’, so that ‘a/b*c’ is interpreted as ‘a/(b*c)’. |
|
2208 |
Before evaluation by ‘calc-eval’ (*note calc-eval: (calc)Calling Calc |
|
2209 |
from Your Programs.), variable substitution takes place according to the |
|
2210 |
rules described above. The range vectors can be directly fed into the |
|
2211 |
Calc vector functions like ‘vmean’ and ‘vsum’. |
|
2212 |
|
|
2213 |
A formula can contain an optional mode string after a semicolon. |
|
2214 |
This string consists of flags to influence Calc and other modes during |
|
2215 |
execution. By default, Org uses the standard Calc modes (precision 12, |
|
2216 |
angular units degrees, fraction and symbolic modes off). The display |
|
2217 |
format, however, has been changed to ‘(float 8)’ to keep tables compact. |
|
2218 |
The default settings can be configured using the option |
|
2219 |
‘org-calc-default-modes’. |
|
2220 |
|
|
2221 |
List of modes: |
|
2222 |
|
|
2223 |
‘p20’ |
|
2224 |
Set the internal Calc calculation precision to 20 digits. |
|
2225 |
‘n3’, ‘s3’, ‘e2’, ‘f4’ |
|
2226 |
Normal, scientific, engineering or fixed format of the result of |
|
2227 |
Calc passed back to Org. Calc formatting is unlimited in precision |
|
2228 |
as long as the Calc calculation precision is greater. |
|
2229 |
‘D’, ‘R’ |
|
2230 |
Degree and radian angle modes of Calc. |
|
2231 |
‘F’, ‘S’ |
|
2232 |
Fraction and symbolic modes of Calc. |
|
2233 |
‘T’, ‘t’, ‘U’ |
|
2234 |
Duration computations in Calc or Lisp, *note Durations and time |
|
2235 |
values::. |
|
2236 |
‘E’ |
|
2237 |
If and how to consider empty fields. Without ‘E’ empty fields in |
|
2238 |
range references are suppressed so that the Calc vector or Lisp |
|
2239 |
list contains only the non-empty fields. With ‘E’ the empty fields |
|
2240 |
are kept. For empty fields in ranges or empty field references the |
|
2241 |
value ‘nan’ (not a number) is used in Calc formulas and the empty |
|
2242 |
string is used for Lisp formulas. Add ‘N’ to use 0 instead for |
|
2243 |
both formula types. For the value of a field the mode ‘N’ has |
|
2244 |
higher precedence than ‘E’. |
|
2245 |
‘N’ |
|
2246 |
Interpret all fields as numbers, use 0 for non-numbers. See the |
|
2247 |
next section to see how this is essential for computations with |
|
2248 |
Lisp formulas. In Calc formulas it is used only occasionally |
|
2249 |
because there number strings are already interpreted as numbers |
|
2250 |
without ‘N’. |
|
2251 |
‘L’ |
|
2252 |
Literal, for Lisp formulas only. See the next section. |
|
2253 |
|
|
2254 |
Unless you use large integer numbers or high-precision-calculation and |
|
2255 |
-display for floating point numbers you may alternatively provide a |
|
2256 |
‘printf’ format specifier to reformat the Calc result after it has been |
|
2257 |
passed back to Org instead of letting Calc already do the formatting(1). |
|
2258 |
A few examples: |
|
2259 |
|
|
2260 |
$1+$2 Sum of first and second field |
|
2261 |
$1+$2;%.2f Same, format result to two decimals |
|
2262 |
exp($2)+exp($1) Math functions can be used |
|
2263 |
$0;%.1f Reformat current cell to 1 decimal |
|
2264 |
($3-32)*5/9 Degrees F -> C conversion |
|
2265 |
$c/$1/$cm Hz -> cm conversion, using ‘constants.el’ |
|
2266 |
tan($1);Dp3s1 Compute in degrees, precision 3, display SCI 1 |
|
2267 |
sin($1);Dp3%.1e Same, but use printf specifier for display |
|
2268 |
taylor($3,x=7,2) Taylor series of $3, at x=7, second degree |
|
2269 |
|
|
2270 |
Calc also contains a complete set of logical operations, (*note |
|
2271 |
Logical Operations: (calc)Logical Operations.). For example |
|
2272 |
|
|
2273 |
‘if($1 < 20, teen, string(""))’ |
|
2274 |
"teen" if age $1 is less than 20, else the Org table result field |
|
2275 |
is set to empty with the empty string. |
|
2276 |
‘if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1’ |
|
2277 |
Sum of the first two columns. When at least one of the input |
|
2278 |
fields is empty the Org table result field is set to empty. ‘E’ is |
|
2279 |
required to not convert empty fields to 0. ‘f-1’ is an optional |
|
2280 |
Calc format string similar to ‘%.1f’ but leaves empty results |
|
2281 |
empty. |
|
2282 |
‘if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E’ |
|
2283 |
Mean value of a range unless there is any empty field. Every field |
|
2284 |
in the range that is empty is replaced by ‘nan’ which lets ‘vmean’ |
|
2285 |
result in ‘nan’. Then ‘typeof == 12’ detects the ‘nan’ from |
|
2286 |
‘vmean’ and the Org table result field is set to empty. Use this |
|
2287 |
when the sample set is expected to never have missing values. |
|
2288 |
‘if("$1..$7" == "[]", string(""), vmean($1..$7))’ |
|
2289 |
Mean value of a range with empty fields skipped. Every field in |
|
2290 |
the range that is empty is skipped. When all fields in the range |
|
2291 |
are empty the mean value is not defined and the Org table result |
|
2292 |
field is set to empty. Use this when the sample set can have a |
|
2293 |
variable size. |
|
2294 |
‘vmean($1..$7); EN’ |
|
2295 |
To complete the example before: Mean value of a range with empty |
|
2296 |
fields counting as samples with value 0. Use this only when |
|
2297 |
incomplete sample sets should be padded with 0 to the full size. |
|
2298 |
|
|
2299 |
You can add your own Calc functions defined in Emacs Lisp with |
|
2300 |
‘defmath’ and use them in formula syntax for Calc. |
|
2301 |
|
|
2302 |
---------- Footnotes ---------- |
|
2303 |
|
|
2304 |
(1) The ‘printf’ reformatting is limited in precision because the |
|
2305 |
value passed to it is converted into an ‘integer’ or ‘double’. The |
|
2306 |
‘integer’ is limited in size by truncating the signed value to 32 bits. |
|
2307 |
The ‘double’ is limited in precision to 64 bits overall which leaves |
|
2308 |
approximately 16 significant decimal digits. |
|
2309 |
|
|
2310 |
|
|
2311 |
File: org, Node: Formula syntax for Lisp, Next: Durations and time values, Prev: Formula syntax for Calc, Up: The spreadsheet |
|
2312 |
|
|
2313 |
3.5.3 Emacs Lisp forms as formulas |
|
2314 |
---------------------------------- |
|
2315 |
|
|
2316 |
It is also possible to write a formula in Emacs Lisp. This can be |
|
2317 |
useful for string manipulation and control structures, if Calc’s |
|
2318 |
functionality is not enough. |
|
2319 |
|
|
2320 |
If a formula starts with an apostrophe followed by an opening |
|
2321 |
parenthesis, then it is evaluated as a Lisp form. The evaluation should |
|
2322 |
return either a string or a number. Just as with ‘calc’ formulas, you |
|
2323 |
can specify modes and a printf format after a semicolon. |
|
2324 |
|
|
2325 |
With Emacs Lisp forms, you need to be conscious about the way field |
|
2326 |
references are interpolated into the form. By default, a reference will |
|
2327 |
be interpolated as a Lisp string (in double-quotes) containing the |
|
2328 |
field. If you provide the ‘N’ mode switch, all referenced elements will |
|
2329 |
be numbers (non-number fields will be zero) and interpolated as Lisp |
|
2330 |
numbers, without quotes. If you provide the ‘L’ flag, all fields will |
|
2331 |
be interpolated literally, without quotes. I.e., if you want a |
|
2332 |
reference to be interpreted as a string by the Lisp form, enclose the |
|
2333 |
reference operator itself in double-quotes, like ‘"$3"’. Ranges are |
|
2334 |
inserted as space-separated fields, so you can embed them in list or |
|
2335 |
vector syntax. |
|
2336 |
|
|
2337 |
Here are a few examples—note how the ‘N’ mode is used when we do |
|
2338 |
computations in Lisp: |
|
2339 |
|
|
2340 |
‘'(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))’ |
|
2341 |
Swap the first two characters of the content of column 1. |
|
2342 |
‘'(+ $1 $2);N’ |
|
2343 |
Add columns 1 and 2, equivalent to Calc’s ‘$1+$2’. |
|
2344 |
‘'(apply '+ '($1..$4));N’ |
|
2345 |
Compute the sum of columns 1 to 4, like Calc’s ‘vsum($1..$4)’. |
|
2346 |
|
|
2347 |
|
|
2348 |
File: org, Node: Durations and time values, Next: Field and range formulas, Prev: Formula syntax for Lisp, Up: The spreadsheet |
|
2349 |
|
|
2350 |
3.5.4 Durations and time values |
|
2351 |
------------------------------- |
|
2352 |
|
|
2353 |
If you want to compute time values use the ‘T’, ‘t’, or ‘U’ flag, either |
|
2354 |
in Calc formulas or Elisp formulas: |
|
2355 |
|
|
2356 |
| Task 1 | Task 2 | Total | |
|
2357 |
|---------+----------+----------| |
|
2358 |
| 2:12 | 1:47 | 03:59:00 | |
|
2359 |
| 2:12 | 1:47 | 03:59 | |
|
2360 |
| 3:02:20 | -2:07:00 | 0.92 | |
|
2361 |
#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t |
|
2362 |
|
|
2363 |
Input duration values must be of the form ‘HH:MM[:SS]’, where seconds |
|
2364 |
are optional. With the ‘T’ flag, computed durations will be displayed |
|
2365 |
as ‘HH:MM:SS’ (see the first formula above). With the ‘U’ flag, seconds |
|
2366 |
will be omitted so that the result will be only ‘HH:MM’ (see second |
|
2367 |
formula above). Zero-padding of the hours field will depend upon the |
|
2368 |
value of the variable ‘org-table-duration-hour-zero-padding’. |
|
2369 |
|
|
2370 |
With the ‘t’ flag, computed durations will be displayed according to |
|
2371 |
the value of the option ‘org-table-duration-custom-format’, which |
|
2372 |
defaults to ‘'hours’ and will display the result as a fraction of hours |
|
2373 |
(see the third formula in the example above). |
|
2374 |
|
|
2375 |
Negative duration values can be manipulated as well, and integers |
|
2376 |
will be considered as seconds in addition and subtraction. |
|
2377 |
|
|
2378 |
|
|
2379 |
File: org, Node: Field and range formulas, Next: Column formulas, Prev: Durations and time values, Up: The spreadsheet |
|
2380 |
|
|
2381 |
3.5.5 Field and range formulas |
|
2382 |
------------------------------ |
|
2383 |
|
|
2384 |
To assign a formula to a particular field, type it directly into the |
|
2385 |
field, preceded by ‘:=’, for example ‘:=vsum(@II..III)’. When you press |
|
2386 |
<TAB> or <RET> or ‘C-c C-c’ with the cursor still in the field, the |
|
2387 |
formula will be stored as the formula for this field, evaluated, and the |
|
2388 |
current field will be replaced with the result. |
|
2389 |
|
|
2390 |
Formulas are stored in a special line starting with ‘#+TBLFM:’ |
|
2391 |
directly below the table. If you type the equation in the 4th field of |
|
2392 |
the 3rd data line in the table, the formula will look like ‘@3$4=$1+$2’. |
|
2393 |
When inserting/deleting/swapping columns and rows with the appropriate |
|
2394 |
commands, absolute references (but not relative ones) in stored formulas |
|
2395 |
are modified in order to still reference the same field. To avoid this, |
|
2396 |
in particular in range references, anchor ranges at the table borders |
|
2397 |
(using ‘@<’, ‘@>’, ‘$<’, ‘$>’), or at hlines using the ‘@I’ notation. |
|
2398 |
Automatic adaptation of field references does of course not happen if |
|
2399 |
you edit the table structure with normal editing commands—then you must |
|
2400 |
fix the equations yourself. |
|
2401 |
|
|
2402 |
Instead of typing an equation into the field, you may also use the |
|
2403 |
following command |
|
2404 |
|
|
2405 |
‘C-u C-c = (org-table-eval-formula)’ |
|
2406 |
Install a new formula for the current field. The command prompts |
|
2407 |
for a formula with default taken from the ‘#+TBLFM:’ line, applies |
|
2408 |
it to the current field, and stores it. |
|
2409 |
|
|
2410 |
The left-hand side of a formula can also be a special expression in |
|
2411 |
order to assign the formula to a number of different fields. There is |
|
2412 |
no keyboard shortcut to enter such range formulas. To add them, use the |
|
2413 |
formula editor (*note Editing and debugging formulas::) or edit the |
|
2414 |
‘#+TBLFM:’ line directly. |
|
2415 |
|
|
2416 |
‘$2=’ |
|
2417 |
Column formula, valid for the entire column. This is so common |
|
2418 |
that Org treats these formulas in a special way, see *note Column |
|
2419 |
formulas::. |
|
2420 |
‘@3=’ |
|
2421 |
Row formula, applies to all fields in the specified row. ‘@>=’ |
|
2422 |
means the last row. |
|
2423 |
‘@1$2..@4$3=’ |
|
2424 |
Range formula, applies to all fields in the given rectangular |
|
2425 |
range. This can also be used to assign a formula to some but not |
|
2426 |
all fields in a row. |
|
2427 |
‘$name=’ |
|
2428 |
Named field, see *note Advanced features::. |
|
2429 |
|
|
2430 |
|
|
2431 |
File: org, Node: Column formulas, Next: Lookup functions, Prev: Field and range formulas, Up: The spreadsheet |
|
2432 |
|
|
2433 |
3.5.6 Column formulas |
|
2434 |
--------------------- |
|
2435 |
|
|
2436 |
When you assign a formula to a simple column reference like ‘$3=’, the |
|
2437 |
same formula will be used in all fields of that column, with the |
|
2438 |
following very convenient exceptions: (i) If the table contains |
|
2439 |
horizontal separator hlines with rows above and below, everything before |
|
2440 |
the first such hline is considered part of the table _header_ and will |
|
2441 |
not be modified by column formulas. Therefore a header is mandatory |
|
2442 |
when you use column formulas and want to add hlines to group rows, like |
|
2443 |
for example to separate a total row at the bottom from the summand rows |
|
2444 |
above. (ii) Fields that already get a value from a field/range formula |
|
2445 |
will be left alone by column formulas. These conditions make column |
|
2446 |
formulas very easy to use. |
|
2447 |
|
|
2448 |
To assign a formula to a column, type it directly into any field in |
|
2449 |
the column, preceded by an equal sign, like ‘=$1+$2’. When you press |
|
2450 |
<TAB> or <RET> or ‘C-c C-c’ with the cursor still in the field, the |
|
2451 |
formula will be stored as the formula for the current column, evaluated |
|
2452 |
and the current field replaced with the result. If the field contains |
|
2453 |
only ‘=’, the previously stored formula for this column is used. For |
|
2454 |
each column, Org will only remember the most recently used formula. In |
|
2455 |
the ‘#+TBLFM:’ line, column formulas will look like ‘$4=$1+$2’. The |
|
2456 |
left-hand side of a column formula cannot be the name of column, it must |
|
2457 |
be the numeric column reference or ‘$>’. |
|
2458 |
|
|
2459 |
Instead of typing an equation into the field, you may also use the |
|
2460 |
following command: |
|
2461 |
|
|
2462 |
‘C-c = (org-table-eval-formula)’ |
|
2463 |
Install a new formula for the current column and replace current |
|
2464 |
field with the result of the formula. The command prompts for a |
|
2465 |
formula, with default taken from the ‘#+TBLFM’ line, applies it to |
|
2466 |
the current field and stores it. With a numeric prefix |
|
2467 |
argument(e.g., ‘C-5 C-c =’) the command will apply it to that many |
|
2468 |
consecutive fields in the current column. |
|
2469 |
|
|
2470 |
|
|
2471 |
File: org, Node: Lookup functions, Next: Editing and debugging formulas, Prev: Column formulas, Up: The spreadsheet |
|
2472 |
|
|
2473 |
3.5.7 Lookup functions |
|
2474 |
---------------------- |
|
2475 |
|
|
2476 |
Org has three predefined Emacs Lisp functions for lookups in tables. |
|
2477 |
‘(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)’ |
|
2478 |
Searches for the first element ‘S’ in list ‘S-LIST’ for which |
|
2479 |
(PREDICATE VAL S) |
|
2480 |
is ‘t’; returns the value from the corresponding position in list |
|
2481 |
‘R-LIST’. The default ‘PREDICATE’ is ‘equal’. Note that the |
|
2482 |
parameters ‘VAL’ and ‘S’ are passed to ‘PREDICATE’ in the same |
|
2483 |
order as the corresponding parameters are in the call to |
|
2484 |
‘org-lookup-first’, where ‘VAL’ precedes ‘S-LIST’. If ‘R-LIST’ is |
|
2485 |
‘nil’, the matching element ‘S’ of ‘S-LIST’ is returned. |
|
2486 |
‘(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)’ |
|
2487 |
Similar to ‘org-lookup-first’ above, but searches for the last |
|
2488 |
element for which ‘PREDICATE’ is ‘t’. |
|
2489 |
‘(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)’ |
|
2490 |
Similar to ‘org-lookup-first’, but searches for all elements for |
|
2491 |
which ‘PREDICATE’ is ‘t’, and returns all corresponding values. |
|
2492 |
This function can not be used by itself in a formula, because it |
|
2493 |
returns a list of values. However, powerful lookups can be built |
|
2494 |
when this function is combined with other Emacs Lisp functions. |
|
2495 |
|
|
2496 |
If the ranges used in these functions contain empty fields, the ‘E’ |
|
2497 |
mode for the formula should usually be specified: otherwise empty fields |
|
2498 |
will not be included in ‘S-LIST’ and/or ‘R-LIST’ which can, for example, |
|
2499 |
result in an incorrect mapping from an element of ‘S-LIST’ to the |
|
2500 |
corresponding element of ‘R-LIST’. |
|
2501 |
|
|
2502 |
These three functions can be used to implement associative arrays, |
|
2503 |
count matching cells, rank results, group data etc. For practical |
|
2504 |
examples see this tutorial on Worg |
|
2505 |
(https://orgmode.org/worg/org-tutorials/org-lookups.html). |
|
2506 |
|
|
2507 |
|
|
2508 |
File: org, Node: Editing and debugging formulas, Next: Updating the table, Prev: Lookup functions, Up: The spreadsheet |
|
2509 |
|
|
2510 |
3.5.8 Editing and debugging formulas |
|
2511 |
------------------------------------ |
|
2512 |
|
|
2513 |
You can edit individual formulas in the minibuffer or directly in the |
|
2514 |
field. Org can also prepare a special buffer with all active formulas |
|
2515 |
of a table. When offering a formula for editing, Org converts |
|
2516 |
references to the standard format (like ‘B3’ or ‘D&’) if possible. If |
|
2517 |
you prefer to only work with the internal format (like ‘@3$2’ or ‘$4’), |
|
2518 |
configure the option ‘org-table-use-standard-references’. |
|
2519 |
|
|
2520 |
‘C-c = or C-u C-c = (org-table-eval-formula)’ |
|
2521 |
Edit the formula associated with the current column/field in the |
|
2522 |
minibuffer. See *note Column formulas::, and *note Field and range |
|
2523 |
formulas::. |
|
2524 |
‘C-u C-u C-c = (org-table-eval-formula)’ |
|
2525 |
Re-insert the active formula (either a field formula, or a column |
|
2526 |
formula) into the current field, so that you can edit it directly |
|
2527 |
in the field. The advantage over editing in the minibuffer is that |
|
2528 |
you can use the command ‘C-c ?’. |
|
2529 |
‘C-c ? (org-table-field-info)’ |
|
2530 |
While editing a formula in a table field, highlight the field(s) |
|
2531 |
referenced by the reference at the cursor position in the formula. |
|
2532 |
‘C-c }’ |
|
2533 |
Toggle the display of row and column numbers for a table, using |
|
2534 |
overlays (‘org-table-toggle-coordinate-overlays’). These are |
|
2535 |
updated each time the table is aligned; you can force it with ‘C-c |
|
2536 |
C-c’. |
|
2537 |
‘C-c {’ |
|
2538 |
Toggle the formula debugger on and off |
|
2539 |
(‘org-table-toggle-formula-debugger’). See below. |
|
2540 |
‘C-c ' (org-table-edit-formulas)’ |
|
2541 |
Edit all formulas for the current table in a special buffer, where |
|
2542 |
the formulas will be displayed one per line. If the current field |
|
2543 |
has an active formula, the cursor in the formula editor will mark |
|
2544 |
it. While inside the special buffer, Org will automatically |
|
2545 |
highlight any field or range reference at the cursor position. You |
|
2546 |
may edit, remove and add formulas, and use the following commands: |
|
2547 |
|
|
2548 |
‘C-c C-c or C-x C-s (org-table-fedit-finish)’ |
|
2549 |
Exit the formula editor and store the modified formulas. With |
|
2550 |
‘C-u’ prefix, also apply the new formulas to the entire table. |
|
2551 |
‘C-c C-q (org-table-fedit-abort)’ |
|
2552 |
Exit the formula editor without installing changes. |
|
2553 |
‘C-c C-r (org-table-fedit-toggle-ref-type)’ |
|
2554 |
Toggle all references in the formula editor between standard |
|
2555 |
(like ‘B3’) and internal (like ‘@3$2’). |
|
2556 |
‘<TAB> (org-table-fedit-lisp-indent)’ |
|
2557 |
Pretty-print or indent Lisp formula at point. When in a line |
|
2558 |
containing a Lisp formula, format the formula according to |
|
2559 |
Emacs Lisp rules. Another <TAB> collapses the formula back |
|
2560 |
again. In the open formula, <TAB> re-indents just like in |
|
2561 |
Emacs Lisp mode. |
|
2562 |
‘M-<TAB> (lisp-complete-symbol)’ |
|
2563 |
Complete Lisp symbols, just like in Emacs Lisp mode.(1) |
|
2564 |
‘S-<UP>/<DOWN>/<LEFT>/<RIGHT>’ |
|
2565 |
Shift the reference at point. For example, if the reference |
|
2566 |
is ‘B3’ and you press ‘S-<RIGHT>’, it will become ‘C3’. This |
|
2567 |
also works for relative references and for hline references. |
|
2568 |
‘M-S-<UP> (org-table-fedit-line-up)’ |
|
2569 |
‘M-S-<DOWN> (org-table-fedit-line-down)’ |
|
2570 |
Move the test line for column formulas in the Org buffer up |
|
2571 |
and down. |
|
2572 |
‘M-<UP> (org-table-fedit-scroll-down)’ |
|
2573 |
‘M-<DOWN> (org-table-fedit-scroll-up)’ |
|
2574 |
Scroll the window displaying the table. |
|
2575 |
‘C-c }’ |
|
2576 |
Turn the coordinate grid in the table on and off. |
|
2577 |
|
|
2578 |
Making a table field blank does not remove the formula associated |
|
2579 |
with the field, because that is stored in a different line (the |
|
2580 |
‘#+TBLFM’ line)—during the next recalculation the field will be filled |
|
2581 |
again. To remove a formula from a field, you have to give an empty |
|
2582 |
reply when prompted for the formula, or to edit the ‘#+TBLFM’ line. |
|
2583 |
|
|
2584 |
You may edit the ‘#+TBLFM’ directly and re-apply the changed |
|
2585 |
equations with ‘C-c C-c’ in that line or with the normal recalculation |
|
2586 |
commands in the table. |
|
2587 |
|
|
2588 |
Using multiple ‘#+TBLFM’ lines |
|
2589 |
.............................. |
|
2590 |
|
|
2591 |
You may apply the formula temporarily. This is useful when you switch |
|
2592 |
the formula. Place multiple ‘#+TBLFM’ lines right after the table, and |
|
2593 |
then press ‘C-c C-c’ on the formula to apply. Here is an example: |
|
2594 |
|
|
2595 |
| x | y | |
|
2596 |
|---+---| |
|
2597 |
| 1 | | |
|
2598 |
| 2 | | |
|
2599 |
#+TBLFM: $2=$1*1 |
|
2600 |
#+TBLFM: $2=$1*2 |
|
2601 |
|
|
2602 |
Pressing ‘C-c C-c’ in the line of ‘#+TBLFM: $2=$1*2’ yields: |
|
2603 |
|
|
2604 |
| x | y | |
|
2605 |
|---+---| |
|
2606 |
| 1 | 2 | |
|
2607 |
| 2 | 4 | |
|
2608 |
#+TBLFM: $2=$1*1 |
|
2609 |
#+TBLFM: $2=$1*2 |
|
2610 |
|
|
2611 |
Note: If you recalculate this table (with ‘C-u C-c *’, for example), you |
|
2612 |
will get the following result of applying only the first ‘#+TBLFM’ line. |
|
2613 |
|
|
2614 |
| x | y | |
|
2615 |
|---+---| |
|
2616 |
| 1 | 1 | |
|
2617 |
| 2 | 2 | |
|
2618 |
#+TBLFM: $2=$1*1 |
|
2619 |
#+TBLFM: $2=$1*2 |
|
2620 |
|
|
2621 |
Debugging formulas |
|
2622 |
.................. |
|
2623 |
|
|
2624 |
When the evaluation of a formula leads to an error, the field content |
|
2625 |
becomes the string ‘#ERROR’. If you would like see what is going on |
|
2626 |
during variable substitution and calculation in order to find a bug, |
|
2627 |
turn on formula debugging in the ‘Tbl’ menu and repeat the calculation, |
|
2628 |
for example by pressing ‘C-u C-u C-c = <RET>’ in a field. Detailed |
|
2629 |
information will be displayed. |
|
2630 |
|
|
2631 |
---------- Footnotes ---------- |
|
2632 |
|
|
2633 |
(1) Many desktops intercept ‘M-<TAB>’ to switch windows. Use ‘C-M-i’ |
|
2634 |
or ‘<ESC> <TAB>’ instead for completion (*note Completion::). |
|
2635 |
|
|
2636 |
|
|
2637 |
File: org, Node: Updating the table, Next: Advanced features, Prev: Editing and debugging formulas, Up: The spreadsheet |
|
2638 |
|
|
2639 |
3.5.9 Updating the table |
|
2640 |
------------------------ |
|
2641 |
|
|
2642 |
Recalculation of a table is normally not automatic, but needs to be |
|
2643 |
triggered by a command. See *note Advanced features::, for a way to |
|
2644 |
make recalculation at least semi-automatic. |
|
2645 |
|
|
2646 |
In order to recalculate a line of a table or the entire table, use |
|
2647 |
the following commands: |
|
2648 |
|
|
2649 |
‘C-c * (org-table-recalculate)’ |
|
2650 |
Recalculate the current row by first applying the stored column |
|
2651 |
formulas from left to right, and all field/range formulas in the |
|
2652 |
current row. |
|
2653 |
‘C-u C-c *’ |
|
2654 |
‘C-u C-c C-c’ |
|
2655 |
Recompute the entire table, line by line. Any lines before the |
|
2656 |
first hline are left alone, assuming that these are part of the |
|
2657 |
table header. |
|
2658 |
‘C-u C-u C-c * or C-u C-u C-c C-c (org-table-iterate)’ |
|
2659 |
Iterate the table by recomputing it until no further changes occur. |
|
2660 |
This may be necessary if some computed fields use the value of |
|
2661 |
other fields that are computed later in the calculation sequence. |
|
2662 |
‘M-x org-table-recalculate-buffer-tables <RET>’ |
|
2663 |
Recompute all tables in the current buffer. |
|
2664 |
‘M-x org-table-iterate-buffer-tables <RET>’ |
|
2665 |
Iterate all tables in the current buffer, in order to converge |
|
2666 |
table-to-table dependencies. |
|
2667 |
|
|
2668 |
|
|
2669 |
File: org, Node: Advanced features, Prev: Updating the table, Up: The spreadsheet |
|
2670 |
|
|
2671 |
3.5.10 Advanced features |
|
2672 |
------------------------ |
|
2673 |
|
|
2674 |
If you want the recalculation of fields to happen automatically, or if |
|
2675 |
you want to be able to assign names(1) to fields and columns, you need |
|
2676 |
to reserve the first column of the table for special marking characters. |
|
2677 |
|
|
2678 |
‘C-# (org-table-rotate-recalc-marks)’ |
|
2679 |
Rotate the calculation mark in first column through the states ‘ ’, |
|
2680 |
‘#’, ‘*’, ‘!’, ‘$’. When there is an active region, change all |
|
2681 |
marks in the region. |
|
2682 |
|
|
2683 |
Here is an example of a table that collects exam results of students |
|
2684 |
and makes use of these features: |
|
2685 |
|
|
2686 |
|---+---------+--------+--------+--------+-------+------| |
|
2687 |
| | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note | |
|
2688 |
|---+---------+--------+--------+--------+-------+------| |
|
2689 |
| ! | | P1 | P2 | P3 | Tot | | |
|
2690 |
| # | Maximum | 10 | 15 | 25 | 50 | 10.0 | |
|
2691 |
| ^ | | m1 | m2 | m3 | mt | | |
|
2692 |
|---+---------+--------+--------+--------+-------+------| |
|
2693 |
| # | Peter | 10 | 8 | 23 | 41 | 8.2 | |
|
2694 |
| # | Sam | 2 | 4 | 3 | 9 | 1.8 | |
|
2695 |
|---+---------+--------+--------+--------+-------+------| |
|
2696 |
| | Average | | | | 25.0 | | |
|
2697 |
| ^ | | | | | at | | |
|
2698 |
| $ | max=50 | | | | | | |
|
2699 |
|---+---------+--------+--------+--------+-------+------| |
|
2700 |
#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f |
|
2701 |
|
|
2702 |
Important: please note that for these special tables, recalculating the |
|
2703 |
table with ‘C-u C-c *’ will only affect rows that are marked ‘#’ or ‘*’, |
|
2704 |
and fields that have a formula assigned to the field itself. The column |
|
2705 |
formulas are not applied in rows with empty first field. |
|
2706 |
|
|
2707 |
The marking characters have the following meaning: |
|
2708 |
|
|
2709 |
‘!’ |
|
2710 |
The fields in this line define names for the columns, so that you |
|
2711 |
may refer to a column as ‘$Tot’ instead of ‘$6’. |
|
2712 |
‘^’ |
|
2713 |
This row defines names for the fields _above_ the row. With such a |
|
2714 |
definition, any formula in the table may use ‘$m1’ to refer to the |
|
2715 |
value ‘10’. Also, if you assign a formula to a names field, it |
|
2716 |
will be stored as ‘$name=...’. |
|
2717 |
‘_’ |
|
2718 |
Similar to ‘^’, but defines names for the fields in the row |
|
2719 |
_below_. |
|
2720 |
‘$’ |
|
2721 |
Fields in this row can define _parameters_ for formulas. For |
|
2722 |
example, if a field in a ‘$’ row contains ‘max=50’, then formulas |
|
2723 |
in this table can refer to the value 50 using ‘$max’. Parameters |
|
2724 |
work exactly like constants, only that they can be defined on a |
|
2725 |
per-table basis. |
|
2726 |
‘#’ |
|
2727 |
Fields in this row are automatically recalculated when pressing |
|
2728 |
<TAB> or <RET> or ‘S-<TAB>’ in this row. Also, this row is |
|
2729 |
selected for a global recalculation with ‘C-u C-c *’. Unmarked |
|
2730 |
lines will be left alone by this command. |
|
2731 |
‘*’ |
|
2732 |
Selects this line for global recalculation with ‘C-u C-c *’, but |
|
2733 |
not for automatic recalculation. Use this when automatic |
|
2734 |
recalculation slows down editing too much. |
|
2735 |
‘ ’ |
|
2736 |
Unmarked lines are exempt from recalculation with ‘C-u C-c *’. All |
|
2737 |
lines that should be recalculated should be marked with ‘#’ or ‘*’. |
|
2738 |
‘/’ |
|
2739 |
Do not export this line. Useful for lines that contain the |
|
2740 |
narrowing ‘<N>’ markers or column group markers. |
|
2741 |
|
|
2742 |
Finally, just to whet your appetite for what can be done with the |
|
2743 |
fantastic ‘calc.el’ package, here is a table that computes the Taylor |
|
2744 |
series of degree ‘n’ at location ‘x’ for a couple of functions. |
|
2745 |
|
|
2746 |
|---+-------------+---+-----+--------------------------------------| |
|
2747 |
| | Func | n | x | Result | |
|
2748 |
|---+-------------+---+-----+--------------------------------------| |
|
2749 |
| # | exp(x) | 1 | x | 1 + x | |
|
2750 |
| # | exp(x) | 2 | x | 1 + x + x^2 / 2 | |
|
2751 |
| # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 | |
|
2752 |
| # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 | |
|
2753 |
| # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 | |
|
2754 |
| * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 | |
|
2755 |
|---+-------------+---+-----+--------------------------------------| |
|
2756 |
#+TBLFM: $5=taylor($2,$4,$3);n3 |
|
2757 |
|
|
2758 |
---------- Footnotes ---------- |
|
2759 |
|
|
2760 |
(1) Such names must start by an alphabetic character and use only |
|
2761 |
alphanumeric/underscore characters. |
|
2762 |
|
|
2763 |
|
|
2764 |
File: org, Node: Org-Plot, Prev: The spreadsheet, Up: Tables |
|
2765 |
|
|
2766 |
3.6 Org-Plot |
|
2767 |
============ |
|
2768 |
|
|
2769 |
Org-Plot can produce graphs of information stored in org tables, either |
|
2770 |
graphically or in ASCII-art. |
|
2771 |
|
|
2772 |
Graphical plots using ‘Gnuplot’ |
|
2773 |
------------------------------- |
|
2774 |
|
|
2775 |
Org-Plot produces 2D and 3D graphs using ‘Gnuplot’ |
|
2776 |
<http://www.gnuplot.info/> and ‘gnuplot-mode’ |
|
2777 |
<http://xafs.org/BruceRavel/GnuplotMode>. To see this in action, ensure |
|
2778 |
that you have both Gnuplot and Gnuplot mode installed on your system, |
|
2779 |
then call ‘C-c " g’ or ‘M-x org-plot/gnuplot <RET>’ on the following |
|
2780 |
table. |
|
2781 |
|
|
2782 |
#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]" |
|
2783 |
| Sede | Max cites | H-index | |
|
2784 |
|-----------+-----------+---------| |
|
2785 |
| Chile | 257.72 | 21.39 | |
|
2786 |
| Leeds | 165.77 | 19.68 | |
|
2787 |
| Sao Paolo | 71.00 | 11.50 | |
|
2788 |
| Stockholm | 134.19 | 14.33 | |
|
2789 |
| Morelia | 257.56 | 17.67 | |
|
2790 |
|
|
2791 |
Notice that Org Plot is smart enough to apply the table’s headers as |
|
2792 |
labels. Further control over the labels, type, content, and appearance |
|
2793 |
of plots can be exercised through the ‘#+PLOT:’ lines preceding a table. |
|
2794 |
See below for a complete list of Org-plot options. The ‘#+PLOT:’ lines |
|
2795 |
are optional. For more information and examples see the Org-plot |
|
2796 |
tutorial at <https://orgmode.org/worg/org-tutorials/org-plot.html>. |
|
2797 |
|
|
2798 |
Plot Options |
|
2799 |
............ |
|
2800 |
|
|
2801 |
‘set’ |
|
2802 |
Specify any ‘gnuplot’ option to be set when graphing. |
|
2803 |
|
|
2804 |
‘title’ |
|
2805 |
Specify the title of the plot. |
|
2806 |
|
|
2807 |
‘ind’ |
|
2808 |
Specify which column of the table to use as the ‘x’ axis. |
|
2809 |
|
|
2810 |
‘deps’ |
|
2811 |
Specify the columns to graph as a Lisp style list, surrounded by |
|
2812 |
parentheses and separated by spaces for example ‘dep:(3 4)’ to |
|
2813 |
graph the third and fourth columns (defaults to graphing all other |
|
2814 |
columns aside from the ‘ind’ column). |
|
2815 |
|
|
2816 |
‘type’ |
|
2817 |
Specify whether the plot will be ‘2d’, ‘3d’, or ‘grid’. |
|
2818 |
|
|
2819 |
‘with’ |
|
2820 |
Specify a ‘with’ option to be inserted for every col being plotted |
|
2821 |
(e.g., ‘lines’, ‘points’, ‘boxes’, ‘impulses’, etc...). Defaults |
|
2822 |
to ‘lines’. |
|
2823 |
|
|
2824 |
‘file’ |
|
2825 |
If you want to plot to a file, specify |
|
2826 |
‘"PATH/TO/DESIRED/OUTPUT-FILE"’. |
|
2827 |
|
|
2828 |
‘labels’ |
|
2829 |
List of labels to be used for the ‘deps’ (defaults to the column |
|
2830 |
headers if they exist). |
|
2831 |
|
|
2832 |
‘line’ |
|
2833 |
Specify an entire line to be inserted in the Gnuplot script. |
|
2834 |
|
|
2835 |
‘map’ |
|
2836 |
When plotting ‘3d’ or ‘grid’ types, set this to ‘t’ to graph a flat |
|
2837 |
mapping rather than a ‘3d’ slope. |
|
2838 |
|
|
2839 |
‘timefmt’ |
|
2840 |
Specify format of Org mode timestamps as they will be parsed by |
|
2841 |
Gnuplot. Defaults to ‘%Y-%m-%d-%H:%M:%S’. |
|
2842 |
|
|
2843 |
‘script’ |
|
2844 |
If you want total control, you can specify a script file (place the |
|
2845 |
file name between double-quotes) which will be used to plot. |
|
2846 |
Before plotting, every instance of ‘$datafile’ in the specified |
|
2847 |
script will be replaced with the path to the generated data file. |
|
2848 |
Note: even if you set this option, you may still want to specify |
|
2849 |
the plot type, as that can impact the content of the data file. |
|
2850 |
|
|
2851 |
ASCII bar plots |
|
2852 |
--------------- |
|
2853 |
|
|
2854 |
While the cursor is on a column, typing ‘C-c " a’ or ‘M-x |
|
2855 |
orgtbl-ascii-plot <RET>’ create a new column containing an ASCII-art |
|
2856 |
bars plot. The plot is implemented through a regular column formula. |
|
2857 |
When the source column changes, the bar plot may be updated by |
|
2858 |
refreshing the table, for example typing ‘C-u C-c *’. |
|
2859 |
|
|
2860 |
| Sede | Max cites | | |
|
2861 |
|---------------+-----------+--------------| |
|
2862 |
| Chile | 257.72 | WWWWWWWWWWWW | |
|
2863 |
| Leeds | 165.77 | WWWWWWWh | |
|
2864 |
| Sao Paolo | 71.00 | WWW; | |
|
2865 |
| Stockholm | 134.19 | WWWWWW: | |
|
2866 |
| Morelia | 257.56 | WWWWWWWWWWWH | |
|
2867 |
| Rochefourchat | 0.00 | | |
|
2868 |
#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12) |
|
2869 |
|
|
2870 |
The formula is an elisp call: |
|
2871 |
(orgtbl-ascii-draw COLUMN MIN MAX WIDTH) |
|
2872 |
|
|
2873 |
‘COLUMN’ |
|
2874 |
is a reference to the source column. |
|
2875 |
|
|
2876 |
‘MIN MAX’ |
|
2877 |
are the minimal and maximal values displayed. Sources values |
|
2878 |
outside this range are displayed as ‘too small’ or ‘too large’. |
|
2879 |
|
|
2880 |
‘WIDTH’ |
|
2881 |
is the width in characters of the bar-plot. It defaults to ‘12’. |
|
2882 |
|
|
2883 |
|
|
2884 |
File: org, Node: Hyperlinks, Next: TODO items, Prev: Tables, Up: Top |
|
2885 |
|
|
2886 |
4 Hyperlinks |
|
2887 |
************ |
|
2888 |
|
|
2889 |
Like HTML, Org provides links inside a file, external links to other |
|
2890 |
files, Usenet articles, emails, and much more. |
|
2891 |
|
|
2892 |
* Menu: |
|
2893 |
|
|
2894 |
* Link format:: How links in Org are formatted |
|
2895 |
* Internal links:: Links to other places in the current file |
|
2896 |
* External links:: URL-like links to the world |
|
2897 |
* Handling links:: Creating, inserting and following |
|
2898 |
* Using links outside Org:: Linking from my C source code? |
|
2899 |
* Link abbreviations:: Shortcuts for writing complex links |
|
2900 |
* Search options:: Linking to a specific location |
|
2901 |
* Custom searches:: When the default search is not enough |
|
2902 |
|
|
2903 |
|
|
2904 |
File: org, Node: Link format, Next: Internal links, Up: Hyperlinks |
|
2905 |
|
|
2906 |
4.1 Link format |
|
2907 |
=============== |
|
2908 |
|
|
2909 |
Org will recognize plain URL-like links and activate them as clickable |
|
2910 |
links. The general link format, however, looks like this: |
|
2911 |
|
|
2912 |
[[link][description]] or alternatively [[link]] |
|
2913 |
|
|
2914 |
Once a link in the buffer is complete (all brackets present), Org will |
|
2915 |
change the display so that ‘description’ is displayed instead of |
|
2916 |
‘[[link][description]]’ and ‘link’ is displayed instead of ‘[[link]]’. |
|
2917 |
Links will be highlighted in the face ‘org-link’, which by default is an |
|
2918 |
underlined face. You can directly edit the visible part of a link. |
|
2919 |
Note that this can be either the ‘link’ part (if there is no |
|
2920 |
description) or the ‘description’ part. To edit also the invisible |
|
2921 |
‘link’ part, use ‘C-c C-l’ with the cursor on the link. |
|
2922 |
|
|
2923 |
If you place the cursor at the beginning or just behind the end of |
|
2924 |
the displayed text and press <BACKSPACE>, you will remove the |
|
2925 |
(invisible) bracket at that location. This makes the link incomplete |
|
2926 |
and the internals are again displayed as plain text. Inserting the |
|
2927 |
missing bracket hides the link internals again. To show the internal |
|
2928 |
structure of all links, use the menu entry ‘Org->Hyperlinks->Literal |
|
2929 |
links’. |
|
2930 |
|
|
2931 |
|
|
2932 |
File: org, Node: Internal links, Next: External links, Prev: Link format, Up: Hyperlinks |
|
2933 |
|
|
2934 |
4.2 Internal links |
|
2935 |
================== |
|
2936 |
|
|
2937 |
If the link does not look like a URL, it is considered to be internal in |
|
2938 |
the current file. The most important case is a link like |
|
2939 |
‘[[#my-custom-id]]’ which will link to the entry with the ‘CUSTOM_ID’ |
|
2940 |
property ‘my-custom-id’. You are responsible yourself to make sure |
|
2941 |
these custom IDs are unique in a file. |
|
2942 |
|
|
2943 |
Links such as ‘[[My Target]]’ or ‘[[My Target][Find my target]]’ lead |
|
2944 |
to a text search in the current file. |
|
2945 |
|
|
2946 |
The link can be followed with ‘C-c C-o’ when the cursor is on the |
|
2947 |
link, or with a mouse click (*note Handling links::). Links to custom |
|
2948 |
IDs will point to the corresponding headline. The preferred match for a |
|
2949 |
text link is a dedicated target: the same string in double angular |
|
2950 |
brackets, like ‘<<My Target>>’. |
|
2951 |
|
|
2952 |
If no dedicated target exists, the link will then try to match the |
|
2953 |
exact name of an element within the buffer. Naming is done with the |
|
2954 |
‘#+NAME’ keyword, which has to be put in the line before the element it |
|
2955 |
refers to, as in the following example |
|
2956 |
|
|
2957 |
#+NAME: My Target |
|
2958 |
| a | table | |
|
2959 |
|----+------------| |
|
2960 |
| of | four cells | |
|
2961 |
|
|
2962 |
If none of the above succeeds, Org will search for a headline that is |
|
2963 |
exactly the link text but may also include a TODO keyword and tags(1). |
|
2964 |
|
|
2965 |
During export, internal links will be used to mark objects and assign |
|
2966 |
them a number. Marked objects will then be referenced by links pointing |
|
2967 |
to them. In particular, links without a description will appear as the |
|
2968 |
number assigned to the marked object(2). In the following excerpt from |
|
2969 |
an Org buffer |
|
2970 |
|
|
2971 |
- one item |
|
2972 |
- <<target>>another item |
|
2973 |
Here we refer to item [[target]]. |
|
2974 |
|
|
2975 |
The last sentence will appear as ‘Here we refer to item 2’ when |
|
2976 |
exported. |
|
2977 |
|
|
2978 |
In non-Org files, the search will look for the words in the link |
|
2979 |
text. In the above example the search would be for ‘my target’. |
|
2980 |
|
|
2981 |
Following a link pushes a mark onto Org’s own mark ring. You can |
|
2982 |
return to the previous position with ‘C-c &’. Using this command |
|
2983 |
several times in direct succession goes back to positions recorded |
|
2984 |
earlier. |
|
2985 |
|
|
2986 |
* Menu: |
|
2987 |
|
|
2988 |
* Radio targets:: Make targets trigger links in plain text |
|
2989 |
|
|
2990 |
---------- Footnotes ---------- |
|
2991 |
|
|
2992 |
(1) To insert a link targeting a headline, in-buffer completion can |
|
2993 |
be used. Just type a star followed by a few optional letters into the |
|
2994 |
buffer and press ‘M-<TAB>’. All headlines in the current buffer will be |
|
2995 |
offered as completions. |
|
2996 |
|
|
2997 |
(2) When targeting a ‘#+NAME’ keyword, ‘#+CAPTION’ keyword is |
|
2998 |
mandatory in order to get proper numbering (*note Images and tables::). |
|
2999 |
|
|
3000 |
|
|
3001 |
File: org, Node: Radio targets, Up: Internal links |
|
3002 |
|
|
3003 |
4.2.1 Radio targets |
|
3004 |
------------------- |
|
3005 |
|
|
3006 |
Org can automatically turn any occurrences of certain target names in |
|
3007 |
normal text into a link. So without explicitly creating a link, the |
|
3008 |
text connects to the target radioing its position. Radio targets are |
|
3009 |
enclosed by triple angular brackets. For example, a target ‘<<<My |
|
3010 |
Target>>>’ causes each occurrence of ‘my target’ in normal text to |
|
3011 |
become activated as a link. The Org file is scanned automatically for |
|
3012 |
radio targets only when the file is first loaded into Emacs. To update |
|
3013 |
the target list during editing, press ‘C-c C-c’ with the cursor on or at |
|
3014 |
a target. |
|
3015 |
|
|
3016 |
|
|
3017 |
File: org, Node: External links, Next: Handling links, Prev: Internal links, Up: Hyperlinks |
|
3018 |
|
|
3019 |
4.3 External links |
|
3020 |
================== |
|
3021 |
|
|
3022 |
Org supports links to files, websites, Usenet and email messages, BBDB |
|
3023 |
database entries and links to both IRC conversations and their logs. |
|
3024 |
External links are URL-like locators. They start with a short |
|
3025 |
identifying string followed by a colon. There can be no space after the |
|
3026 |
colon. The following list shows examples for each link type. |
|
3027 |
|
|
3028 |
http://www.astro.uva.nl/~dominik on the web |
|
3029 |
doi:10.1000/182 DOI for an electronic resource |
|
3030 |
file:/home/dominik/images/jupiter.jpg file, absolute path |
|
3031 |
/home/dominik/images/jupiter.jpg same as above |
|
3032 |
file:papers/last.pdf file, relative path |
|
3033 |
./papers/last.pdf same as above |
|
3034 |
file:/ssh:myself@some.where:papers/last.pdf file, path on remote machine |
|
3035 |
/ssh:myself@some.where:papers/last.pdf same as above |
|
3036 |
file:sometextfile::NNN file, jump to line number |
|
3037 |
file:projects.org another Org file |
|
3038 |
file:projects.org::some words text search in Org file(1) |
|
3039 |
file:projects.org::*task title heading search in Org file(2) |
|
3040 |
docview:papers/last.pdf::NNN open in doc-view mode at page |
|
3041 |
id:B7423F4D-2E8A-471B-8810-C40F074717E9 Link to heading by ID |
|
3042 |
news:comp.emacs Usenet link |
|
3043 |
mailto:adent@galaxy.net Mail link |
|
3044 |
mhe:folder MH-E folder link |
|
3045 |
mhe:folder#id MH-E message link |
|
3046 |
rmail:folder RMAIL folder link |
|
3047 |
rmail:folder#id RMAIL message link |
|
3048 |
gnus:group Gnus group link |
|
3049 |
gnus:group#id Gnus article link |
|
3050 |
bbdb:R.*Stallman BBDB link (with regexp) |
|
3051 |
irc:/irc.com/#emacs/bob IRC link |
|
3052 |
info:org#External links Info node or index link |
|
3053 |
shell:ls *.org A shell command |
|
3054 |
elisp:org-agenda Interactive Elisp command |
|
3055 |
elisp:(find-file-other-frame "Elisp.org") Elisp form to evaluate |
|
3056 |
|
|
3057 |
On top of these built-in link types, some are available through the |
|
3058 |
‘contrib/’ directory (*note Installation::). For example, these links |
|
3059 |
to VM or Wanderlust messages are available when you load the |
|
3060 |
corresponding libraries from the ‘contrib/’ directory: |
|
3061 |
|
|
3062 |
vm:folder VM folder link |
|
3063 |
vm:folder#id VM message link |
|
3064 |
vm://myself@some.where.org/folder#id VM on remote machine |
|
3065 |
vm-imap:account:folder VM IMAP folder link |
|
3066 |
vm-imap:account:folder#id VM IMAP message link |
|
3067 |
wl:folder WANDERLUST folder link |
|
3068 |
wl:folder#id WANDERLUST message link |
|
3069 |
|
|
3070 |
For customizing Org to add new link types *note Adding hyperlink |
|
3071 |
types::. |
|
3072 |
|
|
3073 |
A link should be enclosed in double brackets and may contain a |
|
3074 |
descriptive text to be displayed instead of the URL (*note Link |
|
3075 |
format::), for example: |
|
3076 |
|
|
3077 |
[[https://www.gnu.org/software/emacs/][GNU Emacs]] |
|
3078 |
|
|
3079 |
If the description is a file name or URL that points to an image, HTML |
|
3080 |
export (*note HTML export::) will inline the image as a clickable |
|
3081 |
button. If there is no description at all and the link points to an |
|
3082 |
image, that image will be inlined into the exported HTML file. |
|
3083 |
|
|
3084 |
Org also finds external links in the normal text and activates them |
|
3085 |
as links. If spaces must be part of the link (for example in |
|
3086 |
‘bbdb:Richard Stallman’), or if you need to remove ambiguities about the |
|
3087 |
end of the link, enclose them in square brackets. |
|
3088 |
|
|
3089 |
---------- Footnotes ---------- |
|
3090 |
|
|
3091 |
(1) The actual behavior of the search will depend on the value of the |
|
3092 |
option ‘org-link-search-must-match-exact-headline’. If its value is |
|
3093 |
‘nil’, then a fuzzy text search will be done. If it is ‘t’, then only |
|
3094 |
the exact headline will be matched, ignoring spaces and cookies. If the |
|
3095 |
value is ‘query-to-create’, then an exact headline will be searched; if |
|
3096 |
it is not found, then the user will be queried to create it. |
|
3097 |
|
|
3098 |
(2) Headline searches always match the exact headline, ignoring |
|
3099 |
spaces and cookies. If the headline is not found and the value of the |
|
3100 |
option ‘org-link-search-must-match-exact-headline’ is ‘query-to-create’, |
|
3101 |
then the user will be queried to create it. |
|
3102 |
|
|
3103 |
|
|
3104 |
File: org, Node: Handling links, Next: Using links outside Org, Prev: External links, Up: Hyperlinks |
|
3105 |
|
|
3106 |
4.4 Handling links |
|
3107 |
================== |
|
3108 |
|
|
3109 |
Org provides methods to create a link in the correct syntax, to insert |
|
3110 |
it into an Org file, and to follow the link. |
|
3111 |
|
|
3112 |
‘C-c l (org-store-link)’ |
|
3113 |
Store a link to the current location. This is a _global_ command |
|
3114 |
(you must create the key binding yourself) which can be used in any |
|
3115 |
buffer to create a link. The link will be stored for later |
|
3116 |
insertion into an Org buffer (see below). What kind of link will |
|
3117 |
be created depends on the current buffer: |
|
3118 |
|
|
3119 |
Org mode buffers |
|
3120 |
For Org files, if there is a ‘<<target>>’ at the cursor, the link |
|
3121 |
points to the target. Otherwise it points to the current headline, |
|
3122 |
which will also be the description(1). |
|
3123 |
|
|
3124 |
If the headline has a ‘CUSTOM_ID’ property, a link to this custom |
|
3125 |
ID will be stored. In addition or alternatively (depending on the |
|
3126 |
value of ‘org-id-link-to-org-use-id’), a globally unique ‘ID’ |
|
3127 |
property will be created and/or used to construct a link(2). So |
|
3128 |
using this command in Org buffers will potentially create two |
|
3129 |
links: a human-readable from the custom ID, and one that is |
|
3130 |
globally unique and works even if the entry is moved from file to |
|
3131 |
file. Later, when inserting the link, you need to decide which one |
|
3132 |
to use. |
|
3133 |
|
|
3134 |
Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus |
|
3135 |
Pretty much all Emacs mail clients are supported. The link will |
|
3136 |
point to the current article, or, in some GNUS buffers, to the |
|
3137 |
group. The description is constructed from the author and the |
|
3138 |
subject. |
|
3139 |
|
|
3140 |
Web browsers: Eww, W3 and W3M |
|
3141 |
Here the link will be the current URL, with the page title as |
|
3142 |
description. |
|
3143 |
|
|
3144 |
Contacts: BBDB |
|
3145 |
Links created in a BBDB buffer will point to the current entry. |
|
3146 |
|
|
3147 |
Chat: IRC |
|
3148 |
For IRC links, if you set the option ‘org-irc-link-to-logs’ to ‘t’, |
|
3149 |
a ‘file:/’ style link to the relevant point in the logs for the |
|
3150 |
current conversation is created. Otherwise an ‘irc:/’ style link |
|
3151 |
to the user/channel/server under the point will be stored. |
|
3152 |
|
|
3153 |
Other files |
|
3154 |
For any other files, the link will point to the file, with a search |
|
3155 |
string (*note Search options::) pointing to the contents of the |
|
3156 |
current line. If there is an active region, the selected words |
|
3157 |
will form the basis of the search string. If the automatically |
|
3158 |
created link is not working correctly or accurately enough, you can |
|
3159 |
write custom functions to select the search string and to do the |
|
3160 |
search for particular file types—see *note Custom searches::. The |
|
3161 |
key binding ‘C-c l’ is only a suggestion—see *note Installation::. |
|
3162 |
|
|
3163 |
Agenda view |
|
3164 |
When the cursor is in an agenda view, the created link points to |
|
3165 |
the entry referenced by the current line. |
|
3166 |
|
|
3167 |
‘C-c C-l (org-insert-link)’ |
|
3168 |
Insert a link(3). This prompts for a link to be inserted into the |
|
3169 |
buffer. You can just type a link, using text for an internal link, |
|
3170 |
or one of the link type prefixes mentioned in the examples above. |
|
3171 |
The link will be inserted into the buffer(4), along with a |
|
3172 |
descriptive text. If some text was selected when this command is |
|
3173 |
called, the selected text becomes the default description. |
|
3174 |
|
|
3175 |
Inserting stored links |
|
3176 |
All links stored during the current session are part of the history |
|
3177 |
for this prompt, so you can access them with <UP> and <DOWN> (or |
|
3178 |
‘M-p/n’). |
|
3179 |
|
|
3180 |
Completion support |
|
3181 |
Completion with <TAB> will help you to insert valid link prefixes |
|
3182 |
like ‘https:’, including the prefixes defined through link |
|
3183 |
abbreviations (*note Link abbreviations::). If you press <RET> |
|
3184 |
after inserting only the PREFIX, Org will offer specific completion |
|
3185 |
support for some link types(5) For example, if you type ‘file |
|
3186 |
<RET>’, file name completion (alternative access: ‘C-u C-c C-l’, |
|
3187 |
see below) will be offered, and after ‘bbdb <RET>’ you can complete |
|
3188 |
contact names. |
|
3189 |
‘C-u C-c C-l’ |
|
3190 |
When ‘C-c C-l’ is called with a ‘C-u’ prefix argument, a link to a |
|
3191 |
file will be inserted and you may use file name completion to |
|
3192 |
select the name of the file. The path to the file is inserted |
|
3193 |
relative to the directory of the current Org file, if the linked |
|
3194 |
file is in the current directory or in a sub-directory of it, or if |
|
3195 |
the path is written relative to the current directory using ‘../’. |
|
3196 |
Otherwise an absolute path is used, if possible with ‘~/’ for your |
|
3197 |
home directory. You can force an absolute path with two ‘C-u’ |
|
3198 |
prefixes. |
|
3199 |
‘C-c C-l (with cursor on existing link)’ |
|
3200 |
When the cursor is on an existing link, ‘C-c C-l’ allows you to |
|
3201 |
edit the link and description parts of the link. |
|
3202 |
‘C-c C-o (org-open-at-point)’ |
|
3203 |
Open link at point. This will launch a web browser for URLs (using |
|
3204 |
‘browse-url-at-point’), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for |
|
3205 |
the corresponding links, and execute the command in a shell link. |
|
3206 |
When the cursor is on an internal link, this command runs the |
|
3207 |
corresponding search. When the cursor is on a TAG list in a |
|
3208 |
headline, it creates the corresponding TAGS view. If the cursor is |
|
3209 |
on a timestamp, it compiles the agenda for that date. Furthermore, |
|
3210 |
it will visit text and remote files in ‘file:’ links with Emacs and |
|
3211 |
select a suitable application for local non-text files. |
|
3212 |
Classification of files is based on file extension only. See |
|
3213 |
option ‘org-file-apps’. If you want to override the default |
|
3214 |
application and visit the file with Emacs, use a ‘C-u’ prefix. If |
|
3215 |
you want to avoid opening in Emacs, use a ‘C-u C-u’ prefix. |
|
3216 |
If the cursor is on a headline, but not on a link, offer all links |
|
3217 |
in the headline and entry text. If you want to setup the frame |
|
3218 |
configuration for following links, customize |
|
3219 |
‘org-link-frame-setup’. |
|
3220 |
|
|
3221 |
‘<RET>’ |
|
3222 |
When ‘org-return-follows-link’ is set, ‘<RET>’ will also follow the |
|
3223 |
link at point. |
|
3224 |
‘mouse-2’ |
|
3225 |
‘mouse-1’ |
|
3226 |
On links, ‘mouse-1’ and ‘mouse-2’ will open the link just as ‘C-c |
|
3227 |
C-o’ would. |
|
3228 |
‘mouse-3’ |
|
3229 |
Like ‘mouse-2’, but force file links to be opened with Emacs, and |
|
3230 |
internal links to be displayed in another window(6). |
|
3231 |
‘C-c C-x C-v (org-toggle-inline-images)’ |
|
3232 |
Toggle the inline display of linked images. Normally this will |
|
3233 |
only inline images that have no description part in the link, i.e., |
|
3234 |
images that will also be inlined during export. When called with a |
|
3235 |
prefix argument, also display images that do have a link |
|
3236 |
description. You can ask for inline images to be displayed at |
|
3237 |
startup by configuring the variable |
|
3238 |
‘org-startup-with-inline-images’(7). |
|
3239 |
‘C-c % (org-mark-ring-push)’ |
|
3240 |
Push the current position onto the mark ring, to be able to return |
|
3241 |
easily. Commands following an internal link do this automatically. |
|
3242 |
‘C-c & (org-mark-ring-goto)’ |
|
3243 |
Jump back to a recorded position. A position is recorded by the |
|
3244 |
commands following internal links, and by ‘C-c %’. Using this |
|
3245 |
command several times in direct succession moves through a ring of |
|
3246 |
previously recorded positions. |
|
3247 |
‘C-c C-x C-n (org-next-link)’ |
|
3248 |
‘C-c C-x C-p (org-previous-link)’ |
|
3249 |
Move forward/backward to the next link in the buffer. At the limit |
|
3250 |
of the buffer, the search fails once, and then wraps around. The |
|
3251 |
key bindings for this are really too long; you might want to bind |
|
3252 |
this also to ‘C-n’ and ‘C-p’ |
|
3253 |
(add-hook 'org-load-hook |
|
3254 |
(lambda () |
|
3255 |
(define-key org-mode-map "\C-n" 'org-next-link) |
|
3256 |
(define-key org-mode-map "\C-p" 'org-previous-link))) |
|
3257 |
|
|
3258 |
---------- Footnotes ---------- |
|
3259 |
|
|
3260 |
(1) If the headline contains a timestamp, it will be removed from the |
|
3261 |
link and result in a wrong link—you should avoid putting timestamp in |
|
3262 |
the headline. |
|
3263 |
|
|
3264 |
(2) The library ‘org-id.el’ must first be loaded, either through |
|
3265 |
‘org-customize’ by enabling ‘org-id’ in ‘org-modules’, or by adding |
|
3266 |
‘(require 'org-id)’ in your Emacs init file. |
|
3267 |
|
|
3268 |
(3) Note that you don’t have to use this command to insert a link. |
|
3269 |
Links in Org are plain text, and you can type or paste them straight |
|
3270 |
into the buffer. By using this command, the links are automatically |
|
3271 |
enclosed in double brackets, and you will be asked for the optional |
|
3272 |
descriptive text. |
|
3273 |
|
|
3274 |
(4) After insertion of a stored link, the link will be removed from |
|
3275 |
the list of stored links. To keep it in the list later use, use a |
|
3276 |
triple ‘C-u’ prefix argument to ‘C-c C-l’, or configure the option |
|
3277 |
‘org-keep-stored-link-after-insertion’. |
|
3278 |
|
|
3279 |
(5) This works if a completion function is defined in the ‘:complete’ |
|
3280 |
property of a link in ‘org-link-parameters’. |
|
3281 |
|
|
3282 |
(6) See the option ‘org-display-internal-link-with-indirect-buffer’ |
|
3283 |
|
|
3284 |
(7) with corresponding ‘#+STARTUP’ keywords ‘inlineimages’ and |
|
3285 |
‘noinlineimages’ |
|
3286 |
|
|
3287 |
|
|
3288 |
File: org, Node: Using links outside Org, Next: Link abbreviations, Prev: Handling links, Up: Hyperlinks |
|
3289 |
|
|
3290 |
4.5 Using links outside Org |
|
3291 |
=========================== |
|
3292 |
|
|
3293 |
You can insert and follow links that have Org syntax not only in Org, |
|
3294 |
but in any Emacs buffer. For this, you should create two global |
|
3295 |
commands, like this (please select suitable global keys yourself): |
|
3296 |
|
|
3297 |
(global-set-key "\C-c L" 'org-insert-link-global) |
|
3298 |
(global-set-key "\C-c o" 'org-open-at-point-global) |
|
3299 |
|
|
3300 |
|
|
3301 |
File: org, Node: Link abbreviations, Next: Search options, Prev: Using links outside Org, Up: Hyperlinks |
|
3302 |
|
|
3303 |
4.6 Link abbreviations |
|
3304 |
====================== |
|
3305 |
|
|
3306 |
Long URLs can be cumbersome to type, and often many similar links are |
|
3307 |
needed in a document. For this you can use link abbreviations. An |
|
3308 |
abbreviated link looks like this |
|
3309 |
|
|
3310 |
[[linkword:tag][description]] |
|
3311 |
|
|
3312 |
where the tag is optional. The linkword must be a word, starting with a |
|
3313 |
letter, followed by letters, numbers, ‘-’, and ‘_’. Abbreviations are |
|
3314 |
resolved according to the information in the variable |
|
3315 |
‘org-link-abbrev-alist’ that relates the linkwords to replacement text. |
|
3316 |
Here is an example: |
|
3317 |
|
|
3318 |
(setq org-link-abbrev-alist |
|
3319 |
'(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=") |
|
3320 |
("url-to-ja" . "http://translate.google.fr/translate?sl=en&tl=ja&u=%h") |
|
3321 |
("google" . "http://www.google.com/search?q=") |
|
3322 |
("gmap" . "http://maps.google.com/maps?q=%s") |
|
3323 |
("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1") |
|
3324 |
("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST"))) |
|
3325 |
|
|
3326 |
If the replacement text contains the string ‘%s’, it will be replaced |
|
3327 |
with the tag. Using ‘%h’ instead of ‘%s’ will url-encode the tag (see |
|
3328 |
the example above, where we need to encode the URL parameter.) Using |
|
3329 |
‘%(my-function)’ will pass the tag to a custom function, and replace it |
|
3330 |
by the resulting string. |
|
3331 |
|
|
3332 |
If the replacement text doesn’t contain any specifier, the tag will |
|
3333 |
simply be appended in order to create the link. |
|
3334 |
|
|
3335 |
Instead of a string, you may also specify a function that will be |
|
3336 |
called with the tag as the only argument to create the link. |
|
3337 |
|
|
3338 |
With the above setting, you could link to a specific bug with |
|
3339 |
‘[[bugzilla:129]]’, search the web for ‘OrgMode’ with |
|
3340 |
‘[[google:OrgMode]]’, show the map location of the Free Software |
|
3341 |
Foundation ‘[[gmap:51 Franklin Street, Boston]]’ or of Carsten office |
|
3342 |
‘[[omap:Science Park 904, Amsterdam, The Netherlands]]’ and find out |
|
3343 |
what the Org author is doing besides Emacs hacking with |
|
3344 |
‘[[ads:Dominik,C]]’. |
|
3345 |
|
|
3346 |
If you need special abbreviations just for a single Org buffer, you |
|
3347 |
can define them in the file with |
|
3348 |
|
|
3349 |
#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id= |
|
3350 |
#+LINK: google http://www.google.com/search?q=%s |
|
3351 |
|
|
3352 |
In-buffer completion (*note Completion::) can be used after ‘[’ to |
|
3353 |
complete link abbreviations. You may also define a function that |
|
3354 |
implements special (e.g., completion) support for inserting such a link |
|
3355 |
with ‘C-c C-l’. Such a function should not accept any arguments, and |
|
3356 |
return the full link with prefix. You can add a completion function to |
|
3357 |
a link like this: |
|
3358 |
|
|
3359 |
(org-link-set-parameters ``type'' :complete #'some-function) |
|
3360 |
|
|
3361 |
|
|
3362 |
File: org, Node: Search options, Next: Custom searches, Prev: Link abbreviations, Up: Hyperlinks |
|
3363 |
|
|
3364 |
4.7 Search options in file links |
|
3365 |
================================ |
|
3366 |
|
|
3367 |
File links can contain additional information to make Emacs jump to a |
|
3368 |
particular location in the file when following a link. This can be a |
|
3369 |
line number or a search option after a double(1) colon. For example, |
|
3370 |
when the command ‘C-c l’ creates a link (*note Handling links::) to a |
|
3371 |
file, it encodes the words in the current line as a search string that |
|
3372 |
can be used to find this line back later when following the link with |
|
3373 |
‘C-c C-o’. |
|
3374 |
|
|
3375 |
Here is the syntax of the different ways to attach a search to a file |
|
3376 |
link, together with an explanation: |
|
3377 |
|
|
3378 |
[[file:~/code/main.c::255]] |
|
3379 |
[[file:~/xx.org::My Target]] |
|
3380 |
[[file:~/xx.org::*My Target]] |
|
3381 |
[[file:~/xx.org::#my-custom-id]] |
|
3382 |
[[file:~/xx.org::/regexp/]] |
|
3383 |
|
|
3384 |
‘255’ |
|
3385 |
Jump to line 255. |
|
3386 |
‘My Target’ |
|
3387 |
Search for a link target ‘<<My Target>>’, or do a text search for |
|
3388 |
‘my target’, similar to the search in internal links, see *note |
|
3389 |
Internal links::. In HTML export (*note HTML export::), such a |
|
3390 |
file link will become an HTML reference to the corresponding named |
|
3391 |
anchor in the linked file. |
|
3392 |
‘*My Target’ |
|
3393 |
In an Org file, restrict search to headlines. |
|
3394 |
‘#my-custom-id’ |
|
3395 |
Link to a heading with a ‘CUSTOM_ID’ property |
|
3396 |
‘/regexp/’ |
|
3397 |
Do a regular expression search for ‘regexp’. This uses the Emacs |
|
3398 |
command ‘occur’ to list all matches in a separate window. If the |
|
3399 |
target file is in Org mode, ‘org-occur’ is used to create a sparse |
|
3400 |
tree with the matches. |
|
3401 |
|
|
3402 |
As a degenerate case, a file link with an empty file name can be used |
|
3403 |
to search the current file. For example, ‘[[file:::find me]]’ does a |
|
3404 |
search for ‘find me’ in the current file, just as ‘[[find me]]’ would. |
|
3405 |
|
|
3406 |
---------- Footnotes ---------- |
|
3407 |
|
|
3408 |
(1) For backward compatibility, line numbers can also follow a single |
|
3409 |
colon. |
|
3410 |
|
|
3411 |
|
|
3412 |
File: org, Node: Custom searches, Prev: Search options, Up: Hyperlinks |
|
3413 |
|
|
3414 |
4.8 Custom Searches |
|
3415 |
=================== |
|
3416 |
|
|
3417 |
The default mechanism for creating search strings and for doing the |
|
3418 |
actual search related to a file link may not work correctly in all |
|
3419 |
cases. For example, BibTeX database files have many entries like |
|
3420 |
‘year="1993"’ which would not result in good search strings, because the |
|
3421 |
only unique identification for a BibTeX entry is the citation key. |
|
3422 |
|
|
3423 |
If you come across such a problem, you can write custom functions to |
|
3424 |
set the right search string for a particular file type, and to do the |
|
3425 |
search for the string in the file. Using ‘add-hook’, these functions |
|
3426 |
need to be added to the hook variables |
|
3427 |
‘org-create-file-search-functions’ and |
|
3428 |
‘org-execute-file-search-functions’. See the docstring for these |
|
3429 |
variables for more information. Org actually uses this mechanism for |
|
3430 |
BibTeX database files, and you can use the corresponding code as an |
|
3431 |
implementation example. See the file ‘org-bibtex.el’. |
|
3432 |
|
|
3433 |
|
|
3434 |
File: org, Node: TODO items, Next: Tags, Prev: Hyperlinks, Up: Top |
|
3435 |
|
|
3436 |
5 TODO items |
|
3437 |
************ |
|
3438 |
|
|
3439 |
Org mode does not maintain TODO lists as separate documents(1). |
|
3440 |
Instead, TODO items are an integral part of the notes file, because TODO |
|
3441 |
items usually come up while taking notes! With Org mode, simply mark |
|
3442 |
any entry in a tree as being a TODO item. In this way, information is |
|
3443 |
not duplicated, and the entire context from which the TODO item emerged |
|
3444 |
is always present. |
|
3445 |
|
|
3446 |
Of course, this technique for managing TODO items scatters them |
|
3447 |
throughout your notes file. Org mode compensates for this by providing |
|
3448 |
methods to give you an overview of all the things that you have to do. |
|
3449 |
|
|
3450 |
* Menu: |
|
3451 |
|
|
3452 |
* TODO basics:: Marking and displaying TODO entries |
|
3453 |
* TODO extensions:: Workflow and assignments |
|
3454 |
* Progress logging:: Dates and notes for progress |
|
3455 |
* Priorities:: Some things are more important than others |
|
3456 |
* Breaking down tasks:: Splitting a task into manageable pieces |
|
3457 |
* Checkboxes:: Tick-off lists |
|
3458 |
|
|
3459 |
---------- Footnotes ---------- |
|
3460 |
|
|
3461 |
(1) Of course, you can make a document that contains only long lists |
|
3462 |
of TODO items, but this is not required. |
|
3463 |
|
|
3464 |
|
|
3465 |
File: org, Node: TODO basics, Next: TODO extensions, Up: TODO items |
|
3466 |
|
|
3467 |
5.1 Basic TODO functionality |
|
3468 |
============================ |
|
3469 |
|
|
3470 |
Any headline becomes a TODO item when it starts with the word ‘TODO’, |
|
3471 |
for example: |
|
3472 |
|
|
3473 |
*** TODO Write letter to Sam Fortune |
|
3474 |
|
|
3475 |
The most important commands to work with TODO entries are: |
|
3476 |
|
|
3477 |
‘C-c C-t (org-todo)’ |
|
3478 |
|
|
3479 |
Rotate the TODO state of the current item among |
|
3480 |
|
|
3481 |
,-> (unmarked) -> TODO -> DONE --. |
|
3482 |
'--------------------------------' |
|
3483 |
|
|
3484 |
If TODO keywords have fast access keys (see *note Fast access to |
|
3485 |
TODO states::), you will be prompted for a TODO keyword through the |
|
3486 |
fast selection interface; this is the default behavior when |
|
3487 |
‘org-use-fast-todo-selection’ is non-‘nil’. |
|
3488 |
|
|
3489 |
The same rotation can also be done “remotely” from agenda buffers |
|
3490 |
with the ‘t’ command key (*note Agenda commands::). |
|
3491 |
|
|
3492 |
‘C-u C-c C-t’ |
|
3493 |
When TODO keywords have no selection keys, select a specific |
|
3494 |
keyword using completion; otherwise force cycling through TODO |
|
3495 |
states with no prompt. When ‘org-use-fast-todo-selection’ is set |
|
3496 |
to ‘prefix’, use the fast selection interface. |
|
3497 |
|
|
3498 |
‘S-<RIGHT> / S-<LEFT>’ |
|
3499 |
Select the following/preceding TODO state, similar to cycling. |
|
3500 |
Useful mostly if more than two TODO states are possible (*note TODO |
|
3501 |
extensions::). See also *note Conflicts::, for a discussion of the |
|
3502 |
interaction with ‘shift-selection-mode’. See also the variable |
|
3503 |
‘org-treat-S-cursor-todo-selection-as-state-change’. |
|
3504 |
‘C-c / t (org-show-todo-tree)’ |
|
3505 |
View TODO items in a _sparse tree_ (*note Sparse trees::). Folds |
|
3506 |
the entire buffer, but shows all TODO items (with not-DONE state) |
|
3507 |
and the headings hierarchy above them. With a prefix argument (or |
|
3508 |
by using ‘C-c / T’), search for a specific TODO. You will be |
|
3509 |
prompted for the keyword, and you can also give a list of keywords |
|
3510 |
like ‘KWD1|KWD2|...’ to list entries that match any one of these |
|
3511 |
keywords. With a numeric prefix argument N, show the tree for the |
|
3512 |
Nth keyword in the option ‘org-todo-keywords’. With two prefix |
|
3513 |
arguments, find all TODO states, both un-done and done. |
|
3514 |
‘C-c a t (org-todo-list)’ |
|
3515 |
Show the global TODO list. Collects the TODO items (with not-DONE |
|
3516 |
states) from all agenda files (*note Agenda views::) into a single |
|
3517 |
buffer. The new buffer will be in ‘agenda-mode’, which provides |
|
3518 |
commands to examine and manipulate the TODO entries from the new |
|
3519 |
buffer (*note Agenda commands::). *Note Global TODO list::, for |
|
3520 |
more information. |
|
3521 |
‘S-M-<RET> (org-insert-todo-heading)’ |
|
3522 |
Insert a new TODO entry below the current one. |
|
3523 |
|
|
3524 |
Changing a TODO state can also trigger tag changes. See the docstring |
|
3525 |
of the option ‘org-todo-state-tags-triggers’ for details. |
|
3526 |
|
|
3527 |
|
|
3528 |
File: org, Node: TODO extensions, Next: Progress logging, Prev: TODO basics, Up: TODO items |
|
3529 |
|
|
3530 |
5.2 Extended use of TODO keywords |
|
3531 |
================================= |
|
3532 |
|
|
3533 |
By default, marked TODO entries have one of only two states: TODO and |
|
3534 |
DONE. Org mode allows you to classify TODO items in more complex ways |
|
3535 |
with _TODO keywords_ (stored in ‘org-todo-keywords’). With special |
|
3536 |
setup, the TODO keyword system can work differently in different files. |
|
3537 |
|
|
3538 |
Note that tags are another way to classify headlines in general and |
|
3539 |
TODO items in particular (*note Tags::). |
|
3540 |
|
|
3541 |
* Menu: |
|
3542 |
|
|
3543 |
* Workflow states:: From TODO to DONE in steps |
|
3544 |
* TODO types:: I do this, Fred does the rest |
|
3545 |
* Multiple sets in one file:: Mixing it all, and still finding your way |
|
3546 |
* Fast access to TODO states:: Single letter selection of a state |
|
3547 |
* Per-file keywords:: Different files, different requirements |
|
3548 |
* Faces for TODO keywords:: Highlighting states |
|
3549 |
* TODO dependencies:: When one task needs to wait for others |
|
3550 |
|
|
3551 |
|
|
3552 |
File: org, Node: Workflow states, Next: TODO types, Up: TODO extensions |
|
3553 |
|
|
3554 |
5.2.1 TODO keywords as workflow states |
|
3555 |
-------------------------------------- |
|
3556 |
|
|
3557 |
You can use TODO keywords to indicate different _sequential_ states in |
|
3558 |
the process of working on an item, for example(1): |
|
3559 |
|
|
3560 |
(setq org-todo-keywords |
|
3561 |
'((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) |
|
3562 |
|
|
3563 |
The vertical bar separates the TODO keywords (states that _need |
|
3564 |
action_) from the DONE states (which need _no further action_). If you |
|
3565 |
don’t provide the separator bar, the last state is used as the DONE |
|
3566 |
state. With this setup, the command ‘C-c C-t’ will cycle an entry from |
|
3567 |
TODO to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. |
|
3568 |
You may also use a numeric prefix argument to quickly select a specific |
|
3569 |
state. For example ‘C-3 C-c C-t’ will change the state immediately to |
|
3570 |
VERIFY. Or you can use ‘S-<LEFT>’ to go backward through the sequence. |
|
3571 |
If you define many keywords, you can use in-buffer completion (*note |
|
3572 |
Completion::) or even a special one-key selection scheme (*note Fast |
|
3573 |
access to TODO states::) to insert these words into the buffer. |
|
3574 |
Changing a TODO state can be logged with a timestamp, see *note Tracking |
|
3575 |
TODO state changes::, for more information. |
|
3576 |
|
|
3577 |
---------- Footnotes ---------- |
|
3578 |
|
|
3579 |
(1) Changing this variable only becomes effective after restarting |
|
3580 |
Org mode in a buffer. |
|
3581 |
|
|
3582 |
|
|
3583 |
File: org, Node: TODO types, Next: Multiple sets in one file, Prev: Workflow states, Up: TODO extensions |
|
3584 |
|
|
3585 |
5.2.2 TODO keywords as types |
|
3586 |
---------------------------- |
|
3587 |
|
|
3588 |
The second possibility is to use TODO keywords to indicate different |
|
3589 |
_types_ of action items. For example, you might want to indicate that |
|
3590 |
items are for “work” or “home”. Or, when you work with several people |
|
3591 |
on a single project, you might want to assign action items directly to |
|
3592 |
persons, by using their names as TODO keywords. This would be set up |
|
3593 |
like this: |
|
3594 |
|
|
3595 |
(setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE"))) |
|
3596 |
|
|
3597 |
In this case, different keywords do not indicate a sequence, but |
|
3598 |
rather different types. So the normal work flow would be to assign a |
|
3599 |
task to a person, and later to mark it DONE. Org mode supports this |
|
3600 |
style by adapting the workings of the command ‘C-c C-t’(1). When used |
|
3601 |
several times in succession, it will still cycle through all names, in |
|
3602 |
order to first select the right type for a task. But when you return to |
|
3603 |
the item after some time and execute ‘C-c C-t’ again, it will switch |
|
3604 |
from any name directly to DONE. Use prefix arguments or completion to |
|
3605 |
quickly select a specific name. You can also review the items of a |
|
3606 |
specific TODO type in a sparse tree by using a numeric prefix to ‘C-c / |
|
3607 |
t’. For example, to see all things Lucy has to do, you would use ‘C-3 |
|
3608 |
C-c / t’. To collect Lucy’s items from all agenda files into a single |
|
3609 |
buffer, you would use the numeric prefix argument as well when creating |
|
3610 |
the global TODO list: ‘C-3 C-c a t’. |
|
3611 |
|
|
3612 |
---------- Footnotes ---------- |
|
3613 |
|
|
3614 |
(1) This is also true for the ‘t’ command in the agenda buffers. |
|
3615 |
|
|
3616 |
|
|
3617 |
File: org, Node: Multiple sets in one file, Next: Fast access to TODO states, Prev: TODO types, Up: TODO extensions |
|
3618 |
|
|
3619 |
5.2.3 Multiple keyword sets in one file |
|
3620 |
--------------------------------------- |
|
3621 |
|
|
3622 |
Sometimes you may want to use different sets of TODO keywords in |
|
3623 |
parallel. For example, you may want to have the basic ‘TODO’/‘DONE’, |
|
3624 |
but also a workflow for bug fixing, and a separate state indicating that |
|
3625 |
an item has been canceled (so it is not DONE, but also does not require |
|
3626 |
action). Your setup would then look like this: |
|
3627 |
|
|
3628 |
(setq org-todo-keywords |
|
3629 |
'((sequence "TODO" "|" "DONE") |
|
3630 |
(sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED") |
|
3631 |
(sequence "|" "CANCELED"))) |
|
3632 |
|
|
3633 |
The keywords should all be different, this helps Org mode to keep |
|
3634 |
track of which subsequence should be used for a given entry. In this |
|
3635 |
setup, ‘C-c C-t’ only operates within a subsequence, so it switches from |
|
3636 |
‘DONE’ to (nothing) to ‘TODO’, and from ‘FIXED’ to (nothing) to |
|
3637 |
‘REPORT’. Therefore you need a mechanism to initially select the |
|
3638 |
correct sequence. Besides the obvious ways like typing a keyword or |
|
3639 |
using completion, you may also apply the following commands: |
|
3640 |
|
|
3641 |
‘C-u C-u C-c C-t’ |
|
3642 |
‘C-S-<RIGHT>’ |
|
3643 |
‘C-S-<LEFT>’ |
|
3644 |
These keys jump from one TODO subset to the next. In the above |
|
3645 |
example, ‘C-u C-u C-c C-t’ or ‘C-S-<RIGHT>’ would jump from ‘TODO’ |
|
3646 |
or ‘DONE’ to ‘REPORT’, and any of the words in the second row to |
|
3647 |
‘CANCELED’. Note that the ‘C-S-’ key binding conflict with |
|
3648 |
‘shift-selection-mode’ (*note Conflicts::). |
|
3649 |
‘S-<RIGHT>’ |
|
3650 |
‘S-<LEFT>’ |
|
3651 |
‘S-<LEFT>’ and ‘S-<RIGHT>’ and walk through _all_ keywords from all |
|
3652 |
sets, so for example ‘S-<RIGHT>’ would switch from ‘DONE’ to |
|
3653 |
‘REPORT’ in the example above. See also *note Conflicts::, for a |
|
3654 |
discussion of the interaction with ‘shift-selection-mode’. |
|
3655 |
|
|
3656 |
|
|
3657 |
File: org, Node: Fast access to TODO states, Next: Per-file keywords, Prev: Multiple sets in one file, Up: TODO extensions |
|
3658 |
|
|
3659 |
5.2.4 Fast access to TODO states |
|
3660 |
-------------------------------- |
|
3661 |
|
|
3662 |
If you would like to quickly change an entry to an arbitrary TODO state |
|
3663 |
instead of cycling through the states, you can set up keys for |
|
3664 |
single-letter access to the states. This is done by adding the |
|
3665 |
selection character after each keyword, in parentheses(1). For example: |
|
3666 |
|
|
3667 |
(setq org-todo-keywords |
|
3668 |
'((sequence "TODO(t)" "|" "DONE(d)") |
|
3669 |
(sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)") |
|
3670 |
(sequence "|" "CANCELED(c)"))) |
|
3671 |
|
|
3672 |
If you then press ‘C-c C-t’ followed by the selection key, the entry |
|
3673 |
will be switched to this state. ‘<SPC>’ can be used to remove any TODO |
|
3674 |
keyword from an entry.(2) |
|
3675 |
|
|
3676 |
---------- Footnotes ---------- |
|
3677 |
|
|
3678 |
(1) All characters are allowed except ‘@^!’, which have a special |
|
3679 |
meaning here. |
|
3680 |
|
|
3681 |
(2) Check also the option ‘org-fast-tag-selection-include-todo’, it |
|
3682 |
allows you to change the TODO state through the tags interface (*note |
|
3683 |
Setting tags::), in case you like to mingle the two concepts. Note that |
|
3684 |
this means you need to come up with unique keys across both sets of |
|
3685 |
keywords. |
|
3686 |
|
|
3687 |
|
|
3688 |
File: org, Node: Per-file keywords, Next: Faces for TODO keywords, Prev: Fast access to TODO states, Up: TODO extensions |
|
3689 |
|
|
3690 |
5.2.5 Setting up keywords for individual files |
|
3691 |
---------------------------------------------- |
|
3692 |
|
|
3693 |
It can be very useful to use different aspects of the TODO mechanism in |
|
3694 |
different files. For file-local settings, you need to add special lines |
|
3695 |
to the file which set the keywords and interpretation for that file |
|
3696 |
only. For example, to set one of the two examples discussed above, you |
|
3697 |
need one of the following lines anywhere in the file: |
|
3698 |
|
|
3699 |
#+TODO: TODO FEEDBACK VERIFY | DONE CANCELED |
|
3700 |
(you may also write ‘#+SEQ_TODO’ to be explicit about the |
|
3701 |
interpretation, but it means the same as ‘#+TODO’), or |
|
3702 |
#+TYP_TODO: Fred Sara Lucy Mike | DONE |
|
3703 |
|
|
3704 |
A setup for using several sets in parallel would be: |
|
3705 |
|
|
3706 |
#+TODO: TODO | DONE |
|
3707 |
#+TODO: REPORT BUG KNOWNCAUSE | FIXED |
|
3708 |
#+TODO: | CANCELED |
|
3709 |
|
|
3710 |
To make sure you are using the correct keyword, type ‘#+’ into the |
|
3711 |
buffer and then use ‘M-<TAB>’ completion. |
|
3712 |
|
|
3713 |
Remember that the keywords after the vertical bar (or the last |
|
3714 |
keyword if no bar is there) must always mean that the item is DONE |
|
3715 |
(although you may use a different word). After changing one of these |
|
3716 |
lines, use ‘C-c C-c’ with the cursor still in the line to make the |
|
3717 |
changes known to Org mode(1). |
|
3718 |
|
|
3719 |
---------- Footnotes ---------- |
|
3720 |
|
|
3721 |
(1) Org mode parses these lines only when Org mode is activated after |
|
3722 |
visiting a file. ‘C-c C-c’ with the cursor in a line starting with ‘#+’ |
|
3723 |
is simply restarting Org mode for the current buffer. |
|
3724 |
|
|
3725 |
|
|
3726 |
File: org, Node: Faces for TODO keywords, Next: TODO dependencies, Prev: Per-file keywords, Up: TODO extensions |
|
3727 |
|
|
3728 |
5.2.6 Faces for TODO keywords |
|
3729 |
----------------------------- |
|
3730 |
|
|
3731 |
Org mode highlights TODO keywords with special faces: ‘org-todo’ for |
|
3732 |
keywords indicating that an item still has to be acted upon, and |
|
3733 |
‘org-done’ for keywords indicating that an item is finished. If you are |
|
3734 |
using more than 2 different states, you might want to use special faces |
|
3735 |
for some of them. This can be done using the option |
|
3736 |
‘org-todo-keyword-faces’. For example: |
|
3737 |
|
|
3738 |
(setq org-todo-keyword-faces |
|
3739 |
'(("TODO" . org-warning) ("STARTED" . "yellow") |
|
3740 |
("CANCELED" . (:foreground "blue" :weight bold)))) |
|
3741 |
|
|
3742 |
While using a list with face properties as shown for CANCELED |
|
3743 |
_should_ work, this does not always seem to be the case. If necessary, |
|
3744 |
define a special face and use that. A string is interpreted as a color. |
|
3745 |
The option ‘org-faces-easy-properties’ determines if that color is |
|
3746 |
interpreted as a foreground or a background color. |
|
3747 |
|
|
3748 |
|
|
3749 |
File: org, Node: TODO dependencies, Prev: Faces for TODO keywords, Up: TODO extensions |
|
3750 |
|
|
3751 |
5.2.7 TODO dependencies |
|
3752 |
----------------------- |
|
3753 |
|
|
3754 |
The structure of Org files (hierarchy and lists) makes it easy to define |
|
3755 |
TODO dependencies. Usually, a parent TODO task should not be marked |
|
3756 |
DONE until all subtasks (defined as children tasks) are marked as DONE. |
|
3757 |
And sometimes there is a logical sequence to a number of (sub)tasks, so |
|
3758 |
that one task cannot be acted upon before all siblings above it are |
|
3759 |
done. If you customize the option ‘org-enforce-todo-dependencies’, Org |
|
3760 |
will block entries from changing state to DONE while they have children |
|
3761 |
that are not DONE. Furthermore, if an entry has a property ‘ORDERED’, |
|
3762 |
each of its children will be blocked until all earlier siblings are |
|
3763 |
marked DONE. Here is an example: |
|
3764 |
|
|
3765 |
* TODO Blocked until (two) is done |
|
3766 |
** DONE one |
|
3767 |
** TODO two |
|
3768 |
|
|
3769 |
* Parent |
|
3770 |
:PROPERTIES: |
|
3771 |
:ORDERED: t |
|
3772 |
:END: |
|
3773 |
** TODO a |
|
3774 |
** TODO b, needs to wait for (a) |
|
3775 |
** TODO c, needs to wait for (a) and (b) |
|
3776 |
|
|
3777 |
You can ensure an entry is never blocked by using the ‘NOBLOCKING’ |
|
3778 |
property: |
|
3779 |
|
|
3780 |
* This entry is never blocked |
|
3781 |
:PROPERTIES: |
|
3782 |
:NOBLOCKING: t |
|
3783 |
:END: |
|
3784 |
|
|
3785 |
‘C-c C-x o (org-toggle-ordered-property)’ |
|
3786 |
Toggle the ‘ORDERED’ property of the current entry. A property is |
|
3787 |
used for this behavior because this should be local to the current |
|
3788 |
entry, not inherited like a tag. However, if you would like to |
|
3789 |
track the value of this property with a tag for better visibility, |
|
3790 |
customize the option ‘org-track-ordered-property-with-tag’. |
|
3791 |
‘C-u C-u C-u C-c C-t’ |
|
3792 |
Change TODO state, circumventing any state blocking. |
|
3793 |
|
|
3794 |
If you set the option ‘org-agenda-dim-blocked-tasks’, TODO entries |
|
3795 |
that cannot be closed because of such dependencies will be shown in a |
|
3796 |
dimmed font or even made invisible in agenda views (*note Agenda |
|
3797 |
views::). |
|
3798 |
|
|
3799 |
You can also block changes of TODO states by looking at checkboxes |
|
3800 |
(*note Checkboxes::). If you set the option |
|
3801 |
‘org-enforce-todo-checkbox-dependencies’, an entry that has unchecked |
|
3802 |
checkboxes will be blocked from switching to DONE. |
|
3803 |
|
|
3804 |
If you need more complex dependency structures, for example |
|
3805 |
dependencies between entries in different trees or files, check out the |
|
3806 |
contributed module ‘org-depend.el’. |
|
3807 |
|
|
3808 |
|
|
3809 |
File: org, Node: Progress logging, Next: Priorities, Prev: TODO extensions, Up: TODO items |
|
3810 |
|
|
3811 |
5.3 Progress logging |
|
3812 |
==================== |
|
3813 |
|
|
3814 |
Org mode can automatically record a timestamp and possibly a note when |
|
3815 |
you mark a TODO item as DONE, or even each time you change the state of |
|
3816 |
a TODO item. This system is highly configurable; settings can be on a |
|
3817 |
per-keyword basis and can be localized to a file or even a subtree. For |
|
3818 |
information on how to clock working time for a task, see *note Clocking |
|
3819 |
work time::. |
|
3820 |
|
|
3821 |
* Menu: |
|
3822 |
|
|
3823 |
* Closing items:: When was this entry marked DONE? |
|
3824 |
* Tracking TODO state changes:: When did the status change? |
|
3825 |
* Tracking your habits:: How consistent have you been? |
|
3826 |
|
|
3827 |
|
|
3828 |
File: org, Node: Closing items, Next: Tracking TODO state changes, Up: Progress logging |
|
3829 |
|
|
3830 |
5.3.1 Closing items |
|
3831 |
------------------- |
|
3832 |
|
|
3833 |
The most basic logging is to keep track of _when_ a certain TODO item |
|
3834 |
was finished. This is achieved with(1) |
|
3835 |
|
|
3836 |
(setq org-log-done 'time) |
|
3837 |
|
|
3838 |
Then each time you turn an entry from a TODO (not-done) state into any |
|
3839 |
of the DONE states, a line ‘CLOSED: [timestamp]’ will be inserted just |
|
3840 |
after the headline. If you turn the entry back into a TODO item through |
|
3841 |
further state cycling, that line will be removed again. If you turn the |
|
3842 |
entry back to a non-TODO state (by pressing ‘C-c C-t <SPC>’ for |
|
3843 |
example), that line will also be removed, unless you set |
|
3844 |
‘org-closed-keep-when-no-todo’ to non-‘nil’. If you want to record a |
|
3845 |
note along with the timestamp, use(2) |
|
3846 |
|
|
3847 |
(setq org-log-done 'note) |
|
3848 |
|
|
3849 |
You will then be prompted for a note, and that note will be stored below |
|
3850 |
the entry with a ‘Closing Note’ heading. |
|
3851 |
|
|
3852 |
---------- Footnotes ---------- |
|
3853 |
|
|
3854 |
(1) The corresponding in-buffer setting is: ‘#+STARTUP: logdone’ |
|
3855 |
|
|
3856 |
(2) The corresponding in-buffer setting is: ‘#+STARTUP: lognotedone’. |
|
3857 |
|
|
3858 |
|
|
3859 |
File: org, Node: Tracking TODO state changes, Next: Tracking your habits, Prev: Closing items, Up: Progress logging |
|
3860 |
|
|
3861 |
5.3.2 Tracking TODO state changes |
|
3862 |
--------------------------------- |
|
3863 |
|
|
3864 |
When TODO keywords are used as workflow states (*note Workflow |
|
3865 |
states::), you might want to keep track of when a state change occurred |
|
3866 |
and maybe take a note about this change. You can either record just a |
|
3867 |
timestamp, or a time-stamped note for a change. These records will be |
|
3868 |
inserted after the headline as an itemized list, newest first(1). When |
|
3869 |
taking a lot of notes, you might want to get the notes out of the way |
|
3870 |
into a drawer (*note Drawers::). Customize ‘org-log-into-drawer’ to get |
|
3871 |
this behavior—the recommended drawer for this is called ‘LOGBOOK’(2). |
|
3872 |
You can also overrule the setting of this variable for a subtree by |
|
3873 |
setting a ‘LOG_INTO_DRAWER’ property. |
|
3874 |
|
|
3875 |
Since it is normally too much to record a note for every state, Org |
|
3876 |
mode expects configuration on a per-keyword basis for this. This is |
|
3877 |
achieved by adding special markers ‘!’ (for a timestamp) or ‘@’ (for a |
|
3878 |
note with timestamp) in parentheses after each keyword. For example, |
|
3879 |
with the setting |
|
3880 |
|
|
3881 |
(setq org-todo-keywords |
|
3882 |
'((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) |
|
3883 |
|
|
3884 |
To record a timestamp without a note for TODO keywords configured |
|
3885 |
with ‘@’, just type ‘C-c C-c’ to enter a blank note when prompted. |
|
3886 |
|
|
3887 |
You not only define global TODO keywords and fast access keys, but also |
|
3888 |
request that a time is recorded when the entry is set to DONE(3), and |
|
3889 |
that a note is recorded when switching to WAIT or CANCELED. The setting |
|
3890 |
for WAIT is even more special: the ‘!’ after the slash means that in |
|
3891 |
addition to the note taken when entering the state, a timestamp should |
|
3892 |
be recorded when leaving the WAIT state, if and only if the target state |
|
3893 |
does not configure logging for entering it. So it has no effect when |
|
3894 |
switching from WAIT to DONE, because DONE is configured to record a |
|
3895 |
timestamp only. But when switching from WAIT back to TODO, the ‘/!’ in |
|
3896 |
the WAIT setting now triggers a timestamp even though TODO has no |
|
3897 |
logging configured. |
|
3898 |
|
|
3899 |
You can use the exact same syntax for setting logging preferences |
|
3900 |
local to a buffer: |
|
3901 |
#+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@) |
|
3902 |
|
|
3903 |
In order to define logging settings that are local to a subtree or a |
|
3904 |
single item, define a ‘LOGGING’ property in this entry. Any non-empty |
|
3905 |
‘LOGGING’ property resets all logging settings to ‘nil’. You may then |
|
3906 |
turn on logging for this specific tree using ‘#+STARTUP’ keywords like |
|
3907 |
‘lognotedone’ or ‘logrepeat’, as well as adding state specific settings |
|
3908 |
like ‘TODO(!)’. For example |
|
3909 |
|
|
3910 |
* TODO Log each state with only a time |
|
3911 |
:PROPERTIES: |
|
3912 |
:LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!) |
|
3913 |
:END: |
|
3914 |
* TODO Only log when switching to WAIT, and when repeating |
|
3915 |
:PROPERTIES: |
|
3916 |
:LOGGING: WAIT(@) logrepeat |
|
3917 |
:END: |
|
3918 |
* TODO No logging at all |
|
3919 |
:PROPERTIES: |
|
3920 |
:LOGGING: nil |
|
3921 |
:END: |
|
3922 |
|
|
3923 |
---------- Footnotes ---------- |
|
3924 |
|
|
3925 |
(1) See the option ‘org-log-states-order-reversed’ |
|
3926 |
|
|
3927 |
(2) Note that the ‘LOGBOOK’ drawer is unfolded when pressing ‘<SPC>’ |
|
3928 |
in the agenda to show an entry—use ‘C-u <SPC>’ to keep it folded here |
|
3929 |
|
|
3930 |
(3) It is possible that Org mode will record two timestamps when you |
|
3931 |
are using both ‘org-log-done’ and state change logging. However, it |
|
3932 |
will never prompt for two notes—if you have configured both, the state |
|
3933 |
change recording note will take precedence and cancel the ‘Closing |
|
3934 |
Note’. |
|
3935 |
|
|
3936 |
|
|
3937 |
File: org, Node: Tracking your habits, Prev: Tracking TODO state changes, Up: Progress logging |
|
3938 |
|
|
3939 |
5.3.3 Tracking your habits |
|
3940 |
-------------------------- |
|
3941 |
|
|
3942 |
Org has the ability to track the consistency of a special category of |
|
3943 |
TODOs, called “habits”. A habit has the following properties: |
|
3944 |
|
|
3945 |
1. You have enabled the ‘habits’ module by customizing ‘org-modules’. |
|
3946 |
2. The habit is a TODO item, with a TODO keyword representing an open |
|
3947 |
state. |
|
3948 |
3. The property ‘STYLE’ is set to the value ‘habit’. |
|
3949 |
4. The TODO has a scheduled date, usually with a ‘.+’ style repeat |
|
3950 |
interval. A ‘++’ style may be appropriate for habits with time |
|
3951 |
constraints, e.g., must be done on weekends, or a ‘+’ style for an |
|
3952 |
unusual habit that can have a backlog, e.g., weekly reports. |
|
3953 |
5. The TODO may also have minimum and maximum ranges specified by |
|
3954 |
using the syntax ‘.+2d/3d’, which says that you want to do the task |
|
3955 |
at least every three days, but at most every two days. |
|
3956 |
6. You must also have state logging for the ‘DONE’ state enabled |
|
3957 |
(*note Tracking TODO state changes::), in order for historical data |
|
3958 |
to be represented in the consistency graph. If it is not enabled |
|
3959 |
it is not an error, but the consistency graphs will be largely |
|
3960 |
meaningless. |
|
3961 |
|
|
3962 |
To give you an idea of what the above rules look like in action, |
|
3963 |
here’s an actual habit with some history: |
|
3964 |
|
|
3965 |
** TODO Shave |
|
3966 |
SCHEDULED: <2009-10-17 Sat .+2d/4d> |
|
3967 |
:PROPERTIES: |
|
3968 |
:STYLE: habit |
|
3969 |
:LAST_REPEAT: [2009-10-19 Mon 00:36] |
|
3970 |
:END: |
|
3971 |
- State "DONE" from "TODO" [2009-10-15 Thu] |
|
3972 |
- State "DONE" from "TODO" [2009-10-12 Mon] |
|
3973 |
- State "DONE" from "TODO" [2009-10-10 Sat] |
|
3974 |
- State "DONE" from "TODO" [2009-10-04 Sun] |
|
3975 |
- State "DONE" from "TODO" [2009-10-02 Fri] |
|
3976 |
- State "DONE" from "TODO" [2009-09-29 Tue] |
|
3977 |
- State "DONE" from "TODO" [2009-09-25 Fri] |
|
3978 |
- State "DONE" from "TODO" [2009-09-19 Sat] |
|
3979 |
- State "DONE" from "TODO" [2009-09-16 Wed] |
|
3980 |
- State "DONE" from "TODO" [2009-09-12 Sat] |
|
3981 |
|
|
3982 |
What this habit says is: I want to shave at most every 2 days (given |
|
3983 |
by the ‘SCHEDULED’ date and repeat interval) and at least every 4 days. |
|
3984 |
If today is the 15th, then the habit first appears in the agenda on Oct |
|
3985 |
17, after the minimum of 2 days has elapsed, and will appear overdue on |
|
3986 |
Oct 19, after four days have elapsed. |
|
3987 |
|
|
3988 |
What’s really useful about habits is that they are displayed along |
|
3989 |
with a consistency graph, to show how consistent you’ve been at getting |
|
3990 |
that task done in the past. This graph shows every day that the task |
|
3991 |
was done over the past three weeks, with colors for each day. The |
|
3992 |
colors used are: |
|
3993 |
|
|
3994 |
‘Blue’ |
|
3995 |
If the task wasn’t to be done yet on that day. |
|
3996 |
‘Green’ |
|
3997 |
If the task could have been done on that day. |
|
3998 |
‘Yellow’ |
|
3999 |
If the task was going to be overdue the next day. |
|
4000 |
‘Red’ |
|
4001 |
If the task was overdue on that day. |
|
4002 |
|
|
4003 |
In addition to coloring each day, the day is also marked with an |
|
4004 |
asterisk if the task was actually done that day, and an exclamation mark |
|
4005 |
to show where the current day falls in the graph. |
|
4006 |
|
|
4007 |
There are several configuration variables that can be used to change |
|
4008 |
the way habits are displayed in the agenda. |
|
4009 |
|
|
4010 |
‘org-habit-graph-column’ |
|
4011 |
The buffer column at which the consistency graph should be drawn. |
|
4012 |
This will overwrite any text in that column, so it is a good idea |
|
4013 |
to keep your habits’ titles brief and to the point. |
|
4014 |
‘org-habit-preceding-days’ |
|
4015 |
The amount of history, in days before today, to appear in |
|
4016 |
consistency graphs. |
|
4017 |
‘org-habit-following-days’ |
|
4018 |
The number of days after today that will appear in consistency |
|
4019 |
graphs. |
|
4020 |
‘org-habit-show-habits-only-for-today’ |
|
4021 |
If non-‘nil’, only show habits in today’s agenda view. This is set |
|
4022 |
to true by default. |
|
4023 |
|
|
4024 |
Lastly, pressing ‘K’ in the agenda buffer will cause habits to |
|
4025 |
temporarily be disabled and they won’t appear at all. Press ‘K’ again |
|
4026 |
to bring them back. They are also subject to tag filtering, if you have |
|
4027 |
habits which should only be done in certain contexts, for example. |
|
4028 |
|
|
4029 |
|
|
4030 |
File: org, Node: Priorities, Next: Breaking down tasks, Prev: Progress logging, Up: TODO items |
|
4031 |
|
|
4032 |
5.4 Priorities |
|
4033 |
============== |
|
4034 |
|
|
4035 |
If you use Org mode extensively, you may end up with enough TODO items |
|
4036 |
that it starts to make sense to prioritize them. Prioritizing can be |
|
4037 |
done by placing a _priority cookie_ into the headline of a TODO item, |
|
4038 |
like this |
|
4039 |
|
|
4040 |
*** TODO [#A] Write letter to Sam Fortune |
|
4041 |
|
|
4042 |
By default, Org mode supports three priorities: ‘A’, ‘B’, and ‘C’. ‘A’ |
|
4043 |
is the highest priority. An entry without a cookie is treated just like |
|
4044 |
priority ‘B’. Priorities make a difference only for sorting in the |
|
4045 |
agenda (*note Weekly/daily agenda::); outside the agenda, they have no |
|
4046 |
inherent meaning to Org mode. The cookies can be highlighted with |
|
4047 |
special faces by customizing ‘org-priority-faces’. |
|
4048 |
|
|
4049 |
Priorities can be attached to any outline node; they do not need to |
|
4050 |
be TODO items. |
|
4051 |
|
|
4052 |
‘C-c ,’ |
|
4053 |
Set the priority of the current headline (‘org-priority’). The |
|
4054 |
command prompts for a priority character ‘A’, ‘B’ or ‘C’. When you |
|
4055 |
press <SPC> instead, the priority cookie is removed from the |
|
4056 |
headline. The priorities can also be changed “remotely” from the |
|
4057 |
agenda buffer with the ‘,’ command (*note Agenda commands::). |
|
4058 |
‘S-<UP> (org-priority-up)’ |
|
4059 |
‘S-<DOWN> (org-priority-down)’ |
|
4060 |
Increase/decrease priority of current headline(1). Note that these |
|
4061 |
keys are also used to modify timestamps (*note Creating |
|
4062 |
timestamps::). See also *note Conflicts::, for a discussion of the |
|
4063 |
interaction with ‘shift-selection-mode’. |
|
4064 |
|
|
4065 |
You can change the range of allowed priorities by setting the options |
|
4066 |
‘org-highest-priority’, ‘org-lowest-priority’, and |
|
4067 |
‘org-default-priority’. For an individual buffer, you may set these |
|
4068 |
values (highest, lowest, default) like this (please make sure that the |
|
4069 |
highest priority is earlier in the alphabet than the lowest priority): |
|
4070 |
|
|
4071 |
#+PRIORITIES: A C B |
|
4072 |
|
|
4073 |
---------- Footnotes ---------- |
|
4074 |
|
|
4075 |
(1) See also the option ‘org-priority-start-cycle-with-default’. |
|
4076 |
|
|
4077 |
|
|
4078 |
File: org, Node: Breaking down tasks, Next: Checkboxes, Prev: Priorities, Up: TODO items |
|
4079 |
|
|
4080 |
5.5 Breaking tasks down into subtasks |
|
4081 |
===================================== |
|
4082 |
|
|
4083 |
It is often advisable to break down large tasks into smaller, manageable |
|
4084 |
subtasks. You can do this by creating an outline tree below a TODO |
|
4085 |
item, with detailed subtasks on the tree(1). To keep the overview over |
|
4086 |
the fraction of subtasks that are already completed, insert either ‘[/]’ |
|
4087 |
or ‘[%]’ anywhere in the headline. These cookies will be updated each |
|
4088 |
time the TODO status of a child changes, or when pressing ‘C-c C-c’ on |
|
4089 |
the cookie. For example: |
|
4090 |
|
|
4091 |
* Organize Party [33%] |
|
4092 |
** TODO Call people [1/2] |
|
4093 |
*** TODO Peter |
|
4094 |
*** DONE Sarah |
|
4095 |
** TODO Buy food |
|
4096 |
** DONE Talk to neighbor |
|
4097 |
|
|
4098 |
If a heading has both checkboxes and TODO children below it, the |
|
4099 |
meaning of the statistics cookie become ambiguous. Set the property |
|
4100 |
‘COOKIE_DATA’ to either ‘checkbox’ or ‘todo’ to resolve this issue. |
|
4101 |
|
|
4102 |
If you would like to have the statistics cookie count any TODO |
|
4103 |
entries in the subtree (not just direct children), configure |
|
4104 |
‘org-hierarchical-todo-statistics’. To do this for a single subtree, |
|
4105 |
include the word ‘recursive’ into the value of the ‘COOKIE_DATA’ |
|
4106 |
property. |
|
4107 |
|
|
4108 |
* Parent capturing statistics [2/20] |
|
4109 |
:PROPERTIES: |
|
4110 |
:COOKIE_DATA: todo recursive |
|
4111 |
:END: |
|
4112 |
|
|
4113 |
If you would like a TODO entry to automatically change to DONE when |
|
4114 |
all children are done, you can use the following setup: |
|
4115 |
|
|
4116 |
(defun org-summary-todo (n-done n-not-done) |
|
4117 |
"Switch entry to DONE when all subentries are done, to TODO otherwise." |
|
4118 |
(let (org-log-done org-log-states) ; turn off logging |
|
4119 |
(org-todo (if (= n-not-done 0) "DONE" "TODO")))) |
|
4120 |
|
|
4121 |
(add-hook 'org-after-todo-statistics-hook 'org-summary-todo) |
|
4122 |
|
|
4123 |
Another possibility is the use of checkboxes to identify (a hierarchy |
|
4124 |
of) a large number of subtasks (*note Checkboxes::). |
|
4125 |
|
|
4126 |
---------- Footnotes ---------- |
|
4127 |
|
|
4128 |
(1) To keep subtasks out of the global TODO list, see the |
|
4129 |
‘org-agenda-todo-list-sublevels’. |
|
4130 |
|
|
4131 |
|
|
4132 |
File: org, Node: Checkboxes, Prev: Breaking down tasks, Up: TODO items |
|
4133 |
|
|
4134 |
5.6 Checkboxes |
|
4135 |
============== |
|
4136 |
|
|
4137 |
Every item in a plain list(1) (*note Plain lists::) can be made into a |
|
4138 |
checkbox by starting it with the string ‘[ ]’. This feature is similar |
|
4139 |
to TODO items (*note TODO items::), but is more lightweight. Checkboxes |
|
4140 |
are not included in the global TODO list, so they are often great to |
|
4141 |
split a task into a number of simple steps. Or you can use them in a |
|
4142 |
shopping list. To toggle a checkbox, use ‘C-c C-c’, or use the mouse |
|
4143 |
(thanks to Piotr Zielinski’s ‘org-mouse.el’). |
|
4144 |
|
|
4145 |
Here is an example of a checkbox list. |
|
4146 |
|
|
4147 |
* TODO Organize party [2/4] |
|
4148 |
- [-] call people [1/3] |
|
4149 |
- [ ] Peter |
|
4150 |
- [X] Sarah |
|
4151 |
- [ ] Sam |
|
4152 |
- [X] order food |
|
4153 |
- [ ] think about what music to play |
|
4154 |
- [X] talk to the neighbors |
|
4155 |
|
|
4156 |
Checkboxes work hierarchically, so if a checkbox item has children |
|
4157 |
that are checkboxes, toggling one of the children checkboxes will make |
|
4158 |
the parent checkbox reflect if none, some, or all of the children are |
|
4159 |
checked. |
|
4160 |
|
|
4161 |
The ‘[2/4]’ and ‘[1/3]’ in the first and second line are cookies |
|
4162 |
indicating how many checkboxes present in this entry have been checked |
|
4163 |
off, and the total number of checkboxes present. This can give you an |
|
4164 |
idea on how many checkboxes remain, even without opening a folded entry. |
|
4165 |
The cookies can be placed into a headline or into (the first line of) a |
|
4166 |
plain list item. Each cookie covers checkboxes of direct children |
|
4167 |
structurally below the headline/item on which the cookie appears(2). |
|
4168 |
You have to insert the cookie yourself by typing either ‘[/]’ or ‘[%]’. |
|
4169 |
With ‘[/]’ you get an ‘n out of m’ result, as in the examples above. |
|
4170 |
With ‘[%]’ you get information about the percentage of checkboxes |
|
4171 |
checked (in the above example, this would be ‘[50%]’ and ‘[33%]’, |
|
4172 |
respectively). In a headline, a cookie can count either checkboxes |
|
4173 |
below the heading or TODO states of children, and it will display |
|
4174 |
whatever was changed last. Set the property ‘COOKIE_DATA’ to either |
|
4175 |
‘checkbox’ or ‘todo’ to resolve this issue. |
|
4176 |
|
|
4177 |
If the current outline node has an ‘ORDERED’ property, checkboxes |
|
4178 |
must be checked off in sequence, and an error will be thrown if you try |
|
4179 |
to check off a box while there are unchecked boxes above it. |
|
4180 |
|
|
4181 |
The following commands work with checkboxes: |
|
4182 |
|
|
4183 |
‘C-c C-c (org-toggle-checkbox)’ |
|
4184 |
Toggle checkbox status or (with prefix arg) checkbox presence at |
|
4185 |
point. With a single prefix argument, add an empty checkbox or |
|
4186 |
remove the current one(3). With a double prefix argument, set it |
|
4187 |
to ‘[-]’, which is considered to be an intermediate state. |
|
4188 |
‘C-c C-x C-b (org-toggle-checkbox)’ |
|
4189 |
Toggle checkbox status or (with prefix arg) checkbox presence at |
|
4190 |
point. With double prefix argument, set it to ‘[-]’, which is |
|
4191 |
considered to be an intermediate state. |
|
4192 |
− If there is an active region, toggle the first checkbox in the |
|
4193 |
region and set all remaining boxes to the same status as the |
|
4194 |
first. With a prefix arg, add or remove the checkbox for all |
|
4195 |
items in the region. |
|
4196 |
− If the cursor is in a headline, toggle the state of the first |
|
4197 |
checkbox in the region between this headline and the next—so |
|
4198 |
_not_ the entire subtree—and propagate this new state to all |
|
4199 |
other checkboxes in the same area. |
|
4200 |
− If there is no active region, just toggle the checkbox at |
|
4201 |
point. |
|
4202 |
‘M-S-<RET> (org-insert-todo-heading)’ |
|
4203 |
Insert a new item with a checkbox. This works only if the cursor |
|
4204 |
is already in a plain list item (*note Plain lists::). |
|
4205 |
‘C-c C-x o (org-toggle-ordered-property)’ |
|
4206 |
Toggle the ‘ORDERED’ property of the entry, to toggle if checkboxes |
|
4207 |
must be checked off in sequence. A property is used for this |
|
4208 |
behavior because this should be local to the current entry, not |
|
4209 |
inherited like a tag. However, if you would like to track the |
|
4210 |
value of this property with a tag for better visibility, customize |
|
4211 |
‘org-track-ordered-property-with-tag’. |
|
4212 |
‘C-c # (org-update-statistics-cookies)’ |
|
4213 |
Update the statistics cookie in the current outline entry. When |
|
4214 |
called with a ‘C-u’ prefix, update the entire file. Checkbox |
|
4215 |
statistic cookies are updated automatically if you toggle |
|
4216 |
checkboxes with ‘C-c C-c’ and make new ones with ‘M-S-<RET>’. TODO |
|
4217 |
statistics cookies update when changing TODO states. If you delete |
|
4218 |
boxes/entries or add/change them by hand, use this command to get |
|
4219 |
things back into sync. |
|
4220 |
|
|
4221 |
---------- Footnotes ---------- |
|
4222 |
|
|
4223 |
(1) With the exception of description lists. But you can allow it by |
|
4224 |
modifying ‘org-list-automatic-rules’ accordingly. |
|
4225 |
|
|
4226 |
(2) Set the option ‘org-checkbox-hierarchical-statistics’ if you want |
|
4227 |
such cookies to count all checkboxes below the cookie, not just those |
|
4228 |
belonging to direct children. |
|
4229 |
|
|
4230 |
(3) ‘C-u C-c C-c’ before the _first_ bullet in a list with no |
|
4231 |
checkbox will add checkboxes to the rest of the list. |
|
4232 |
|
|
4233 |
|
|
4234 |
File: org, Node: Tags, Next: Properties and columns, Prev: TODO items, Up: Top |
|
4235 |
|
|
4236 |
6 Tags |
|
4237 |
****** |
|
4238 |
|
|
4239 |
An excellent way to implement labels and contexts for cross-correlating |
|
4240 |
information is to assign tags to headlines. Org mode has extensive |
|
4241 |
support for tags. |
|
4242 |
|
|
4243 |
Every headline can contain a list of tags; they occur at the end of |
|
4244 |
the headline. Tags are normal words containing letters, numbers, ‘_’, |
|
4245 |
and ‘@’. Tags must be preceded and followed by a single colon, e.g., |
|
4246 |
‘:work:’. Several tags can be specified, as in ‘:work:urgent:’. Tags |
|
4247 |
will by default be in bold face with the same color as the headline. |
|
4248 |
You may specify special faces for specific tags using the option |
|
4249 |
‘org-tag-faces’, in much the same way as you can for TODO keywords |
|
4250 |
(*note Faces for TODO keywords::). |
|
4251 |
|
|
4252 |
* Menu: |
|
4253 |
|
|
4254 |
* Tag inheritance:: Tags use the tree structure of the outline |
|
4255 |
* Setting tags:: How to assign tags to a headline |
|
4256 |
* Tag hierarchy:: Create a hierarchy of tags |
|
4257 |
* Tag searches:: Searching for combinations of tags |
|
4258 |
|
|
4259 |
|
|
4260 |
File: org, Node: Tag inheritance, Next: Setting tags, Up: Tags |
|
4261 |
|
|
4262 |
6.1 Tag inheritance |
|
4263 |
=================== |
|
4264 |
|
|
4265 |
Tags make use of the hierarchical structure of outline trees. If a |
|
4266 |
heading has a certain tag, all subheadings will inherit the tag as well. |
|
4267 |
For example, in the list |
|
4268 |
|
|
4269 |
* Meeting with the French group :work: |
|
4270 |
** Summary by Frank :boss:notes: |
|
4271 |
*** TODO Prepare slides for him :action: |
|
4272 |
|
|
4273 |
the final heading will have the tags ‘:work:’, ‘:boss:’, ‘:notes:’, and |
|
4274 |
‘:action:’ even though the final heading is not explicitly marked with |
|
4275 |
all those tags. You can also set tags that all entries in a file should |
|
4276 |
inherit just as if these tags were defined in a hypothetical level zero |
|
4277 |
that surrounds the entire file. Use a line like this(1): |
|
4278 |
|
|
4279 |
#+FILETAGS: :Peter:Boss:Secret: |
|
4280 |
|
|
4281 |
To limit tag inheritance to specific tags, use |
|
4282 |
‘org-tags-exclude-from-inheritance’. To turn it off entirely, use |
|
4283 |
‘org-use-tag-inheritance’. |
|
4284 |
|
|
4285 |
When a headline matches during a tags search while tag inheritance is |
|
4286 |
turned on, all the sublevels in the same tree will (for a simple match |
|
4287 |
form) match as well(2). The list of matches may then become very long. |
|
4288 |
If you only want to see the first tags match in a subtree, configure |
|
4289 |
‘org-tags-match-list-sublevels’ (not recommended). |
|
4290 |
|
|
4291 |
Tag inheritance is relevant when the agenda search tries to match a |
|
4292 |
tag, either in the ‘tags’ or ‘tags-todo’ agenda types. In other agenda |
|
4293 |
types, ‘org-use-tag-inheritance’ has no effect. Still, you may want to |
|
4294 |
have your tags correctly set in the agenda, so that tag filtering works |
|
4295 |
fine, with inherited tags. Set ‘org-agenda-use-tag-inheritance’ to |
|
4296 |
control this: the default value includes all agenda types, but setting |
|
4297 |
this to ‘nil’ can really speed up agenda generation. |
|
4298 |
|
|
4299 |
---------- Footnotes ---------- |
|
4300 |
|
|
4301 |
(1) As with all these in-buffer settings, pressing ‘C-c C-c’ |
|
4302 |
activates any changes in the line. |
|
4303 |
|
|
4304 |
(2) This is only true if the search does not involve more complex |
|
4305 |
tests including properties (*note Property searches::). |
|
4306 |
|
|
4307 |
|
|
4308 |
File: org, Node: Setting tags, Next: Tag hierarchy, Prev: Tag inheritance, Up: Tags |
|
4309 |
|
|
4310 |
6.2 Setting tags |
|
4311 |
================ |
|
4312 |
|
|
4313 |
Tags can simply be typed into the buffer at the end of a headline. |
|
4314 |
After a colon, ‘M-<TAB>’ offers completion on tags. There is also a |
|
4315 |
special command for inserting tags: |
|
4316 |
|
|
4317 |
‘C-c C-q (org-set-tags-command)’ |
|
4318 |
Enter new tags for the current headline. Org mode will either |
|
4319 |
offer completion or a special single-key interface for setting |
|
4320 |
tags, see below. After pressing <RET>, the tags will be inserted |
|
4321 |
and aligned to ‘org-tags-column’. When called with a ‘C-u’ prefix, |
|
4322 |
all tags in the current buffer will be aligned to that column, just |
|
4323 |
to make things look nice. TAGS are automatically realigned after |
|
4324 |
promotion, demotion, and TODO state changes (*note TODO basics::). |
|
4325 |
|
|
4326 |
‘C-c C-c (org-set-tags-command)’ |
|
4327 |
When the cursor is in a headline, this does the same as ‘C-c C-q’. |
|
4328 |
|
|
4329 |
Org supports tag insertion based on a _list of tags_. By default |
|
4330 |
this list is constructed dynamically, containing all tags currently used |
|
4331 |
in the buffer. You may also globally specify a hard list of tags with |
|
4332 |
the variable ‘org-tag-alist’. Finally you can set the default tags for |
|
4333 |
a given file with lines like |
|
4334 |
|
|
4335 |
#+TAGS: @work @home @tennisclub |
|
4336 |
#+TAGS: laptop car pc sailboat |
|
4337 |
|
|
4338 |
If you have globally defined your preferred set of tags using the |
|
4339 |
variable ‘org-tag-alist’, but would like to use a dynamic tag list in a |
|
4340 |
specific file, add an empty TAGS option line to that file: |
|
4341 |
|
|
4342 |
#+TAGS: |
|
4343 |
|
|
4344 |
If you have a preferred set of tags that you would like to use in |
|
4345 |
every file, in addition to those defined on a per-file basis by TAGS |
|
4346 |
option lines, then you may specify a list of tags with the variable |
|
4347 |
‘org-tag-persistent-alist’. You may turn this off on a per-file basis |
|
4348 |
by adding a ‘#+STARTUP’ option line to that file: |
|
4349 |
|
|
4350 |
#+STARTUP: noptag |
|
4351 |
|
|
4352 |
By default Org mode uses the standard minibuffer completion |
|
4353 |
facilities for entering tags. However, it also implements another, |
|
4354 |
quicker, tag selection method called _fast tag selection_. This allows |
|
4355 |
you to select and deselect tags with just a single key press. For this |
|
4356 |
to work well you should assign unique, case-sensitive, letters to most |
|
4357 |
of your commonly used tags. You can do this globally by configuring the |
|
4358 |
variable ‘org-tag-alist’ in your Emacs init file. For example, you may |
|
4359 |
find the need to tag many items in different files with ‘:@home:’. In |
|
4360 |
this case you can set something like: |
|
4361 |
|
|
4362 |
(setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l))) |
|
4363 |
|
|
4364 |
If the tag is only relevant to the file you are working on, then you can |
|
4365 |
instead set the TAGS option line as: |
|
4366 |
|
|
4367 |
#+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p) |
|
4368 |
|
|
4369 |
The tags interface will show the available tags in a splash window. If |
|
4370 |
you want to start a new line after a specific tag, insert ‘\n’ into the |
|
4371 |
tag list |
|
4372 |
|
|
4373 |
#+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p) |
|
4374 |
|
|
4375 |
or write them in two lines: |
|
4376 |
|
|
4377 |
#+TAGS: @work(w) @home(h) @tennisclub(t) |
|
4378 |
#+TAGS: laptop(l) pc(p) |
|
4379 |
|
|
4380 |
You can also group together tags that are mutually exclusive by using |
|
4381 |
braces, as in: |
|
4382 |
|
|
4383 |
#+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p) |
|
4384 |
|
|
4385 |
you indicate that at most one of ‘@work’, ‘@home’, and ‘@tennisclub’ |
|
4386 |
should be selected. Multiple such groups are allowed. |
|
4387 |
|
|
4388 |
Don’t forget to press ‘C-c C-c’ with the cursor in one of these lines to |
|
4389 |
activate any changes. |
|
4390 |
|
|
4391 |
To set these mutually exclusive groups in the variable ‘org-tag-alist’, |
|
4392 |
you must use the dummy tags ‘:startgroup’ and ‘:endgroup’ instead of the |
|
4393 |
braces. Similarly, you can use ‘:newline’ to indicate a line break. |
|
4394 |
The previous example would be set globally by the following |
|
4395 |
configuration: |
|
4396 |
|
|
4397 |
(setq org-tag-alist '((:startgroup . nil) |
|
4398 |
("@work" . ?w) ("@home" . ?h) |
|
4399 |
("@tennisclub" . ?t) |
|
4400 |
(:endgroup . nil) |
|
4401 |
("laptop" . ?l) ("pc" . ?p))) |
|
4402 |
|
|
4403 |
If at least one tag has a selection key then pressing ‘C-c C-c’ will |
|
4404 |
automatically present you with a special interface, listing inherited |
|
4405 |
tags, the tags of the current headline, and a list of all valid tags |
|
4406 |
with corresponding keys(1). |
|
4407 |
|
|
4408 |
Pressing keys assigned to tags will add or remove them from the list |
|
4409 |
of tags in the current line. Selecting a tag in a group of mutually |
|
4410 |
exclusive tags will turn off any other tags from that group. |
|
4411 |
|
|
4412 |
In this interface, you can also use the following special keys: |
|
4413 |
|
|
4414 |
‘<TAB>’ |
|
4415 |
Enter a tag in the minibuffer, even if the tag is not in the |
|
4416 |
predefined list. You will be able to complete on all tags present |
|
4417 |
in the buffer. You can also add several tags: just separate them |
|
4418 |
with a comma. |
|
4419 |
|
|
4420 |
‘<SPC>’ |
|
4421 |
Clear all tags for this line. |
|
4422 |
|
|
4423 |
‘<RET>’ |
|
4424 |
Accept the modified set. |
|
4425 |
|
|
4426 |
‘C-g’ |
|
4427 |
Abort without installing changes. |
|
4428 |
|
|
4429 |
‘q’ |
|
4430 |
If ‘q’ is not assigned to a tag, it aborts like ‘C-g’. |
|
4431 |
|
|
4432 |
‘!’ |
|
4433 |
Turn off groups of mutually exclusive tags. Use this to (as an |
|
4434 |
exception) assign several tags from such a group. |
|
4435 |
|
|
4436 |
‘C-c’ |
|
4437 |
Toggle auto-exit after the next change (see below). If you are |
|
4438 |
using expert mode, the first ‘C-c’ will display the selection |
|
4439 |
window. |
|
4440 |
|
|
4441 |
This method lets you assign tags to a headline with very few keys. With |
|
4442 |
the above setup, you could clear the current tags and set ‘@home’, |
|
4443 |
‘laptop’ and ‘pc’ tags with just the following keys: ‘C-c C-c <SPC> h l |
|
4444 |
p <RET>’. Switching from ‘@home’ to ‘@work’ would be done with ‘C-c C-c |
|
4445 |
w <RET>’ or alternatively with ‘C-c C-c C-c w’. Adding the |
|
4446 |
non-predefined tag ‘Sarah’ could be done with ‘C-c C-c <TAB> S a r a h |
|
4447 |
<RET> <RET>’. |
|
4448 |
|
|
4449 |
If you find that most of the time you need only a single key press to |
|
4450 |
modify your list of tags, set ‘org-fast-tag-selection-single-key’. Then |
|
4451 |
you no longer have to press <RET> to exit fast tag selection—it will |
|
4452 |
immediately exit after the first change. If you then occasionally need |
|
4453 |
more keys, press ‘C-c’ to turn off auto-exit for the current tag |
|
4454 |
selection process (in effect: start selection with ‘C-c C-c C-c’ instead |
|
4455 |
of ‘C-c C-c’). If you set the variable to the value ‘expert’, the |
|
4456 |
special window is not even shown for single-key tag selection, it comes |
|
4457 |
up only when you press an extra ‘C-c’. |
|
4458 |
|
|
4459 |
---------- Footnotes ---------- |
|
4460 |
|
|
4461 |
(1) Keys will automatically be assigned to tags which have no |
|
4462 |
configured keys. |
|
4463 |
|
|
4464 |
|
|
4465 |
File: org, Node: Tag hierarchy, Next: Tag searches, Prev: Setting tags, Up: Tags |
|
4466 |
|
|
4467 |
6.3 Tag hierarchy |
|
4468 |
================= |
|
4469 |
|
|
4470 |
Tags can be defined in hierarchies. A tag can be defined as a _group |
|
4471 |
tag_ for a set of other tags. The group tag can be seen as the “broader |
|
4472 |
term” for its set of tags. Defining multiple _group tags_ and nesting |
|
4473 |
them creates a tag hierarchy. |
|
4474 |
|
|
4475 |
One use-case is to create a taxonomy of terms (tags) that can be used |
|
4476 |
to classify nodes in a document or set of documents. |
|
4477 |
|
|
4478 |
When you search for a group tag, it will return matches for all |
|
4479 |
members in the group and its subgroups. In an agenda view, filtering by |
|
4480 |
a group tag will display or hide headlines tagged with at least one of |
|
4481 |
the members of the group or any of its subgroups. This makes tag |
|
4482 |
searches and filters even more flexible. |
|
4483 |
|
|
4484 |
You can set group tags by using brackets and inserting a colon |
|
4485 |
between the group tag and its related tags—beware that all whitespaces |
|
4486 |
are mandatory so that Org can parse this line correctly: |
|
4487 |
|
|
4488 |
#+TAGS: [ GTD : Control Persp ] |
|
4489 |
|
|
4490 |
In this example, ‘GTD’ is the _group tag_ and it is related to two |
|
4491 |
other tags: ‘Control’, ‘Persp’. Defining ‘Control’ and ‘Persp’ as group |
|
4492 |
tags creates a hierarchy of tags: |
|
4493 |
|
|
4494 |
#+TAGS: [ Control : Context Task ] |
|
4495 |
#+TAGS: [ Persp : Vision Goal AOF Project ] |
|
4496 |
|
|
4497 |
That can conceptually be seen as a hierarchy of tags: |
|
4498 |
|
|
4499 |
- GTD |
|
4500 |
- Persp |
|
4501 |
- Vision |
|
4502 |
- Goal |
|
4503 |
- AOF |
|
4504 |
- Project |
|
4505 |
- Control |
|
4506 |
- Context |
|
4507 |
- Task |
|
4508 |
|
|
4509 |
You can use the ‘:startgrouptag’, ‘:grouptags’ and ‘:endgrouptag’ |
|
4510 |
keyword directly when setting ‘org-tag-alist’ directly: |
|
4511 |
|
|
4512 |
(setq org-tag-alist '((:startgrouptag) |
|
4513 |
("GTD") |
|
4514 |
(:grouptags) |
|
4515 |
("Control") |
|
4516 |
("Persp") |
|
4517 |
(:endgrouptag) |
|
4518 |
(:startgrouptag) |
|
4519 |
("Control") |
|
4520 |
(:grouptags) |
|
4521 |
("Context") |
|
4522 |
("Task") |
|
4523 |
(:endgrouptag))) |
|
4524 |
|
|
4525 |
The tags in a group can be mutually exclusive if using the same group |
|
4526 |
syntax as is used for grouping mutually exclusive tags together; using |
|
4527 |
curly brackets. |
|
4528 |
|
|
4529 |
#+TAGS: { Context : @Home @Work @Call } |
|
4530 |
|
|
4531 |
When setting ‘org-tag-alist’ you can use ‘:startgroup’ & ‘:endgroup’ |
|
4532 |
instead of ‘:startgrouptag’ & ‘:endgrouptag’ to make the tags mutually |
|
4533 |
exclusive. |
|
4534 |
|
|
4535 |
Furthermore, the members of a _group tag_ can also be regular |
|
4536 |
expressions, creating the possibility of a more dynamic and rule-based |
|
4537 |
tag structure. The regular expressions in the group must be specified |
|
4538 |
within { }. Here is an expanded example: |
|
4539 |
|
|
4540 |
#+TAGS: [ Vision : {V@.+} ] |
|
4541 |
#+TAGS: [ Goal : {G@.+} ] |
|
4542 |
#+TAGS: [ AOF : {AOF@.+} ] |
|
4543 |
#+TAGS: [ Project : {P@.+} ] |
|
4544 |
|
|
4545 |
Searching for the tag ‘Project’ will now list all tags also including |
|
4546 |
regular expression matches for ‘P@.+’, and similarly for tag searches on |
|
4547 |
‘Vision’, ‘Goal’ and ‘AOF’. For example, this would work well for a |
|
4548 |
project tagged with a common project-identifier, e.g. ‘P@2014_OrgTags’. |
|
4549 |
|
|
4550 |
If you want to ignore group tags temporarily, toggle group tags |
|
4551 |
support with ‘org-toggle-tags-groups’, bound to ‘C-c C-x q’. If you |
|
4552 |
want to disable tag groups completely, set ‘org-group-tags’ to ‘nil’. |
|
4553 |
|
|
4554 |
|
|
4555 |
File: org, Node: Tag searches, Prev: Tag hierarchy, Up: Tags |
|
4556 |
|
|
4557 |
6.4 Tag searches |
|
4558 |
================ |
|
4559 |
|
|
4560 |
Once a system of tags has been set up, it can be used to collect related |
|
4561 |
information into special lists. |
|
4562 |
|
|
4563 |
‘C-c / m or C-c \ (org-match-sparse-tree)’ |
|
4564 |
Create a sparse tree with all headlines matching a |
|
4565 |
tags/property/TODO search. With a ‘C-u’ prefix argument, ignore |
|
4566 |
headlines that are not a TODO line. *Note Matching tags and |
|
4567 |
properties::. |
|
4568 |
‘C-c a m (org-tags-view)’ |
|
4569 |
Create a global list of tag matches from all agenda files. *Note |
|
4570 |
Matching tags and properties::. |
|
4571 |
‘C-c a M (org-tags-view)’ |
|
4572 |
Create a global list of tag matches from all agenda files, but |
|
4573 |
check only TODO items and force checking subitems (see the option |
|
4574 |
‘org-tags-match-list-sublevels’). |
|
4575 |
|
|
4576 |
These commands all prompt for a match string which allows basic |
|
4577 |
Boolean logic like ‘+boss+urgent-project1’, to find entries with tags |
|
4578 |
‘boss’ and ‘urgent’, but not ‘project1’, or ‘Kathy|Sally’ to find |
|
4579 |
entries tagged as ‘Kathy’ or ‘Sally’. The full syntax of the search |
|
4580 |
string is rich and allows also matching against TODO keywords, entry |
|
4581 |
levels and properties. For a complete description with many examples, |
|
4582 |
see *note Matching tags and properties::. |
|
4583 |
|
|
4584 |
|
|
4585 |
File: org, Node: Properties and columns, Next: Dates and times, Prev: Tags, Up: Top |
|
4586 |
|
|
4587 |
7 Properties and columns |
|
4588 |
************************ |
|
4589 |
|
|
4590 |
A property is a key-value pair associated with an entry. Properties can |
|
4591 |
be set so they are associated with a single entry, with every entry in a |
|
4592 |
tree, or with every entry in an Org mode file. |
|
4593 |
|
|
4594 |
There are two main applications for properties in Org mode. First, |
|
4595 |
properties are like tags, but with a value. Imagine maintaining a file |
|
4596 |
where you document bugs and plan releases for a piece of software. |
|
4597 |
Instead of using tags like ‘:release_1:’, ‘:release_2:’, you can use a |
|
4598 |
property, say ‘:Release:’, that in different subtrees has different |
|
4599 |
values, such as ‘1.0’ or ‘2.0’. Second, you can use properties to |
|
4600 |
implement (very basic) database capabilities in an Org buffer. Imagine |
|
4601 |
keeping track of your music CDs, where properties could be things such |
|
4602 |
as the album, artist, date of release, number of tracks, and so on. |
|
4603 |
|
|
4604 |
Properties can be conveniently edited and viewed in column view |
|
4605 |
(*note Column view::). |
|
4606 |
|
|
4607 |
* Menu: |
|
4608 |
|
|
4609 |
* Property syntax:: How properties are spelled out |
|
4610 |
* Special properties:: Access to other Org mode features |
|
4611 |
* Property searches:: Matching property values |
|
4612 |
* Property inheritance:: Passing values down the tree |
|
4613 |
* Column view:: Tabular viewing and editing |
|
4614 |
* Property API:: Properties for Lisp programmers |
|
4615 |
|
|
4616 |
|
|
4617 |
File: org, Node: Property syntax, Next: Special properties, Up: Properties and columns |
|
4618 |
|
|
4619 |
7.1 Property syntax |
|
4620 |
=================== |
|
4621 |
|
|
4622 |
Properties are key-value pairs. When they are associated with a single |
|
4623 |
entry or with a tree they need to be inserted into a special drawer |
|
4624 |
(*note Drawers::) with the name ‘PROPERTIES’, which has to be located |
|
4625 |
right below a headline, and its planning line (*note Deadlines and |
|
4626 |
scheduling::) when applicable. Each property is specified on a single |
|
4627 |
line, with the key (surrounded by colons) first, and the value after it. |
|
4628 |
Keys are case-insensitive. Here is an example: |
|
4629 |
|
|
4630 |
* CD collection |
|
4631 |
** Classic |
|
4632 |
*** Goldberg Variations |
|
4633 |
:PROPERTIES: |
|
4634 |
:Title: Goldberg Variations |
|
4635 |
:Composer: J.S. Bach |
|
4636 |
:Artist: Glen Gould |
|
4637 |
:Publisher: Deutsche Grammophon |
|
4638 |
:NDisks: 1 |
|
4639 |
:END: |
|
4640 |
|
|
4641 |
Depending on the value of ‘org-use-property-inheritance’, a property |
|
4642 |
set this way will either be associated with a single entry, or the |
|
4643 |
subtree defined by the entry, see *note Property inheritance::. |
|
4644 |
|
|
4645 |
You may define the allowed values for a particular property ‘:Xyz:’ |
|
4646 |
by setting a property ‘:Xyz_ALL:’. This special property is |
|
4647 |
_inherited_, so if you set it in a level 1 entry, it will apply to the |
|
4648 |
entire tree. When allowed values are defined, setting the corresponding |
|
4649 |
property becomes easier and is less prone to typing errors. For the |
|
4650 |
example with the CD collection, we can predefine publishers and the |
|
4651 |
number of disks in a box like this: |
|
4652 |
|
|
4653 |
* CD collection |
|
4654 |
:PROPERTIES: |
|
4655 |
:NDisks_ALL: 1 2 3 4 |
|
4656 |
:Publisher_ALL: "Deutsche Grammophon" Philips EMI |
|
4657 |
:END: |
|
4658 |
|
|
4659 |
If you want to set properties that can be inherited by any entry in a |
|
4660 |
file, use a line like |
|
4661 |
#+PROPERTY: NDisks_ALL 1 2 3 4 |
|
4662 |
|
|
4663 |
Contrary to properties set from a special drawer, you have to refresh |
|
4664 |
the buffer with ‘C-c C-c’ to activate this change. |
|
4665 |
|
|
4666 |
If you want to add to the value of an existing property, append a ‘+’ |
|
4667 |
to the property name. The following results in the property ‘var’ |
|
4668 |
having the value “foo=1 bar=2”. |
|
4669 |
#+PROPERTY: var foo=1 |
|
4670 |
#+PROPERTY: var+ bar=2 |
|
4671 |
|
|
4672 |
It is also possible to add to the values of inherited properties. |
|
4673 |
The following results in the ‘genres’ property having the value “Classic |
|
4674 |
Baroque” under the ‘Goldberg Variations’ subtree. |
|
4675 |
* CD collection |
|
4676 |
** Classic |
|
4677 |
:PROPERTIES: |
|
4678 |
:GENRES: Classic |
|
4679 |
:END: |
|
4680 |
*** Goldberg Variations |
|
4681 |
:PROPERTIES: |
|
4682 |
:Title: Goldberg Variations |
|
4683 |
:Composer: J.S. Bach |
|
4684 |
:Artist: Glen Gould |
|
4685 |
:Publisher: Deutsche Grammophon |
|
4686 |
:NDisks: 1 |
|
4687 |
:GENRES+: Baroque |
|
4688 |
:END: |
|
4689 |
Note that a property can only have one entry per Drawer. |
|
4690 |
|
|
4691 |
Property values set with the global variable ‘org-global-properties’ |
|
4692 |
can be inherited by all entries in all Org files. |
|
4693 |
|
|
4694 |
The following commands help to work with properties: |
|
4695 |
|
|
4696 |
‘M-<TAB> (pcomplete)’ |
|
4697 |
After an initial colon in a line, complete property keys. All keys |
|
4698 |
used in the current file will be offered as possible completions. |
|
4699 |
‘C-c C-x p (org-set-property)’ |
|
4700 |
Set a property. This prompts for a property name and a value. If |
|
4701 |
necessary, the property drawer is created as well. |
|
4702 |
‘C-u M-x org-insert-drawer <RET>’ |
|
4703 |
Insert a property drawer into the current entry. The drawer will |
|
4704 |
be inserted early in the entry, but after the lines with planning |
|
4705 |
information like deadlines. |
|
4706 |
‘C-c C-c (org-property-action)’ |
|
4707 |
With the cursor in a property drawer, this executes property |
|
4708 |
commands. |
|
4709 |
‘C-c C-c s (org-set-property)’ |
|
4710 |
Set a property in the current entry. Both the property and the |
|
4711 |
value can be inserted using completion. |
|
4712 |
‘S-<RIGHT> (org-property-next-allowed-value)’ |
|
4713 |
‘S-<LEFT> (org-property-previous-allowed-value)’ |
|
4714 |
Switch property at point to the next/previous allowed value. |
|
4715 |
‘C-c C-c d (org-delete-property)’ |
|
4716 |
Remove a property from the current entry. |
|
4717 |
‘C-c C-c D (org-delete-property-globally)’ |
|
4718 |
Globally remove a property, from all entries in the current file. |
|
4719 |
‘C-c C-c c (org-compute-property-at-point)’ |
|
4720 |
Compute the property at point, using the operator and scope from |
|
4721 |
the nearest column format definition. |
|
4722 |
|
|
4723 |
|
|
4724 |
File: org, Node: Special properties, Next: Property searches, Prev: Property syntax, Up: Properties and columns |
|
4725 |
|
|
4726 |
7.2 Special properties |
|
4727 |
====================== |
|
4728 |
|
|
4729 |
Special properties provide an alternative access method to Org mode |
|
4730 |
features, like the TODO state or the priority of an entry, discussed in |
|
4731 |
the previous chapters. This interface exists so that you can include |
|
4732 |
these states in a column view (*note Column view::), or to use them in |
|
4733 |
queries. The following property names are special and should not be |
|
4734 |
used as keys in the properties drawer: |
|
4735 |
|
|
4736 |
ALLTAGS All tags, including inherited ones. |
|
4737 |
BLOCKED "t" if task is currently blocked by children or siblings. |
|
4738 |
CLOCKSUM The sum of CLOCK intervals in the subtree. ‘org-clock-sum’ |
|
4739 |
must be run first to compute the values in the current buffer. |
|
4740 |
CLOCKSUM_T The sum of CLOCK intervals in the subtree for today. |
|
4741 |
‘org-clock-sum-today’ must be run first to compute the |
|
4742 |
values in the current buffer. |
|
4743 |
CLOSED When was this entry closed? |
|
4744 |
DEADLINE The deadline time string, without the angular brackets. |
|
4745 |
FILE The filename the entry is located in. |
|
4746 |
ITEM The headline of the entry. |
|
4747 |
PRIORITY The priority of the entry, a string with a single letter. |
|
4748 |
SCHEDULED The scheduling timestamp, without the angular brackets. |
|
4749 |
TAGS The tags defined directly in the headline. |
|
4750 |
TIMESTAMP The first keyword-less timestamp in the entry. |
|
4751 |
TIMESTAMP_IA The first inactive timestamp in the entry. |
|
4752 |
TODO The TODO keyword of the entry. |
|
4753 |
|
|
4754 |
|
|
4755 |
File: org, Node: Property searches, Next: Property inheritance, Prev: Special properties, Up: Properties and columns |
|
4756 |
|
|
4757 |
7.3 Property searches |
|
4758 |
===================== |
|
4759 |
|
|
4760 |
To create sparse trees and special lists with selection based on |
|
4761 |
properties, the same commands are used as for tag searches (*note Tag |
|
4762 |
searches::). |
|
4763 |
|
|
4764 |
‘C-c / m or C-c \ (org-match-sparse-tree)’ |
|
4765 |
Create a sparse tree with all matching entries. With a ‘C-u’ |
|
4766 |
prefix argument, ignore headlines that are not a TODO line. |
|
4767 |
‘C-c a m (org-tags-view)’ |
|
4768 |
Create a global list of tag/property matches from all agenda files. |
|
4769 |
*Note Matching tags and properties::. |
|
4770 |
‘C-c a M (org-tags-view)’ |
|
4771 |
Create a global list of tag matches from all agenda files, but |
|
4772 |
check only TODO items and force checking of subitems (see the |
|
4773 |
option ‘org-tags-match-list-sublevels’). |
|
4774 |
|
|
4775 |
The syntax for the search string is described in *note Matching tags |
|
4776 |
and properties::. |
|
4777 |
|
|
4778 |
There is also a special command for creating sparse trees based on a |
|
4779 |
single property: |
|
4780 |
|
|
4781 |
‘C-c / p’ |
|
4782 |
Create a sparse tree based on the value of a property. This first |
|
4783 |
prompts for the name of a property, and then for a value. A sparse |
|
4784 |
tree is created with all entries that define this property with the |
|
4785 |
given value. If you enclose the value in curly braces, it is |
|
4786 |
interpreted as a regular expression and matched against the |
|
4787 |
property values. |
|
4788 |
|
|
4789 |
|
|
4790 |
File: org, Node: Property inheritance, Next: Column view, Prev: Property searches, Up: Properties and columns |
|
4791 |
|
|
4792 |
7.4 Property Inheritance |
|
4793 |
======================== |
|
4794 |
|
|
4795 |
The outline structure of Org mode documents lends itself to an |
|
4796 |
inheritance model of properties: if the parent in a tree has a certain |
|
4797 |
property, the children can inherit this property. Org mode does not |
|
4798 |
turn this on by default, because it can slow down property searches |
|
4799 |
significantly and is often not needed. However, if you find inheritance |
|
4800 |
useful, you can turn it on by setting the variable |
|
4801 |
‘org-use-property-inheritance’. It may be set to ‘t’ to make all |
|
4802 |
properties inherited from the parent, to a list of properties that |
|
4803 |
should be inherited, or to a regular expression that matches inherited |
|
4804 |
properties. If a property has the value ‘nil’, this is interpreted as |
|
4805 |
an explicit undefine of the property, so that inheritance search will |
|
4806 |
stop at this value and return ‘nil’. |
|
4807 |
|
|
4808 |
Org mode has a few properties for which inheritance is hard-coded, at |
|
4809 |
least for the special applications for which they are used: |
|
4810 |
|
|
4811 |
‘COLUMNS’ |
|
4812 |
The ‘:COLUMNS:’ property defines the format of column view (*note |
|
4813 |
Column view::). It is inherited in the sense that the level where |
|
4814 |
a ‘:COLUMNS:’ property is defined is used as the starting point for |
|
4815 |
a column view table, independently of the location in the subtree |
|
4816 |
from where columns view is turned on. |
|
4817 |
‘CATEGORY’ |
|
4818 |
For agenda view, a category set through a ‘:CATEGORY:’ property |
|
4819 |
applies to the entire subtree. |
|
4820 |
‘ARCHIVE’ |
|
4821 |
For archiving, the ‘:ARCHIVE:’ property may define the archive |
|
4822 |
location for the entire subtree (*note Moving subtrees::). |
|
4823 |
‘LOGGING’ |
|
4824 |
The ‘LOGGING’ property may define logging settings for an entry or |
|
4825 |
a subtree (*note Tracking TODO state changes::). |
|
4826 |
|
|
4827 |
|
|
4828 |
File: org, Node: Column view, Next: Property API, Prev: Property inheritance, Up: Properties and columns |
|
4829 |
|
|
4830 |
7.5 Column view |
|
4831 |
=============== |
|
4832 |
|
|
4833 |
A great way to view and edit properties in an outline tree is _column |
|
4834 |
view_. In column view, each outline node is turned into a table row. |
|
4835 |
Columns in this table provide access to properties of the entries. Org |
|
4836 |
mode implements columns by overlaying a tabular structure over the |
|
4837 |
headline of each item. While the headlines have been turned into a |
|
4838 |
table row, you can still change the visibility of the outline tree. For |
|
4839 |
example, you get a compact table by switching to CONTENTS view (‘S-<TAB> |
|
4840 |
S-<TAB>’, or simply ‘c’ while column view is active), but you can still |
|
4841 |
open, read, and edit the entry below each headline. Or, you can switch |
|
4842 |
to column view after executing a sparse tree command and in this way get |
|
4843 |
a table only for the selected items. Column view also works in agenda |
|
4844 |
buffers (*note Agenda views::) where queries have collected selected |
|
4845 |
items, possibly from a number of files. |
|
4846 |
|
|
4847 |
* Menu: |
|
4848 |
|
|
4849 |
* Defining columns:: The COLUMNS format property |
|
4850 |
* Using column view:: How to create and use column view |
|
4851 |
* Capturing column view:: A dynamic block for column view |
|
4852 |
|
|
4853 |
|
|
4854 |
File: org, Node: Defining columns, Next: Using column view, Up: Column view |
|
4855 |
|
|
4856 |
7.5.1 Defining columns |
|
4857 |
---------------------- |
|
4858 |
|
|
4859 |
Setting up a column view first requires defining the columns. This is |
|
4860 |
done by defining a column format line. |
|
4861 |
|
|
4862 |
* Menu: |
|
4863 |
|
|
4864 |
* Scope of column definitions:: Where defined, where valid? |
|
4865 |
* Column attributes:: Appearance and content of a column |
|
4866 |
|
|
4867 |
|
|
4868 |
File: org, Node: Scope of column definitions, Next: Column attributes, Up: Defining columns |
|
4869 |
|
|
4870 |
7.5.1.1 Scope of column definitions |
|
4871 |
................................... |
|
4872 |
|
|
4873 |
To define a column format for an entire file, use a line like |
|
4874 |
|
|
4875 |
#+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO |
|
4876 |
|
|
4877 |
To specify a format that only applies to a specific tree, add a |
|
4878 |
‘:COLUMNS:’ property to the top node of that tree, for example: |
|
4879 |
|
|
4880 |
** Top node for columns view |
|
4881 |
:PROPERTIES: |
|
4882 |
:COLUMNS: %25ITEM %TAGS %PRIORITY %TODO |
|
4883 |
:END: |
|
4884 |
|
|
4885 |
If a ‘:COLUMNS:’ property is present in an entry, it defines columns |
|
4886 |
for the entry itself, and for the entire subtree below it. Since the |
|
4887 |
column definition is part of the hierarchical structure of the document, |
|
4888 |
you can define columns on level 1 that are general enough for all |
|
4889 |
sublevels, and more specific columns further down, when you edit a |
|
4890 |
deeper part of the tree. |
|
4891 |
|
|
4892 |
|
|
4893 |
File: org, Node: Column attributes, Prev: Scope of column definitions, Up: Defining columns |
|
4894 |
|
|
4895 |
7.5.1.2 Column attributes |
|
4896 |
......................... |
|
4897 |
|
|
4898 |
A column definition sets the attributes of a column. The general |
|
4899 |
definition looks like this: |
|
4900 |
|
|
4901 |
%[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}] |
|
4902 |
|
|
4903 |
Except for the percent sign and the property name, all items are |
|
4904 |
optional. The individual parts have the following meaning: |
|
4905 |
|
|
4906 |
WIDTH An integer specifying the width of the column in characters. |
|
4907 |
If omitted, the width will be determined automatically. |
|
4908 |
PROPERTY The property that should be edited in this column. |
|
4909 |
Special properties representing meta data are allowed here |
|
4910 |
as well (*note Special properties::) |
|
4911 |
TITLE The header text for the column. If omitted, the property |
|
4912 |
name is used. |
|
4913 |
{SUMMARY-TYPE} The summary type. If specified, the column values for |
|
4914 |
parent nodes are computed from the children(1). |
|
4915 |
Supported summary types are: |
|
4916 |
{+} Sum numbers in this column. |
|
4917 |
{+;%.1f} Like ‘+’, but format result with ‘%.1f’. |
|
4918 |
{$} Currency, short for ‘+;%.2f’. |
|
4919 |
{min} Smallest number in column. |
|
4920 |
{max} Largest number. |
|
4921 |
{mean} Arithmetic mean of numbers. |
|
4922 |
{X} Checkbox status, ‘[X]’ if all children are ‘[X]’. |
|
4923 |
{X/} Checkbox status, ‘[n/m]’. |
|
4924 |
{X%} Checkbox status, ‘[n%]’. |
|
4925 |
{:} Sum times, HH:MM, plain numbers are |
|
4926 |
hours(2). |
|
4927 |
{:min} Smallest time value in column. |
|
4928 |
{:max} Largest time value. |
|
4929 |
{:mean} Arithmetic mean of time values. |
|
4930 |
{@min} Minimum age(3) (in |
|
4931 |
days/hours/mins/seconds). |
|
4932 |
{@max} Maximum age (in days/hours/mins/seconds). |
|
4933 |
{@mean} Arithmetic mean of ages (in days/hours/mins/seconds). |
|
4934 |
{est+} Add ‘low-high’ estimates. |
|
4935 |
|
|
4936 |
The ‘est+’ summary type requires further explanation. It is used for |
|
4937 |
combining estimates, expressed as ‘low-high’ ranges or plain numbers. |
|
4938 |
For example, instead of estimating a particular task will take 5 days, |
|
4939 |
you might estimate it as 5–6 days if you’re fairly confident you know |
|
4940 |
how much work is required, or 1–10 days if you don’t really know what |
|
4941 |
needs to be done. Both ranges average at 5.5 days, but the first |
|
4942 |
represents a more predictable delivery. |
|
4943 |
|
|
4944 |
When combining a set of such estimates, simply adding the lows and |
|
4945 |
highs produces an unrealistically wide result. Instead, ‘est+’ adds the |
|
4946 |
statistical mean and variance of the sub-tasks, generating a final |
|
4947 |
estimate from the sum. For example, suppose you had ten tasks, each of |
|
4948 |
which was estimated at 0.5 to 2 days of work. Straight addition |
|
4949 |
produces an estimate of 5 to 20 days, representing what to expect if |
|
4950 |
everything goes either extremely well or extremely poorly. In contrast, |
|
4951 |
‘est+’ estimates the full job more realistically, at 10–15 days. |
|
4952 |
|
|
4953 |
Numbers are right-aligned when a format specifier with an explicit |
|
4954 |
width like ‘%5d’ or ‘%5.1f’ is used. |
|
4955 |
|
|
4956 |
You can also define custom summary types by setting |
|
4957 |
‘org-columns-summary-types’, which see. |
|
4958 |
|
|
4959 |
Here is an example for a complete columns definition, along with |
|
4960 |
allowed values. |
|
4961 |
|
|
4962 |
:COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \(4) |
|
4963 |
%10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T |
|
4964 |
:Owner_ALL: Tammy Mark Karl Lisa Don |
|
4965 |
:Status_ALL: "In progress" "Not started yet" "Finished" "" |
|
4966 |
:Approved_ALL: "[ ]" "[X]" |
|
4967 |
|
|
4968 |
The first column, ‘%25ITEM’, means the first 25 characters of the item |
|
4969 |
itself, i.e., of the headline. You probably always should start the |
|
4970 |
column definition with the ‘ITEM’ specifier. The other specifiers |
|
4971 |
create columns ‘Owner’ with a list of names as allowed values, for |
|
4972 |
‘Status’ with four different possible values, and for a checkbox field |
|
4973 |
‘Approved’. When no width is given after the ‘%’ character, the column |
|
4974 |
will be exactly as wide as it needs to be in order to fully display all |
|
4975 |
values. The ‘Approved’ column does have a modified title (‘Approved?’, |
|
4976 |
with a question mark). Summaries will be created for the |
|
4977 |
‘Time_Estimate’ column by adding time duration expressions like HH:MM, |
|
4978 |
and for the ‘Approved’ column, by providing an ‘[X]’ status if all |
|
4979 |
children have been checked. The ‘CLOCKSUM’ and ‘CLOCKSUM_T’ columns are |
|
4980 |
special, they lists the sums of CLOCK intervals in the subtree, either |
|
4981 |
for all clocks or just for today. |
|
4982 |
|
|
4983 |
---------- Footnotes ---------- |
|
4984 |
|
|
4985 |
(1) If more than one summary type apply to the property, the parent |
|
4986 |
values are computed according to the first of them. |
|
4987 |
|
|
4988 |
(2) A time can also be a duration, using effort modifiers defined in |
|
4989 |
‘org-effort-durations’, e.g., ‘3d 1h’. If any value in the column is as |
|
4990 |
such, the summary will also be an effort duration. |
|
4991 |
|
|
4992 |
(3) An age is defined as a duration since a given time-stamp (*note |
|
4993 |
Timestamps::). It can also be expressed as days, hours, minutes and |
|
4994 |
seconds, identified by ‘d’, ‘h’, ‘m’ and ‘s’ suffixes, all mandatory, |
|
4995 |
e.g., ‘0d 13h 0m 10s’. |
|
4996 |
|
|
4997 |
(4) Please note that the COLUMNS definition must be on a single |
|
4998 |
line—it is wrapped here only because of formatting constraints. |
|
4999 |
|
|
5000 |
|
|
5001 |
File: org, Node: Using column view, Next: Capturing column view, Prev: Defining columns, Up: Column view |
|
5002 |
|
|
5003 |
7.5.2 Using column view |
|
5004 |
----------------------- |
|
5005 |
|
|
5006 |
Turning column view on and off |
|
5007 |
.............................. |
|
5008 |
|
|
5009 |
‘C-c C-x C-c (org-columns)’ |
|
5010 |
Turn on column view. If the cursor is before the first headline in |
|
5011 |
the file, or the function called with the universal prefix |
|
5012 |
argument, column view is turned on for the entire file, using the |
|
5013 |
‘#+COLUMNS’ definition. If the cursor is somewhere inside the |
|
5014 |
outline, this command searches the hierarchy, up from point, for a |
|
5015 |
‘:COLUMNS:’ property that defines a format. When one is found, the |
|
5016 |
column view table is established for the tree starting at the entry |
|
5017 |
that contains the ‘:COLUMNS:’ property. If no such property is |
|
5018 |
found, the format is taken from the ‘#+COLUMNS’ line or from the |
|
5019 |
variable ‘org-columns-default-format’, and column view is |
|
5020 |
established for the current entry and its subtree. |
|
5021 |
‘r (org-columns-redo)’ |
|
5022 |
Recreate the column view, to include recent changes made in the |
|
5023 |
buffer. |
|
5024 |
‘g (org-columns-redo)’ |
|
5025 |
Same as ‘r’. |
|
5026 |
‘q (org-columns-quit)’ |
|
5027 |
Exit column view. |
|
5028 |
|
|
5029 |
Editing values |
|
5030 |
.............. |
|
5031 |
|
|
5032 |
‘<LEFT> <RIGHT> <UP> <DOWN>’ |
|
5033 |
Move through the column view from field to field. |
|
5034 |
‘S-<LEFT>/<RIGHT>’ |
|
5035 |
Switch to the next/previous allowed value of the field. For this, |
|
5036 |
you have to have specified allowed values for a property. |
|
5037 |
‘1..9,0’ |
|
5038 |
Directly select the Nth allowed value, ‘0’ selects the 10th value. |
|
5039 |
‘n (org-columns-next-allowed-value)’ |
|
5040 |
‘p (org-columns-previous-allowed-value)’ |
|
5041 |
Same as ‘S-<LEFT>/<RIGHT>’ |
|
5042 |
‘e (org-columns-edit-value)’ |
|
5043 |
Edit the property at point. For the special properties, this will |
|
5044 |
invoke the same interface that you normally use to change that |
|
5045 |
property. For example, when editing a TAGS property, the tag |
|
5046 |
completion or fast selection interface will pop up. |
|
5047 |
‘C-c C-c (org-columns-set-tags-or-toggle)’ |
|
5048 |
When there is a checkbox at point, toggle it. |
|
5049 |
‘v (org-columns-show-value)’ |
|
5050 |
View the full value of this property. This is useful if the width |
|
5051 |
of the column is smaller than that of the value. |
|
5052 |
‘a (org-columns-edit-allowed)’ |
|
5053 |
Edit the list of allowed values for this property. If the list is |
|
5054 |
found in the hierarchy, the modified value is stored there. If no |
|
5055 |
list is found, the new value is stored in the first entry that is |
|
5056 |
part of the current column view. |
|
5057 |
|
|
5058 |
Modifying the table structure |
|
5059 |
............................. |
|
5060 |
|
|
5061 |
‘< (org-columns-narrow)’ |
|
5062 |
‘> (org-columns-widen)’ |
|
5063 |
Make the column narrower/wider by one character. |
|
5064 |
‘S-M-<RIGHT> (org-columns-new)’ |
|
5065 |
Insert a new column, to the left of the current column. |
|
5066 |
‘S-M-<LEFT> (org-columns-delete)’ |
|
5067 |
Delete the current column. |
|
5068 |
|
|
5069 |
|
|
5070 |
File: org, Node: Capturing column view, Prev: Using column view, Up: Column view |
|
5071 |
|
|
5072 |
7.5.3 Capturing column view |
|
5073 |
--------------------------- |
|
5074 |
|
|
5075 |
Since column view is just an overlay over a buffer, it cannot be |
|
5076 |
exported or printed directly. If you want to capture a column view, use |
|
5077 |
a ‘columnview’ dynamic block (*note Dynamic blocks::). The frame of |
|
5078 |
this block looks like this: |
|
5079 |
|
|
5080 |
* The column view |
|
5081 |
#+BEGIN: columnview :hlines 1 :id "label" |
|
5082 |
|
|
5083 |
#+END: |
|
5084 |
|
|
5085 |
This dynamic block has the following parameters: |
|
5086 |
|
|
5087 |
‘:id’ |
|
5088 |
This is the most important parameter. Column view is a feature |
|
5089 |
that is often localized to a certain (sub)tree, and the capture |
|
5090 |
block might be at a different location in the file. To identify |
|
5091 |
the tree whose view to capture, you can use 4 values: |
|
5092 |
local use the tree in which the capture block is located |
|
5093 |
global make a global view, including all headings in the file |
|
5094 |
"file:PATH-TO-FILE" |
|
5095 |
run column view at the top of this file |
|
5096 |
"ID" call column view in the tree that has an ‘:ID:’ |
|
5097 |
property with the value label. You can use |
|
5098 |
‘M-x org-id-copy <RET>’ to create a globally unique ‘ID’ for |
|
5099 |
the current entry and copy it to the kill-ring. |
|
5100 |
‘:hlines’ |
|
5101 |
When ‘t’, insert an hline after every line. When a number N, |
|
5102 |
insert an hline before each headline with level ‘<= N’. |
|
5103 |
‘:vlines’ |
|
5104 |
When set to ‘t’, force column groups to get vertical lines. |
|
5105 |
‘:maxlevel’ |
|
5106 |
When set to a number, don’t capture entries below this level. |
|
5107 |
‘:skip-empty-rows’ |
|
5108 |
When set to ‘t’, skip rows where the only non-empty specifier of |
|
5109 |
the column view is ‘ITEM’. |
|
5110 |
‘:indent’ |
|
5111 |
When non-‘nil’, indent each ‘ITEM’ field according to its level. |
|
5112 |
|
|
5113 |
The following commands insert or update the dynamic block: |
|
5114 |
|
|
5115 |
‘C-c C-x i (org-insert-columns-dblock)’ |
|
5116 |
Insert a dynamic block capturing a column view. You will be |
|
5117 |
prompted for the scope or ‘ID’ of the view. |
|
5118 |
‘C-c C-c or C-c C-x C-u (org-dblock-update)’ |
|
5119 |
Update dynamic block at point. |
|
5120 |
‘C-u C-c C-x C-u (org-update-all-dblocks)’ |
|
5121 |
Update all dynamic blocks (*note Dynamic blocks::). This is useful |
|
5122 |
if you have several clock table blocks, column-capturing blocks or |
|
5123 |
other dynamic blocks in a buffer. |
|
5124 |
|
|
5125 |
You can add formulas to the column view table and you may add |
|
5126 |
plotting instructions in front of the table—these will survive an update |
|
5127 |
of the block. If there is a ‘#+TBLFM:’ after the table, the table will |
|
5128 |
actually be recalculated automatically after an update. |
|
5129 |
|
|
5130 |
An alternative way to capture and process property values into a |
|
5131 |
table is provided by Eric Schulte’s ‘org-collector.el’ which is a |
|
5132 |
contributed package(1). It provides a general API to collect properties |
|
5133 |
from entries in a certain scope, and arbitrary Lisp expressions to |
|
5134 |
process these values before inserting them into a table or a dynamic |
|
5135 |
block. |
|
5136 |
|
|
5137 |
---------- Footnotes ---------- |
|
5138 |
|
|
5139 |
(1) Contributed packages are not part of Emacs, but are distributed |
|
5140 |
with the main distribution of Org (visit <https://orgmode.org>). |
|
5141 |
|
|
5142 |
|
|
5143 |
File: org, Node: Property API, Prev: Column view, Up: Properties and columns |
|
5144 |
|
|
5145 |
7.6 The Property API |
|
5146 |
==================== |
|
5147 |
|
|
5148 |
There is a full API for accessing and changing properties. This API can |
|
5149 |
be used by Emacs Lisp programs to work with properties and to implement |
|
5150 |
features based on them. For more information see *note Using the |
|
5151 |
property API::. |
|
5152 |
|
|
5153 |
|
|
5154 |
File: org, Node: Dates and times, Next: Capture - Refile - Archive, Prev: Properties and columns, Up: Top |
|
5155 |
|
|
5156 |
8 Dates and times |
|
5157 |
***************** |
|
5158 |
|
|
5159 |
To assist project planning, TODO items can be labeled with a date and/or |
|
5160 |
a time. The specially formatted string carrying the date and time |
|
5161 |
information is called a _timestamp_ in Org mode. This may be a little |
|
5162 |
confusing because timestamp is often used to indicate when something was |
|
5163 |
created or last changed. However, in Org mode this term is used in a |
|
5164 |
much wider sense. |
|
5165 |
|
|
5166 |
* Menu: |
|
5167 |
|
|
5168 |
* Timestamps:: Assigning a time to a tree entry |
|
5169 |
* Creating timestamps:: Commands which insert timestamps |
|
5170 |
* Deadlines and scheduling:: Planning your work |
|
5171 |
* Clocking work time:: Tracking how long you spend on a task |
|
5172 |
* Effort estimates:: Planning work effort in advance |
|
5173 |
* Timers:: Notes with a running timer |
|
5174 |
|
|
5175 |
|
|
5176 |
File: org, Node: Timestamps, Next: Creating timestamps, Up: Dates and times |
|
5177 |
|
|
5178 |
8.1 Timestamps, deadlines, and scheduling |
|
5179 |
========================================= |
|
5180 |
|
|
5181 |
A timestamp is a specification of a date (possibly with a time or a |
|
5182 |
range of times) in a special format, either ‘<2003-09-16 Tue>’(1) or |
|
5183 |
‘<2003-09-16 Tue 09:39>’ or ‘<2003-09-16 Tue 12:00-12:30>’(2). A |
|
5184 |
timestamp can appear anywhere in the headline or body of an Org tree |
|
5185 |
entry. Its presence causes entries to be shown on specific dates in the |
|
5186 |
agenda (*note Weekly/daily agenda::). We distinguish: |
|
5187 |
|
|
5188 |
PLAIN TIMESTAMP; EVENT; APPOINTMENT |
|
5189 |
A simple timestamp just assigns a date/time to an item. This is |
|
5190 |
just like writing down an appointment or event in a paper agenda. |
|
5191 |
In the agenda display, the headline of an entry associated with a |
|
5192 |
plain timestamp will be shown exactly on that date. |
|
5193 |
|
|
5194 |
* Meet Peter at the movies |
|
5195 |
<2006-11-01 Wed 19:15> |
|
5196 |
* Discussion on climate change |
|
5197 |
<2006-11-02 Thu 20:00-22:00> |
|
5198 |
|
|
5199 |
TIMESTAMP WITH REPEATER INTERVAL |
|
5200 |
A timestamp may contain a _repeater interval_, indicating that it |
|
5201 |
applies not only on the given date, but again and again after a |
|
5202 |
certain interval of N days (d), weeks (w), months (m), or years |
|
5203 |
(y). The following will show up in the agenda every Wednesday: |
|
5204 |
|
|
5205 |
* Pick up Sam at school |
|
5206 |
<2007-05-16 Wed 12:30 +1w> |
|
5207 |
|
|
5208 |
DIARY-STYLE SEXP ENTRIES |
|
5209 |
For more complex date specifications, Org mode supports using the |
|
5210 |
special sexp diary entries implemented in the Emacs calendar/diary |
|
5211 |
package(3). For example with optional time |
|
5212 |
|
|
5213 |
* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month |
|
5214 |
<%%(diary-float t 4 2)> |
|
5215 |
|
|
5216 |
TIME/DATE RANGE |
|
5217 |
Two timestamps connected by ‘--’ denote a range. The headline will |
|
5218 |
be shown on the first and last day of the range, and on any dates |
|
5219 |
that are displayed and fall in the range. Here is an example: |
|
5220 |
|
|
5221 |
** Meeting in Amsterdam |
|
5222 |
<2004-08-23 Mon>--<2004-08-26 Thu> |
|
5223 |
|
|
5224 |
INACTIVE TIMESTAMP |
|
5225 |
Just like a plain timestamp, but with square brackets instead of |
|
5226 |
angular ones. These timestamps are inactive in the sense that they |
|
5227 |
do _not_ trigger an entry to show up in the agenda. |
|
5228 |
|
|
5229 |
* Gillian comes late for the fifth time |
|
5230 |
[2006-11-01 Wed] |
|
5231 |
|
|
5232 |
---------- Footnotes ---------- |
|
5233 |
|
|
5234 |
(1) In this simplest form, the day name is optional when you type the |
|
5235 |
date yourself. However, any dates inserted or modified by Org will add |
|
5236 |
that day name, for reading convenience. |
|
5237 |
|
|
5238 |
(2) This is inspired by the standard ISO 8601 date/time format. To |
|
5239 |
use an alternative format, see *note Custom time format::. |
|
5240 |
|
|
5241 |
(3) When working with the standard diary sexp functions, you need to |
|
5242 |
be very careful with the order of the arguments. That order depends |
|
5243 |
evilly on the variable ‘calendar-date-style’ (or, for older Emacs |
|
5244 |
versions, ‘european-calendar-style’). For example, to specify a date |
|
5245 |
December 1, 2005, the call might look like ‘(diary-date 12 1 2005)’ or |
|
5246 |
‘(diary-date 1 12 2005)’ or ‘(diary-date 2005 12 1)’, depending on the |
|
5247 |
settings. This has been the source of much confusion. Org mode users |
|
5248 |
can resort to special versions of these functions like ‘org-date’ or |
|
5249 |
‘org-anniversary’. These work just like the corresponding ‘diary-’ |
|
5250 |
functions, but with stable ISO order of arguments (year, month, day) |
|
5251 |
wherever applicable, independent of the value of ‘calendar-date-style’. |
|
5252 |
|
|
5253 |
|
|
5254 |
File: org, Node: Creating timestamps, Next: Deadlines and scheduling, Prev: Timestamps, Up: Dates and times |
|
5255 |
|
|
5256 |
8.2 Creating timestamps |
|
5257 |
======================= |
|
5258 |
|
|
5259 |
For Org mode to recognize timestamps, they need to be in the specific |
|
5260 |
format. All commands listed below produce timestamps in the correct |
|
5261 |
format. |
|
5262 |
|
|
5263 |
‘C-c . (org-time-stamp)’ |
|
5264 |
Prompt for a date and insert a corresponding timestamp. When the |
|
5265 |
cursor is at an existing timestamp in the buffer, the command is |
|
5266 |
used to modify this timestamp instead of inserting a new one. When |
|
5267 |
this command is used twice in succession, a time range is inserted. |
|
5268 |
‘C-c ! (org-time-stamp-inactive)’ |
|
5269 |
Like ‘C-c .’, but insert an inactive timestamp that will not cause |
|
5270 |
an agenda entry. |
|
5271 |
‘C-u C-c .’ |
|
5272 |
‘C-u C-c !’ |
|
5273 |
Like ‘C-c .’ and ‘C-c !’, but use the alternative format which |
|
5274 |
contains date and time. The default time can be rounded to |
|
5275 |
multiples of 5 minutes, see the option |
|
5276 |
‘org-time-stamp-rounding-minutes’. |
|
5277 |
‘C-c C-c’ |
|
5278 |
Normalize timestamp, insert/fix day name if missing or wrong. |
|
5279 |
‘C-c < (org-date-from-calendar)’ |
|
5280 |
Insert a timestamp corresponding to the cursor date in the |
|
5281 |
Calendar. |
|
5282 |
‘C-c > (org-goto-calendar)’ |
|
5283 |
Access the Emacs calendar for the current date. If there is a |
|
5284 |
timestamp in the current line, go to the corresponding date |
|
5285 |
instead. |
|
5286 |
‘C-c C-o (org-open-at-point)’ |
|
5287 |
Access the agenda for the date given by the timestamp or -range at |
|
5288 |
point (*note Weekly/daily agenda::). |
|
5289 |
‘S-<LEFT> (org-timestamp-down-day)’ |
|
5290 |
‘S-<RIGHT> (org-timestamp-up-day)’ |
|
5291 |
Change date at cursor by one day. These key bindings conflict with |
|
5292 |
shift-selection and related modes (*note Conflicts::). |
|
5293 |
‘S-<UP> (org-timestamp-up)’ |
|
5294 |
‘S-<DOWN> (org-timestamp-down-down)’ |
|
5295 |
Change the item under the cursor in a timestamp. The cursor can be |
|
5296 |
on a year, month, day, hour or minute. When the timestamp contains |
|
5297 |
a time range like ‘15:30-16:30’, modifying the first time will also |
|
5298 |
shift the second, shifting the time block with constant length. To |
|
5299 |
change the length, modify the second time. Note that if the cursor |
|
5300 |
is in a headline and not at a timestamp, these same keys modify the |
|
5301 |
priority of an item. (*note Priorities::). The key bindings also |
|
5302 |
conflict with shift-selection and related modes (*note |
|
5303 |
Conflicts::). |
|
5304 |
‘C-c C-y (org-evaluate-time-range)’ |
|
5305 |
Evaluate a time range by computing the difference between start and |
|
5306 |
end. With a prefix argument, insert result after the time range |
|
5307 |
(in a table: into the following column). |
|
5308 |
|
|
5309 |
* Menu: |
|
5310 |
|
|
5311 |
* The date/time prompt:: How Org mode helps you entering date and time |
|
5312 |
* Custom time format:: Making dates look different |
|
5313 |
|
|
5314 |
|
|
5315 |
File: org, Node: The date/time prompt, Next: Custom time format, Up: Creating timestamps |
|
5316 |
|
|
5317 |
8.2.1 The date/time prompt |
|
5318 |
-------------------------- |
|
5319 |
|
|
5320 |
When Org mode prompts for a date/time, the default is shown in default |
|
5321 |
date/time format, and the prompt therefore seems to ask for a specific |
|
5322 |
format. But it will in fact accept date/time information in a variety |
|
5323 |
of formats. Generally, the information should start at the beginning of |
|
5324 |
the string. Org mode will find whatever information is in there and |
|
5325 |
derive anything you have not specified from the _default date and time_. |
|
5326 |
The default is usually the current date and time, but when modifying an |
|
5327 |
existing timestamp, or when entering the second stamp of a range, it is |
|
5328 |
taken from the stamp in the buffer. When filling in information, Org |
|
5329 |
mode assumes that most of the time you will want to enter a date in the |
|
5330 |
future: if you omit the month/year and the given day/month is before |
|
5331 |
today, it will assume that you mean a future date(1). If the date has |
|
5332 |
been automatically shifted into the future, the time prompt will show |
|
5333 |
this with ‘(=>F).’ |
|
5334 |
|
|
5335 |
For example, let’s assume that today is June 13, 2006. Here is how |
|
5336 |
various inputs will be interpreted, the items filled in by Org mode are |
|
5337 |
in bold. |
|
5338 |
|
|
5339 |
3-2-5 ⇒ 2003-02-05 |
|
5340 |
2/5/3 ⇒ 2003-02-05 |
|
5341 |
14 ⇒ 2006-06-14 |
|
5342 |
12 ⇒ 2006-07-12 |
|
5343 |
2/5 ⇒ 2007-02-05 |
|
5344 |
Fri ⇒ nearest Friday after the default date |
|
5345 |
sep 15 ⇒ 2006-09-15 |
|
5346 |
feb 15 ⇒ 2007-02-15 |
|
5347 |
sep 12 9 ⇒ 2009-09-12 |
|
5348 |
12:45 ⇒ 2006-06-13 12:45 |
|
5349 |
22 sept 0:34 ⇒ 2006-09-22 00:34 |
|
5350 |
w4 ⇒ ISO week four of the current year 2006 |
|
5351 |
2012 w4 fri ⇒ Friday of ISO week 4 in 2012 |
|
5352 |
2012-w04-5 ⇒ Same as above |
|
5353 |
|
|
5354 |
Furthermore you can specify a relative date by giving, as the _first_ |
|
5355 |
thing in the input: a plus/minus sign, a number and a letter ([hdwmy]) |
|
5356 |
to indicate change in hours, days, weeks, months, or years. With a |
|
5357 |
single plus or minus, the date is always relative to today. With a |
|
5358 |
double plus or minus, it is relative to the default date. If instead of |
|
5359 |
a single letter, you use the abbreviation of day name, the date will be |
|
5360 |
the Nth such day, e.g.: |
|
5361 |
|
|
5362 |
+0 ⇒ today |
|
5363 |
. ⇒ today |
|
5364 |
+4d ⇒ four days from today |
|
5365 |
+4 ⇒ same as above |
|
5366 |
+2w ⇒ two weeks from today |
|
5367 |
++5 ⇒ five days from default date |
|
5368 |
+2tue ⇒ second Tuesday from now |
|
5369 |
-wed ⇒ last Wednesday |
|
5370 |
|
|
5371 |
The function understands English month and weekday abbreviations. If |
|
5372 |
you want to use unabbreviated names and/or other languages, configure |
|
5373 |
the variables ‘parse-time-months’ and ‘parse-time-weekdays’. |
|
5374 |
|
|
5375 |
Not all dates can be represented in a given Emacs implementation. By |
|
5376 |
default Org mode forces dates into the compatibility range 1970–2037 |
|
5377 |
which works on all Emacs implementations. If you want to use dates |
|
5378 |
outside of this range, read the docstring of the variable |
|
5379 |
‘org-read-date-force-compatible-dates’. |
|
5380 |
|
|
5381 |
You can specify a time range by giving start and end times or by |
|
5382 |
giving a start time and a duration (in HH:MM format). Use one or two |
|
5383 |
dash(es) as the separator in the former case and use ’+’ as the |
|
5384 |
separator in the latter case, e.g.: |
|
5385 |
|
|
5386 |
11am-1:15pm ⇒ 11:00-13:15 |
|
5387 |
11am--1:15pm ⇒ same as above |
|
5388 |
11am+2:15 ⇒ same as above |
|
5389 |
|
|
5390 |
Parallel to the minibuffer prompt, a calendar is popped up(2). When |
|
5391 |
you exit the date prompt, either by clicking on a date in the calendar, |
|
5392 |
or by pressing <RET>, the date selected in the calendar will be combined |
|
5393 |
with the information entered at the prompt. You can control the |
|
5394 |
calendar fully from the minibuffer: |
|
5395 |
|
|
5396 |
<RET> Choose date at cursor in calendar. |
|
5397 |
mouse-1 Select date by clicking on it. |
|
5398 |
S-<RIGHT>/<LEFT> One day forward/backward. |
|
5399 |
S-<DOWN>/<UP> One week forward/backward. |
|
5400 |
M-S-<RIGHT>/<LEFT> One month forward/backward. |
|
5401 |
> / < Scroll calendar forward/backward by one month. |
|
5402 |
M-v / C-v Scroll calendar forward/backward by 3 months. |
|
5403 |
M-S-<DOWN>/<UP> Scroll calendar forward/backward by one year. |
|
5404 |
|
|
5405 |
The actions of the date/time prompt may seem complex, but I assure |
|
5406 |
you they will grow on you, and you will start getting annoyed by pretty |
|
5407 |
much any other way of entering a date/time out there. To help you |
|
5408 |
understand what is going on, the current interpretation of your input |
|
5409 |
will be displayed live in the minibuffer(3). |
|
5410 |
|
|
5411 |
---------- Footnotes ---------- |
|
5412 |
|
|
5413 |
(1) See the variable ‘org-read-date-prefer-future’. You may set that |
|
5414 |
variable to the symbol ‘time’ to even make a time before now shift the |
|
5415 |
date to tomorrow. |
|
5416 |
|
|
5417 |
(2) If you don’t need/want the calendar, configure the variable |
|
5418 |
‘org-popup-calendar-for-date-prompt’. |
|
5419 |
|
|
5420 |
(3) If you find this distracting, turn the display off with |
|
5421 |
‘org-read-date-display-live’. |
|
5422 |
|
|
5423 |
|
|
5424 |
File: org, Node: Custom time format, Prev: The date/time prompt, Up: Creating timestamps |
|
5425 |
|
|
5426 |
8.2.2 Custom time format |
|
5427 |
------------------------ |
|
5428 |
|
|
5429 |
Org mode uses the standard ISO notation for dates and times as it is |
|
5430 |
defined in ISO 8601. If you cannot get used to this and require another |
|
5431 |
representation of date and time to keep you happy, you can get it by |
|
5432 |
customizing the options ‘org-display-custom-times’ and |
|
5433 |
‘org-time-stamp-custom-formats’. |
|
5434 |
|
|
5435 |
‘C-c C-x C-t (org-toggle-time-stamp-overlays)’ |
|
5436 |
Toggle the display of custom formats for dates and times. |
|
5437 |
|
|
5438 |
Org mode needs the default format for scanning, so the custom date/time |
|
5439 |
format does not _replace_ the default format—instead it is put _over_ |
|
5440 |
the default format using text properties. This has the following |
|
5441 |
consequences: |
|
5442 |
• You cannot place the cursor onto a timestamp anymore, only before |
|
5443 |
or after. |
|
5444 |
• The ‘S-<UP>/<DOWN>’ keys can no longer be used to adjust each |
|
5445 |
component of a timestamp. If the cursor is at the beginning of the |
|
5446 |
stamp, ‘S-<UP>/<DOWN>’ will change the stamp by one day, just like |
|
5447 |
‘S-<LEFT>/<RIGHT>’. At the end of the stamp, the time will be |
|
5448 |
changed by one minute. |
|
5449 |
• If the timestamp contains a range of clock times or a repeater, |
|
5450 |
these will not be overlaid, but remain in the buffer as they were. |
|
5451 |
• When you delete a timestamp character-by-character, it will only |
|
5452 |
disappear from the buffer after _all_ (invisible) characters |
|
5453 |
belonging to the ISO timestamp have been removed. |
|
5454 |
• If the custom timestamp format is longer than the default and you |
|
5455 |
are using dates in tables, table alignment will be messed up. If |
|
5456 |
the custom format is shorter, things do work as expected. |
|
5457 |
|
|
5458 |
|
|
5459 |
File: org, Node: Deadlines and scheduling, Next: Clocking work time, Prev: Creating timestamps, Up: Dates and times |
|
5460 |
|
|
5461 |
8.3 Deadlines and scheduling |
|
5462 |
============================ |
|
5463 |
|
|
5464 |
A timestamp may be preceded by special keywords to facilitate planning. |
|
5465 |
Both the timestamp and the keyword have to be positioned immediately |
|
5466 |
after the task they refer to. |
|
5467 |
|
|
5468 |
DEADLINE |
|
5469 |
|
|
5470 |
Meaning: the task (most likely a TODO item, though not necessarily) |
|
5471 |
is supposed to be finished on that date. |
|
5472 |
|
|
5473 |
On the deadline date, the task will be listed in the agenda. In |
|
5474 |
addition, the agenda for _today_ will carry a warning about the |
|
5475 |
approaching or missed deadline, starting |
|
5476 |
‘org-deadline-warning-days’ before the due date, and continuing |
|
5477 |
until the entry is marked DONE. An example: |
|
5478 |
|
|
5479 |
*** TODO write article about the Earth for the Guide |
|
5480 |
DEADLINE: <2004-02-29 Sun> |
|
5481 |
The editor in charge is [[bbdb:Ford Prefect]] |
|
5482 |
|
|
5483 |
You can specify a different lead time for warnings for a specific |
|
5484 |
deadline using the following syntax. Here is an example with a |
|
5485 |
warning period of 5 days ‘DEADLINE: <2004-02-29 Sun -5d>’. This |
|
5486 |
warning is deactivated if the task gets scheduled and you set |
|
5487 |
‘org-agenda-skip-deadline-prewarning-if-scheduled’ to ‘t’. |
|
5488 |
|
|
5489 |
SCHEDULED |
|
5490 |
|
|
5491 |
Meaning: you are planning to start working on that task on the |
|
5492 |
given date. |
|
5493 |
|
|
5494 |
The headline will be listed under the given date(1). In addition, |
|
5495 |
a reminder that the scheduled date has passed will be present in |
|
5496 |
the compilation for _today_, until the entry is marked DONE, i.e., |
|
5497 |
the task will automatically be forwarded until completed. |
|
5498 |
|
|
5499 |
*** TODO Call Trillian for a date on New Years Eve. |
|
5500 |
SCHEDULED: <2004-12-25 Sat> |
|
5501 |
|
|
5502 |
If you want to _delay_ the display of this task in the agenda, use |
|
5503 |
‘SCHEDULED: <2004-12-25 Sat -2d>’: the task is still scheduled on |
|
5504 |
the 25th but will appear two days later. In case the task contains |
|
5505 |
a repeater, the delay is considered to affect all occurrences; if |
|
5506 |
you want the delay to only affect the first scheduled occurrence of |
|
5507 |
the task, use ‘--2d’ instead. See ‘org-scheduled-delay-days’ and |
|
5508 |
‘org-agenda-skip-scheduled-delay-if-deadline’ for details on how to |
|
5509 |
control this globally or per agenda. |
|
5510 |
|
|
5511 |
Important: Scheduling an item in Org mode should not be understood |
|
5512 |
in the same way that we understand scheduling a meeting. Setting a |
|
5513 |
date for a meeting is just a simple appointment, you should mark |
|
5514 |
this entry with a simple plain timestamp, to get this item shown on |
|
5515 |
the date where it applies. This is a frequent misunderstanding by |
|
5516 |
Org users. In Org mode, scheduling means setting a date when you |
|
5517 |
want to start working on an action item. |
|
5518 |
|
|
5519 |
You may use timestamps with repeaters in scheduling and deadline |
|
5520 |
entries. Org mode will issue early and late warnings based on the |
|
5521 |
assumption that the timestamp represents the nearest instance of the |
|
5522 |
repeater. However, the use of diary sexp entries like ‘<%%(diary-float |
|
5523 |
t 42)>’ in scheduling and deadline timestamps is limited. Org mode does |
|
5524 |
not know enough about the internals of each sexp function to issue early |
|
5525 |
and late warnings. However, it will show the item on each day where the |
|
5526 |
sexp entry matches. |
|
5527 |
|
|
5528 |
* Menu: |
|
5529 |
|
|
5530 |
* Inserting deadline/schedule:: Planning items |
|
5531 |
* Repeated tasks:: Items that show up again and again |
|
5532 |
|
|
5533 |
---------- Footnotes ---------- |
|
5534 |
|
|
5535 |
(1) It will still be listed on that date after it has been marked |
|
5536 |
DONE. If you don’t like this, set the variable |
|
5537 |
‘org-agenda-skip-scheduled-if-done’. |
|
5538 |
|
|
5539 |
|
|
5540 |
File: org, Node: Inserting deadline/schedule, Next: Repeated tasks, Up: Deadlines and scheduling |
|
5541 |
|
|
5542 |
8.3.1 Inserting deadlines or schedules |
|
5543 |
-------------------------------------- |
|
5544 |
|
|
5545 |
The following commands allow you to quickly insert a deadline or to |
|
5546 |
schedule an item: |
|
5547 |
|
|
5548 |
‘C-c C-d (org-deadline)’ |
|
5549 |
Insert ‘DEADLINE’ keyword along with a stamp. Any CLOSED timestamp |
|
5550 |
will be removed. When called with a prefix arg, an existing |
|
5551 |
deadline will be removed from the entry. Depending on the variable |
|
5552 |
‘org-log-redeadline’(1), a note will be taken when changing an |
|
5553 |
existing deadline. |
|
5554 |
|
|
5555 |
‘C-c C-s (org-schedule)’ |
|
5556 |
Insert ‘SCHEDULED’ keyword along with a stamp. Any CLOSED |
|
5557 |
timestamp will be removed. When called with a prefix argument, |
|
5558 |
remove the scheduling date from the entry. Depending on the |
|
5559 |
variable ‘org-log-reschedule’(2), a note will be taken when |
|
5560 |
changing an existing scheduling time. |
|
5561 |
‘C-c / d (org-check-deadlines)’ |
|
5562 |
Create a sparse tree with all deadlines that are either past-due, |
|
5563 |
or which will become due within ‘org-deadline-warning-days’. With |
|
5564 |
‘C-u’ prefix, show all deadlines in the file. With a numeric |
|
5565 |
prefix, check that many days. For example, ‘C-1 C-c / d’ shows all |
|
5566 |
deadlines due tomorrow. |
|
5567 |
‘C-c / b (org-check-before-date)’ |
|
5568 |
Sparse tree for deadlines and scheduled items before a given date. |
|
5569 |
‘C-c / a (org-check-after-date)’ |
|
5570 |
Sparse tree for deadlines and scheduled items after a given date. |
|
5571 |
|
|
5572 |
Note that ‘org-schedule’ and ‘org-deadline’ supports setting the date |
|
5573 |
by indicating a relative time: e.g., +1d will set the date to the next |
|
5574 |
day after today, and –1w will set the date to the previous week before |
|
5575 |
any current timestamp. |
|
5576 |
|
|
5577 |
---------- Footnotes ---------- |
|
5578 |
|
|
5579 |
(1) with corresponding ‘#+STARTUP’ keywords ‘logredeadline’, |
|
5580 |
‘lognoteredeadline’, and ‘nologredeadline’ |
|
5581 |
|
|
5582 |
(2) with corresponding ‘#+STARTUP’ keywords ‘logreschedule’, |
|
5583 |
‘lognotereschedule’, and ‘nologreschedule’ |
|
5584 |
|
|
5585 |
|
|
5586 |
File: org, Node: Repeated tasks, Prev: Inserting deadline/schedule, Up: Deadlines and scheduling |
|
5587 |
|
|
5588 |
8.3.2 Repeated tasks |
|
5589 |
-------------------- |
|
5590 |
|
|
5591 |
Some tasks need to be repeated again and again. Org mode helps to |
|
5592 |
organize such tasks using a so-called repeater in a ‘DEADLINE’, |
|
5593 |
‘SCHEDULED’, or plain timestamp. In the following example |
|
5594 |
** TODO Pay the rent |
|
5595 |
DEADLINE: <2005-10-01 Sat +1m> |
|
5596 |
the ‘+1m’ is a repeater; the intended interpretation is that the task |
|
5597 |
has a deadline on <2005-10-01> and repeats itself every (one) month |
|
5598 |
starting from that time. You can use yearly, monthly, weekly, daily and |
|
5599 |
hourly repeat cookies by using the ‘y/w/m/d/h’ letters. If you need |
|
5600 |
both a repeater and a special warning period in a deadline entry, the |
|
5601 |
repeater should come first and the warning period last: ‘DEADLINE: |
|
5602 |
<2005-10-01 Sat +1m -3d>’. |
|
5603 |
|
|
5604 |
Deadlines and scheduled items produce entries in the agenda when they |
|
5605 |
are over-due, so it is important to be able to mark such an entry as |
|
5606 |
completed once you have done so. When you mark a ‘DEADLINE’ or a |
|
5607 |
‘SCHEDULED’ with the TODO keyword DONE, it will no longer produce |
|
5608 |
entries in the agenda. The problem with this is, however, that then |
|
5609 |
also the _next_ instance of the repeated entry will not be active. Org |
|
5610 |
mode deals with this in the following way: When you try to mark such an |
|
5611 |
entry DONE (using ‘C-c C-t’), it will shift the base date of the |
|
5612 |
repeating timestamp by the repeater interval, and immediately set the |
|
5613 |
entry state back to TODO(1). In the example above, setting the state to |
|
5614 |
DONE would actually switch the date like this: |
|
5615 |
|
|
5616 |
** TODO Pay the rent |
|
5617 |
DEADLINE: <2005-11-01 Tue +1m> |
|
5618 |
|
|
5619 |
To mark a task with a repeater as ‘DONE’, use ‘C-- 1 C-c C-t’ (i.e., |
|
5620 |
‘org-todo’ with a numeric prefix argument of -1.) |
|
5621 |
|
|
5622 |
A timestamp(2) will be added under the deadline, to keep a record |
|
5623 |
that you actually acted on the previous instance of this deadline. |
|
5624 |
|
|
5625 |
As a consequence of shifting the base date, this entry will no longer |
|
5626 |
be visible in the agenda when checking past dates, but all future |
|
5627 |
instances will be visible. |
|
5628 |
|
|
5629 |
With the ‘+1m’ cookie, the date shift will always be exactly one |
|
5630 |
month. So if you have not paid the rent for three months, marking this |
|
5631 |
entry DONE will still keep it as an overdue deadline. Depending on the |
|
5632 |
task, this may not be the best way to handle it. For example, if you |
|
5633 |
forgot to call your father for 3 weeks, it does not make sense to call |
|
5634 |
him 3 times in a single day to make up for it. Finally, there are tasks |
|
5635 |
like changing batteries which should always repeat a certain time after |
|
5636 |
the last time you did it. For these tasks, Org mode has special |
|
5637 |
repeaters ‘++’ and ‘.+’. For example: |
|
5638 |
|
|
5639 |
** TODO Call Father |
|
5640 |
DEADLINE: <2008-02-10 Sun ++1w> |
|
5641 |
Marking this DONE will shift the date by at least one week, |
|
5642 |
but also by as many weeks as it takes to get this date into |
|
5643 |
the future. However, it stays on a Sunday, even if you called |
|
5644 |
and marked it done on Saturday. |
|
5645 |
** TODO Empty kitchen trash |
|
5646 |
DEADLINE: <2008-02-08 Fri 20:00 ++1d> |
|
5647 |
Marking this DONE will shift the date by at least one day, and |
|
5648 |
also by as many days as it takes to get the timestamp into the |
|
5649 |
future. Since there is a time in the timestamp, the next |
|
5650 |
deadline in the future will be on today's date if you |
|
5651 |
complete the task before 20:00. |
|
5652 |
** TODO Check the batteries in the smoke detectors |
|
5653 |
DEADLINE: <2005-11-01 Tue .+1m> |
|
5654 |
Marking this DONE will shift the date to one month after |
|
5655 |
today. |
|
5656 |
|
|
5657 |
You may have both scheduling and deadline information for a specific |
|
5658 |
task. If the repeater is set for the scheduling information only, you |
|
5659 |
probably want the repeater to be ignored after the deadline. If so, set |
|
5660 |
the variable ‘org-agenda-skip-scheduled-if-deadline-is-shown’ to |
|
5661 |
‘repeated-after-deadline’. However, any scheduling information without |
|
5662 |
a repeater is no longer relevant once the task is done, and thus, |
|
5663 |
removed upon repeating the task. If you want both scheduling and |
|
5664 |
deadline information to repeat after the same interval, set the same |
|
5665 |
repeater for both timestamps. |
|
5666 |
|
|
5667 |
An alternative to using a repeater is to create a number of copies of |
|
5668 |
a task subtree, with dates shifted in each copy. The command ‘C-c C-x |
|
5669 |
c’ was created for this purpose, it is described in *note Structure |
|
5670 |
editing::. |
|
5671 |
|
|
5672 |
---------- Footnotes ---------- |
|
5673 |
|
|
5674 |
(1) In fact, the target state is taken from, in this sequence, the |
|
5675 |
‘REPEAT_TO_STATE’ property or the variable ‘org-todo-repeat-to-state’. |
|
5676 |
If neither of these is specified, the target state defaults to the first |
|
5677 |
state of the TODO state sequence. |
|
5678 |
|
|
5679 |
(2) You can change this using the option ‘org-log-repeat’, or the |
|
5680 |
‘#+STARTUP’ options ‘logrepeat’, ‘lognoterepeat’, and ‘nologrepeat’. |
|
5681 |
With ‘lognoterepeat’, you will also be prompted for a note. |
|
5682 |
|
|
5683 |
|
|
5684 |
File: org, Node: Clocking work time, Next: Effort estimates, Prev: Deadlines and scheduling, Up: Dates and times |
|
5685 |
|
|
5686 |
8.4 Clocking work time |
|
5687 |
====================== |
|
5688 |
|
|
5689 |
Org mode allows you to clock the time you spend on specific tasks in a |
|
5690 |
project. When you start working on an item, you can start the clock. |
|
5691 |
When you stop working on that task, or when you mark the task done, the |
|
5692 |
clock is stopped and the corresponding time interval is recorded. It |
|
5693 |
also computes the total time spent on each subtree(1) of a project. And |
|
5694 |
it remembers a history or tasks recently clocked, so that you can jump |
|
5695 |
quickly between a number of tasks absorbing your time. |
|
5696 |
|
|
5697 |
To save the clock history across Emacs sessions, use |
|
5698 |
(setq org-clock-persist 'history) |
|
5699 |
(org-clock-persistence-insinuate) |
|
5700 |
When you clock into a new task after resuming Emacs, the incomplete |
|
5701 |
clock(2) will be found (*note Resolving idle time::) and you will be |
|
5702 |
prompted about what to do with it. |
|
5703 |
|
|
5704 |
* Menu: |
|
5705 |
|
|
5706 |
* Clocking commands:: Starting and stopping a clock |
|
5707 |
* The clock table:: Detailed reports |
|
5708 |
* Resolving idle time:: Resolving time when you’ve been idle |
|
5709 |
|
|
5710 |
---------- Footnotes ---------- |
|
5711 |
|
|
5712 |
(1) Clocking only works if all headings are indented with less than |
|
5713 |
30 stars. This is a hardcoded limitation of ‘lmax’ in ‘org-clock-sum’. |
|
5714 |
|
|
5715 |
(2) To resume the clock under the assumption that you have worked on |
|
5716 |
this task while outside Emacs, use ‘(setq org-clock-persist t)’. |
|
5717 |
|
|
5718 |
|
|
5719 |
File: org, Node: Clocking commands, Next: The clock table, Up: Clocking work time |
|
5720 |
|
|
5721 |
8.4.1 Clocking commands |
|
5722 |
----------------------- |
|
5723 |
|
|
5724 |
‘C-c C-x C-i (org-clock-in)’ |
|
5725 |
!Start the clock on the current item (clock-in). This inserts the |
|
5726 |
‘CLOCK’ keyword together with a timestamp. If this is not the |
|
5727 |
first clocking of this item, the multiple ‘CLOCK’ lines will be |
|
5728 |
wrapped into a ‘:LOGBOOK:’ drawer (see also the variable |
|
5729 |
‘org-clock-into-drawer’). You can also overrule the setting of |
|
5730 |
this variable for a subtree by setting a ‘CLOCK_INTO_DRAWER’ or |
|
5731 |
‘LOG_INTO_DRAWER’ property. When called with a ‘C-u’ prefix |
|
5732 |
argument, select the task from a list of recently clocked tasks. |
|
5733 |
With two ‘C-u C-u’ prefixes, clock into the task at point and mark |
|
5734 |
it as the default task; the default task will then always be |
|
5735 |
available with letter ‘d’ when selecting a clocking task. With |
|
5736 |
three ‘C-u C-u C-u’ prefixes, force continuous clocking by starting |
|
5737 |
the clock when the last clock stopped. |
|
5738 |
While the clock is running, the current clocking time is shown in |
|
5739 |
the mode line, along with the title of the task. The clock time |
|
5740 |
shown will be all time ever clocked for this task and its children. |
|
5741 |
If the task has an effort estimate (*note Effort estimates::), the |
|
5742 |
mode line displays the current clocking time against it(1) If the |
|
5743 |
task is a repeating one (*note Repeated tasks::), only the time |
|
5744 |
since the last reset of the task (2) will be shown. More control |
|
5745 |
over what time is shown can be exercised with the |
|
5746 |
‘CLOCK_MODELINE_TOTAL’ property. It may have the values ‘current’ |
|
5747 |
to show only the current clocking instance, ‘today’ to show all |
|
5748 |
time clocked on this task today (see also the variable |
|
5749 |
‘org-extend-today-until’), ‘all’ to include all time, or ‘auto’ |
|
5750 |
which is the default(3). |
|
5751 |
Clicking with ‘mouse-1’ onto the mode line entry will pop up a menu |
|
5752 |
with clocking options. |
|
5753 |
‘C-c C-x C-o (org-clock-out)’ |
|
5754 |
Stop the clock (clock-out). This inserts another timestamp at the |
|
5755 |
same location where the clock was last started. It also directly |
|
5756 |
computes the resulting time and inserts it after the time range as |
|
5757 |
‘=> HH:MM’. See the variable ‘org-log-note-clock-out’ for the |
|
5758 |
possibility to record an additional note together with the |
|
5759 |
clock-out timestamp(4). |
|
5760 |
‘C-c C-x C-x (org-clock-in-last)’ |
|
5761 |
Reclock the last clocked task. With one ‘C-u’ prefix argument, |
|
5762 |
select the task from the clock history. With two ‘C-u’ prefixes, |
|
5763 |
force continuous clocking by starting the clock when the last clock |
|
5764 |
stopped. |
|
5765 |
‘C-c C-x C-e (org-clock-modify-effort-estimate)’ |
|
5766 |
Update the effort estimate for the current clock task. |
|
5767 |
‘C-c C-c or C-c C-y (org-evaluate-time-range)’ |
|
5768 |
Recompute the time interval after changing one of the timestamps. |
|
5769 |
This is only necessary if you edit the timestamps directly. If you |
|
5770 |
change them with ‘S-<cursor>’ keys, the update is automatic. |
|
5771 |
‘C-S-<up/down> (org-clock-timestamps-up/down)’ |
|
5772 |
On ‘CLOCK’ log lines, increase/decrease both timestamps so that the |
|
5773 |
clock duration keeps the same. |
|
5774 |
‘S-M-<up/down> (org-timestamp-up/down)’ |
|
5775 |
On ‘CLOCK’ log lines, increase/decrease the timestamp at point and |
|
5776 |
the one of the previous (or the next clock) timestamp by the same |
|
5777 |
duration. For example, if you hit ‘S-M-<UP>’ to increase a |
|
5778 |
clocked-out timestamp by five minutes, then the clocked-in |
|
5779 |
timestamp of the next clock will be increased by five minutes. |
|
5780 |
‘C-c C-t (org-todo)’ |
|
5781 |
Changing the TODO state of an item to DONE automatically stops the |
|
5782 |
clock if it is running in this same item. |
|
5783 |
‘C-c C-x C-q (org-clock-cancel)’ |
|
5784 |
Cancel the current clock. This is useful if a clock was started by |
|
5785 |
mistake, or if you ended up working on something else. |
|
5786 |
‘C-c C-x C-j (org-clock-goto)’ |
|
5787 |
Jump to the headline of the currently clocked in task. With a |
|
5788 |
‘C-u’ prefix arg, select the target task from a list of recently |
|
5789 |
clocked tasks. |
|
5790 |
‘C-c C-x C-d (org-clock-display)’ |
|
5791 |
Display time summaries for each subtree in the current buffer. |
|
5792 |
This puts overlays at the end of each headline, showing the total |
|
5793 |
time recorded under that heading, including the time of any |
|
5794 |
subheadings. You can use visibility cycling to study the tree, but |
|
5795 |
the overlays disappear when you change the buffer (see variable |
|
5796 |
‘org-remove-highlights-with-change’) or press ‘C-c C-c’. |
|
5797 |
|
|
5798 |
The ‘l’ key may be used the agenda (*note Weekly/daily agenda::) to |
|
5799 |
show which tasks have been worked on or closed during a day. |
|
5800 |
|
|
5801 |
*Important:* note that both ‘org-clock-out’ and ‘org-clock-in-last’ |
|
5802 |
can have a global key binding and will not modify the window |
|
5803 |
disposition. |
|
5804 |
|
|
5805 |
---------- Footnotes ---------- |
|
5806 |
|
|
5807 |
(1) To add an effort estimate “on the fly”, hook a function doing |
|
5808 |
this to ‘org-clock-in-prepare-hook’. |
|
5809 |
|
|
5810 |
(2) as recorded by the ‘LAST_REPEAT’ property |
|
5811 |
|
|
5812 |
(3) See also the variable ‘org-clock-modeline-total’. |
|
5813 |
|
|
5814 |
(4) The corresponding in-buffer setting is: ‘#+STARTUP: |
|
5815 |
lognoteclock-out’ |
|
5816 |
|
|
5817 |
|
|
5818 |
File: org, Node: The clock table, Next: Resolving idle time, Prev: Clocking commands, Up: Clocking work time |
|
5819 |
|
|
5820 |
8.4.2 The clock table |
|
5821 |
--------------------- |
|
5822 |
|
|
5823 |
Org mode can produce quite complex reports based on the time clocking |
|
5824 |
information. Such a report is called a _clock table_, because it is |
|
5825 |
formatted as one or several Org tables. |
|
5826 |
|
|
5827 |
‘C-c C-x C-r (org-clock-report)’ |
|
5828 |
Insert a dynamic block (*note Dynamic blocks::) containing a clock |
|
5829 |
report as an Org mode table into the current file. When the cursor |
|
5830 |
is at an existing clock table, just update it. When called with a |
|
5831 |
prefix argument, jump to the first clock report in the current |
|
5832 |
document and update it. The clock table always includes also trees |
|
5833 |
with ‘:ARCHIVE:’ tag. |
|
5834 |
‘C-c C-c or C-c C-x C-u (org-dblock-update)’ |
|
5835 |
Update dynamic block at point. |
|
5836 |
‘C-u C-c C-x C-u’ |
|
5837 |
Update all dynamic blocks (*note Dynamic blocks::). This is useful |
|
5838 |
if you have several clock table blocks in a buffer. |
|
5839 |
‘S-<LEFT>’ |
|
5840 |
‘S-<RIGHT> (org-clocktable-try-shift)’ |
|
5841 |
Shift the current ‘:block’ interval and update the table. The |
|
5842 |
cursor needs to be in the ‘#+BEGIN: clocktable’ line for this |
|
5843 |
command. If ‘:block’ is ‘today’, it will be shifted to ‘today-1’ |
|
5844 |
etc. |
|
5845 |
|
|
5846 |
Here is an example of the frame for a clock table as it is inserted |
|
5847 |
into the buffer with the ‘C-c C-x C-r’ command: |
|
5848 |
|
|
5849 |
#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file |
|
5850 |
#+END: clocktable |
|
5851 |
The ‘BEGIN’ line specifies a number of options to define the scope, |
|
5852 |
structure, and formatting of the report. Defaults for all these options |
|
5853 |
can be configured in the variable ‘org-clocktable-defaults’. |
|
5854 |
|
|
5855 |
First there are options that determine which clock entries are to be |
|
5856 |
selected: |
|
5857 |
:maxlevel Maximum level depth to which times are listed in the table. |
|
5858 |
Clocks at deeper levels will be summed into the upper level. |
|
5859 |
:scope The scope to consider. This can be any of the following: |
|
5860 |
nil the current buffer or narrowed region |
|
5861 |
file the full current buffer |
|
5862 |
subtree the subtree where the clocktable is located |
|
5863 |
treeN the surrounding level N tree, for example ‘tree3’ |
|
5864 |
tree the surrounding level 1 tree |
|
5865 |
agenda all agenda files |
|
5866 |
("file"..) scan these files |
|
5867 |
function the list of files returned by a function of no argument |
|
5868 |
file-with-archives current file and its archives |
|
5869 |
agenda-with-archives all agenda files, including archives |
|
5870 |
:block The time block to consider. This block is specified either |
|
5871 |
absolutely, or relative to the current time and may be any of |
|
5872 |
these formats: |
|
5873 |
2007-12-31 New year eve 2007 |
|
5874 |
2007-12 December 2007 |
|
5875 |
2007-W50 ISO-week 50 in 2007 |
|
5876 |
2007-Q2 2nd quarter in 2007 |
|
5877 |
2007 the year 2007 |
|
5878 |
today, yesterday, today-N a relative day |
|
5879 |
thisweek, lastweek, thisweek-N a relative week |
|
5880 |
thismonth, lastmonth, thismonth-N a relative month |
|
5881 |
thisyear, lastyear, thisyear-N a relative year |
|
5882 |
untilnow |
|
5883 |
Use ‘S-<LEFT>/<RIGHT>’ keys to shift the time interval. |
|
5884 |
:tstart A time string specifying when to start considering times. |
|
5885 |
Relative times like ‘"<-2w>"’ can also be used. See |
|
5886 |
*note Matching tags and properties:: for relative time syntax. |
|
5887 |
:tend A time string specifying when to stop considering times. |
|
5888 |
Relative times like ‘"<now>"’ can also be used. See |
|
5889 |
*note Matching tags and properties:: for relative time syntax. |
|
5890 |
:wstart The starting day of the week. The default is 1 for monday. |
|
5891 |
:mstart The starting day of the month. The default 1 is for the first |
|
5892 |
day of the month. |
|
5893 |
:step ‘week’ or ‘day’, to split the table into chunks. |
|
5894 |
To use this, ‘:block’ or ‘:tstart’, ‘:tend’ are needed. |
|
5895 |
:stepskip0 Do not show steps that have zero time. |
|
5896 |
:fileskip0 Do not show table sections from files which did not contribute. |
|
5897 |
:tags A tags match to select entries that should contribute. See |
|
5898 |
*note Matching tags and properties:: for the match syntax. |
|
5899 |
|
|
5900 |
Then there are options which determine the formatting of the table. |
|
5901 |
These options are interpreted by the function |
|
5902 |
‘org-clocktable-write-default’, but you can specify your own function |
|
5903 |
using the ‘:formatter’ parameter. |
|
5904 |
:emphasize When ‘t’, emphasize level one and level two items. |
|
5905 |
:lang Language(1) to use for descriptive cells like "Task". |
|
5906 |
:link Link the item headlines in the table to their origins. |
|
5907 |
:narrow An integer to limit the width of the headline column in |
|
5908 |
the org table. If you write it like ‘50!’, then the |
|
5909 |
headline will also be shortened in export. |
|
5910 |
:indent Indent each headline field according to its level. |
|
5911 |
:tcolumns Number of columns to be used for times. If this is smaller |
|
5912 |
than ‘:maxlevel’, lower levels will be lumped into one column. |
|
5913 |
:level Should a level number column be included? |
|
5914 |
:sort A cons cell like containing the column to sort and a sorting type. |
|
5915 |
E.g., ‘:sort (1 . ?a)’ sorts the first column alphabetically. |
|
5916 |
:compact Abbreviation for ‘:level nil :indent t :narrow 40! :tcolumns 1’ |
|
5917 |
All are overwritten except if there is an explicit ‘:narrow’ |
|
5918 |
:timestamp A timestamp for the entry, when available. Look for ‘SCHEDULED’, |
|
5919 |
‘DEADLINE’, ‘TIMESTAMP’ and ‘TIMESTAMP_IA’, in this order. |
|
5920 |
:properties List of properties that should be shown in the table. Each |
|
5921 |
property will get its own column. |
|
5922 |
:inherit-props When this flag is ‘t’, the values for ‘:properties’ will be inherited. |
|
5923 |
:formula Content of a ‘#+TBLFM’ line to be added and evaluated. |
|
5924 |
As a special case, ‘:formula %’ adds a column with % time. |
|
5925 |
If you do not specify a formula here, any existing formula |
|
5926 |
below the clock table will survive updates and be evaluated. |
|
5927 |
:formatter A function to format clock data and insert it into the buffer. |
|
5928 |
To get a clock summary of the current level 1 tree, for the current |
|
5929 |
day, you could write |
|
5930 |
#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t |
|
5931 |
#+END: clocktable |
|
5932 |
and to use a specific time range you could write(2) |
|
5933 |
#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" |
|
5934 |
:tend "<2006-08-10 Thu 12:00>" |
|
5935 |
#+END: clocktable |
|
5936 |
A range starting a week ago and ending right now could be written as |
|
5937 |
#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>" |
|
5938 |
#+END: clocktable |
|
5939 |
A summary of the current subtree with % times would be |
|
5940 |
#+BEGIN: clocktable :scope subtree :link t :formula % |
|
5941 |
#+END: clocktable |
|
5942 |
A horizontally compact representation of everything clocked during |
|
5943 |
last week would be |
|
5944 |
#+BEGIN: clocktable :scope agenda :block lastweek :compact t |
|
5945 |
#+END: clocktable |
|
5946 |
|
|
5947 |
---------- Footnotes ---------- |
|
5948 |
|
|
5949 |
(1) Language terms can be set through the variable |
|
5950 |
‘org-clock-clocktable-language-setup’. |
|
5951 |
|
|
5952 |
(2) Note that all parameters must be specified in a single line—the |
|
5953 |
line is broken here only to fit it into the manual. |
|
5954 |
|
|
5955 |
|
|
5956 |
File: org, Node: Resolving idle time, Prev: The clock table, Up: Clocking work time |
|
5957 |
|
|
5958 |
8.4.3 Resolving idle time and continuous clocking |
|
5959 |
------------------------------------------------- |
|
5960 |
|
|
5961 |
Resolving idle time |
|
5962 |
................... |
|
5963 |
|
|
5964 |
If you clock in on a work item, and then walk away from your |
|
5965 |
computer—perhaps to take a phone call—you often need to “resolve” the |
|
5966 |
time you were away by either subtracting it from the current clock, or |
|
5967 |
applying it to another one. |
|
5968 |
|
|
5969 |
By customizing the variable ‘org-clock-idle-time’ to some integer, |
|
5970 |
such as 10 or 15, Emacs can alert you when you get back to your computer |
|
5971 |
after being idle for that many minutes(1), and ask what you want to do |
|
5972 |
with the idle time. There will be a question waiting for you when you |
|
5973 |
get back, indicating how much idle time has passed (constantly updated |
|
5974 |
with the current amount), as well as a set of choices to correct the |
|
5975 |
discrepancy: |
|
5976 |
|
|
5977 |
‘k’ |
|
5978 |
To keep some or all of the minutes and stay clocked in, press ‘k’. |
|
5979 |
Org will ask how many of the minutes to keep. Press <RET> to keep |
|
5980 |
them all, effectively changing nothing, or enter a number to keep |
|
5981 |
that many minutes. |
|
5982 |
‘K’ |
|
5983 |
If you use the shift key and press ‘K’, it will keep however many |
|
5984 |
minutes you request and then immediately clock out of that task. |
|
5985 |
If you keep all of the minutes, this is the same as just clocking |
|
5986 |
out of the current task. |
|
5987 |
‘s’ |
|
5988 |
To keep none of the minutes, use ‘s’ to subtract all the away time |
|
5989 |
from the clock, and then check back in from the moment you |
|
5990 |
returned. |
|
5991 |
‘S’ |
|
5992 |
To keep none of the minutes and just clock out at the start of the |
|
5993 |
away time, use the shift key and press ‘S’. Remember that using |
|
5994 |
shift will always leave you clocked out, no matter which option you |
|
5995 |
choose. |
|
5996 |
‘C’ |
|
5997 |
To cancel the clock altogether, use ‘C’. Note that if instead of |
|
5998 |
canceling you subtract the away time, and the resulting clock |
|
5999 |
amount is less than a minute, the clock will still be canceled |
|
6000 |
rather than clutter up the log with an empty entry. |
|
6001 |
|
|
6002 |
What if you subtracted those away minutes from the current clock, and |
|
6003 |
now want to apply them to a new clock? Simply clock in to any task |
|
6004 |
immediately after the subtraction. Org will notice that you have |
|
6005 |
subtracted time “on the books”, so to speak, and will ask if you want to |
|
6006 |
apply those minutes to the next task you clock in on. |
|
6007 |
|
|
6008 |
There is one other instance when this clock resolution magic occurs. |
|
6009 |
Say you were clocked in and hacking away, and suddenly your cat chased a |
|
6010 |
mouse who scared a hamster that crashed into your UPS’s power button! |
|
6011 |
You suddenly lose all your buffers, but thanks to auto-save you still |
|
6012 |
have your recent Org mode changes, including your last clock in. |
|
6013 |
|
|
6014 |
If you restart Emacs and clock into any task, Org will notice that |
|
6015 |
you have a dangling clock which was never clocked out from your last |
|
6016 |
session. Using that clock’s starting time as the beginning of the |
|
6017 |
unaccounted-for period, Org will ask how you want to resolve that time. |
|
6018 |
The logic and behavior is identical to dealing with away time due to |
|
6019 |
idleness; it is just happening due to a recovery event rather than a set |
|
6020 |
amount of idle time. |
|
6021 |
|
|
6022 |
You can also check all the files visited by your Org agenda for |
|
6023 |
dangling clocks at any time using ‘M-x org-resolve-clocks <RET>’ (or |
|
6024 |
‘C-c C-x C-z’). |
|
6025 |
|
|
6026 |
Continuous clocking |
|
6027 |
................... |
|
6028 |
|
|
6029 |
You may want to start clocking from the time when you clocked out the |
|
6030 |
previous task. To enable this systematically, set |
|
6031 |
‘org-clock-continuously’ to ‘t’. Each time you clock in, Org retrieves |
|
6032 |
the clock-out time of the last clocked entry for this session, and start |
|
6033 |
the new clock from there. |
|
6034 |
|
|
6035 |
If you only want this from time to time, use three universal prefix |
|
6036 |
arguments with ‘org-clock-in’ and two ‘C-u C-u’ with |
|
6037 |
‘org-clock-in-last’. |
|
6038 |
|
|
6039 |
---------- Footnotes ---------- |
|
6040 |
|
|
6041 |
(1) On computers using macOS, idleness is based on actual user |
|
6042 |
idleness, not just Emacs’ idle time. For X11, you can install a utility |
|
6043 |
program ‘x11idle.c’, available in the ‘contrib/scripts’ directory of the |
|
6044 |
Org git distribution, or install the ‘xprintidle’ package and set it to |
|
6045 |
the variable ‘org-clock-x11idle-program-name’ if you are running Debian, |
|
6046 |
to get the same general treatment of idleness. On other systems, idle |
|
6047 |
time refers to Emacs idle time only. |
|
6048 |
|
|
6049 |
|
|
6050 |
File: org, Node: Effort estimates, Next: Timers, Prev: Clocking work time, Up: Dates and times |
|
6051 |
|
|
6052 |
8.5 Effort estimates |
|
6053 |
==================== |
|
6054 |
|
|
6055 |
If you want to plan your work in a very detailed way, or if you need to |
|
6056 |
produce offers with quotations of the estimated work effort, you may |
|
6057 |
want to assign effort estimates to entries. If you are also clocking |
|
6058 |
your work, you may later want to compare the planned effort with the |
|
6059 |
actual working time, a great way to improve planning estimates. Effort |
|
6060 |
estimates are stored in a special property ‘EFFORT’. You can set the |
|
6061 |
effort for an entry with the following commands: |
|
6062 |
|
|
6063 |
‘C-c C-x e (org-set-effort)’ |
|
6064 |
Set the effort estimate for the current entry. With a numeric |
|
6065 |
prefix argument, set it to the Nth allowed value (see below). This |
|
6066 |
command is also accessible from the agenda with the ‘e’ key. |
|
6067 |
‘C-c C-x C-e (org-clock-modify-effort-estimate)’ |
|
6068 |
Modify the effort estimate of the item currently being clocked. |
|
6069 |
|
|
6070 |
Clearly the best way to work with effort estimates is through column |
|
6071 |
view (*note Column view::). You should start by setting up discrete |
|
6072 |
values for effort estimates, and a ‘COLUMNS’ format that displays these |
|
6073 |
values together with clock sums (if you want to clock your time). For a |
|
6074 |
specific buffer you can use |
|
6075 |
|
|
6076 |
#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 |
|
6077 |
#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM |
|
6078 |
|
|
6079 |
or, even better, you can set up these values globally by customizing the |
|
6080 |
variables ‘org-global-properties’ and ‘org-columns-default-format’. In |
|
6081 |
particular if you want to use this setup also in the agenda, a global |
|
6082 |
setup may be advised. |
|
6083 |
|
|
6084 |
The way to assign estimates to individual items is then to switch to |
|
6085 |
column mode, and to use ‘S-<RIGHT>’ and ‘S-<LEFT>’ to change the value. |
|
6086 |
The values you enter will immediately be summed up in the hierarchy. In |
|
6087 |
the column next to it, any clocked time will be displayed. |
|
6088 |
|
|
6089 |
If you switch to column view in the daily/weekly agenda, the effort |
|
6090 |
column will summarize the estimated work effort for each day(1), and you |
|
6091 |
can use this to find space in your schedule. To get an overview of the |
|
6092 |
entire part of the day that is committed, you can set the option |
|
6093 |
‘org-agenda-columns-add-appointments-to-effort-sum’. The appointments |
|
6094 |
on a day that take place over a specified time interval will then also |
|
6095 |
be added to the load estimate of the day. |
|
6096 |
|
|
6097 |
Effort estimates can be used in secondary agenda filtering that is |
|
6098 |
triggered with the ‘/’ key in the agenda (*note Agenda commands::). If |
|
6099 |
you have these estimates defined consistently, two or three key presses |
|
6100 |
will narrow down the list to stuff that fits into an available time |
|
6101 |
slot. |
|
6102 |
|
|
6103 |
---------- Footnotes ---------- |
|
6104 |
|
|
6105 |
(1) Please note the pitfalls of summing hierarchical data in a flat |
|
6106 |
list (*note Agenda column view::). |
|
6107 |
|
|
6108 |
|
|
6109 |
File: org, Node: Timers, Prev: Effort estimates, Up: Dates and times |
|
6110 |
|
|
6111 |
8.6 Taking notes with a timer |
|
6112 |
============================= |
|
6113 |
|
|
6114 |
Org provides two types of timers. There is a relative timer that counts |
|
6115 |
up, which can be useful when taking notes during, for example, a meeting |
|
6116 |
or a video viewing. There is also a countdown timer. |
|
6117 |
|
|
6118 |
The relative and countdown are started with separate commands. |
|
6119 |
|
|
6120 |
‘C-c C-x 0 (org-timer-start)’ |
|
6121 |
Start or reset the relative timer. By default, the timer is set to |
|
6122 |
0. When called with a ‘C-u’ prefix, prompt the user for a starting |
|
6123 |
offset. If there is a timer string at point, this is taken as the |
|
6124 |
default, providing a convenient way to restart taking notes after a |
|
6125 |
break in the process. When called with a double prefix argument |
|
6126 |
‘C-u C-u’, change all timer strings in the active region by a |
|
6127 |
certain amount. This can be used to fix timer strings if the timer |
|
6128 |
was not started at exactly the right moment. |
|
6129 |
‘C-c C-x ; (org-timer-set-timer)’ |
|
6130 |
Start a countdown timer. The user is prompted for a duration. |
|
6131 |
‘org-timer-default-timer’ sets the default countdown value. Giving |
|
6132 |
a numeric prefix argument overrides this default value. This |
|
6133 |
command is available as ‘;’ in agenda buffers. |
|
6134 |
|
|
6135 |
Once started, relative and countdown timers are controlled with the |
|
6136 |
same commands. |
|
6137 |
|
|
6138 |
‘C-c C-x . (org-timer)’ |
|
6139 |
Insert the value of the current relative or countdown timer into |
|
6140 |
the buffer. If no timer is running, the relative timer will be |
|
6141 |
started. When called with a prefix argument, the relative timer is |
|
6142 |
restarted. |
|
6143 |
‘C-c C-x - (org-timer-item)’ |
|
6144 |
Insert a description list item with the value of the current |
|
6145 |
relative or countdown timer. With a prefix argument, first reset |
|
6146 |
the relative timer to 0. |
|
6147 |
‘M-<RET> (org-insert-heading)’ |
|
6148 |
Once the timer list is started, you can also use ‘M-<RET>’ to |
|
6149 |
insert new timer items. |
|
6150 |
‘C-c C-x , (org-timer-pause-or-continue)’ |
|
6151 |
Pause the timer, or continue it if it is already paused. |
|
6152 |
‘C-c C-x _ (org-timer-stop)’ |
|
6153 |
Stop the timer. After this, you can only start a new timer, not |
|
6154 |
continue the old one. This command also removes the timer from the |
|
6155 |
mode line. |
|
6156 |
|
|
6157 |
|
|
6158 |
File: org, Node: Capture - Refile - Archive, Next: Agenda views, Prev: Dates and times, Up: Top |
|
6159 |
|
|
6160 |
9 Capture - Refile - Archive |
|
6161 |
**************************** |
|
6162 |
|
|
6163 |
An important part of any organization system is the ability to quickly |
|
6164 |
capture new ideas and tasks, and to associate reference material with |
|
6165 |
them. Org does this using a process called capture. It also can store |
|
6166 |
files related to a task (attachments) in a special directory. Once in |
|
6167 |
the system, tasks and projects need to be moved around. Moving |
|
6168 |
completed project trees to an archive file keeps the system compact and |
|
6169 |
fast. |
|
6170 |
|
|
6171 |
* Menu: |
|
6172 |
|
|
6173 |
* Capture:: Capturing new stuff |
|
6174 |
* Attachments:: Add files to tasks |
|
6175 |
* RSS feeds:: Getting input from RSS feeds |
|
6176 |
* Protocols:: External (e.g., Browser) access to Emacs and Org |
|
6177 |
* Refile and copy:: Moving/copying a tree from one place to another |
|
6178 |
* Archiving:: What to do with finished projects |
|
6179 |
|
|
6180 |
|
|
6181 |
File: org, Node: Capture, Next: Attachments, Up: Capture - Refile - Archive |
|
6182 |
|
|
6183 |
9.1 Capture |
|
6184 |
=========== |
|
6185 |
|
|
6186 |
Capture lets you quickly store notes with little interruption of your |
|
6187 |
work flow. Org’s method for capturing new items is heavily inspired by |
|
6188 |
John Wiegley excellent ‘remember.el’ package. Up to version 6.36, Org |
|
6189 |
used a special setup for ‘remember.el’, then replaced it with |
|
6190 |
‘org-remember.el’. As of version 8.0, ‘org-remember.el’ has been |
|
6191 |
completely replaced by ‘org-capture.el’. |
|
6192 |
|
|
6193 |
If your configuration depends on ‘org-remember.el’, you need to |
|
6194 |
update it and use the setup described below. To convert your |
|
6195 |
‘org-remember-templates’, run the command |
|
6196 |
M-x org-capture-import-remember-templates <RET> |
|
6197 |
and then customize the new variable with ‘M-x customize-variable |
|
6198 |
org-capture-templates’, check the result, and save the customization. |
|
6199 |
|
|
6200 |
* Menu: |
|
6201 |
|
|
6202 |
* Setting up capture:: Where notes will be stored |
|
6203 |
* Using capture:: Commands to invoke and terminate capture |
|
6204 |
* Capture templates:: Define the outline of different note types |
|
6205 |
|
|
6206 |
|
|
6207 |
File: org, Node: Setting up capture, Next: Using capture, Up: Capture |
|
6208 |
|
|
6209 |
9.1.1 Setting up capture |
|
6210 |
------------------------ |
|
6211 |
|
|
6212 |
The following customization sets a default target file for notes, and |
|
6213 |
defines a global key(1) for capturing new material. |
|
6214 |
|
|
6215 |
(setq org-default-notes-file (concat org-directory "/notes.org")) |
|
6216 |
(define-key global-map "\C-cc" 'org-capture) |
|
6217 |
|
|
6218 |
---------- Footnotes ---------- |
|
6219 |
|
|
6220 |
(1) Please select your own key, ‘C-c c’ is only a suggestion. |
|
6221 |
|
|
6222 |
|
|
6223 |
File: org, Node: Using capture, Next: Capture templates, Prev: Setting up capture, Up: Capture |
|
6224 |
|
|
6225 |
9.1.2 Using capture |
|
6226 |
------------------- |
|
6227 |
|
|
6228 |
‘C-c c (org-capture)’ |
|
6229 |
Call the command ‘org-capture’. Note that this key binding is |
|
6230 |
global and not active by default: you need to install it. If you |
|
6231 |
have templates defined *note Capture templates::, it will offer |
|
6232 |
these templates for selection or use a new Org outline node as the |
|
6233 |
default template. It will insert the template into the target file |
|
6234 |
and switch to an indirect buffer narrowed to this new node. You |
|
6235 |
may then insert the information you want. |
|
6236 |
|
|
6237 |
‘C-c C-c (org-capture-finalize)’ |
|
6238 |
Once you have finished entering information into the capture |
|
6239 |
buffer, ‘C-c C-c’ will return you to the window configuration |
|
6240 |
before the capture process, so that you can resume your work |
|
6241 |
without further distraction. When called with a prefix arg, |
|
6242 |
finalize and then jump to the captured item. |
|
6243 |
|
|
6244 |
‘C-c C-w (org-capture-refile)’ |
|
6245 |
Finalize the capture process by refiling (*note Refile and copy::) |
|
6246 |
the note to a different place. Please realize that this is a |
|
6247 |
normal refiling command that will be executed—so the cursor |
|
6248 |
position at the moment you run this command is important. If you |
|
6249 |
have inserted a tree with a parent and children, first move the |
|
6250 |
cursor back to the parent. Any prefix argument given to this |
|
6251 |
command will be passed on to the ‘org-refile’ command. |
|
6252 |
|
|
6253 |
‘C-c C-k (org-capture-kill)’ |
|
6254 |
Abort the capture process and return to the previous state. |
|
6255 |
|
|
6256 |
You can also call ‘org-capture’ in a special way from the agenda, |
|
6257 |
using the ‘k c’ key combination. With this access, any timestamps |
|
6258 |
inserted by the selected capture template will default to the cursor |
|
6259 |
date in the agenda, rather than to the current date. |
|
6260 |
|
|
6261 |
To find the locations of the last stored capture, use ‘org-capture’ |
|
6262 |
with prefix commands: |
|
6263 |
|
|
6264 |
‘C-u C-c c’ |
|
6265 |
Visit the target location of a capture template. You get to select |
|
6266 |
the template in the usual way. |
|
6267 |
‘C-u C-u C-c c’ |
|
6268 |
Visit the last stored capture item in its buffer. |
|
6269 |
|
|
6270 |
You can also jump to the bookmark ‘org-capture-last-stored’, which |
|
6271 |
will automatically be created unless you set ‘org-capture-bookmark’ to |
|
6272 |
‘nil’. |
|
6273 |
|
|
6274 |
To insert the capture at point in an Org buffer, call ‘org-capture’ |
|
6275 |
with a ‘C-0’ prefix argument. |
|
6276 |
|
|
6277 |
|
|
6278 |
File: org, Node: Capture templates, Prev: Using capture, Up: Capture |
|
6279 |
|
|
6280 |
9.1.3 Capture templates |
|
6281 |
----------------------- |
|
6282 |
|
|
6283 |
You can use templates for different types of capture items, and for |
|
6284 |
different target locations. The easiest way to create such templates is |
|
6285 |
through the customize interface. |
|
6286 |
|
|
6287 |
‘C-c c C’ |
|
6288 |
Customize the variable ‘org-capture-templates’. |
|
6289 |
|
|
6290 |
Before we give the formal description of template definitions, let’s |
|
6291 |
look at an example. Say you would like to use one template to create |
|
6292 |
general TODO entries, and you want to put these entries under the |
|
6293 |
heading ‘Tasks’ in your file ‘~/org/gtd.org’. Also, a date tree in the |
|
6294 |
file ‘journal.org’ should capture journal entries. A possible |
|
6295 |
configuration would look like: |
|
6296 |
|
|
6297 |
(setq org-capture-templates |
|
6298 |
'(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") |
|
6299 |
"* TODO %?\n %i\n %a") |
|
6300 |
("j" "Journal" entry (file+olp+datetree "~/org/journal.org") |
|
6301 |
"* %?\nEntered on %U\n %i\n %a"))) |
|
6302 |
|
|
6303 |
If you then press ‘C-c c t’, Org will prepare the template for you like |
|
6304 |
this: |
|
6305 |
* TODO |
|
6306 |
[[file:LINK TO WHERE YOU INITIATED CAPTURE]] |
|
6307 |
|
|
6308 |
During expansion of the template, ‘%a’ has been replaced by a link to |
|
6309 |
the location from where you called the capture command. This can be |
|
6310 |
extremely useful for deriving tasks from emails, for example. You fill |
|
6311 |
in the task definition, press ‘C-c C-c’ and Org returns you to the same |
|
6312 |
place where you started the capture process. |
|
6313 |
|
|
6314 |
To define special keys to capture to a particular template without |
|
6315 |
going through the interactive template selection, you can create your |
|
6316 |
key binding like this: |
|
6317 |
|
|
6318 |
(define-key global-map "\C-cx" |
|
6319 |
(lambda () (interactive) (org-capture nil "x"))) |
|
6320 |
|
|
6321 |
* Menu: |
|
6322 |
|
|
6323 |
* Template elements:: What is needed for a complete template entry |
|
6324 |
* Template expansion:: Filling in information about time and context |
|
6325 |
* Templates in contexts:: Only show a template in a specific context |
|
6326 |
|
|
6327 |
|
|
6328 |
File: org, Node: Template elements, Next: Template expansion, Up: Capture templates |
|
6329 |
|
|
6330 |
9.1.3.1 Template elements |
|
6331 |
......................... |
|
6332 |
|
|
6333 |
Now lets look at the elements of a template definition. Each entry in |
|
6334 |
‘org-capture-templates’ is a list with the following items: |
|
6335 |
|
|
6336 |
KEYS |
|
6337 |
The keys that will select the template, as a string, characters |
|
6338 |
only, for example ‘"a"’ for a template to be selected with a single |
|
6339 |
key, or ‘"bt"’ for selection with two keys. When using several |
|
6340 |
keys, keys using the same prefix key must be sequential in the list |
|
6341 |
and preceded by a 2-element entry explaining the prefix key, for |
|
6342 |
example |
|
6343 |
("b" "Templates for marking stuff to buy") |
|
6344 |
If you do not define a template for the ‘C’ key, this key will be |
|
6345 |
used to open the customize buffer for this complex variable. |
|
6346 |
|
|
6347 |
DESCRIPTION |
|
6348 |
A short string describing the template, which will be shown during |
|
6349 |
selection. |
|
6350 |
|
|
6351 |
TYPE |
|
6352 |
The type of entry, a symbol. Valid values are: |
|
6353 |
|
|
6354 |
‘entry’ |
|
6355 |
An Org mode node, with a headline. Will be filed as the child |
|
6356 |
of the target entry or as a top-level entry. The target file |
|
6357 |
should be an Org mode file. |
|
6358 |
‘item’ |
|
6359 |
A plain list item, placed in the first plain list at the |
|
6360 |
target location. Again the target file should be an Org file. |
|
6361 |
‘checkitem’ |
|
6362 |
A checkbox item. This only differs from the plain list item |
|
6363 |
by the default template. |
|
6364 |
‘table-line’ |
|
6365 |
a new line in the first table at the target location. Where |
|
6366 |
exactly the line will be inserted depends on the properties |
|
6367 |
‘:prepend’ and ‘:table-line-pos’ (see below). |
|
6368 |
‘plain’ |
|
6369 |
Text to be inserted as it is. |
|
6370 |
|
|
6371 |
TARGET |
|
6372 |
Specification of where the captured item should be placed. In Org |
|
6373 |
mode files, targets usually define a node. Entries will become |
|
6374 |
children of this node. Other types will be added to the table or |
|
6375 |
list in the body of this node. Most target specifications contain |
|
6376 |
a file name. If that file name is the empty string, it defaults to |
|
6377 |
‘org-default-notes-file’. A file can also be given as a variable |
|
6378 |
or as a function called with no argument. When an absolute path is |
|
6379 |
not specified for a target, it is taken as relative to |
|
6380 |
‘org-directory’. |
|
6381 |
|
|
6382 |
Valid values are: |
|
6383 |
|
|
6384 |
‘(file "path/to/file")’ |
|
6385 |
Text will be placed at the beginning or end of that file. |
|
6386 |
|
|
6387 |
‘(id "id of existing org entry")’ |
|
6388 |
Filing as child of this entry, or in the body of the entry. |
|
6389 |
|
|
6390 |
‘(file+headline "path/to/file" "node headline")’ |
|
6391 |
Fast configuration if the target heading is unique in the |
|
6392 |
file. |
|
6393 |
|
|
6394 |
‘(file+olp "path/to/file" "Level 1 heading" "Level 2" ...)’ |
|
6395 |
For non-unique headings, the full path is safer. |
|
6396 |
|
|
6397 |
‘(file+regexp "path/to/file" "regexp to find location")’ |
|
6398 |
Use a regular expression to position the cursor. |
|
6399 |
|
|
6400 |
‘(file+olp+datetree "path/to/file" [ "Level 1 heading" ....])’ |
|
6401 |
This target(1) will create a heading in a date tree(2) for |
|
6402 |
today’s date. If the optional outline path is given, the tree |
|
6403 |
will be built under the node it is pointing to, instead of at |
|
6404 |
top level. Check out the ‘:time-prompt’ and ‘:tree-type’ |
|
6405 |
properties below for additional options. |
|
6406 |
|
|
6407 |
‘(file+function "path/to/file" function-finding-location)’ |
|
6408 |
A function to find the right location in the file. |
|
6409 |
|
|
6410 |
‘(clock)’ |
|
6411 |
File to the entry that is currently being clocked. |
|
6412 |
|
|
6413 |
‘(function function-finding-location)’ |
|
6414 |
Most general way: write your own function which both visits |
|
6415 |
the file and moves point to the right location. |
|
6416 |
|
|
6417 |
TEMPLATE |
|
6418 |
The template for creating the capture item. If you leave this |
|
6419 |
empty, an appropriate default template will be used. Otherwise |
|
6420 |
this is a string with escape codes, which will be replaced |
|
6421 |
depending on time and context of the capture call. The string with |
|
6422 |
escapes may be loaded from a template file, using the special |
|
6423 |
syntax ‘(file "path/to/template")’. See below for more details. |
|
6424 |
|
|
6425 |
PROPERTIES |
|
6426 |
The rest of the entry is a property list of additional options. |
|
6427 |
Recognized properties are: |
|
6428 |
|
|
6429 |
‘:prepend’ |
|
6430 |
Normally new captured information will be appended at the |
|
6431 |
target location (last child, last table line, last list |
|
6432 |
item...). Setting this property will change that. |
|
6433 |
|
|
6434 |
‘:immediate-finish’ |
|
6435 |
When set, do not offer to edit the information, just file it |
|
6436 |
away immediately. This makes sense if the template only needs |
|
6437 |
information that can be added automatically. |
|
6438 |
|
|
6439 |
‘:empty-lines’ |
|
6440 |
Set this to the number of lines to insert before and after the |
|
6441 |
new item. Default 0, only common other value is 1. |
|
6442 |
|
|
6443 |
‘:clock-in’ |
|
6444 |
Start the clock in this item. |
|
6445 |
|
|
6446 |
‘:clock-keep’ |
|
6447 |
Keep the clock running when filing the captured entry. |
|
6448 |
|
|
6449 |
‘:clock-resume’ |
|
6450 |
If starting the capture interrupted a clock, restart that |
|
6451 |
clock when finished with the capture. Note that ‘:clock-keep’ |
|
6452 |
has precedence over ‘:clock-resume’. When setting both to |
|
6453 |
‘t’, the current clock will run and the previous one will not |
|
6454 |
be resumed. |
|
6455 |
|
|
6456 |
‘:time-prompt’ |
|
6457 |
Prompt for a date/time to be used for date/week trees and when |
|
6458 |
filling the template. Without this property, capture uses the |
|
6459 |
current date and time. Even if this property has not been |
|
6460 |
set, you can force the same behavior by calling ‘org-capture’ |
|
6461 |
with a ‘C-1’ prefix argument. |
|
6462 |
|
|
6463 |
‘:tree-type’ |
|
6464 |
When ‘week’, make a week tree instead of the month tree, i.e. |
|
6465 |
place the headings for each day under a heading with the |
|
6466 |
current iso week. |
|
6467 |
|
|
6468 |
‘:unnarrowed’ |
|
6469 |
Do not narrow the target buffer, simply show the full buffer. |
|
6470 |
Default is to narrow it so that you only see the new material. |
|
6471 |
|
|
6472 |
‘:table-line-pos’ |
|
6473 |
Specification of the location in the table where the new line |
|
6474 |
should be inserted. It can be a string, a variable holding a |
|
6475 |
string or a function returning a string. The string should |
|
6476 |
look like ‘"II-3"’ meaning that the new line should become the |
|
6477 |
third line before the second horizontal separator line. |
|
6478 |
|
|
6479 |
‘:kill-buffer’ |
|
6480 |
If the target file was not yet visited when capture was |
|
6481 |
invoked, kill the buffer again after capture is completed. |
|
6482 |
|
|
6483 |
---------- Footnotes ---------- |
|
6484 |
|
|
6485 |
(1) Org used to offer four different targets for date/week tree |
|
6486 |
capture. Now, Org automatically translates these to use |
|
6487 |
‘file+olp+datetree’, applying the ‘:time-prompt’ and ‘:tree-type’ |
|
6488 |
properties. Please rewrite your date/week-tree targets using |
|
6489 |
‘file+olp+datetree’ since the older targets are now deprecated. |
|
6490 |
|
|
6491 |
(2) A date tree is an outline structure with years on the highest |
|
6492 |
level, months or ISO-weeks as sublevels and then dates on the lowest |
|
6493 |
level. Tags are allowed in the tree structure. |
|
6494 |
|
|
6495 |
|
|
6496 |
File: org, Node: Template expansion, Next: Templates in contexts, Prev: Template elements, Up: Capture templates |
|
6497 |
|
|
6498 |
9.1.3.2 Template expansion |
|
6499 |
.......................... |
|
6500 |
|
|
6501 |
In the template itself, special ‘%’-escapes(1) allow dynamic insertion |
|
6502 |
of content. The templates are expanded in the order given here: |
|
6503 |
|
|
6504 |
%[FILE] Insert the contents of the file given by FILE. |
|
6505 |
%(SEXP) Evaluate Elisp SEXP and replace with the result. |
|
6506 |
For convenience, %:keyword (see below) placeholders |
|
6507 |
within the expression will be expanded prior to this. |
|
6508 |
The sexp must return a string. |
|
6509 |
%<...> The result of format-time-string on the ... format specification. |
|
6510 |
%t Timestamp, date only. |
|
6511 |
%T Timestamp, with date and time. |
|
6512 |
%u, %U Like the above, but inactive timestamps. |
|
6513 |
%i Initial content, the region when capture is called while the |
|
6514 |
region is active. |
|
6515 |
The entire text will be indented like ‘%i’ itself. |
|
6516 |
%a Annotation, normally the link created with ‘org-store-link’. |
|
6517 |
%A Like ‘%a’, but prompt for the description part. |
|
6518 |
%l Like %a, but only insert the literal link. |
|
6519 |
%c Current kill ring head. |
|
6520 |
%x Content of the X clipboard. |
|
6521 |
%k Title of the currently clocked task. |
|
6522 |
%K Link to the currently clocked task. |
|
6523 |
%n User name (taken from ‘user-full-name’). |
|
6524 |
%f File visited by current buffer when org-capture was called. |
|
6525 |
%F Full path of the file or directory visited by current buffer. |
|
6526 |
%:keyword Specific information for certain link types, see below. |
|
6527 |
%^g Prompt for tags, with completion on tags in target file. |
|
6528 |
%^G Prompt for tags, with completion all tags in all agenda files. |
|
6529 |
%^t Like ‘%t’, but prompt for date. Similarly ‘%^T’, ‘%^u’, ‘%^U’. |
|
6530 |
You may define a prompt like ‘%^{Birthday}t’. |
|
6531 |
%^C Interactive selection of which kill or clip to use. |
|
6532 |
%^L Like ‘%^C’, but insert as link. |
|
6533 |
%^{PROP}p Prompt the user for a value for property PROP. |
|
6534 |
%^{PROMPT} prompt the user for a string and replace this sequence with it. |
|
6535 |
You may specify a default value and a completion table with |
|
6536 |
%^{prompt|default|completion2|completion3...}. |
|
6537 |
The arrow keys access a prompt-specific history. |
|
6538 |
%\1 ... %\N Insert the text entered at the Nth %^{PROMPT}, where ‘N’ is |
|
6539 |
a number, starting from 1.(2) |
|
6540 |
%? After completing the template, position cursor here. |
|
6541 |
|
|
6542 |
For specific link types, the following keywords will be defined(3): |
|
6543 |
|
|
6544 |
Link type | Available keywords |
|
6545 |
---------------------------------+---------------------------------------------- |
|
6546 |
bbdb | %:name %:company |
|
6547 |
irc | %:server %:port %:nick |
|
6548 |
vm, vm-imap, wl, mh, mew, rmail, | %:type %:subject %:message-id |
|
6549 |
gnus, notmuch | %:from %:fromname %:fromaddress |
|
6550 |
| %:to %:toname %:toaddress |
|
6551 |
| %:date (message date header field) |
|
6552 |
| %:date-timestamp (date as active timestamp) |
|
6553 |
| %:date-timestamp-inactive (date as inactive timestamp) |
|
6554 |
| %:fromto (either "to NAME" or "from NAME")(4) |
|
6555 |
gnus | %:group, for messages also all email fields |
|
6556 |
eww, w3, w3m | %:url |
|
6557 |
info | %:file %:node |
|
6558 |
calendar | %:date |
|
6559 |
org-protocol | %:link %:description %:annotation |
|
6560 |
|
|
6561 |
To place the cursor after template expansion use: |
|
6562 |
|
|
6563 |
%? After completing the template, position cursor here. |
|
6564 |
|
|
6565 |
---------- Footnotes ---------- |
|
6566 |
|
|
6567 |
(1) If you need one of these sequences literally, escape the ‘%’ with |
|
6568 |
a backslash. |
|
6569 |
|
|
6570 |
(2) As required in Emacs Lisp, it is necessary to escape any |
|
6571 |
backslash character in a string with another backslash. So, in order to |
|
6572 |
use ‘%\1’ placeholder, you need to write ‘%\\1’ in the template. |
|
6573 |
|
|
6574 |
(3) If you define your own link types (*note Adding hyperlink |
|
6575 |
types::), any property you store with ‘org-store-link-props’ can be |
|
6576 |
accessed in capture templates in a similar way. |
|
6577 |
|
|
6578 |
(4) This will always be the other, not the user. See the variable |
|
6579 |
‘org-from-is-user-regexp’. |
|
6580 |
|
|
6581 |
|
|
6582 |
File: org, Node: Templates in contexts, Prev: Template expansion, Up: Capture templates |
|
6583 |
|
|
6584 |
9.1.3.3 Templates in contexts |
|
6585 |
............................. |
|
6586 |
|
|
6587 |
To control whether a capture template should be accessible from a |
|
6588 |
specific context, you can customize ‘org-capture-templates-contexts’. |
|
6589 |
Let’s say for example that you have a capture template ‘"p"’ for storing |
|
6590 |
Gnus emails containing patches. Then you would configure this option |
|
6591 |
like this: |
|
6592 |
|
|
6593 |
(setq org-capture-templates-contexts |
|
6594 |
'(("p" (in-mode . "message-mode")))) |
|
6595 |
|
|
6596 |
You can also tell that the command key ‘"p"’ should refer to another |
|
6597 |
template. In that case, add this command key like this: |
|
6598 |
|
|
6599 |
(setq org-capture-templates-contexts |
|
6600 |
'(("p" "q" (in-mode . "message-mode")))) |
|
6601 |
|
|
6602 |
See the docstring of the variable for more information. |
|
6603 |
|
|
6604 |
|
|
6605 |
File: org, Node: Attachments, Next: RSS feeds, Prev: Capture, Up: Capture - Refile - Archive |
|
6606 |
|
|
6607 |
9.2 Attachments |
|
6608 |
=============== |
|
6609 |
|
|
6610 |
It is often useful to associate reference material with an outline |
|
6611 |
node/task. Small chunks of plain text can simply be stored in the |
|
6612 |
subtree of a project. Hyperlinks (*note Hyperlinks::) can establish |
|
6613 |
associations with files that live elsewhere on your computer or in the |
|
6614 |
cloud, like emails or source code files belonging to a project. Another |
|
6615 |
method is attachments, which are files located in a directory belonging |
|
6616 |
to an outline node. Org uses directories named by the unique ID of each |
|
6617 |
entry. These directories are located in the ‘data’ directory which |
|
6618 |
lives in the same directory where your Org file lives(1). If you |
|
6619 |
initialize this directory with ‘git init’, Org will automatically commit |
|
6620 |
changes when it sees them. The attachment system has been contributed |
|
6621 |
to Org by John Wiegley. |
|
6622 |
|
|
6623 |
In cases where it seems better to do so, you can also attach a |
|
6624 |
directory of your choice to an entry. You can also make children |
|
6625 |
inherit the attachment directory from a parent, so that an entire |
|
6626 |
subtree uses the same attached directory. |
|
6627 |
|
|
6628 |
The following commands deal with attachments: |
|
6629 |
|
|
6630 |
‘C-c C-a (org-attach)’ |
|
6631 |
The dispatcher for commands related to the attachment system. |
|
6632 |
After these keys, a list of commands is displayed and you must |
|
6633 |
press an additional key to select a command: |
|
6634 |
|
|
6635 |
‘a (org-attach-attach)’ |
|
6636 |
Select a file and move it into the task’s attachment |
|
6637 |
directory. The file will be copied, moved, or linked, |
|
6638 |
depending on ‘org-attach-method’. Note that hard links are |
|
6639 |
not supported on all systems. |
|
6640 |
|
|
6641 |
‘c/m/l’ |
|
6642 |
Attach a file using the copy/move/link method. Note that hard |
|
6643 |
links are not supported on all systems. |
|
6644 |
|
|
6645 |
‘u (org-attach-url)’ |
|
6646 |
Attach a file from URL |
|
6647 |
|
|
6648 |
‘n (org-attach-new)’ |
|
6649 |
Create a new attachment as an Emacs buffer. |
|
6650 |
|
|
6651 |
‘z (org-attach-sync)’ |
|
6652 |
Synchronize the current task with its attachment directory, in |
|
6653 |
case you added attachments yourself. |
|
6654 |
|
|
6655 |
‘o (org-attach-open)’ |
|
6656 |
Open current task’s attachment. If there is more than one, |
|
6657 |
prompt for a file name first. Opening will follow the rules |
|
6658 |
set by ‘org-file-apps’. For more details, see the information |
|
6659 |
on following hyperlinks (*note Handling links::). |
|
6660 |
|
|
6661 |
‘O (org-attach-open-in-emacs)’ |
|
6662 |
Also open the attachment, but force opening the file in Emacs. |
|
6663 |
|
|
6664 |
‘f (org-attach-reveal)’ |
|
6665 |
Open the current task’s attachment directory. |
|
6666 |
|
|
6667 |
‘F (org-attach-reveal-in-emacs)’ |
|
6668 |
Also open the directory, but force using ‘dired’ in Emacs. |
|
6669 |
|
|
6670 |
‘d (org-attach-delete-one)’ |
|
6671 |
Select and delete a single attachment. |
|
6672 |
|
|
6673 |
‘D (org-attach-delete-all)’ |
|
6674 |
Delete all of a task’s attachments. A safer way is to open |
|
6675 |
the directory in ‘dired’ and delete from there. |
|
6676 |
|
|
6677 |
‘s (org-attach-set-directory)’ |
|
6678 |
Set a specific directory as the entry’s attachment directory. |
|
6679 |
This works by putting the directory path into the ‘ATTACH_DIR’ |
|
6680 |
property. |
|
6681 |
|
|
6682 |
‘i (org-attach-set-inherit)’ |
|
6683 |
Set the ‘ATTACH_DIR_INHERIT’ property, so that children will |
|
6684 |
use the same directory for attachments as the parent does. |
|
6685 |
|
|
6686 |
---------- Footnotes ---------- |
|
6687 |
|
|
6688 |
(1) If you move entries or Org files from one directory to another, |
|
6689 |
you may want to configure ‘org-attach-directory’ to contain an absolute |
|
6690 |
path. |
|
6691 |
|
|
6692 |
|
|
6693 |
File: org, Node: RSS feeds, Next: Protocols, Prev: Attachments, Up: Capture - Refile - Archive |
|
6694 |
|
|
6695 |
9.3 RSS feeds |
|
6696 |
============= |
|
6697 |
|
|
6698 |
Org can add and change entries based on information found in RSS feeds |
|
6699 |
and Atom feeds. You could use this to make a task out of each new |
|
6700 |
podcast in a podcast feed. Or you could use a phone-based note-creating |
|
6701 |
service on the web to import tasks into Org. To access feeds, configure |
|
6702 |
the variable ‘org-feed-alist’. The docstring of this variable has |
|
6703 |
detailed information. Here is just an example: |
|
6704 |
|
|
6705 |
(setq org-feed-alist |
|
6706 |
'(("Slashdot" |
|
6707 |
"http://rss.slashdot.org/Slashdot/slashdot" |
|
6708 |
"~/txt/org/feeds.org" "Slashdot Entries"))) |
|
6709 |
|
|
6710 |
will configure that new items from the feed provided by |
|
6711 |
‘rss.slashdot.org’ will result in new entries in the file |
|
6712 |
‘~/org/feeds.org’ under the heading ‘Slashdot Entries’, whenever the |
|
6713 |
following command is used: |
|
6714 |
|
|
6715 |
‘C-c C-x g (org-feed-update-all)’ |
|
6716 |
‘C-c C-x g’ |
|
6717 |
Collect items from the feeds configured in ‘org-feed-alist’ and act |
|
6718 |
upon them. |
|
6719 |
‘C-c C-x G (org-feed-goto-inbox)’ |
|
6720 |
Prompt for a feed name and go to the inbox configured for this |
|
6721 |
feed. |
|
6722 |
|
|
6723 |
Under the same headline, Org will create a drawer ‘FEEDSTATUS’ in |
|
6724 |
which it will store information about the status of items in the feed, |
|
6725 |
to avoid adding the same item several times. |
|
6726 |
|
|
6727 |
For more information, including how to read atom feeds, see |
|
6728 |
‘org-feed.el’ and the docstring of ‘org-feed-alist’. |
|
6729 |
|
|
6730 |
|
|
6731 |
File: org, Node: Protocols, Next: Refile and copy, Prev: RSS feeds, Up: Capture - Refile - Archive |
|
6732 |
|
|
6733 |
9.4 Protocols for external access |
|
6734 |
================================= |
|
6735 |
|
|
6736 |
Org protocol is a mean to trigger custom actions in Emacs from external |
|
6737 |
applications. Any application that supports calling external programs |
|
6738 |
with an URL as argument may be used with this functionality. For |
|
6739 |
example, you can configure bookmarks in your web browser to send a link |
|
6740 |
to the current page to Org and create a note from it using capture |
|
6741 |
(*note Capture::). You can also create a bookmark that tells Emacs to |
|
6742 |
open the local source file of a remote website you are browsing. |
|
6743 |
|
|
6744 |
In order to use Org protocol from an application, you need to |
|
6745 |
register ‘org-protocol://’ as a valid scheme-handler. External calls |
|
6746 |
are passed to Emacs through the ‘emacsclient’ command, so you also need |
|
6747 |
to ensure an Emacs server is running. More precisely, when the |
|
6748 |
application calls |
|
6749 |
|
|
6750 |
emacsclient org-protocol://PROTOCOL?key1=val1&key2=val2 |
|
6751 |
|
|
6752 |
Emacs calls the handler associated to ‘PROTOCOL’ with argument ‘(:key1 |
|
6753 |
val1 :key2 val2)’. |
|
6754 |
|
|
6755 |
Org protocol comes with three predefined protocols, detailed in the |
|
6756 |
following sections. Configure ‘org-protocol-protocol-alist’ to define |
|
6757 |
your own. |
|
6758 |
|
|
6759 |
* Menu: |
|
6760 |
|
|
6761 |
* store-link protocol:: Store a link, push URL to kill-ring. |
|
6762 |
* capture protocol:: Fill a buffer with external information. |
|
6763 |
* open-source protocol:: Edit published contents. |
|
6764 |
|
|
6765 |
|
|
6766 |
File: org, Node: store-link protocol, Next: capture protocol, Up: Protocols |
|
6767 |
|
|
6768 |
9.4.1 ‘store-link’ protocol |
|
6769 |
--------------------------- |
|
6770 |
|
|
6771 |
Using ‘store-link’ handler, you can copy links, insertable through ‘M-x |
|
6772 |
org-insert-link’ or yanking thereafter. More precisely, the command |
|
6773 |
|
|
6774 |
emacsclient org-protocol://store-link?url=URL&title=TITLE |
|
6775 |
|
|
6776 |
stores the following link: |
|
6777 |
|
|
6778 |
[[URL][TITLE]] |
|
6779 |
|
|
6780 |
In addition, ‘URL’ is pushed on the kill-ring for yanking. You need |
|
6781 |
to encode ‘URL’ and ‘TITLE’ if they contain slashes, and probably quote |
|
6782 |
those for the shell. |
|
6783 |
|
|
6784 |
To use this feature from a browser, add a bookmark with an arbitrary |
|
6785 |
name, e.g., ‘Org: store-link’ and enter this as _Location_: |
|
6786 |
|
|
6787 |
javascript:location.href='org-protocol://store-link?url='+ |
|
6788 |
encodeURIComponent(location.href); |
|
6789 |
|
|
6790 |
|
|
6791 |
File: org, Node: capture protocol, Next: open-source protocol, Prev: store-link protocol, Up: Protocols |
|
6792 |
|
|
6793 |
9.4.2 ‘capture’ protocol |
|
6794 |
------------------------ |
|
6795 |
|
|
6796 |
Activating ‘capture’ handler pops up a ‘Capture’ buffer and fills the |
|
6797 |
capture template associated to the ‘X’ key with them. |
|
6798 |
|
|
6799 |
emacsclient org-protocol://capture?template=X?url=URL?title=TITLE?body=BODY |
|
6800 |
|
|
6801 |
To use this feature, add a bookmark with an arbitrary name, e.g. |
|
6802 |
‘Org: capture’ and enter this as ‘Location’: |
|
6803 |
|
|
6804 |
javascript:location.href='org-protocol://capture?template=x'+ |
|
6805 |
'&url='+encodeURIComponent(window.location.href)+ |
|
6806 |
'&title='+encodeURIComponent(document.title)+ |
|
6807 |
'&body='+encodeURIComponent(window.getSelection()); |
|
6808 |
|
|
6809 |
The result depends on the capture template used, which is set in the |
|
6810 |
bookmark itself, as in the example above, or in |
|
6811 |
‘org-protocol-default-template-key’. |
|
6812 |
|
|
6813 |
The following template placeholders are available: |
|
6814 |
|
|
6815 |
%:link The URL |
|
6816 |
%:description The webpage title |
|
6817 |
%:annotation Equivalent to [[%:link][%:description]] |
|
6818 |
%i The selected text |
|
6819 |
|
|
6820 |
|
|
6821 |
File: org, Node: open-source protocol, Prev: capture protocol, Up: Protocols |
|
6822 |
|
|
6823 |
9.4.3 ‘open-source’ protocol |
|
6824 |
---------------------------- |
|
6825 |
|
|
6826 |
The ‘open-source’ handler is designed to help with editing local sources |
|
6827 |
when reading a document. To that effect, you can use a bookmark with |
|
6828 |
the following location: |
|
6829 |
|
|
6830 |
javascript:location.href='org-protocol://open-source?&url='+ |
|
6831 |
encodeURIComponent(location.href) |
|
6832 |
|
|
6833 |
The variable ‘org-protocol-project-alist’ maps URLs to local file |
|
6834 |
names, by stripping URL parameters from the end and replacing the |
|
6835 |
‘:base-url’ with ‘:working-directory’ and ‘:online-suffix’ with |
|
6836 |
‘:working-suffix’. For example, assuming you own a local copy of |
|
6837 |
<https://orgmode.org/worg/> contents at ‘/home/user/worg’, you can set |
|
6838 |
‘org-protocol-project-alist’ to the following |
|
6839 |
|
|
6840 |
(setq org-protocol-project-alist |
|
6841 |
'(("Worg" |
|
6842 |
:base-url "https://orgmode.org/worg/" |
|
6843 |
:working-directory "/home/user/worg/" |
|
6844 |
:online-suffix ".html" |
|
6845 |
:working-suffix ".org"))) |
|
6846 |
|
|
6847 |
If you are now browsing |
|
6848 |
<https://orgmode.org/worg/org-contrib/org-protocol.html> and find a typo |
|
6849 |
or have an idea about how to enhance the documentation, simply click the |
|
6850 |
bookmark and start editing. |
|
6851 |
|
|
6852 |
However, such mapping may not yield the desired results. Suppose you |
|
6853 |
maintain an online store located at <http://example.com/>. The local |
|
6854 |
sources reside in ‘/home/user/example/’. It is common practice to serve |
|
6855 |
all products in such a store through one file and rewrite URLs that do |
|
6856 |
not match an existing file on the server. That way, a request to |
|
6857 |
<http://example.com/print/posters.html> might be rewritten on the server |
|
6858 |
to something like |
|
6859 |
<http://example.com/shop/products.php/posters.html.php>. The |
|
6860 |
‘open-source’ handler probably cannot find a file named |
|
6861 |
‘/home/user/example/print/posters.html.php’ and fails. |
|
6862 |
|
|
6863 |
Such an entry in ‘org-protocol-project-alist’ may hold an additional |
|
6864 |
property ‘:rewrites’. This property is a list of cons cells, each of |
|
6865 |
which maps a regular expression to a path relative to the |
|
6866 |
‘:working-directory’. |
|
6867 |
|
|
6868 |
Now map the URL to the path ‘/home/user/example/products.php’ by |
|
6869 |
adding ‘:rewrites’ rules like this: |
|
6870 |
|
|
6871 |
(setq org-protocol-project-alist |
|
6872 |
'(("example.com" |
|
6873 |
:base-url "http://example.com/" |
|
6874 |
:working-directory "/home/user/example/" |
|
6875 |
:online-suffix ".php" |
|
6876 |
:working-suffix ".php" |
|
6877 |
:rewrites (("example.com/print/" . "products.php") |
|
6878 |
("example.com/$" . "index.php"))))) |
|
6879 |
|
|
6880 |
Since ‘example.com/$’ is used as a regular expression, it maps |
|
6881 |
<http://example.com/>, <https://example.com>, <http://www.example.com/> |
|
6882 |
and similar to ‘/home/user/example/index.php’. |
|
6883 |
|
|
6884 |
The ‘:rewrites’ rules are searched as a last resort if and only if no |
|
6885 |
existing file name is matched. |
|
6886 |
|
|
6887 |
Two functions can help you filling ‘org-protocol-project-alist’ with |
|
6888 |
valid contents: ‘org-protocol-create’ and ‘org-protocol-create-for-org’. |
|
6889 |
The latter is of use if you’re editing an Org file that is part of a |
|
6890 |
publishing project. |
|
6891 |
|
|
6892 |
|
|
6893 |
File: org, Node: Refile and copy, Next: Archiving, Prev: Protocols, Up: Capture - Refile - Archive |
|
6894 |
|
|
6895 |
9.5 Refile and copy |
|
6896 |
=================== |
|
6897 |
|
|
6898 |
When reviewing the captured data, you may want to refile or to copy some |
|
6899 |
of the entries into a different list, for example into a project. |
|
6900 |
Cutting, finding the right location, and then pasting the note is |
|
6901 |
cumbersome. To simplify this process, you can use the following special |
|
6902 |
command: |
|
6903 |
|
|
6904 |
‘C-c M-w (org-copy)’ |
|
6905 |
Copying works like refiling, except that the original note is not |
|
6906 |
deleted. |
|
6907 |
‘C-c C-w (org-refile)’ |
|
6908 |
Refile the entry or region at point. This command offers possible |
|
6909 |
locations for refiling the entry and lets you select one with |
|
6910 |
completion. The item (or all items in the region) is filed below |
|
6911 |
the target heading as a subitem. Depending on |
|
6912 |
‘org-reverse-note-order’, it will be either the first or last |
|
6913 |
subitem. |
|
6914 |
By default, all level 1 headlines in the current buffer are |
|
6915 |
considered to be targets, but you can have more complex definitions |
|
6916 |
across a number of files. See the variable ‘org-refile-targets’ |
|
6917 |
for details. If you would like to select a location via a |
|
6918 |
file-path-like completion along the outline path, see the variables |
|
6919 |
‘org-refile-use-outline-path’ and |
|
6920 |
‘org-outline-path-complete-in-steps’. If you would like to be able |
|
6921 |
to create new nodes as new parents for refiling on the fly, check |
|
6922 |
the variable ‘org-refile-allow-creating-parent-nodes’. When the |
|
6923 |
variable ‘org-log-refile’(1) is set, a timestamp or a note will be |
|
6924 |
recorded when an entry has been refiled. |
|
6925 |
‘C-u C-c C-w’ |
|
6926 |
Use the refile interface to jump to a heading. |
|
6927 |
‘C-u C-u C-c C-w (org-refile-goto-last-stored)’ |
|
6928 |
Jump to the location where ‘org-refile’ last moved a tree to. |
|
6929 |
‘C-2 C-c C-w’ |
|
6930 |
Refile as the child of the item currently being clocked. |
|
6931 |
‘C-3 C-c C-w’ |
|
6932 |
Refile and keep the entry in place. Also see ‘org-refile-keep’ to |
|
6933 |
make this the default behavior, and beware that this may result in |
|
6934 |
duplicated ‘ID’ properties. |
|
6935 |
‘C-0 C-c C-w or C-u C-u C-u C-c C-w (org-refile-cache-clear)’ |
|
6936 |
Clear the target cache. Caching of refile targets can be turned on |
|
6937 |
by setting ‘org-refile-use-cache’. To make the command see new |
|
6938 |
possible targets, you have to clear the cache with this command. |
|
6939 |
|
|
6940 |
---------- Footnotes ---------- |
|
6941 |
|
|
6942 |
(1) with corresponding ‘#+STARTUP’ keywords ‘logrefile’, |
|
6943 |
‘lognoterefile’, and ‘nologrefile’ |
|
6944 |
|
|
6945 |
|
|
6946 |
File: org, Node: Archiving, Prev: Refile and copy, Up: Capture - Refile - Archive |
|
6947 |
|
|
6948 |
9.6 Archiving |
|
6949 |
============= |
|
6950 |
|
|
6951 |
When a project represented by a (sub)tree is finished, you may want to |
|
6952 |
move the tree out of the way and to stop it from contributing to the |
|
6953 |
agenda. Archiving is important to keep your working files compact and |
|
6954 |
global searches like the construction of agenda views fast. |
|
6955 |
|
|
6956 |
‘C-c C-x C-a (org-archive-subtree-default)’ |
|
6957 |
Archive the current entry using the command specified in the |
|
6958 |
variable ‘org-archive-default-command’. |
|
6959 |
|
|
6960 |
* Menu: |
|
6961 |
|
|
6962 |
* Moving subtrees:: Moving a tree to an archive file |
|
6963 |
* Internal archiving:: Switch off a tree but keep it in the file |
|
6964 |
|
|
6965 |
|
|
6966 |
File: org, Node: Moving subtrees, Next: Internal archiving, Up: Archiving |
|
6967 |
|
|
6968 |
9.6.1 Moving a tree to the archive file |
|
6969 |
--------------------------------------- |
|
6970 |
|
|
6971 |
The most common archiving action is to move a project tree to another |
|
6972 |
file, the archive file. |
|
6973 |
|
|
6974 |
‘C-c C-x C-s or short C-c $ (org-archive-subtree)’ |
|
6975 |
Archive the subtree starting at the cursor position to the location |
|
6976 |
given by ‘org-archive-location’. |
|
6977 |
‘C-u C-c C-x C-s’ |
|
6978 |
Check if any direct children of the current headline could be moved |
|
6979 |
to the archive. To do this, each subtree is checked for open TODO |
|
6980 |
entries. If none are found, the command offers to move it to the |
|
6981 |
archive location. If the cursor is _not_ on a headline when this |
|
6982 |
command is invoked, the level 1 trees will be checked. |
|
6983 |
‘C-u C-u C-c C-x C-s’ |
|
6984 |
As above, but check subtree for timestamps instead of TODO entries. |
|
6985 |
The command will offer to archive the subtree if it _does_ contain |
|
6986 |
a timestamp, and that timestamp is in the past. |
|
6987 |
|
|
6988 |
The default archive location is a file in the same directory as the |
|
6989 |
current file, with the name derived by appending ‘_archive’ to the |
|
6990 |
current file name. You can also choose what heading to file archived |
|
6991 |
items under, with the possibility to add them to a datetree in a file. |
|
6992 |
For information and examples on how to specify the file and the heading, |
|
6993 |
see the documentation string of the variable ‘org-archive-location’. |
|
6994 |
|
|
6995 |
There is also an in-buffer option for setting this variable, for |
|
6996 |
example: |
|
6997 |
|
|
6998 |
#+ARCHIVE: %s_done:: |
|
6999 |
|
|
7000 |
If you would like to have a special ARCHIVE location for a single entry |
|
7001 |
or a (sub)tree, give the entry an ‘:ARCHIVE:’ property with the location |
|
7002 |
as the value (*note Properties and columns::). |
|
7003 |
|
|
7004 |
When a subtree is moved, it receives a number of special properties |
|
7005 |
that record context information like the file from where the entry came, |
|
7006 |
its outline path the archiving time etc. Configure the variable |
|
7007 |
‘org-archive-save-context-info’ to adjust the amount of information |
|
7008 |
added. |
|
7009 |
|
|
7010 |
|
|
7011 |
File: org, Node: Internal archiving, Prev: Moving subtrees, Up: Archiving |
|
7012 |
|
|
7013 |
9.6.2 Internal archiving |
|
7014 |
------------------------ |
|
7015 |
|
|
7016 |
If you want to just switch off—for agenda views—certain subtrees without |
|
7017 |
moving them to a different file, you can use the archive tag. |
|
7018 |
|
|
7019 |
A headline that is marked with the ‘:ARCHIVE:’ tag (*note Tags::) |
|
7020 |
stays at its location in the outline tree, but behaves in the following |
|
7021 |
way: |
|
7022 |
− It does not open when you attempt to do so with a visibility |
|
7023 |
cycling command (*note Visibility cycling::). You can force |
|
7024 |
cycling archived subtrees with ‘C-<TAB>’, or by setting the option |
|
7025 |
‘org-cycle-open-archived-trees’. Also normal outline commands like |
|
7026 |
‘show-all’ will open archived subtrees. |
|
7027 |
− During sparse tree construction (*note Sparse trees::), matches in |
|
7028 |
archived subtrees are not exposed, unless you configure the option |
|
7029 |
‘org-sparse-tree-open-archived-trees’. |
|
7030 |
− During agenda view construction (*note Agenda views::), the content |
|
7031 |
of archived trees is ignored unless you configure the option |
|
7032 |
‘org-agenda-skip-archived-trees’, in which case these trees will |
|
7033 |
always be included. In the agenda you can press ‘v a’ to get |
|
7034 |
archives temporarily included. |
|
7035 |
− Archived trees are not exported (*note Exporting::), only the |
|
7036 |
headline is. Configure the details using the variable |
|
7037 |
‘org-export-with-archived-trees’. |
|
7038 |
− Archived trees are excluded from column view unless the variable |
|
7039 |
‘org-columns-skip-archived-trees’ is configured to ‘nil’. |
|
7040 |
|
|
7041 |
The following commands help manage the ARCHIVE tag: |
|
7042 |
|
|
7043 |
‘C-c C-x a (org-toggle-archive-tag)’ |
|
7044 |
Toggle the ARCHIVE tag for the current headline. When the tag is |
|
7045 |
set, the headline changes to a shadowed face, and the subtree below |
|
7046 |
it is hidden. |
|
7047 |
‘C-u C-c C-x a’ |
|
7048 |
Check if any direct children of the current headline should be |
|
7049 |
archived. To do this, each subtree is checked for open TODO |
|
7050 |
entries. If none are found, the command offers to set the ARCHIVE |
|
7051 |
tag for the child. If the cursor is _not_ on a headline when this |
|
7052 |
command is invoked, the level 1 trees will be checked. |
|
7053 |
‘C-<TAB> (org-force-cycle-archived)’ |
|
7054 |
Cycle a tree even if it is tagged with ARCHIVE. |
|
7055 |
‘C-c C-x A (org-archive-to-archive-sibling)’ |
|
7056 |
Move the current entry to the _Archive Sibling_. This is a sibling |
|
7057 |
of the entry with the heading ‘Archive’ and the tag ‘ARCHIVE’. The |
|
7058 |
entry becomes a child of that sibling and in this way retains a lot |
|
7059 |
of its original context, including inherited tags and approximate |
|
7060 |
position in the outline. |
|
7061 |
|
|
7062 |
|
|
7063 |
File: org, Node: Agenda views, Next: Markup, Prev: Capture - Refile - Archive, Up: Top |
|
7064 |
|
|
7065 |
10 Agenda views |
|
7066 |
*************** |
|
7067 |
|
|
7068 |
Due to the way Org works, TODO items, time-stamped items, and tagged |
|
7069 |
headlines can be scattered throughout a file or even a number of files. |
|
7070 |
To get an overview of open action items, or of events that are important |
|
7071 |
for a particular date, this information must be collected, sorted and |
|
7072 |
displayed in an organized way. |
|
7073 |
|
|
7074 |
Org can select items based on various criteria and display them in a |
|
7075 |
separate buffer. Six different view types are provided: |
|
7076 |
|
|
7077 |
• an _agenda_ that is like a calendar and shows information for |
|
7078 |
specific dates, |
|
7079 |
• a _TODO list_ that covers all unfinished action items, |
|
7080 |
• a _match view_, showings headlines based on the tags, properties, |
|
7081 |
and TODO state associated with them, |
|
7082 |
• a _text search view_ that shows all entries from multiple files |
|
7083 |
that contain specified keywords, |
|
7084 |
• a _stuck projects view_ showing projects that currently don’t move |
|
7085 |
along, and |
|
7086 |
• _custom views_ that are special searches and combinations of |
|
7087 |
different views. |
|
7088 |
|
|
7089 |
The extracted information is displayed in a special _agenda buffer_. |
|
7090 |
This buffer is read-only, but provides commands to visit the |
|
7091 |
corresponding locations in the original Org files, and even to edit |
|
7092 |
these files remotely. |
|
7093 |
|
|
7094 |
By default, the report ignores commented (*note Comment lines::) and |
|
7095 |
archived (*note Internal archiving::) entries. You can override this by |
|
7096 |
setting ‘org-agenda-skip-comment-trees’ and |
|
7097 |
‘org-agenda-skip-archived-trees’ to ‘nil’. |
|
7098 |
|
|
7099 |
Two variables control how the agenda buffer is displayed and whether |
|
7100 |
the window configuration is restored when the agenda exits: |
|
7101 |
‘org-agenda-window-setup’ and ‘org-agenda-restore-windows-after-quit’. |
|
7102 |
|
|
7103 |
* Menu: |
|
7104 |
|
|
7105 |
* Agenda files:: Files being searched for agenda information |
|
7106 |
* Agenda dispatcher:: Keyboard access to agenda views |
|
7107 |
* Built-in agenda views:: What is available out of the box? |
|
7108 |
* Presentation and sorting:: How agenda items are prepared for display |
|
7109 |
* Agenda commands:: Remote editing of Org trees |
|
7110 |
* Custom agenda views:: Defining special searches and views |
|
7111 |
* Exporting agenda views:: Writing a view to a file |
|
7112 |
* Agenda column view:: Using column view for collected entries |
|
7113 |
|
|
7114 |
|
|
7115 |
File: org, Node: Agenda files, Next: Agenda dispatcher, Up: Agenda views |
|
7116 |
|
|
7117 |
10.1 Agenda files |
|
7118 |
================= |
|
7119 |
|
|
7120 |
The information to be shown is normally collected from all _agenda |
|
7121 |
files_, the files listed in the variable ‘org-agenda-files’(1). If a |
|
7122 |
directory is part of this list, all files with the extension ‘.org’ in |
|
7123 |
this directory will be part of the list. |
|
7124 |
|
|
7125 |
Thus, even if you only work with a single Org file, that file should |
|
7126 |
be put into the list(2). You can customize ‘org-agenda-files’, but the |
|
7127 |
easiest way to maintain it is through the following commands |
|
7128 |
|
|
7129 |
‘C-c [ (org-agenda-file-to-front)’ |
|
7130 |
Add current file to the list of agenda files. The file is added to |
|
7131 |
the front of the list. If it was already in the list, it is moved |
|
7132 |
to the front. With a prefix argument, file is added/moved to the |
|
7133 |
end. |
|
7134 |
‘C-c ] (org-remove-file)’ |
|
7135 |
Remove current file from the list of agenda files. |
|
7136 |
‘C-' (org-cycle-agenda-files)’ |
|
7137 |
‘C-,’ |
|
7138 |
Cycle through agenda file list, visiting one file after the other. |
|
7139 |
‘M-x org-switchb <RET>’ |
|
7140 |
Command to use an ‘iswitchb’-like interface to switch to and |
|
7141 |
between Org buffers. |
|
7142 |
|
|
7143 |
The Org menu contains the current list of files and can be used to visit |
|
7144 |
any of them. |
|
7145 |
|
|
7146 |
If you would like to focus the agenda temporarily on a file not in |
|
7147 |
this list, or on just one file in the list, or even on only a subtree in |
|
7148 |
a file, then this can be done in different ways. For a single agenda |
|
7149 |
command, you may press ‘<’ once or several times in the dispatcher |
|
7150 |
(*note Agenda dispatcher::). To restrict the agenda scope for an |
|
7151 |
extended period, use the following commands: |
|
7152 |
|
|
7153 |
‘C-c C-x < (org-agenda-set-restriction-lock)’ |
|
7154 |
Permanently restrict the agenda to the current subtree. When with |
|
7155 |
a prefix argument, or with the cursor before the first headline in |
|
7156 |
a file, the agenda scope is set to the entire file. This |
|
7157 |
restriction remains in effect until removed with ‘C-c C-x >’, or by |
|
7158 |
typing either ‘<’ or ‘>’ in the agenda dispatcher. If there is a |
|
7159 |
window displaying an agenda view, the new restriction takes effect |
|
7160 |
immediately. |
|
7161 |
‘C-c C-x > (org-agenda-remove-restriction-lock)’ |
|
7162 |
Remove the permanent restriction created by ‘C-c C-x <’. |
|
7163 |
|
|
7164 |
When working with ‘speedbar.el’, you can use the following commands in |
|
7165 |
the Speedbar frame: |
|
7166 |
|
|
7167 |
‘< in the speedbar frame (org-speedbar-set-agenda-restriction)’ |
|
7168 |
Permanently restrict the agenda to the item—either an Org file or a |
|
7169 |
subtree in such a file—at the cursor in the Speedbar frame. If |
|
7170 |
there is a window displaying an agenda view, the new restriction |
|
7171 |
takes effect immediately. |
|
7172 |
‘> in the speedbar frame (org-agenda-remove-restriction-lock)’ |
|
7173 |
Lift the restriction. |
|
7174 |
|
|
7175 |
---------- Footnotes ---------- |
|
7176 |
|
|
7177 |
(1) If the value of that variable is not a list, but a single file |
|
7178 |
name, then the list of agenda files will be maintained in that external |
|
7179 |
file. |
|
7180 |
|
|
7181 |
(2) When using the dispatcher, pressing ‘<’ before selecting a |
|
7182 |
command will actually limit the command to the current file, and ignore |
|
7183 |
‘org-agenda-files’ until the next dispatcher command. |
|
7184 |
|
|
7185 |
|
|
7186 |
File: org, Node: Agenda dispatcher, Next: Built-in agenda views, Prev: Agenda files, Up: Agenda views |
|
7187 |
|
|
7188 |
10.2 The agenda dispatcher |
|
7189 |
========================== |
|
7190 |
|
|
7191 |
The views are created through a dispatcher, which should be bound to a |
|
7192 |
global key—for example ‘C-c a’ (*note Activation::). In the following |
|
7193 |
we will assume that ‘C-c a’ is indeed how the dispatcher is accessed and |
|
7194 |
list keyboard access to commands accordingly. After pressing ‘C-c a’, |
|
7195 |
an additional letter is required to execute a command. The dispatcher |
|
7196 |
offers the following default commands: |
|
7197 |
|
|
7198 |
‘a’ |
|
7199 |
Create the calendar-like agenda (*note Weekly/daily agenda::). |
|
7200 |
‘t / T’ |
|
7201 |
Create a list of all TODO items (*note Global TODO list::). |
|
7202 |
‘m / M’ |
|
7203 |
Create a list of headlines matching a TAGS expression (*note |
|
7204 |
Matching tags and properties::). |
|
7205 |
‘s’ |
|
7206 |
Create a list of entries selected by a boolean expression of |
|
7207 |
keywords and/or regular expressions that must or must not occur in |
|
7208 |
the entry. |
|
7209 |
‘/’ |
|
7210 |
Search for a regular expression in all agenda files and |
|
7211 |
additionally in the files listed in |
|
7212 |
‘org-agenda-text-search-extra-files’. This uses the Emacs command |
|
7213 |
‘multi-occur’. A prefix argument can be used to specify the number |
|
7214 |
of context lines for each match, default is 1. |
|
7215 |
‘# / !’ |
|
7216 |
Create a list of stuck projects (*note Stuck projects::). |
|
7217 |
‘<’ |
|
7218 |
Restrict an agenda command to the current buffer(1). After |
|
7219 |
pressing ‘<’, you still need to press the character selecting the |
|
7220 |
command. |
|
7221 |
‘< <’ |
|
7222 |
If there is an active region, restrict the following agenda command |
|
7223 |
to the region. Otherwise, restrict it to the current subtree(2). |
|
7224 |
After pressing ‘< <’, you still need to press the character |
|
7225 |
selecting the command. |
|
7226 |
|
|
7227 |
‘*’ |
|
7228 |
Toggle sticky agenda views. By default, Org maintains only a |
|
7229 |
single agenda buffer and rebuilds it each time you change the view, |
|
7230 |
to make sure everything is always up to date. If you often switch |
|
7231 |
between agenda views and the build time bothers you, you can turn |
|
7232 |
on sticky agenda buffers or make this the default by customizing |
|
7233 |
the variable ‘org-agenda-sticky’. With sticky agendas, the agenda |
|
7234 |
dispatcher will not recreate agenda views from scratch, it will |
|
7235 |
only switch to the selected one, and you need to update the agenda |
|
7236 |
by hand with ‘r’ or ‘g’ when needed. You can toggle sticky agenda |
|
7237 |
view any time with ‘org-toggle-sticky-agenda’. |
|
7238 |
|
|
7239 |
You can also define custom commands that will be accessible through |
|
7240 |
the dispatcher, just like the default commands. This includes the |
|
7241 |
possibility to create extended agenda buffers that contain several |
|
7242 |
blocks together, for example the weekly agenda, the global TODO list and |
|
7243 |
a number of special tags matches. *Note Custom agenda views::. |
|
7244 |
|
|
7245 |
---------- Footnotes ---------- |
|
7246 |
|
|
7247 |
(1) For backward compatibility, you can also press ‘1’ to restrict to |
|
7248 |
the current buffer. |
|
7249 |
|
|
7250 |
(2) For backward compatibility, you can also press ‘0’ to restrict to |
|
7251 |
the current region/subtree. |
|
7252 |
|
|
7253 |
|
|
7254 |
File: org, Node: Built-in agenda views, Next: Presentation and sorting, Prev: Agenda dispatcher, Up: Agenda views |
|
7255 |
|
|
7256 |
10.3 The built-in agenda views |
|
7257 |
============================== |
|
7258 |
|
|
7259 |
In this section we describe the built-in views. |
|
7260 |
|
|
7261 |
* Menu: |
|
7262 |
|
|
7263 |
* Weekly/daily agenda:: The calendar page with current tasks |
|
7264 |
* Global TODO list:: All unfinished action items |
|
7265 |
* Matching tags and properties:: Structured information with fine-tuned search |
|
7266 |
* Search view:: Find entries by searching for text |
|
7267 |
* Stuck projects:: Find projects you need to review |
|
7268 |
|
|
7269 |
|
|
7270 |
File: org, Node: Weekly/daily agenda, Next: Global TODO list, Up: Built-in agenda views |
|
7271 |
|
|
7272 |
10.3.1 The weekly/daily agenda |
|
7273 |
------------------------------ |
|
7274 |
|
|
7275 |
The purpose of the weekly/daily _agenda_ is to act like a page of a |
|
7276 |
paper agenda, showing all the tasks for the current week or day. |
|
7277 |
|
|
7278 |
‘C-c a a (org-agenda-list)’ |
|
7279 |
Compile an agenda for the current week from a list of Org files. |
|
7280 |
The agenda shows the entries for each day. With a numeric |
|
7281 |
prefix(1) (like ‘C-u 2 1 C-c a a’) you may set the number of days |
|
7282 |
to be displayed. |
|
7283 |
|
|
7284 |
The default number of days displayed in the agenda is set by the |
|
7285 |
variable ‘org-agenda-span’ (or the obsolete ‘org-agenda-ndays’). This |
|
7286 |
variable can be set to any number of days you want to see by default in |
|
7287 |
the agenda, or to a span name, such as ‘day’, ‘week’, ‘month’ or ‘year’. |
|
7288 |
For weekly agendas, the default is to start on the previous monday (see |
|
7289 |
‘org-agenda-start-on-weekday’). You can also set the start date using a |
|
7290 |
date shift: ‘(setq org-agenda-start-day "+10d")’ will start the agenda |
|
7291 |
ten days from today in the future. |
|
7292 |
|
|
7293 |
Remote editing from the agenda buffer means, for example, that you |
|
7294 |
can change the dates of deadlines and appointments from the agenda |
|
7295 |
buffer. The commands available in the Agenda buffer are listed in *note |
|
7296 |
Agenda commands::. |
|
7297 |
|
|
7298 |
Calendar/Diary integration |
|
7299 |
.......................... |
|
7300 |
|
|
7301 |
Emacs contains the calendar and diary by Edward M. Reingold. The |
|
7302 |
calendar displays a three-month calendar with holidays from different |
|
7303 |
countries and cultures. The diary allows you to keep track of |
|
7304 |
anniversaries, lunar phases, sunrise/set, recurrent appointments |
|
7305 |
(weekly, monthly) and more. In this way, it is quite complementary to |
|
7306 |
Org. It can be very useful to combine output from Org with the diary. |
|
7307 |
|
|
7308 |
In order to include entries from the Emacs diary into Org mode’s |
|
7309 |
agenda, you only need to customize the variable |
|
7310 |
|
|
7311 |
(setq org-agenda-include-diary t) |
|
7312 |
|
|
7313 |
After that, everything will happen automatically. All diary entries |
|
7314 |
including holidays, anniversaries, etc., will be included in the agenda |
|
7315 |
buffer created by Org mode. <SPC>, <TAB>, and <RET> can be used from |
|
7316 |
the agenda buffer to jump to the diary file in order to edit existing |
|
7317 |
diary entries. The ‘i’ command to insert new entries for the current |
|
7318 |
date works in the agenda buffer, as well as the commands ‘S’, ‘M’, and |
|
7319 |
‘C’ to display Sunrise/Sunset times, show lunar phases and to convert to |
|
7320 |
other calendars, respectively. ‘c’ can be used to switch back and forth |
|
7321 |
between calendar and agenda. |
|
7322 |
|
|
7323 |
If you are using the diary only for sexp entries and holidays, it is |
|
7324 |
faster to not use the above setting, but instead to copy or even move |
|
7325 |
the entries into an Org file. Org mode evaluates diary-style sexp |
|
7326 |
entries, and does it faster because there is no overhead for first |
|
7327 |
creating the diary display. Note that the sexp entries must start at |
|
7328 |
the left margin, no whitespace is allowed before them. For example, the |
|
7329 |
following segment of an Org file will be processed and entries will be |
|
7330 |
made in the agenda: |
|
7331 |
|
|
7332 |
* Holidays |
|
7333 |
:PROPERTIES: |
|
7334 |
:CATEGORY: Holiday |
|
7335 |
:END: |
|
7336 |
%%(org-calendar-holiday) ; special function for holiday names |
|
7337 |
|
|
7338 |
* Birthdays |
|
7339 |
:PROPERTIES: |
|
7340 |
:CATEGORY: Ann |
|
7341 |
:END: |
|
7342 |
%%(org-anniversary 1956 5 14)(2) Arthur Dent is %d years old |
|
7343 |
%%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old |
|
7344 |
|
|
7345 |
Anniversaries from BBDB |
|
7346 |
....................... |
|
7347 |
|
|
7348 |
If you are using the Big Brothers Database to store your contacts, you |
|
7349 |
will very likely prefer to store anniversaries in BBDB rather than in a |
|
7350 |
separate Org or diary file. Org supports this and will show BBDB |
|
7351 |
anniversaries as part of the agenda. All you need to do is to add the |
|
7352 |
following to one of your agenda files: |
|
7353 |
|
|
7354 |
* Anniversaries |
|
7355 |
:PROPERTIES: |
|
7356 |
:CATEGORY: Anniv |
|
7357 |
:END: |
|
7358 |
%%(org-bbdb-anniversaries) |
|
7359 |
|
|
7360 |
You can then go ahead and define anniversaries for a BBDB record. |
|
7361 |
Basically, you need to press ‘C-o anniversary <RET>’ with the cursor in |
|
7362 |
a BBDB record and then add the date in the format ‘YYYY-MM-DD’ or |
|
7363 |
‘MM-DD’, followed by a space and the class of the anniversary |
|
7364 |
(‘birthday’ or ‘wedding’, or a format string). If you omit the class, |
|
7365 |
it will default to ‘birthday’. Here are a few examples, the header for |
|
7366 |
the file ‘org-bbdb.el’ contains more detailed information. |
|
7367 |
|
|
7368 |
1973-06-22 |
|
7369 |
06-22 |
|
7370 |
1955-08-02 wedding |
|
7371 |
2008-04-14 %s released version 6.01 of org mode, %d years ago |
|
7372 |
|
|
7373 |
After a change to BBDB, or for the first agenda display during an |
|
7374 |
Emacs session, the agenda display will suffer a short delay as Org |
|
7375 |
updates its hash with anniversaries. However, from then on things will |
|
7376 |
be very fast—much faster in fact than a long list of |
|
7377 |
‘%%(diary-anniversary)’ entries in an Org or Diary file. |
|
7378 |
|
|
7379 |
If you would like to see upcoming anniversaries with a bit of |
|
7380 |
forewarning, you can use the following instead: |
|
7381 |
|
|
7382 |
* Anniversaries |
|
7383 |
:PROPERTIES: |
|
7384 |
:CATEGORY: Anniv |
|
7385 |
:END: |
|
7386 |
%%(org-bbdb-anniversaries-future 3) |
|
7387 |
|
|
7388 |
That will give you three days’ warning: on the anniversary date |
|
7389 |
itself and the two days prior. The argument is optional: if omitted, it |
|
7390 |
defaults to 7. |
|
7391 |
|
|
7392 |
Appointment reminders |
|
7393 |
..................... |
|
7394 |
|
|
7395 |
Org can interact with Emacs appointments notification facility. To add |
|
7396 |
the appointments of your agenda files, use the command |
|
7397 |
‘org-agenda-to-appt’. This command lets you filter through the list of |
|
7398 |
your appointments and add only those belonging to a specific category or |
|
7399 |
matching a regular expression. It also reads a ‘APPT_WARNTIME’ property |
|
7400 |
which will then override the value of ‘appt-message-warning-time’ for |
|
7401 |
this appointment. See the docstring for details. |
|
7402 |
|
|
7403 |
---------- Footnotes ---------- |
|
7404 |
|
|
7405 |
(1) For backward compatibility, the universal prefix ‘C-u’ causes all |
|
7406 |
TODO entries to be listed before the agenda. This feature is |
|
7407 |
deprecated, use the dedicated TODO list, or a block agenda instead |
|
7408 |
(*note Block agenda::). |
|
7409 |
|
|
7410 |
(2) ‘org-anniversary’ is just like ‘diary-anniversary’, but the |
|
7411 |
argument order is always according to ISO and therefore independent of |
|
7412 |
the value of ‘calendar-date-style’. |
|
7413 |
|
|
7414 |
|
|
7415 |
File: org, Node: Global TODO list, Next: Matching tags and properties, Prev: Weekly/daily agenda, Up: Built-in agenda views |
|
7416 |
|
|
7417 |
10.3.2 The global TODO list |
|
7418 |
--------------------------- |
|
7419 |
|
|
7420 |
The global TODO list contains all unfinished TODO items formatted and |
|
7421 |
collected into a single place. |
|
7422 |
|
|
7423 |
‘C-c a t (org-todo-list)’ |
|
7424 |
Show the global TODO list. This collects the TODO items from all |
|
7425 |
agenda files (*note Agenda views::) into a single buffer. By |
|
7426 |
default, this lists items with a state the is not a DONE state. |
|
7427 |
The buffer is in ‘agenda-mode’, so there are commands to examine |
|
7428 |
and manipulate the TODO entries directly from that buffer (*note |
|
7429 |
Agenda commands::). |
|
7430 |
‘C-c a T (org-todo-list)’ |
|
7431 |
Like the above, but allows selection of a specific TODO keyword. |
|
7432 |
You can also do this by specifying a prefix argument to ‘C-c a t’. |
|
7433 |
You are prompted for a keyword, and you may also specify several |
|
7434 |
keywords by separating them with ‘|’ as the boolean OR operator. |
|
7435 |
With a numeric prefix, the Nth keyword in ‘org-todo-keywords’ is |
|
7436 |
selected. The ‘r’ key in the agenda buffer regenerates it, and you |
|
7437 |
can give a prefix argument to this command to change the selected |
|
7438 |
TODO keyword, for example ‘3 r’. If you often need a search for a |
|
7439 |
specific keyword, define a custom command for it (*note Agenda |
|
7440 |
dispatcher::). |
|
7441 |
Matching specific TODO keywords can also be done as part of a tags |
|
7442 |
search (*note Tag searches::). |
|
7443 |
|
|
7444 |
Remote editing of TODO items means that you can change the state of a |
|
7445 |
TODO entry with a single key press. The commands available in the TODO |
|
7446 |
list are described in *note Agenda commands::. |
|
7447 |
|
|
7448 |
Normally the global TODO list simply shows all headlines with TODO |
|
7449 |
keywords. This list can become very long. There are two ways to keep |
|
7450 |
it more compact: |
|
7451 |
− Some people view a TODO item that has been _scheduled_ for |
|
7452 |
execution or have a _deadline_ (*note Timestamps::) as no longer |
|
7453 |
_open_. Configure the variables |
|
7454 |
‘org-agenda-todo-ignore-scheduled’, |
|
7455 |
‘org-agenda-todo-ignore-deadlines’, |
|
7456 |
‘org-agenda-todo-ignore-timestamp’ and/or |
|
7457 |
‘org-agenda-todo-ignore-with-date’ to exclude such items from the |
|
7458 |
global TODO list. |
|
7459 |
− TODO items may have sublevels to break up the task into subtasks. |
|
7460 |
In such cases it may be enough to list only the highest level TODO |
|
7461 |
headline and omit the sublevels from the global list. Configure |
|
7462 |
the variable ‘org-agenda-todo-list-sublevels’ to get this behavior. |
|
7463 |
|
|
7464 |
|
|
7465 |
File: org, Node: Matching tags and properties, Next: Search view, Prev: Global TODO list, Up: Built-in agenda views |
|
7466 |
|
|
7467 |
10.3.3 Matching tags and properties |
|
7468 |
----------------------------------- |
|
7469 |
|
|
7470 |
If headlines in the agenda files are marked with _tags_ (*note Tags::), |
|
7471 |
or have properties (*note Properties and columns::), you can select |
|
7472 |
headlines based on this metadata and collect them into an agenda buffer. |
|
7473 |
The match syntax described here also applies when creating sparse trees |
|
7474 |
with ‘C-c / m’. |
|
7475 |
|
|
7476 |
‘C-c a m (org-tags-view)’ |
|
7477 |
Produce a list of all headlines that match a given set of tags. |
|
7478 |
The command prompts for a selection criterion, which is a boolean |
|
7479 |
logic expression with tags, like ‘+work+urgent-withboss’ or |
|
7480 |
‘work|home’ (*note Tags::). If you often need a specific search, |
|
7481 |
define a custom command for it (*note Agenda dispatcher::). |
|
7482 |
‘C-c a M (org-tags-view)’ |
|
7483 |
Like ‘C-c a m’, but only select headlines that are also TODO items |
|
7484 |
in a not-DONE state and force checking subitems (see variable |
|
7485 |
‘org-tags-match-list-sublevels’). To exclude scheduled/deadline |
|
7486 |
items, see the variable |
|
7487 |
‘org-agenda-tags-todo-honor-ignore-options’. Matching specific |
|
7488 |
TODO keywords together with a tags match is also possible, see |
|
7489 |
*note Tag searches::. |
|
7490 |
|
|
7491 |
The commands available in the tags list are described in *note Agenda |
|
7492 |
commands::. |
|
7493 |
|
|
7494 |
Match syntax |
|
7495 |
............ |
|
7496 |
|
|
7497 |
A search string can use Boolean operators ‘&’ for ‘AND’ and ‘|’ for |
|
7498 |
‘OR’. ‘&’ binds more strongly than ‘|’. Parentheses are not |
|
7499 |
implemented. Each element in the search is either a tag, a regular |
|
7500 |
expression matching tags, or an expression like ‘PROPERTY OPERATOR |
|
7501 |
VALUE’ with a comparison operator, accessing a property value. Each |
|
7502 |
element may be preceded by ‘-’, to select against it, and ‘+’ is |
|
7503 |
syntactic sugar for positive selection. The ‘AND’ operator ‘&’ is |
|
7504 |
optional when ‘+’ or ‘-’ is present. Here are some examples, using only |
|
7505 |
tags. |
|
7506 |
|
|
7507 |
‘work’ |
|
7508 |
Select headlines tagged ‘:work:’. |
|
7509 |
‘work&boss’ |
|
7510 |
Select headlines tagged ‘:work:’ and ‘:boss:’. |
|
7511 |
‘+work-boss’ |
|
7512 |
Select headlines tagged ‘:work:’, but discard those also tagged |
|
7513 |
‘:boss:’. |
|
7514 |
‘work|laptop’ |
|
7515 |
Selects lines tagged ‘:work:’ or ‘:laptop:’. |
|
7516 |
‘work|laptop+night’ |
|
7517 |
Like before, but require the ‘:laptop:’ lines to be tagged also |
|
7518 |
‘:night:’. |
|
7519 |
|
|
7520 |
Instead of a tag, you may also specify a regular expression enclosed |
|
7521 |
in curly braces. For example, ‘work+{^boss.*}’ matches headlines that |
|
7522 |
contain the tag ‘:work:’ and any tag starting with ‘boss’. |
|
7523 |
|
|
7524 |
Group tags (*note Tag hierarchy::) are expanded as regular |
|
7525 |
expressions. E.g., if ‘:work:’ is a group tag for the group |
|
7526 |
‘:work:lab:conf:’, then searching for ‘work’ will search for |
|
7527 |
‘{\(?:work\|lab\|conf\)}’ and searching for ‘-work’ will search for all |
|
7528 |
headlines but those with one of the tags in the group (i.e., |
|
7529 |
‘-{\(?:work\|lab\|conf\)}’). |
|
7530 |
|
|
7531 |
You may also test for properties (*note Properties and columns::) at |
|
7532 |
the same time as matching tags. The properties may be real properties, |
|
7533 |
or special properties that represent other metadata (*note Special |
|
7534 |
properties::). For example, the “property” ‘TODO’ represents the TODO |
|
7535 |
keyword of the entry and the “property” ‘PRIORITY’ represents the |
|
7536 |
PRIORITY keyword of the entry. |
|
7537 |
|
|
7538 |
In addition to the properties mentioned above, ‘LEVEL’ represents the |
|
7539 |
level of an entry. So a search ‘+LEVEL=3+boss-TODO="DONE"’ lists all |
|
7540 |
level three headlines that have the tag ‘boss’ and are _not_ marked with |
|
7541 |
the TODO keyword DONE. In buffers with ‘org-odd-levels-only’ set, |
|
7542 |
‘LEVEL’ does not count the number of stars, but ‘LEVEL=2’ will |
|
7543 |
correspond to 3 stars etc. |
|
7544 |
|
|
7545 |
Here are more examples: |
|
7546 |
|
|
7547 |
‘work+TODO="WAITING"’ |
|
7548 |
Select ‘:work:’-tagged TODO lines with the specific TODO keyword |
|
7549 |
‘WAITING’. |
|
7550 |
‘work+TODO="WAITING"|home+TODO="WAITING"’ |
|
7551 |
Waiting tasks both at work and at home. |
|
7552 |
|
|
7553 |
When matching properties, a number of different operators can be used |
|
7554 |
to test the value of a property. Here is a complex example: |
|
7555 |
|
|
7556 |
+work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2 \ |
|
7557 |
+With={Sarah\|Denny}+SCHEDULED>="<2008-10-11>" |
|
7558 |
|
|
7559 |
The type of comparison will depend on how the comparison value is |
|
7560 |
written: |
|
7561 |
− If the comparison value is a plain number, a numerical comparison |
|
7562 |
is done, and the allowed operators are ‘<’, ‘=’, ‘>’, ‘<=’, ‘>=’, |
|
7563 |
and ‘<>’. |
|
7564 |
− If the comparison value is enclosed in double-quotes, a string |
|
7565 |
comparison is done, and the same operators are allowed. |
|
7566 |
− If the comparison value is enclosed in double-quotes _and_ angular |
|
7567 |
brackets (like ‘DEADLINE<="<2008-12-24 18:30>"’), both values are |
|
7568 |
assumed to be date/time specifications in the standard Org way, and |
|
7569 |
the comparison will be done accordingly. Special values that will |
|
7570 |
be recognized are ‘"<now>"’ for now (including time), and |
|
7571 |
‘"<today>"’, and ‘"<tomorrow>"’ for these days at 00:00 hours, |
|
7572 |
i.e., without a time specification. Also strings like ‘"<+5d>"’ or |
|
7573 |
‘"<-2m>"’ with units ‘d’, ‘w’, ‘m’, and ‘y’ for day, week, month, |
|
7574 |
and year, respectively, can be used. |
|
7575 |
− If the comparison value is enclosed in curly braces, a regexp match |
|
7576 |
is performed, with ‘=’ meaning that the regexp matches the property |
|
7577 |
value, and ‘<>’ meaning that it does not match. |
|
7578 |
|
|
7579 |
So the search string in the example finds entries tagged ‘:work:’ but |
|
7580 |
not ‘:boss:’, which also have a priority value ‘A’, a ‘:Coffee:’ |
|
7581 |
property with the value ‘unlimited’, an ‘Effort’ property that is |
|
7582 |
numerically smaller than 2, a ‘:With:’ property that is matched by the |
|
7583 |
regular expression ‘Sarah\|Denny’, and that are scheduled on or after |
|
7584 |
October 11, 2008. |
|
7585 |
|
|
7586 |
You can configure Org mode to use property inheritance during a |
|
7587 |
search, but beware that this can slow down searches considerably. See |
|
7588 |
*note Property inheritance::, for details. |
|
7589 |
|
|
7590 |
For backward compatibility, and also for typing speed, there is also |
|
7591 |
a different way to test TODO states in a search. For this, terminate |
|
7592 |
the tags/property part of the search string (which may include several |
|
7593 |
terms connected with ‘|’) with a ‘/’ and then specify a Boolean |
|
7594 |
expression just for TODO keywords. The syntax is then similar to that |
|
7595 |
for tags, but should be applied with care: for example, a positive |
|
7596 |
selection on several TODO keywords cannot meaningfully be combined with |
|
7597 |
boolean AND. However, _negative selection_ combined with AND can be |
|
7598 |
meaningful. To make sure that only lines are checked that actually have |
|
7599 |
any TODO keyword (resulting in a speed-up), use ‘C-c a M’, or |
|
7600 |
equivalently start the TODO part after the slash with ‘!’. Using ‘C-c a |
|
7601 |
M’ or ‘/!’ will not match TODO keywords in a DONE state. Examples: |
|
7602 |
|
|
7603 |
‘work/WAITING’ |
|
7604 |
Same as ‘work+TODO="WAITING"’ |
|
7605 |
‘work/!-WAITING-NEXT’ |
|
7606 |
Select ‘:work:’-tagged TODO lines that are neither ‘WAITING’ nor |
|
7607 |
‘NEXT’ |
|
7608 |
‘work/!+WAITING|+NEXT’ |
|
7609 |
Select ‘:work:’-tagged TODO lines that are either ‘WAITING’ or |
|
7610 |
‘NEXT’. |
|
7611 |
|
|
7612 |
|
|
7613 |
File: org, Node: Search view, Next: Stuck projects, Prev: Matching tags and properties, Up: Built-in agenda views |
|
7614 |
|
|
7615 |
10.3.4 Search view |
|
7616 |
------------------ |
|
7617 |
|
|
7618 |
This agenda view is a general text search facility for Org mode entries. |
|
7619 |
It is particularly useful to find notes. |
|
7620 |
|
|
7621 |
‘C-c a s (org-search-view)’ |
|
7622 |
This is a special search that lets you select entries by matching a |
|
7623 |
substring or specific words using a boolean logic. |
|
7624 |
For example, the search string ‘computer equipment’ will find entries |
|
7625 |
that contain ‘computer equipment’ as a substring. If the two words are |
|
7626 |
separated by more space or a line break, the search will still match. |
|
7627 |
Search view can also search for specific keywords in the entry, using |
|
7628 |
Boolean logic. The search string ‘+computer +wifi -ethernet |
|
7629 |
-{8\.11[bg]}’ will search for note entries that contain the keywords |
|
7630 |
‘computer’ and ‘wifi’, but not the keyword ‘ethernet’, and which are |
|
7631 |
also not matched by the regular expression ‘8\.11[bg]’, meaning to |
|
7632 |
exclude both 8.11b and 8.11g. The first ‘+’ is necessary to turn on |
|
7633 |
word search, other ‘+’ characters are optional. For more details, see |
|
7634 |
the docstring of the command ‘org-search-view’. |
|
7635 |
|
|
7636 |
Note that in addition to the agenda files, this command will also |
|
7637 |
search the files listed in ‘org-agenda-text-search-extra-files’. |
|
7638 |
|
|
7639 |
|
|
7640 |
File: org, Node: Stuck projects, Prev: Search view, Up: Built-in agenda views |
|
7641 |
|
|
7642 |
10.3.5 Stuck projects |
|
7643 |
--------------------- |
|
7644 |
|
|
7645 |
If you are following a system like David Allen’s GTD to organize your |
|
7646 |
work, one of the “duties” you have is a regular review to make sure that |
|
7647 |
all projects move along. A _stuck_ project is a project that has no |
|
7648 |
defined next actions, so it will never show up in the TODO lists Org |
|
7649 |
mode produces. During the review, you need to identify such projects |
|
7650 |
and define next actions for them. |
|
7651 |
|
|
7652 |
‘C-c a # (org-agenda-list-stuck-projects)’ |
|
7653 |
List projects that are stuck. |
|
7654 |
‘C-c a !’ |
|
7655 |
Customize the variable ‘org-stuck-projects’ to define what a stuck |
|
7656 |
project is and how to find it. |
|
7657 |
|
|
7658 |
You almost certainly will have to configure this view before it will |
|
7659 |
work for you. The built-in default assumes that all your projects are |
|
7660 |
level-2 headlines, and that a project is not stuck if it has at least |
|
7661 |
one entry marked with a TODO keyword TODO or NEXT or NEXTACTION. |
|
7662 |
|
|
7663 |
Let’s assume that you, in your own way of using Org mode, identify |
|
7664 |
projects with a tag PROJECT, and that you use a TODO keyword MAYBE to |
|
7665 |
indicate a project that should not be considered yet. Let’s further |
|
7666 |
assume that the TODO keyword DONE marks finished projects, and that NEXT |
|
7667 |
and TODO indicate next actions. The tag @SHOP indicates shopping and is |
|
7668 |
a next action even without the NEXT tag. Finally, if the project |
|
7669 |
contains the special word IGNORE anywhere, it should not be listed |
|
7670 |
either. In this case you would start by identifying eligible projects |
|
7671 |
with a tags/todo match(1) ‘+PROJECT/-MAYBE-DONE’, and then check for |
|
7672 |
TODO, NEXT, @SHOP, and IGNORE in the subtree to identify projects that |
|
7673 |
are not stuck. The correct customization for this is |
|
7674 |
|
|
7675 |
(setq org-stuck-projects |
|
7676 |
'("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@SHOP") |
|
7677 |
"\\<IGNORE\\>")) |
|
7678 |
|
|
7679 |
Note that if a project is identified as non-stuck, the subtree of |
|
7680 |
this entry will still be searched for stuck projects. |
|
7681 |
|
|
7682 |
---------- Footnotes ---------- |
|
7683 |
|
|
7684 |
(1) *Note Tag searches::. |
|
7685 |
|
|
7686 |
|
|
7687 |
File: org, Node: Presentation and sorting, Next: Agenda commands, Prev: Built-in agenda views, Up: Agenda views |
|
7688 |
|
|
7689 |
10.4 Presentation and sorting |
|
7690 |
============================= |
|
7691 |
|
|
7692 |
Before displaying items in an agenda view, Org mode visually prepares |
|
7693 |
the items and sorts them. Each item occupies a single line. The line |
|
7694 |
starts with a _prefix_ that contains the _category_ (*note Categories::) |
|
7695 |
of the item and other important information. You can customize in which |
|
7696 |
column tags will be displayed through ‘org-agenda-tags-column’. You can |
|
7697 |
also customize the prefix using the option ‘org-agenda-prefix-format’. |
|
7698 |
This prefix is followed by a cleaned-up version of the outline headline |
|
7699 |
associated with the item. |
|
7700 |
|
|
7701 |
* Menu: |
|
7702 |
|
|
7703 |
* Categories:: Not all tasks are equal |
|
7704 |
* Time-of-day specifications:: How the agenda knows the time |
|
7705 |
* Sorting agenda items:: The order of things |
|
7706 |
* Filtering/limiting agenda items:: Dynamically narrow the agenda |
|
7707 |
|
|
7708 |
|
|
7709 |
File: org, Node: Categories, Next: Time-of-day specifications, Up: Presentation and sorting |
|
7710 |
|
|
7711 |
10.4.1 Categories |
|
7712 |
----------------- |
|
7713 |
|
|
7714 |
The category is a broad label assigned to each agenda item. By default, |
|
7715 |
the category is simply derived from the file name, but you can also |
|
7716 |
specify it with a special line in the buffer, like this: |
|
7717 |
|
|
7718 |
#+CATEGORY: Thesis |
|
7719 |
|
|
7720 |
If you would like to have a special ‘CATEGORY’ for a single entry or a |
|
7721 |
(sub)tree, give the entry a ‘:CATEGORY:’ property with the special |
|
7722 |
category you want to apply as the value. |
|
7723 |
|
|
7724 |
The display in the agenda buffer looks best if the category is not |
|
7725 |
longer than 10 characters. |
|
7726 |
|
|
7727 |
You can set up icons for category by customizing the |
|
7728 |
‘org-agenda-category-icon-alist’ variable. |
|
7729 |
|
|
7730 |
|
|
7731 |
File: org, Node: Time-of-day specifications, Next: Sorting agenda items, Prev: Categories, Up: Presentation and sorting |
|
7732 |
|
|
7733 |
10.4.2 Time-of-day specifications |
|
7734 |
--------------------------------- |
|
7735 |
|
|
7736 |
Org mode checks each agenda item for a time-of-day specification. The |
|
7737 |
time can be part of the timestamp that triggered inclusion into the |
|
7738 |
agenda, for example as in ‘<2005-05-10 Tue 19:00>’. Time ranges can be |
|
7739 |
specified with two timestamps, like |
|
7740 |
‘<2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15>’. |
|
7741 |
|
|
7742 |
In the headline of the entry itself, a time(range) may also appear as |
|
7743 |
plain text (like ‘12:45’ or a ‘8:30-1pm’)(1). |
|
7744 |
|
|
7745 |
If the agenda integrates the Emacs diary (*note Weekly/daily |
|
7746 |
agenda::), time specifications in diary entries are recognized as well. |
|
7747 |
|
|
7748 |
For agenda display, Org mode extracts the time and displays it in a |
|
7749 |
standard 24 hour format as part of the prefix. The example times in the |
|
7750 |
previous paragraphs would end up in the agenda like this: |
|
7751 |
|
|
7752 |
8:30-13:00 Arthur Dent lies in front of the bulldozer |
|
7753 |
12:45...... Ford Prefect arrives and takes Arthur to the pub |
|
7754 |
19:00...... The Vogon reads his poem |
|
7755 |
20:30-22:15 Marvin escorts the Hitchhikers to the bridge |
|
7756 |
|
|
7757 |
If the agenda is in single-day mode, or for the display of today, the |
|
7758 |
timed entries are embedded in a time grid, like |
|
7759 |
|
|
7760 |
8:00...... ------------------ |
|
7761 |
8:30-13:00 Arthur Dent lies in front of the bulldozer |
|
7762 |
10:00...... ------------------ |
|
7763 |
12:00...... ------------------ |
|
7764 |
12:45...... Ford Prefect arrives and takes Arthur to the pub |
|
7765 |
14:00...... ------------------ |
|
7766 |
16:00...... ------------------ |
|
7767 |
18:00...... ------------------ |
|
7768 |
19:00...... The Vogon reads his poem |
|
7769 |
20:00...... ------------------ |
|
7770 |
20:30-22:15 Marvin escorts the Hitchhikers to the bridge |
|
7771 |
|
|
7772 |
The time grid can be turned on and off with the variable |
|
7773 |
‘org-agenda-use-time-grid’, and can be configured with |
|
7774 |
‘org-agenda-time-grid’. |
|
7775 |
|
|
7776 |
---------- Footnotes ---------- |
|
7777 |
|
|
7778 |
(1) You can, however, disable this by setting |
|
7779 |
‘org-agenda-search-headline-for-time’ variable to a ‘nil’ value. |
|
7780 |
|
|
7781 |
|
|
7782 |
File: org, Node: Sorting agenda items, Next: Filtering/limiting agenda items, Prev: Time-of-day specifications, Up: Presentation and sorting |
|
7783 |
|
|
7784 |
10.4.3 Sorting agenda items |
|
7785 |
--------------------------- |
|
7786 |
|
|
7787 |
Before being inserted into a view, the items are sorted. How this is |
|
7788 |
done depends on the type of view. |
|
7789 |
• For the daily/weekly agenda, the items for each day are sorted. |
|
7790 |
The default order is to first collect all items containing an |
|
7791 |
explicit time-of-day specification. These entries will be shown at |
|
7792 |
the beginning of the list, as a _schedule_ for the day. After |
|
7793 |
that, items remain grouped in categories, in the sequence given by |
|
7794 |
‘org-agenda-files’. Within each category, items are sorted by |
|
7795 |
priority (*note Priorities::), which is composed of the base |
|
7796 |
priority (2000 for priority ‘A’, 1000 for ‘B’, and 0 for ‘C’), plus |
|
7797 |
additional increments for overdue scheduled or deadline items. |
|
7798 |
• For the TODO list, items remain in the order of categories, but |
|
7799 |
within each category, sorting takes place according to priority |
|
7800 |
(*note Priorities::). The priority used for sorting derives from |
|
7801 |
the priority cookie, with additions depending on how close an item |
|
7802 |
is to its due or scheduled date. |
|
7803 |
• For tags matches, items are not sorted at all, but just appear in |
|
7804 |
the sequence in which they are found in the agenda files. |
|
7805 |
|
|
7806 |
Sorting can be customized using the variable |
|
7807 |
‘org-agenda-sorting-strategy’, and may also include criteria based on |
|
7808 |
the estimated effort of an entry (*note Effort estimates::). |
|
7809 |
|
|
7810 |
|
|
7811 |
File: org, Node: Filtering/limiting agenda items, Prev: Sorting agenda items, Up: Presentation and sorting |
|
7812 |
|
|
7813 |
10.4.4 Filtering/limiting agenda items |
|
7814 |
-------------------------------------- |
|
7815 |
|
|
7816 |
Agenda built-in or customized commands are statically defined. Agenda |
|
7817 |
filters and limits provide two ways of dynamically narrowing down the |
|
7818 |
list of agenda entries: _filters_ and _limits_. Filters only act on the |
|
7819 |
display of the items, while limits take effect before the list of agenda |
|
7820 |
entries is built. Filters are more often used interactively, while |
|
7821 |
limits are mostly useful when defined as local variables within custom |
|
7822 |
agenda commands. |
|
7823 |
|
|
7824 |
Filtering in the agenda |
|
7825 |
....................... |
|
7826 |
|
|
7827 |
‘/ (org-agenda-filter-by-tag)’ |
|
7828 |
Filter the agenda view with respect to a tag and/or effort |
|
7829 |
estimates. The difference between this and a custom agenda command |
|
7830 |
is that filtering is very fast, so that you can switch quickly |
|
7831 |
between different filters without having to recreate the agenda.(1) |
|
7832 |
|
|
7833 |
You will be prompted for a tag selection letter; <SPC> will mean |
|
7834 |
any tag at all. Pressing <TAB> at that prompt will offer use |
|
7835 |
completion to select a tag (including any tags that do not have a |
|
7836 |
selection character). The command then hides all entries that do |
|
7837 |
not contain or inherit this tag. When called with prefix arg, |
|
7838 |
remove the entries that _do_ have the tag. A second ‘/’ at the |
|
7839 |
prompt will turn off the filter and unhide any hidden entries. |
|
7840 |
Pressing ‘+’ or ‘-’ switches between filtering and excluding the |
|
7841 |
next tag. |
|
7842 |
|
|
7843 |
Org also supports automatic, context-aware tag filtering. If the |
|
7844 |
variable ‘org-agenda-auto-exclude-function’ is set to a |
|
7845 |
user-defined function, that function can decide which tags should |
|
7846 |
be excluded from the agenda automatically. Once this is set, the |
|
7847 |
‘/’ command then accepts ‘<RET>’ as a sub-option key and runs the |
|
7848 |
auto exclusion logic. For example, let’s say you use a ‘Net’ tag |
|
7849 |
to identify tasks which need network access, an ‘Errand’ tag for |
|
7850 |
errands in town, and a ‘Call’ tag for making phone calls. You |
|
7851 |
could auto-exclude these tags based on the availability of the |
|
7852 |
Internet, and outside of business hours, with something like this: |
|
7853 |
|
|
7854 |
(defun org-my-auto-exclude-function (tag) |
|
7855 |
(and (cond |
|
7856 |
((string= tag "Net") |
|
7857 |
(/= 0 (call-process "/sbin/ping" nil nil nil |
|
7858 |
"-c1" "-q" "-t1" "mail.gnu.org"))) |
|
7859 |
((or (string= tag "Errand") (string= tag "Call")) |
|
7860 |
(let ((hour (nth 2 (decode-time)))) |
|
7861 |
(or (< hour 8) (> hour 21))))) |
|
7862 |
(concat "-" tag))) |
|
7863 |
|
|
7864 |
(setq org-agenda-auto-exclude-function 'org-my-auto-exclude-function) |
|
7865 |
|
|
7866 |
‘[ ] { }’ |
|
7867 |
in search view |
|
7868 |
add new search words (‘[’ and ‘]’) or new regular expressions |
|
7869 |
(‘{’ and ‘}’) to the query string. The opening bracket/brace |
|
7870 |
will add a positive search term prefixed by ‘+’, indicating |
|
7871 |
that this search term must occur/match in the entry. The |
|
7872 |
closing bracket/brace will add a negative search term which |
|
7873 |
must not occur/match in the entry for it to be selected. |
|
7874 |
|
|
7875 |
‘< (org-agenda-filter-by-category)’ |
|
7876 |
|
|
7877 |
Filter the current agenda view with respect to the category of the |
|
7878 |
item at point. Pressing ‘<’ another time will remove this filter. |
|
7879 |
When called with a prefix argument exclude the category of the item |
|
7880 |
at point from the agenda. |
|
7881 |
|
|
7882 |
You can add a filter preset in custom agenda commands through the |
|
7883 |
option ‘org-agenda-category-filter-preset’. *Note Setting |
|
7884 |
options::. |
|
7885 |
|
|
7886 |
‘^ (org-agenda-filter-by-top-headline)’ |
|
7887 |
Filter the current agenda view and only display the siblings and |
|
7888 |
the parent headline of the one at point. |
|
7889 |
|
|
7890 |
‘= (org-agenda-filter-by-regexp)’ |
|
7891 |
|
|
7892 |
Filter the agenda view by a regular expression: only show agenda |
|
7893 |
entries matching the regular expression the user entered. When |
|
7894 |
called with a prefix argument, it will filter _out_ entries |
|
7895 |
matching the regexp. With two universal prefix arguments, it will |
|
7896 |
remove all the regexp filters, which can be accumulated. |
|
7897 |
|
|
7898 |
You can add a filter preset in custom agenda commands through the |
|
7899 |
option ‘org-agenda-regexp-filter-preset’. *Note Setting options::. |
|
7900 |
|
|
7901 |
‘_ (org-agenda-filter-by-effort)’ |
|
7902 |
Filter the agenda view with respect to effort estimates. You first |
|
7903 |
need to set up allowed efforts globally, for example |
|
7904 |
(setq org-global-properties |
|
7905 |
'(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00"))) |
|
7906 |
You can then filter for an effort by first typing an operator, one |
|
7907 |
of ‘<’, ‘>’, and ‘=’, and then the one-digit index of an effort |
|
7908 |
estimate in your array of allowed values, where ‘0’ means the 10th |
|
7909 |
value. The filter will then restrict to entries with effort |
|
7910 |
smaller-or-equal, equal, or larger-or-equal than the selected |
|
7911 |
value. For application of the operator, entries without a defined |
|
7912 |
effort will be treated according to the value of |
|
7913 |
‘org-sort-agenda-noeffort-is-high’. |
|
7914 |
|
|
7915 |
When called with a prefix argument, it will remove entries matching |
|
7916 |
the condition. With two universal prefix arguments, it will clear |
|
7917 |
effort filters, which can be accumulated. |
|
7918 |
|
|
7919 |
You can add a filter preset in custom agenda commands through the |
|
7920 |
option ‘org-agenda-effort-filter-preset’. *Note Setting options::. |
|
7921 |
|
|
7922 |
‘| (org-agenda-filter-remove-all)’ |
|
7923 |
Remove all filters in the current agenda view. |
|
7924 |
|
|
7925 |
Setting limits for the agenda |
|
7926 |
............................. |
|
7927 |
|
|
7928 |
Here is a list of options that you can set, either globally, or locally |
|
7929 |
in your custom agenda views (*note Custom agenda views::). |
|
7930 |
|
|
7931 |
‘org-agenda-max-entries’ |
|
7932 |
Limit the number of entries. |
|
7933 |
‘org-agenda-max-effort’ |
|
7934 |
Limit the duration of accumulated efforts (as minutes). |
|
7935 |
‘org-agenda-max-todos’ |
|
7936 |
Limit the number of entries with TODO keywords. |
|
7937 |
‘org-agenda-max-tags’ |
|
7938 |
Limit the number of tagged entries. |
|
7939 |
|
|
7940 |
When set to a positive integer, each option will exclude entries from |
|
7941 |
other categories: for example, ‘(setq org-agenda-max-effort 100)’ will |
|
7942 |
limit the agenda to 100 minutes of effort and exclude any entry that has |
|
7943 |
no effort property. If you want to include entries with no effort |
|
7944 |
property, use a negative value for ‘org-agenda-max-effort’. |
|
7945 |
|
|
7946 |
One useful setup is to use ‘org-agenda-max-entries’ locally in a |
|
7947 |
custom command. For example, this custom command will display the next |
|
7948 |
five entries with a ‘NEXT’ TODO keyword. |
|
7949 |
|
|
7950 |
(setq org-agenda-custom-commands |
|
7951 |
'(("n" todo "NEXT" |
|
7952 |
((org-agenda-max-entries 5))))) |
|
7953 |
|
|
7954 |
Once you mark one of these five entry as ‘DONE’, rebuilding the |
|
7955 |
agenda will again the next five entries again, including the first entry |
|
7956 |
that was excluded so far. |
|
7957 |
|
|
7958 |
You can also dynamically set temporary limits, which will be lost |
|
7959 |
when rebuilding the agenda: |
|
7960 |
|
|
7961 |
‘~ (org-agenda-limit-interactively)’ |
|
7962 |
This prompts for the type of limit to apply and its value. |
|
7963 |
|
|
7964 |
---------- Footnotes ---------- |
|
7965 |
|
|
7966 |
(1) Custom commands can preset a filter by binding the variable |
|
7967 |
‘org-agenda-tag-filter-preset’ as an option. This filter will then be |
|
7968 |
applied to the view and persist as a basic filter through refreshes and |
|
7969 |
more secondary filtering. The filter is a global property of the entire |
|
7970 |
agenda view—in a block agenda, you should only set this in the global |
|
7971 |
options section, not in the section of an individual block. |
|
7972 |
|
|
7973 |
|
|
7974 |
File: org, Node: Agenda commands, Next: Custom agenda views, Prev: Presentation and sorting, Up: Agenda views |
|
7975 |
|
|
7976 |
10.5 Commands in the agenda buffer |
|
7977 |
================================== |
|
7978 |
|
|
7979 |
Entries in the agenda buffer are linked back to the Org file or diary |
|
7980 |
file where they originate. You are not allowed to edit the agenda |
|
7981 |
buffer itself, but commands are provided to show and jump to the |
|
7982 |
original entry location, and to edit the Org files “remotely” from the |
|
7983 |
agenda buffer. In this way, all information is stored only once, |
|
7984 |
removing the risk that your agenda and note files may diverge. |
|
7985 |
|
|
7986 |
Some commands can be executed with mouse clicks on agenda lines. For |
|
7987 |
the other commands, the cursor needs to be in the desired line. |
|
7988 |
|
|
7989 |
Motion |
|
7990 |
...... |
|
7991 |
|
|
7992 |
‘n (org-agenda-next-line)’ |
|
7993 |
Next line (same as <DOWN> and ‘C-n’). |
|
7994 |
‘p (org-agenda-previous-line)’ |
|
7995 |
Previous line (same as <UP> and ‘C-p’). |
|
7996 |
‘N (org-agenda-next-item)’ |
|
7997 |
Next item: same as next line, but only consider items. |
|
7998 |
‘P (org-agenda-previous-item)’ |
|
7999 |
Previous item: same as previous line, but only consider items. |
|
8000 |
|
|
8001 |
View/Go to Org file |
|
8002 |
................... |
|
8003 |
|
|
8004 |
‘<SPC> or mouse-3 (org-agenda-show-and-scroll-up)’ |
|
8005 |
Display the original location of the item in another window. With |
|
8006 |
prefix arg, make sure that drawers stay folded. |
|
8007 |
‘L (org-agenda-recenter)’ |
|
8008 |
Display original location and recenter that window. |
|
8009 |
‘<TAB> or mouse-2 (org-agenda-goto)’ |
|
8010 |
Go to the original location of the item in another window. |
|
8011 |
‘<RET> (org-agenda-switch-to)’ |
|
8012 |
Go to the original location of the item and delete other windows. |
|
8013 |
‘F (org-agenda-follow-mode)’ |
|
8014 |
Toggle Follow mode. In Follow mode, as you move the cursor through |
|
8015 |
the agenda buffer, the other window always shows the corresponding |
|
8016 |
location in the Org file. The initial setting for this mode in new |
|
8017 |
agenda buffers can be set with the variable |
|
8018 |
‘org-agenda-start-with-follow-mode’. |
|
8019 |
‘C-c C-x b (org-agenda-tree-to-indirect-buffer)’ |
|
8020 |
Display the entire subtree of the current item in an indirect |
|
8021 |
buffer. With a numeric prefix argument N, go up to level N and |
|
8022 |
then take that tree. If N is negative, go up that many levels. |
|
8023 |
With a ‘C-u’ prefix, do not remove the previously used indirect |
|
8024 |
buffer. |
|
8025 |
|
|
8026 |
‘C-c C-o (org-agenda-open-link)’ |
|
8027 |
Follow a link in the entry. This will offer a selection of any |
|
8028 |
links in the text belonging to the referenced Org node. If there |
|
8029 |
is only one link, it will be followed without a selection prompt. |
|
8030 |
|
|
8031 |
Change display |
|
8032 |
.............. |
|
8033 |
|
|
8034 |
‘A’ |
|
8035 |
Interactively select another agenda view and append it to the |
|
8036 |
current view. |
|
8037 |
‘o’ |
|
8038 |
Delete other windows. |
|
8039 |
‘v d or short d (org-agenda-day-view)’ |
|
8040 |
‘v w or short w (org-agenda-week-view)’ |
|
8041 |
‘v t (org-agenda-fortnight-view)’ |
|
8042 |
‘v m (org-agenda-month-view)’ |
|
8043 |
‘v y (org-agenda-year-view)’ |
|
8044 |
‘v <SPC> (org-agenda-reset-view)’ |
|
8045 |
Switch to day/week/month/year view. When switching to day or week |
|
8046 |
view, this setting becomes the default for subsequent agenda |
|
8047 |
refreshes. Since month and year views are slow to create, they do |
|
8048 |
not become the default. A numeric prefix argument may be used to |
|
8049 |
jump directly to a specific day of the year, ISO week, month, or |
|
8050 |
year, respectively. For example, ‘32 d’ jumps to February 1st, ‘9 |
|
8051 |
w’ to ISO week number 9. When setting day, week, or month view, a |
|
8052 |
year may be encoded in the prefix argument as well. For example, |
|
8053 |
‘200712 w’ will jump to week 12 in 2007. If such a year |
|
8054 |
specification has only one or two digits, it will be mapped to the |
|
8055 |
interval 1938–2037. ‘v <SPC>’ will reset to what is set in |
|
8056 |
‘org-agenda-span’. |
|
8057 |
‘f (org-agenda-later)’ |
|
8058 |
Go forward in time to display the following |
|
8059 |
‘org-agenda-current-span’ days. For example, if the display covers |
|
8060 |
a week, switch to the following week. With prefix arg, go forward |
|
8061 |
that many times ‘org-agenda-current-span’ days. |
|
8062 |
‘b (org-agenda-earlier)’ |
|
8063 |
Go backward in time to display earlier dates. |
|
8064 |
‘. (org-agenda-goto-today)’ |
|
8065 |
Go to today. |
|
8066 |
‘j (org-agenda-goto-date)’ |
|
8067 |
Prompt for a date and go there. |
|
8068 |
‘J (org-agenda-clock-goto)’ |
|
8069 |
Go to the currently clocked-in task in the agenda buffer. |
|
8070 |
‘D (org-agenda-toggle-diary)’ |
|
8071 |
Toggle the inclusion of diary entries. See *note Weekly/daily |
|
8072 |
agenda::. |
|
8073 |
‘v l or short l (org-agenda-log-mode)’ |
|
8074 |
Toggle Logbook mode. In Logbook mode, entries that were marked |
|
8075 |
DONE while logging was on (variable ‘org-log-done’) are shown in |
|
8076 |
the agenda, as are entries that have been clocked on that day. You |
|
8077 |
can configure the entry types that should be included in log mode |
|
8078 |
using the variable ‘org-agenda-log-mode-items’. When called with a |
|
8079 |
‘C-u’ prefix, show all possible logbook entries, including state |
|
8080 |
changes. When called with two prefix arguments ‘C-u C-u’, show |
|
8081 |
only logging information, nothing else. ‘v L’ is equivalent to |
|
8082 |
‘C-u v l’. |
|
8083 |
‘v [ or short [ (org-agenda-manipulate-query-add)’ |
|
8084 |
Include inactive timestamps into the current view. Only for |
|
8085 |
weekly/daily agenda. |
|
8086 |
‘v a (org-agenda-archives-mode)’ |
|
8087 |
‘v A (org-agenda-archives-mode 'files)’ |
|
8088 |
Toggle Archives mode. In Archives mode, trees that are marked |
|
8089 |
‘ARCHIVED’ are also scanned when producing the agenda. When you |
|
8090 |
use the capital ‘A’, even all archive files are included. To exit |
|
8091 |
archives mode, press ‘v a’ again. |
|
8092 |
‘v R or short R (org-agenda-clockreport-mode)’ |
|
8093 |
Toggle Clockreport mode. In Clockreport mode, the daily/weekly |
|
8094 |
agenda will always show a table with the clocked times for the time |
|
8095 |
span and file scope covered by the current agenda view. The |
|
8096 |
initial setting for this mode in new agenda buffers can be set with |
|
8097 |
the variable ‘org-agenda-start-with-clockreport-mode’. By using a |
|
8098 |
prefix argument when toggling this mode (i.e., ‘C-u R’), the clock |
|
8099 |
table will not show contributions from entries that are hidden by |
|
8100 |
agenda filtering(1). See also the variable |
|
8101 |
‘org-clock-report-include-clocking-task’. |
|
8102 |
‘v c’ |
|
8103 |
Show overlapping clock entries, clocking gaps, and other clocking |
|
8104 |
problems in the current agenda range. You can then visit clocking |
|
8105 |
lines and fix them manually. See the variable |
|
8106 |
‘org-agenda-clock-consistency-checks’ for information on how to |
|
8107 |
customize the definition of what constituted a clocking problem. |
|
8108 |
To return to normal agenda display, press ‘l’ to exit Logbook mode. |
|
8109 |
‘v E or short E (org-agenda-entry-text-mode)’ |
|
8110 |
Toggle entry text mode. In entry text mode, a number of lines from |
|
8111 |
the Org outline node referenced by an agenda line will be displayed |
|
8112 |
below the line. The maximum number of lines is given by the |
|
8113 |
variable ‘org-agenda-entry-text-maxlines’. Calling this command |
|
8114 |
with a numeric prefix argument will temporarily modify that number |
|
8115 |
to the prefix value. |
|
8116 |
‘G (org-agenda-toggle-time-grid)’ |
|
8117 |
Toggle the time grid on and off. See also the variables |
|
8118 |
‘org-agenda-use-time-grid’ and ‘org-agenda-time-grid’. |
|
8119 |
‘r (org-agenda-redo)’ |
|
8120 |
Recreate the agenda buffer, for example to reflect the changes |
|
8121 |
after modification of the timestamps of items with ‘S-<LEFT>’ and |
|
8122 |
‘S-<RIGHT>’. When the buffer is the global TODO list, a prefix |
|
8123 |
argument is interpreted to create a selective list for a specific |
|
8124 |
TODO keyword. |
|
8125 |
‘g (org-agenda-redo)’ |
|
8126 |
Same as ‘r’. |
|
8127 |
‘C-x C-s or short s (org-save-all-org-buffers)’ |
|
8128 |
Save all Org buffers in the current Emacs session, and also the |
|
8129 |
locations of IDs. |
|
8130 |
‘C-c C-x C-c (org-agenda-columns)’ |
|
8131 |
Invoke column view (*note Column view::) in the agenda buffer. The |
|
8132 |
column view format is taken from the entry at point, or (if there |
|
8133 |
is no entry at point), from the first entry in the agenda view. So |
|
8134 |
whatever the format for that entry would be in the original buffer |
|
8135 |
(taken from a property, from a ‘#+COLUMNS’ line, or from the |
|
8136 |
default variable ‘org-columns-default-format’), will be used in the |
|
8137 |
agenda. |
|
8138 |
|
|
8139 |
‘C-c C-x > (org-agenda-remove-restriction-lock)’ |
|
8140 |
Remove the restriction lock on the agenda, if it is currently |
|
8141 |
restricted to a file or subtree (*note Agenda files::). |
|
8142 |
|
|
8143 |
Secondary filtering and query editing |
|
8144 |
..................................... |
|
8145 |
|
|
8146 |
For a detailed description of these commands, *note |
|
8147 |
Filtering/limiting agenda items::. |
|
8148 |
|
|
8149 |
‘/ (org-agenda-filter-by-tag)’ |
|
8150 |
Filter the agenda view with respect to a tag and/or effort |
|
8151 |
estimates. |
|
8152 |
|
|
8153 |
‘< (org-agenda-filter-by-category)’ |
|
8154 |
Filter the current agenda view with respect to the category of the |
|
8155 |
item at point. |
|
8156 |
|
|
8157 |
‘^ (org-agenda-filter-by-top-headline)’ |
|
8158 |
Filter the current agenda view and only display the siblings and |
|
8159 |
the parent headline of the one at point. |
|
8160 |
|
|
8161 |
‘= (org-agenda-filter-by-regexp)’ |
|
8162 |
Filter the agenda view by a regular expression. |
|
8163 |
|
|
8164 |
‘_ (org-agenda-filter-by-effort)’ |
|
8165 |
Filter the agenda view with respect to effort estimates. |
|
8166 |
|
|
8167 |
‘| (org-agenda-filter-remove-all)’ |
|
8168 |
Remove all filters in the current agenda view. |
|
8169 |
|
|
8170 |
Remote editing |
|
8171 |
.............. |
|
8172 |
|
|
8173 |
‘0--9’ |
|
8174 |
Digit argument. |
|
8175 |
‘C-_ (org-agenda-undo)’ |
|
8176 |
Undo a change due to a remote editing command. The change is |
|
8177 |
undone both in the agenda buffer and in the remote buffer. |
|
8178 |
‘t (org-agenda-todo)’ |
|
8179 |
Change the TODO state of the item, both in the agenda and in the |
|
8180 |
original org file. |
|
8181 |
‘C-S-<RIGHT> (org-agenda-todo-nextset)’ |
|
8182 |
‘C-S-<LEFT> (org-agenda-todo-previousset)’ |
|
8183 |
Switch to the next/previous set of TODO keywords. |
|
8184 |
‘C-k (org-agenda-kill)’ |
|
8185 |
Delete the current agenda item along with the entire subtree |
|
8186 |
belonging to it in the original Org file. If the text to be |
|
8187 |
deleted remotely is longer than one line, the kill needs to be |
|
8188 |
confirmed by the user. See variable ‘org-agenda-confirm-kill’. |
|
8189 |
‘C-c C-w (org-agenda-refile)’ |
|
8190 |
Refile the entry at point. |
|
8191 |
‘C-c C-x C-a or short a (org-agenda-archive-default-with-confirmation)’ |
|
8192 |
Archive the subtree corresponding to the entry at point using the |
|
8193 |
default archiving command set in ‘org-archive-default-command’. |
|
8194 |
When using the ‘a’ key, confirmation will be required. |
|
8195 |
‘C-c C-x a (org-agenda-toggle-archive-tag)’ |
|
8196 |
Toggle the ARCHIVE tag for the current headline. |
|
8197 |
‘C-c C-x A (org-agenda-archive-to-archive-sibling)’ |
|
8198 |
Move the subtree corresponding to the current entry to its _archive |
|
8199 |
sibling_. |
|
8200 |
‘C-c C-x C-s or short $ (org-agenda-archive)’ |
|
8201 |
Archive the subtree corresponding to the current headline. This |
|
8202 |
means the entry will be moved to the configured archive location, |
|
8203 |
most likely a different file. |
|
8204 |
‘T (org-agenda-show-tags)’ |
|
8205 |
Show all tags associated with the current item. This is useful if |
|
8206 |
you have turned off ‘org-agenda-show-inherited-tags’, but still |
|
8207 |
want to see all tags of a headline occasionally. |
|
8208 |
‘: (org-agenda-set-tags)’ |
|
8209 |
Set tags for the current headline. If there is an active region in |
|
8210 |
the agenda, change a tag for all headings in the region. |
|
8211 |
‘,’ |
|
8212 |
Set the priority for the current item (‘org-agenda-priority’). Org |
|
8213 |
mode prompts for the priority character. If you reply with <SPC>, |
|
8214 |
the priority cookie is removed from the entry. |
|
8215 |
‘P (org-agenda-show-priority)’ |
|
8216 |
Display weighted priority of current item. |
|
8217 |
‘+ or S-<UP> (org-agenda-priority-up)’ |
|
8218 |
Increase the priority of the current item. The priority is changed |
|
8219 |
in the original buffer, but the agenda is not resorted. Use the |
|
8220 |
‘r’ key for this. |
|
8221 |
‘- or S-<DOWN> (org-agenda-priority-down)’ |
|
8222 |
Decrease the priority of the current item. |
|
8223 |
‘z or C-c C-z (org-agenda-add-note)’ |
|
8224 |
Add a note to the entry. This note will be recorded, and then |
|
8225 |
filed to the same location where state change notes are put. |
|
8226 |
Depending on ‘org-log-into-drawer’, this may be inside a drawer. |
|
8227 |
‘C-c C-a (org-attach)’ |
|
8228 |
Dispatcher for all command related to attachments. |
|
8229 |
‘C-c C-s (org-agenda-schedule)’ |
|
8230 |
Schedule this item. With prefix arg remove the scheduling |
|
8231 |
timestamp |
|
8232 |
‘C-c C-d (org-agenda-deadline)’ |
|
8233 |
Set a deadline for this item. With prefix arg remove the deadline. |
|
8234 |
‘S-<RIGHT> (org-agenda-do-date-later)’ |
|
8235 |
Change the timestamp associated with the current line by one day |
|
8236 |
into the future. If the date is in the past, the first call to |
|
8237 |
this command will move it to today. |
|
8238 |
With a numeric prefix argument, change it by that many days. For |
|
8239 |
example, ‘3 6 5 S-<RIGHT>’ will change it by a year. With a ‘C-u’ |
|
8240 |
prefix, change the time by one hour. If you immediately repeat the |
|
8241 |
command, it will continue to change hours even without the prefix |
|
8242 |
arg. With a double ‘C-u C-u’ prefix, do the same for changing |
|
8243 |
minutes. |
|
8244 |
The stamp is changed in the original Org file, but the change is |
|
8245 |
not directly reflected in the agenda buffer. Use ‘r’ or ‘g’ to |
|
8246 |
update the buffer. |
|
8247 |
‘S-<LEFT> (org-agenda-do-date-earlier)’ |
|
8248 |
Change the timestamp associated with the current line by one day |
|
8249 |
into the past. |
|
8250 |
‘> (org-agenda-date-prompt)’ |
|
8251 |
Change the timestamp associated with the current line. The key ‘>’ |
|
8252 |
has been chosen, because it is the same as ‘S-.’ on my keyboard. |
|
8253 |
‘I (org-agenda-clock-in)’ |
|
8254 |
Start the clock on the current item. If a clock is running |
|
8255 |
already, it is stopped first. |
|
8256 |
‘O (org-agenda-clock-out)’ |
|
8257 |
Stop the previously started clock. |
|
8258 |
‘X (org-agenda-clock-cancel)’ |
|
8259 |
Cancel the currently running clock. |
|
8260 |
‘J (org-agenda-clock-goto)’ |
|
8261 |
Jump to the running clock in another window. |
|
8262 |
‘k (org-agenda-capture)’ |
|
8263 |
Like ‘org-capture’, but use the date at point as the default date |
|
8264 |
for the capture template. See ‘org-capture-use-agenda-date’ to |
|
8265 |
make this the default behavior of ‘org-capture’. |
|
8266 |
|
|
8267 |
Dragging agenda lines forward/backward |
|
8268 |
...................................... |
|
8269 |
|
|
8270 |
‘M-<up> (org-agenda-drag-line-backward)’ |
|
8271 |
Drag the line at point backward one line(2). With a numeric prefix |
|
8272 |
argument, drag backward by that many lines. |
|
8273 |
|
|
8274 |
‘M-<down> (org-agenda-drag-line-forward)’ |
|
8275 |
Drag the line at point forward one line. With a numeric prefix |
|
8276 |
argument, drag forward by that many lines. |
|
8277 |
|
|
8278 |
Bulk remote editing selected entries |
|
8279 |
.................................... |
|
8280 |
|
|
8281 |
‘m (org-agenda-bulk-mark)’ |
|
8282 |
Mark the entry at point for bulk action. With numeric prefix |
|
8283 |
argument, mark that many successive entries. |
|
8284 |
‘* (org-agenda-bulk-mark-all)’ |
|
8285 |
Mark all visible agenda entries for bulk action. |
|
8286 |
‘u (org-agenda-bulk-unmark)’ |
|
8287 |
Unmark entry at point for bulk action. |
|
8288 |
‘U (org-agenda-bulk-remove-all-marks)’ |
|
8289 |
Unmark all marked entries for bulk action. |
|
8290 |
‘M-m (org-agenda-bulk-toggle)’ |
|
8291 |
Toggle mark of the entry at point for bulk action. |
|
8292 |
‘M-* (org-agenda-bulk-toggle-all)’ |
|
8293 |
Toggle marks of all visible entries for bulk action. |
|
8294 |
‘% (org-agenda-bulk-mark-regexp)’ |
|
8295 |
Mark entries matching a regular expression for bulk action. |
|
8296 |
‘B (org-agenda-bulk-action)’ |
|
8297 |
Bulk action: act on all marked entries in the agenda. This will |
|
8298 |
prompt for another key to select the action to be applied. The |
|
8299 |
prefix arg to ‘B’ will be passed through to the ‘s’ and ‘d’ |
|
8300 |
commands, to bulk-remove these special timestamps. By default, |
|
8301 |
marks are removed after the bulk. If you want them to persist, set |
|
8302 |
‘org-agenda-persistent-marks’ to ‘t’ or hit ‘p’ at the prompt. |
|
8303 |
|
|
8304 |
‘*’ |
|
8305 |
Toggle persistent marks. |
|
8306 |
‘$’ |
|
8307 |
Archive all selected entries. |
|
8308 |
‘A’ |
|
8309 |
Archive entries by moving them to their respective archive |
|
8310 |
siblings. |
|
8311 |
‘t’ |
|
8312 |
Change TODO state. This prompts for a single TODO keyword and |
|
8313 |
changes the state of all selected entries, bypassing blocking |
|
8314 |
and suppressing logging notes (but not timestamps). |
|
8315 |
‘+’ |
|
8316 |
Add a tag to all selected entries. |
|
8317 |
‘-’ |
|
8318 |
Remove a tag from all selected entries. |
|
8319 |
‘s’ |
|
8320 |
Schedule all items to a new date. To shift existing schedule |
|
8321 |
dates by a fixed number of days, use something starting with |
|
8322 |
double plus at the prompt, for example ‘++8d’ or ‘++2w’. |
|
8323 |
‘d’ |
|
8324 |
Set deadline to a specific date. |
|
8325 |
‘r’ |
|
8326 |
Prompt for a single refile target and move all entries. The |
|
8327 |
entries will no longer be in the agenda; refresh (‘g’) to |
|
8328 |
bring them back. |
|
8329 |
‘S’ |
|
8330 |
Reschedule randomly into the coming N days. N will be |
|
8331 |
prompted for. With prefix arg (‘C-u B S’), scatter only |
|
8332 |
across weekdays. |
|
8333 |
‘f’ |
|
8334 |
Apply a function(3) to marked entries. For example, the |
|
8335 |
function below sets the CATEGORY property of the entries to |
|
8336 |
web. |
|
8337 |
|
|
8338 |
(defun set-category () |
|
8339 |
(interactive "P") |
|
8340 |
(let* ((marker (or (org-get-at-bol 'org-hd-marker) |
|
8341 |
(org-agenda-error))) |
|
8342 |
(buffer (marker-buffer marker))) |
|
8343 |
(with-current-buffer buffer |
|
8344 |
(save-excursion |
|
8345 |
(save-restriction |
|
8346 |
(widen) |
|
8347 |
(goto-char marker) |
|
8348 |
(org-back-to-heading t) |
|
8349 |
(org-set-property "CATEGORY" "web")))))) |
|
8350 |
|
|
8351 |
Calendar commands |
|
8352 |
................. |
|
8353 |
|
|
8354 |
‘c (org-agenda-goto-calendar)’ |
|
8355 |
Open the Emacs calendar and move to the date at the agenda cursor. |
|
8356 |
‘c (org-calendar-goto-agenda)’ |
|
8357 |
When in the calendar, compute and show the Org mode agenda for the |
|
8358 |
date at the cursor. |
|
8359 |
‘i (org-agenda-diary-entry)’ |
|
8360 |
Insert a new entry into the diary, using the date at the cursor and |
|
8361 |
(for block entries) the date at the mark. This will add to the |
|
8362 |
Emacs diary file(4), in a way similar to the ‘i’ command in the |
|
8363 |
calendar. The diary file will pop up in another window, where you |
|
8364 |
can add the entry. |
|
8365 |
|
|
8366 |
If you configure ‘org-agenda-diary-file’ to point to an Org mode |
|
8367 |
file, Org will create entries (in Org mode syntax) in that file |
|
8368 |
instead. Most entries will be stored in a date-based outline tree |
|
8369 |
that will later make it easy to archive appointments from previous |
|
8370 |
months/years. The tree will be built under an entry with a |
|
8371 |
‘DATE_TREE’ property, or else with years as top-level entries. |
|
8372 |
Emacs will prompt you for the entry text—if you specify it, the |
|
8373 |
entry will be created in ‘org-agenda-diary-file’ without further |
|
8374 |
interaction. If you directly press <RET> at the prompt without |
|
8375 |
typing text, the target file will be shown in another window for |
|
8376 |
you to finish the entry there. See also the ‘k r’ command. |
|
8377 |
‘M (org-agenda-phases-of-moon)’ |
|
8378 |
Show the phases of the moon for the three months around current |
|
8379 |
date. |
|
8380 |
‘S (org-agenda-sunrise-sunset)’ |
|
8381 |
Show sunrise and sunset times. The geographical location must be |
|
8382 |
set with calendar variables, see the documentation for the Emacs |
|
8383 |
calendar. |
|
8384 |
‘C (org-agenda-convert-date)’ |
|
8385 |
Convert the date at cursor into many other cultural and historic |
|
8386 |
calendars. |
|
8387 |
‘H (org-agenda-holidays)’ |
|
8388 |
Show holidays for three months around the cursor date. |
|
8389 |
|
|
8390 |
‘M-x org-icalendar-combine-agenda-files <RET>’ |
|
8391 |
Export a single iCalendar file containing entries from all agenda |
|
8392 |
files. This is a globally available command, and also available in |
|
8393 |
the agenda menu. |
|
8394 |
|
|
8395 |
Exporting to a file |
|
8396 |
................... |
|
8397 |
|
|
8398 |
‘C-x C-w (org-agenda-write)’ |
|
8399 |
Write the agenda view to a file. Depending on the extension of the |
|
8400 |
selected file name, the view will be exported as HTML (‘.html’ or |
|
8401 |
‘.htm’), Postscript (‘.ps’), PDF (‘.pdf’), Org (‘.org’) and plain |
|
8402 |
text (any other extension). When exporting to Org, only the body |
|
8403 |
of original headlines are exported, not subtrees or inherited tags. |
|
8404 |
When called with a ‘C-u’ prefix argument, immediately open the |
|
8405 |
newly created file. Use the variable |
|
8406 |
‘org-agenda-exporter-settings’ to set options for ‘ps-print’ and |
|
8407 |
for ‘htmlize’ to be used during export. |
|
8408 |
|
|
8409 |
Quit and Exit |
|
8410 |
............. |
|
8411 |
|
|
8412 |
‘q (org-agenda-quit)’ |
|
8413 |
Quit agenda, remove the agenda buffer. |
|
8414 |
‘x (org-agenda-exit)’ |
|
8415 |
Exit agenda, remove the agenda buffer and all buffers loaded by |
|
8416 |
Emacs for the compilation of the agenda. Buffers created by the |
|
8417 |
user to visit Org files will not be removed. |
|
8418 |
|
|
8419 |
---------- Footnotes ---------- |
|
8420 |
|
|
8421 |
(1) Only tags filtering will be respected here, effort filtering is |
|
8422 |
ignored. |
|
8423 |
|
|
8424 |
(2) Moving agenda lines does not persist after an agenda refresh and |
|
8425 |
does not modify the contributing ‘.org’ files |
|
8426 |
|
|
8427 |
(3) You can also create persistent custom functions through |
|
8428 |
‘org-agenda-bulk-custom-functions’. |
|
8429 |
|
|
8430 |
(4) This file is parsed for the agenda when |
|
8431 |
‘org-agenda-include-diary’ is set. |
|
8432 |
|
|
8433 |
|
|
8434 |
File: org, Node: Custom agenda views, Next: Exporting agenda views, Prev: Agenda commands, Up: Agenda views |
|
8435 |
|
|
8436 |
10.6 Custom agenda views |
|
8437 |
======================== |
|
8438 |
|
|
8439 |
Custom agenda commands serve two purposes: to store and quickly access |
|
8440 |
frequently used TODO and tags searches, and to create special composite |
|
8441 |
agenda buffers. Custom agenda commands will be accessible through the |
|
8442 |
dispatcher (*note Agenda dispatcher::), just like the default commands. |
|
8443 |
|
|
8444 |
* Menu: |
|
8445 |
|
|
8446 |
* Storing searches:: Type once, use often |
|
8447 |
* Block agenda:: All the stuff you need in a single buffer |
|
8448 |
* Setting options:: Changing the rules |
|
8449 |
|
|
8450 |
|
|
8451 |
File: org, Node: Storing searches, Next: Block agenda, Up: Custom agenda views |
|
8452 |
|
|
8453 |
10.6.1 Storing searches |
|
8454 |
----------------------- |
|
8455 |
|
|
8456 |
The first application of custom searches is the definition of keyboard |
|
8457 |
shortcuts for frequently used searches, either creating an agenda |
|
8458 |
buffer, or a sparse tree (the latter covering of course only the current |
|
8459 |
buffer). |
|
8460 |
|
|
8461 |
Custom commands are configured in the variable |
|
8462 |
‘org-agenda-custom-commands’. You can customize this variable, for |
|
8463 |
example by pressing ‘C-c a C’. You can also directly set it with Emacs |
|
8464 |
Lisp in the Emacs init file. The following example contains all valid |
|
8465 |
agenda views: |
|
8466 |
|
|
8467 |
(setq org-agenda-custom-commands |
|
8468 |
'(("x" agenda) |
|
8469 |
("y" agenda*) |
|
8470 |
("w" todo "WAITING") |
|
8471 |
("W" todo-tree "WAITING") |
|
8472 |
("u" tags "+boss-urgent") |
|
8473 |
("v" tags-todo "+boss-urgent") |
|
8474 |
("U" tags-tree "+boss-urgent") |
|
8475 |
("f" occur-tree "\\<FIXME\\>") |
|
8476 |
("h" . "HOME+Name tags searches") ; description for "h" prefix |
|
8477 |
("hl" tags "+home+Lisa") |
|
8478 |
("hp" tags "+home+Peter") |
|
8479 |
("hk" tags "+home+Kim"))) |
|
8480 |
|
|
8481 |
The initial string in each entry defines the keys you have to press |
|
8482 |
after the dispatcher command ‘C-c a’ in order to access the command. |
|
8483 |
Usually this will be just a single character, but if you have many |
|
8484 |
similar commands, you can also define two-letter combinations where the |
|
8485 |
first character is the same in several combinations and serves as a |
|
8486 |
prefix key(1). The second parameter is the search type, followed by the |
|
8487 |
string or regular expression to be used for the matching. The example |
|
8488 |
above will therefore define: |
|
8489 |
|
|
8490 |
‘C-c a x’ |
|
8491 |
as a global search for agenda entries planned(2) this week/day. |
|
8492 |
‘C-c a y’ |
|
8493 |
as a global search for agenda entries planned this week/day, but |
|
8494 |
only those with an hour specification like ‘[h]h:mm’—think of them |
|
8495 |
as appointments. |
|
8496 |
‘C-c a w’ |
|
8497 |
as a global search for TODO entries with ‘WAITING’ as the TODO |
|
8498 |
keyword |
|
8499 |
‘C-c a W’ |
|
8500 |
as the same search, but only in the current buffer and displaying |
|
8501 |
the results as a sparse tree |
|
8502 |
‘C-c a u’ |
|
8503 |
as a global tags search for headlines marked ‘:boss:’ but not |
|
8504 |
‘:urgent:’ |
|
8505 |
‘C-c a v’ |
|
8506 |
as the same search as ‘C-c a u’, but limiting the search to |
|
8507 |
headlines that are also TODO items |
|
8508 |
‘C-c a U’ |
|
8509 |
as the same search as ‘C-c a u’, but only in the current buffer and |
|
8510 |
displaying the result as a sparse tree |
|
8511 |
‘C-c a f’ |
|
8512 |
to create a sparse tree (again: current buffer only) with all |
|
8513 |
entries containing the word ‘FIXME’ |
|
8514 |
‘C-c a h’ |
|
8515 |
as a prefix command for a HOME tags search where you have to press |
|
8516 |
an additional key (‘l’, ‘p’ or ‘k’) to select a name (Lisa, Peter, |
|
8517 |
or Kim) as additional tag to match. |
|
8518 |
|
|
8519 |
Note that the ‘*-tree’ agenda views need to be called from an Org |
|
8520 |
buffer as they operate on the current buffer only. |
|
8521 |
|
|
8522 |
---------- Footnotes ---------- |
|
8523 |
|
|
8524 |
(1) You can provide a description for a prefix key by inserting a |
|
8525 |
cons cell with the prefix and the description. |
|
8526 |
|
|
8527 |
(2) _Planned_ means here that these entries have some planning |
|
8528 |
information attached to them, like a time-stamp, a scheduled or a |
|
8529 |
deadline string. See ‘org-agenda-entry-types’ on how to set what |
|
8530 |
planning information will be taken into account. |
|
8531 |
|
|
8532 |
|
|
8533 |
File: org, Node: Block agenda, Next: Setting options, Prev: Storing searches, Up: Custom agenda views |
|
8534 |
|
|
8535 |
10.6.2 Block agenda |
|
8536 |
------------------- |
|
8537 |
|
|
8538 |
Another possibility is the construction of agenda views that comprise |
|
8539 |
the results of _several_ commands, each of which creates a block in the |
|
8540 |
agenda buffer. The available commands include ‘agenda’ for the daily or |
|
8541 |
weekly agenda (as created with ‘C-c a a’), ‘alltodo’ for the global TODO |
|
8542 |
list (as constructed with ‘C-c a t’), and the matching commands |
|
8543 |
discussed above: ‘todo’, ‘tags’, and ‘tags-todo’. Here are two |
|
8544 |
examples: |
|
8545 |
|
|
8546 |
(setq org-agenda-custom-commands |
|
8547 |
'(("h" "Agenda and Home-related tasks" |
|
8548 |
((agenda "") |
|
8549 |
(tags-todo "home") |
|
8550 |
(tags "garden"))) |
|
8551 |
("o" "Agenda and Office-related tasks" |
|
8552 |
((agenda "") |
|
8553 |
(tags-todo "work") |
|
8554 |
(tags "office"))))) |
|
8555 |
|
|
8556 |
This will define ‘C-c a h’ to create a multi-block view for stuff you |
|
8557 |
need to attend to at home. The resulting agenda buffer will contain |
|
8558 |
your agenda for the current week, all TODO items that carry the tag |
|
8559 |
‘home’, and also all lines tagged with ‘garden’. Finally the command |
|
8560 |
‘C-c a o’ provides a similar view for office tasks. |
|
8561 |
|
|
8562 |
|
|
8563 |
File: org, Node: Setting options, Prev: Block agenda, Up: Custom agenda views |
|
8564 |
|
|
8565 |
10.6.3 Setting options for custom commands |
|
8566 |
------------------------------------------ |
|
8567 |
|
|
8568 |
Org mode contains a number of variables regulating agenda construction |
|
8569 |
and display. The global variables define the behavior for all agenda |
|
8570 |
commands, including the custom commands. However, if you want to change |
|
8571 |
some settings just for a single custom view, you can do so. Setting |
|
8572 |
options requires inserting a list of variable names and values at the |
|
8573 |
right spot in ‘org-agenda-custom-commands’. For example: |
|
8574 |
|
|
8575 |
(setq org-agenda-custom-commands |
|
8576 |
'(("w" todo "WAITING" |
|
8577 |
((org-agenda-sorting-strategy '(priority-down)) |
|
8578 |
(org-agenda-prefix-format " Mixed: "))) |
|
8579 |
("U" tags-tree "+boss-urgent" |
|
8580 |
((org-show-context-detail 'minimal))) |
|
8581 |
("N" search "" |
|
8582 |
((org-agenda-files '("~org/notes.org")) |
|
8583 |
(org-agenda-text-search-extra-files nil))))) |
|
8584 |
|
|
8585 |
Now the ‘C-c a w’ command will sort the collected entries only by |
|
8586 |
priority, and the prefix format is modified to just say ‘ Mixed: ’ |
|
8587 |
instead of giving the category of the entry. The sparse tags tree of |
|
8588 |
‘C-c a U’ will now turn out ultra-compact, because neither the headline |
|
8589 |
hierarchy above the match, nor the headline following the match will be |
|
8590 |
shown. The command ‘C-c a N’ will do a text search limited to only a |
|
8591 |
single file. |
|
8592 |
|
|
8593 |
For command sets creating a block agenda, |
|
8594 |
‘org-agenda-custom-commands’ has two separate spots for setting options. |
|
8595 |
You can add options that should be valid for just a single command in |
|
8596 |
the set, and options that should be valid for all commands in the set. |
|
8597 |
The former are just added to the command entry; the latter must come |
|
8598 |
after the list of command entries. Going back to the block agenda |
|
8599 |
example (*note Block agenda::), let’s change the sorting strategy for |
|
8600 |
the ‘C-c a h’ commands to ‘priority-down’, but let’s sort the results |
|
8601 |
for GARDEN tags query in the opposite order, ‘priority-up’. This would |
|
8602 |
look like this: |
|
8603 |
|
|
8604 |
(setq org-agenda-custom-commands |
|
8605 |
'(("h" "Agenda and Home-related tasks" |
|
8606 |
((agenda) |
|
8607 |
(tags-todo "home") |
|
8608 |
(tags "garden" |
|
8609 |
((org-agenda-sorting-strategy '(priority-up))))) |
|
8610 |
((org-agenda-sorting-strategy '(priority-down)))) |
|
8611 |
("o" "Agenda and Office-related tasks" |
|
8612 |
((agenda) |
|
8613 |
(tags-todo "work") |
|
8614 |
(tags "office"))))) |
|
8615 |
|
|
8616 |
As you see, the values and parentheses setting is a little complex. |
|
8617 |
When in doubt, use the customize interface to set this variable—it fully |
|
8618 |
supports its structure. Just one caveat: when setting options in this |
|
8619 |
interface, the _values_ are just Lisp expressions. So if the value is a |
|
8620 |
string, you need to add the double-quotes around the value yourself. |
|
8621 |
|
|
8622 |
To control whether an agenda command should be accessible from a |
|
8623 |
specific context, you can customize |
|
8624 |
‘org-agenda-custom-commands-contexts’. Let’s say for example that you |
|
8625 |
have an agenda command ‘"o"’ displaying a view that you only need when |
|
8626 |
reading emails. Then you would configure this option like this: |
|
8627 |
|
|
8628 |
(setq org-agenda-custom-commands-contexts |
|
8629 |
'(("o" (in-mode . "message-mode")))) |
|
8630 |
|
|
8631 |
You can also tell that the command key ‘"o"’ should refer to another |
|
8632 |
command key ‘"r"’. In that case, add this command key like this: |
|
8633 |
|
|
8634 |
(setq org-agenda-custom-commands-contexts |
|
8635 |
'(("o" "r" (in-mode . "message-mode")))) |
|
8636 |
|
|
8637 |
See the docstring of the variable for more information. |
|
8638 |
|
|
8639 |
|
|
8640 |
File: org, Node: Exporting agenda views, Next: Agenda column view, Prev: Custom agenda views, Up: Agenda views |
|
8641 |
|
|
8642 |
10.7 Exporting agenda views |
|
8643 |
=========================== |
|
8644 |
|
|
8645 |
If you are away from your computer, it can be very useful to have a |
|
8646 |
printed version of some agenda views to carry around. Org mode can |
|
8647 |
export custom agenda views as plain text, HTML(1), Postscript, PDF(2), |
|
8648 |
and iCalendar files. If you want to do this only occasionally, use the |
|
8649 |
command |
|
8650 |
|
|
8651 |
‘C-x C-w (org-agenda-write)’ |
|
8652 |
Write the agenda view to a file. Depending on the extension of the |
|
8653 |
selected file name, the view will be exported as HTML (extension |
|
8654 |
‘.html’ or ‘.htm’), Postscript (extension ‘.ps’), iCalendar |
|
8655 |
(extension ‘.ics’), or plain text (any other extension). Use the |
|
8656 |
variable ‘org-agenda-exporter-settings’ to set options for |
|
8657 |
‘ps-print’ and for ‘htmlize’ to be used during export, for example |
|
8658 |
|
|
8659 |
(setq org-agenda-exporter-settings |
|
8660 |
'((ps-number-of-columns 2) |
|
8661 |
(ps-landscape-mode t) |
|
8662 |
(org-agenda-add-entry-text-maxlines 5) |
|
8663 |
(htmlize-output-type 'css))) |
|
8664 |
|
|
8665 |
If you need to export certain agenda views frequently, you can |
|
8666 |
associate any custom agenda command with a list of output file names |
|
8667 |
(3). Here is an example that first defines custom commands for the |
|
8668 |
agenda and the global TODO list, together with a number of files to |
|
8669 |
which to export them. Then we define two block agenda commands and |
|
8670 |
specify file names for them as well. File names can be relative to the |
|
8671 |
current working directory, or absolute. |
|
8672 |
|
|
8673 |
(setq org-agenda-custom-commands |
|
8674 |
'(("X" agenda "" nil ("agenda.html" "agenda.ps")) |
|
8675 |
("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps")) |
|
8676 |
("h" "Agenda and Home-related tasks" |
|
8677 |
((agenda "") |
|
8678 |
(tags-todo "home") |
|
8679 |
(tags "garden")) |
|
8680 |
nil |
|
8681 |
("~/views/home.html")) |
|
8682 |
("o" "Agenda and Office-related tasks" |
|
8683 |
((agenda) |
|
8684 |
(tags-todo "work") |
|
8685 |
(tags "office")) |
|
8686 |
nil |
|
8687 |
("~/views/office.ps" "~/calendars/office.ics")))) |
|
8688 |
|
|
8689 |
The extension of the file name determines the type of export. If it |
|
8690 |
is ‘.html’, Org mode will try to use the ‘htmlize.el’ package to convert |
|
8691 |
the buffer to HTML and save it to this file name. If the extension is |
|
8692 |
‘.ps’, ‘ps-print-buffer-with-faces’ is used to produce Postscript |
|
8693 |
output. If the extension is ‘.ics’, iCalendar export is run export over |
|
8694 |
all files that were used to construct the agenda, and limit the export |
|
8695 |
to entries listed in the agenda. Any other extension produces a plain |
|
8696 |
ASCII file. |
|
8697 |
|
|
8698 |
The export files are _not_ created when you use one of those commands |
|
8699 |
interactively because this might use too much overhead. Instead, there |
|
8700 |
is a special command to produce _all_ specified files in one step: |
|
8701 |
|
|
8702 |
‘C-c a e (org-store-agenda-views)’ |
|
8703 |
Export all agenda views that have export file names associated with |
|
8704 |
them. |
|
8705 |
|
|
8706 |
You can use the options section of the custom agenda commands to also |
|
8707 |
set options for the export commands. For example: |
|
8708 |
|
|
8709 |
(setq org-agenda-custom-commands |
|
8710 |
'(("X" agenda "" |
|
8711 |
((ps-number-of-columns 2) |
|
8712 |
(ps-landscape-mode t) |
|
8713 |
(org-agenda-prefix-format " [ ] ") |
|
8714 |
(org-agenda-with-colors nil) |
|
8715 |
(org-agenda-remove-tags t)) |
|
8716 |
("theagenda.ps")))) |
|
8717 |
|
|
8718 |
This command sets two options for the Postscript exporter, to make it |
|
8719 |
print in two columns in landscape format—the resulting page can be cut |
|
8720 |
in two and then used in a paper agenda. The remaining settings modify |
|
8721 |
the agenda prefix to omit category and scheduling information, and |
|
8722 |
instead include a checkbox to check off items. We also remove the tags |
|
8723 |
to make the lines compact, and we don’t want to use colors for the |
|
8724 |
black-and-white printer. Settings specified in |
|
8725 |
‘org-agenda-exporter-settings’ will also apply, but the settings in |
|
8726 |
‘org-agenda-custom-commands’ take precedence. |
|
8727 |
|
|
8728 |
From the command line you may also use |
|
8729 |
emacs -eval (org-batch-store-agenda-views) -kill |
|
8730 |
or, if you need to modify some parameters(4) |
|
8731 |
emacs -eval '(org-batch-store-agenda-views \ |
|
8732 |
org-agenda-span (quote month) \ |
|
8733 |
org-agenda-start-day "2007-11-01" \ |
|
8734 |
org-agenda-include-diary nil \ |
|
8735 |
org-agenda-files (quote ("~/org/project.org")))' \ |
|
8736 |
-kill |
|
8737 |
which will create the agenda views restricted to the file |
|
8738 |
‘~/org/project.org’, without diary entries and with a 30-day extent. |
|
8739 |
|
|
8740 |
You can also extract agenda information in a way that allows further |
|
8741 |
processing by other programs. See *note Extracting agenda |
|
8742 |
information::, for more information. |
|
8743 |
|
|
8744 |
---------- Footnotes ---------- |
|
8745 |
|
|
8746 |
(1) You need to install ‘htmlize.el’ from Hrvoje Niksic’s repository. |
|
8747 |
(https://github.com/hniksic/emacs-htmlize) |
|
8748 |
|
|
8749 |
(2) To create PDF output, the ghostscript ‘ps2pdf’ utility must be |
|
8750 |
installed on the system. Selecting a PDF file will also create the |
|
8751 |
postscript file. |
|
8752 |
|
|
8753 |
(3) If you want to store standard views like the weekly agenda or the |
|
8754 |
global TODO list as well, you need to define custom commands for them in |
|
8755 |
order to be able to specify file names. |
|
8756 |
|
|
8757 |
(4) Quoting depends on the system you use, please check the FAQ for |
|
8758 |
examples. |
|
8759 |
|
|
8760 |
|
|
8761 |
File: org, Node: Agenda column view, Prev: Exporting agenda views, Up: Agenda views |
|
8762 |
|
|
8763 |
10.8 Using column view in the agenda |
|
8764 |
==================================== |
|
8765 |
|
|
8766 |
Column view (*note Column view::) is normally used to view and edit |
|
8767 |
properties embedded in the hierarchical structure of an Org file. It |
|
8768 |
can be quite useful to use column view also from the agenda, where |
|
8769 |
entries are collected by certain criteria. |
|
8770 |
|
|
8771 |
‘C-c C-x C-c (org-agenda-columns)’ |
|
8772 |
Turn on column view in the agenda. |
|
8773 |
|
|
8774 |
To understand how to use this properly, it is important to realize |
|
8775 |
that the entries in the agenda are no longer in their proper outline |
|
8776 |
environment. This causes the following issues: |
|
8777 |
|
|
8778 |
1. Org needs to make a decision which ‘COLUMNS’ format to use. Since |
|
8779 |
the entries in the agenda are collected from different files, and |
|
8780 |
different files may have different ‘COLUMNS’ formats, this is a |
|
8781 |
non-trivial problem. Org first checks if the variable |
|
8782 |
‘org-agenda-overriding-columns-format’ is currently set, and if so, |
|
8783 |
takes the format from there. Otherwise it takes the format |
|
8784 |
associated with the first item in the agenda, or, if that item does |
|
8785 |
not have a specific format—defined in a property, or in its file—it |
|
8786 |
uses ‘org-columns-default-format’. |
|
8787 |
|
|
8788 |
2. If any of the columns has a summary type defined (*note Column |
|
8789 |
attributes::), turning on column view in the agenda will visit all |
|
8790 |
relevant agenda files and make sure that the computations of this |
|
8791 |
property are up to date. This is also true for the special |
|
8792 |
‘CLOCKSUM’ property. Org will then sum the values displayed in the |
|
8793 |
agenda. In the daily/weekly agenda, the sums will cover a single |
|
8794 |
day; in all other views they cover the entire block. It is vital |
|
8795 |
to realize that the agenda may show the same entry _twice_—for |
|
8796 |
example as scheduled and as a deadline—and it may show two entries |
|
8797 |
from the same hierarchy—for example a _parent_ and its _child_. In |
|
8798 |
these cases, the summation in the agenda will lead to incorrect |
|
8799 |
results because some values will count double. |
|
8800 |
|
|
8801 |
3. When the column view in the agenda shows the ‘CLOCKSUM’, that is |
|
8802 |
always the entire clocked time for this item. So even in the |
|
8803 |
daily/weekly agenda, the clocksum listed in column view may |
|
8804 |
originate from times outside the current view. This has the |
|
8805 |
advantage that you can compare these values with a column listing |
|
8806 |
the planned total effort for a task—one of the major applications |
|
8807 |
for column view in the agenda. If you want information about |
|
8808 |
clocked time in the displayed period use clock table mode (press |
|
8809 |
‘R’ in the agenda). |
|
8810 |
|
|
8811 |
4. When the column view in the agenda shows the ‘CLOCKSUM_T’, that is |
|
8812 |
always today’s clocked time for this item. So even in the weekly |
|
8813 |
agenda, the clocksum listed in column view only originates from |
|
8814 |
today. This lets you compare the time you spent on a task for |
|
8815 |
today, with the time already spent —via ‘CLOCKSUM’—and with the |
|
8816 |
planned total effort for it. |
|
8817 |
|
|
8818 |
|
|
8819 |
File: org, Node: Markup, Next: Exporting, Prev: Agenda views, Up: Top |
|
8820 |
|
|
8821 |
11 Markup for rich export |
|
8822 |
************************* |
|
8823 |
|
|
8824 |
When exporting Org mode documents, the exporter tries to reflect the |
|
8825 |
structure of the document as accurately as possible in the back-end. |
|
8826 |
Since export targets like HTML and LaTeX allow much richer formatting, |
|
8827 |
Org mode has rules on how to prepare text for rich export. This section |
|
8828 |
summarizes the markup rules used in an Org mode buffer. |
|
8829 |
|
|
8830 |
* Menu: |
|
8831 |
|
|
8832 |
* Paragraphs:: The basic unit of text |
|
8833 |
* Emphasis and monospace:: Bold, italic, etc. |
|
8834 |
* Horizontal rules:: Make a line |
|
8835 |
* Images and tables:: Images, tables and caption mechanism |
|
8836 |
* Literal examples:: Source code examples with special formatting |
|
8837 |
* Special symbols:: Greek letters and other symbols |
|
8838 |
* Subscripts and superscripts:: Simple syntax for raising/lowering text |
|
8839 |
* Embedded LaTeX:: LaTeX can be freely used inside Org documents |
|
8840 |
|
|
8841 |
|
|
8842 |
File: org, Node: Paragraphs, Next: Emphasis and monospace, Up: Markup |
|
8843 |
|
|
8844 |
11.1 Paragraphs, line breaks, and quoting |
|
8845 |
========================================= |
|
8846 |
|
|
8847 |
Paragraphs are separated by at least one empty line. If you need to |
|
8848 |
enforce a line break within a paragraph, use ‘\\’ at the end of a line. |
|
8849 |
|
|
8850 |
To preserve the line breaks, indentation and blank lines in a region, |
|
8851 |
but otherwise use normal formatting, you can use this construct, which |
|
8852 |
can also be used to format poetry. |
|
8853 |
|
|
8854 |
#+BEGIN_VERSE |
|
8855 |
Great clouds overhead |
|
8856 |
Tiny black birds rise and fall |
|
8857 |
Snow covers Emacs |
|
8858 |
|
|
8859 |
-- AlexSchroeder |
|
8860 |
#+END_VERSE |
|
8861 |
|
|
8862 |
When quoting a passage from another document, it is customary to |
|
8863 |
format this as a paragraph that is indented on both the left and the |
|
8864 |
right margin. You can include quotations in Org mode documents like |
|
8865 |
this: |
|
8866 |
|
|
8867 |
#+BEGIN_QUOTE |
|
8868 |
Everything should be made as simple as possible, |
|
8869 |
but not any simpler -- Albert Einstein |
|
8870 |
#+END_QUOTE |
|
8871 |
|
|
8872 |
If you would like to center some text, do it like this: |
|
8873 |
#+BEGIN_CENTER |
|
8874 |
Everything should be made as simple as possible, \\ |
|
8875 |
but not any simpler |
|
8876 |
#+END_CENTER |
|
8877 |
|
|
8878 |
|
|
8879 |
File: org, Node: Emphasis and monospace, Next: Horizontal rules, Prev: Paragraphs, Up: Markup |
|
8880 |
|
|
8881 |
11.2 Emphasis and monospace |
|
8882 |
=========================== |
|
8883 |
|
|
8884 |
You can make words *bold*, /italic/, _underlined_, ‘=verbatim=’ and |
|
8885 |
‘~code~’, and, if you must, ‘+strike-through+’. Text in the code and |
|
8886 |
verbatim string is not processed for Org mode specific syntax, it is |
|
8887 |
exported verbatim. |
|
8888 |
|
|
8889 |
To turn off fontification for marked up text, you can set |
|
8890 |
‘org-fontify-emphasized-text’ to ‘nil’. To narrow down the list of |
|
8891 |
available markup syntax, you can customize ‘org-emphasis-alist’. To |
|
8892 |
fine tune what characters are allowed before and after the markup |
|
8893 |
characters, you can tweak ‘org-emphasis-regexp-components’. Beware that |
|
8894 |
changing one of the above variables will not take effect until you |
|
8895 |
reload Org, for which you may need to restart Emacs. |
|
8896 |
|
|
8897 |
|
|
8898 |
File: org, Node: Horizontal rules, Next: Images and tables, Prev: Emphasis and monospace, Up: Markup |
|
8899 |
|
|
8900 |
11.3 Horizontal rules |
|
8901 |
===================== |
|
8902 |
|
|
8903 |
A line consisting of only dashes, and at least 5 of them, will be |
|
8904 |
exported as a horizontal line. |
|
8905 |
|
|
8906 |
|
|
8907 |
File: org, Node: Images and tables, Next: Literal examples, Prev: Horizontal rules, Up: Markup |
|
8908 |
|
|
8909 |
11.4 Images and Tables |
|
8910 |
====================== |
|
8911 |
|
|
8912 |
Both the native Org mode tables (*note Tables::) and tables formatted |
|
8913 |
with the ‘table.el’ package will be exported properly. For Org mode |
|
8914 |
tables, the lines before the first horizontal separator line will become |
|
8915 |
table header lines. You can use the following lines somewhere before |
|
8916 |
the table to assign a caption and a label for cross references, and in |
|
8917 |
the text you can refer to the object with ‘[[tab:basic-data]]’ (*note |
|
8918 |
Internal links::): |
|
8919 |
|
|
8920 |
#+CAPTION: This is the caption for the next table (or link) |
|
8921 |
#+NAME: tab:basic-data |
|
8922 |
| ... | ...| |
|
8923 |
|-----|----| |
|
8924 |
|
|
8925 |
Optionally, the caption can take the form: |
|
8926 |
#+CAPTION[Caption for list of tables]: Caption for table. |
|
8927 |
|
|
8928 |
Some back-ends allow you to directly include images into the exported |
|
8929 |
document. Org does this, if a link to an image files does not have a |
|
8930 |
description part, for example ‘[[./img/a.jpg]]’. If you wish to define |
|
8931 |
a caption for the image and maybe a label for internal cross references, |
|
8932 |
make sure that the link is on a line by itself and precede it with |
|
8933 |
‘#+CAPTION’ and ‘#+NAME’ as follows: |
|
8934 |
|
|
8935 |
#+CAPTION: This is the caption for the next figure link (or table) |
|
8936 |
#+NAME: fig:SED-HR4049 |
|
8937 |
[[./img/a.jpg]] |
|
8938 |
|
|
8939 |
Such images can be displayed within the buffer. *Note the discussion of |
|
8940 |
image links: Handling links. |
|
8941 |
|
|
8942 |
Even though images and tables are prominent examples of captioned |
|
8943 |
structures, the same caption mechanism can apply to many others (e.g., |
|
8944 |
LaTeX equations, source code blocks). Depending on the export back-end, |
|
8945 |
those may or may not be handled. |
|
8946 |
|
|
8947 |
|
|
8948 |
File: org, Node: Literal examples, Next: Special symbols, Prev: Images and tables, Up: Markup |
|
8949 |
|
|
8950 |
11.5 Literal examples |
|
8951 |
===================== |
|
8952 |
|
|
8953 |
You can include literal examples that should not be subjected to markup. |
|
8954 |
Such examples will be typeset in monospace, so this is well suited for |
|
8955 |
source code and similar examples. |
|
8956 |
|
|
8957 |
#+BEGIN_EXAMPLE |
|
8958 |
Some example from a text file. |
|
8959 |
#+END_EXAMPLE |
|
8960 |
|
|
8961 |
Note that such blocks may be indented in order to align nicely with |
|
8962 |
indented text and in particular with plain list structure (*note Plain |
|
8963 |
lists::). For simplicity when using small examples, you can also start |
|
8964 |
the example lines with a colon followed by a space. There may also be |
|
8965 |
additional whitespace before the colon: |
|
8966 |
|
|
8967 |
Here is an example |
|
8968 |
: Some example from a text file. |
|
8969 |
|
|
8970 |
If the example is source code from a programming language, or any |
|
8971 |
other text that can be marked up by font-lock in Emacs, you can ask for |
|
8972 |
the example to look like the fontified Emacs buffer(1). This is done |
|
8973 |
with the ‘src’ block, where you also need to specify the name of the |
|
8974 |
major mode that should be used to fontify the example(2), see *note Easy |
|
8975 |
templates:: for shortcuts to easily insert code blocks. |
|
8976 |
|
|
8977 |
#+BEGIN_SRC emacs-lisp |
|
8978 |
(defun org-xor (a b) |
|
8979 |
"Exclusive or." |
|
8980 |
(if a (not b) b)) |
|
8981 |
#+END_SRC |
|
8982 |
|
|
8983 |
Both in ‘example’ and in ‘src’ snippets, you can add a ‘-n’ switch to |
|
8984 |
the end of the ‘BEGIN’ line, to get the lines of the example numbered. |
|
8985 |
The ‘-n’ takes an optional numeric argument specifying the starting line |
|
8986 |
number of the block. If you use a ‘+n’ switch, the numbering from the |
|
8987 |
previous numbered snippet will be continued in the current one. The |
|
8988 |
‘+n’ can also take a numeric argument. The value of the argument will |
|
8989 |
be added to the last line of the previous block to determine the |
|
8990 |
starting line number. |
|
8991 |
|
|
8992 |
#+BEGIN_SRC emacs-lisp -n 20 |
|
8993 |
;; this will export with line number 20 |
|
8994 |
(message "This is line 21") |
|
8995 |
#+END_SRC |
|
8996 |
#+BEGIN_SRC emacs-lisp +n 10 |
|
8997 |
;; This will be listed as line 31 |
|
8998 |
(message "This is line 32") |
|
8999 |
#+END_SRC |
|
9000 |
|
|
9001 |
In literal examples, Org will interpret strings like ‘(ref:name)’ as |
|
9002 |
labels, and use them as targets for special hyperlinks like ‘[[(name)]]’ |
|
9003 |
(i.e., the reference name enclosed in single parenthesis). In HTML, |
|
9004 |
hovering the mouse over such a link will remote-highlight the |
|
9005 |
corresponding code line, which is kind of cool. |
|
9006 |
|
|
9007 |
You can also add a ‘-r’ switch which removes the labels from the |
|
9008 |
source code(3). With the ‘-n’ switch, links to these references will be |
|
9009 |
labeled by the line numbers from the code listing, otherwise links will |
|
9010 |
use the labels with no parentheses. Here is an example: |
|
9011 |
|
|
9012 |
#+BEGIN_SRC emacs-lisp -n -r |
|
9013 |
(save-excursion (ref:sc) |
|
9014 |
(goto-char (point-min))) (ref:jump) |
|
9015 |
#+END_SRC |
|
9016 |
In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]] |
|
9017 |
jumps to point-min. |
|
9018 |
|
|
9019 |
Finally, you can use ‘-i’ to preserve the indentation of a specific |
|
9020 |
code block (*note Editing source code::). |
|
9021 |
|
|
9022 |
If the syntax for the label format conflicts with the language |
|
9023 |
syntax, use a ‘-l’ switch to change the format, for example ‘#+BEGIN_SRC |
|
9024 |
pascal -n -r -l "((%s))"’. See also the variable |
|
9025 |
‘org-coderef-label-format’. |
|
9026 |
|
|
9027 |
HTML export also allows examples to be published as text areas (*note |
|
9028 |
Text areas in HTML export::). |
|
9029 |
|
|
9030 |
Because the ‘#+BEGIN_...’ and ‘#+END_...’ patterns need to be added |
|
9031 |
so often, shortcuts are provided using the Easy templates facility |
|
9032 |
(*note Easy templates::). |
|
9033 |
|
|
9034 |
‘C-c '’ |
|
9035 |
Edit the source code example at point in its native mode. This |
|
9036 |
works by switching to a temporary buffer with the source code. You |
|
9037 |
need to exit by pressing ‘C-c '’ again(4). The edited version will |
|
9038 |
then replace the old version in the Org buffer. Fixed-width |
|
9039 |
regions (where each line starts with a colon followed by a space) |
|
9040 |
will be edited using ‘artist-mode’(5) to allow creating ASCII |
|
9041 |
drawings easily. Using this command in an empty line will create a |
|
9042 |
new fixed-width region. |
|
9043 |
‘C-c l’ |
|
9044 |
Calling ‘org-store-link’ while editing a source code example in a |
|
9045 |
temporary buffer created with ‘C-c '’ will prompt for a label. |
|
9046 |
Make sure that it is unique in the current buffer, and insert it |
|
9047 |
with the proper formatting like ‘(ref:label)’ at the end of the |
|
9048 |
current line. Then the label is stored as a link ‘(label)’, for |
|
9049 |
retrieval with ‘C-c C-l’. |
|
9050 |
|
|
9051 |
---------- Footnotes ---------- |
|
9052 |
|
|
9053 |
(1) This works automatically for the HTML back-end (it requires |
|
9054 |
version 1.34 of the ‘htmlize.el’ package, which you need to install). |
|
9055 |
Fontified code chunks in LaTeX can be achieved using either the |
|
9056 |
<https://www.ctan.org/tex-archive/macros/latex/contrib/listings/?lang=en> |
|
9057 |
or the <https://github.com/gpoore/minted> package. If you use minted or |
|
9058 |
listing, you must load the packages manually, for example by adding the |
|
9059 |
desired package to ‘org-latex-packages-alist’. Refer to |
|
9060 |
‘org-latex-listings’ for details. |
|
9061 |
|
|
9062 |
(2) Code in ‘src’ blocks may also be evaluated either interactively |
|
9063 |
or on export. *Note Working with source code::, for more information on |
|
9064 |
evaluating code blocks. |
|
9065 |
|
|
9066 |
(3) Adding ‘-k’ to ‘-n -r’ will keep the labels in the source code |
|
9067 |
while using line numbers for the links, which might be useful to explain |
|
9068 |
those in an Org mode example code. |
|
9069 |
|
|
9070 |
(4) Upon exit, lines starting with ‘*’, ‘,*’, ‘#+’ and ‘,#+’ will get |
|
9071 |
a comma prepended, to keep them from being interpreted by Org as outline |
|
9072 |
nodes or special syntax. These commas will be stripped for editing with |
|
9073 |
‘C-c '’, and also for export. |
|
9074 |
|
|
9075 |
(5) You may select a different-mode with the variable |
|
9076 |
‘org-edit-fixed-width-region-mode’. |
|
9077 |
|
|
9078 |
|
|
9079 |
File: org, Node: Special symbols, Next: Subscripts and superscripts, Prev: Literal examples, Up: Markup |
|
9080 |
|
|
9081 |
11.6 Special symbols |
|
9082 |
==================== |
|
9083 |
|
|
9084 |
You can use LaTeX-like syntax to insert special symbols—named |
|
9085 |
entities—like ‘\alpha’ to indicate the Greek letter, or ‘\to’ to |
|
9086 |
indicate an arrow. Completion for these symbols is available, just type |
|
9087 |
‘\’ and maybe a few letters, and press ‘M-<TAB>’ to see possible |
|
9088 |
completions. If you need such a symbol inside a word, terminate it with |
|
9089 |
a pair of curly brackets. For example |
|
9090 |
|
|
9091 |
Pro tip: Given a circle \Gamma of diameter d, the length of its circumference |
|
9092 |
is \pi{}d. |
|
9093 |
|
|
9094 |
A large number of entities is provided, with names taken from both |
|
9095 |
HTML and LaTeX; you can comfortably browse the complete list from a |
|
9096 |
dedicated buffer using the command ‘org-entities-help’. It is also |
|
9097 |
possible to provide your own special symbols in the variable |
|
9098 |
‘org-entities-user’. |
|
9099 |
|
|
9100 |
During export, these symbols are transformed into the native format |
|
9101 |
of the exporter back-end. Strings like ‘\alpha’ are exported as |
|
9102 |
‘α’ in the HTML output, and as ‘\(\alpha\)’ in the LaTeX output. |
|
9103 |
Similarly, ‘\nbsp’ becomes ‘ ’ in HTML and ‘~’ in LaTeX. |
|
9104 |
|
|
9105 |
Entities may also be used as a may to escape markup in an Org |
|
9106 |
document, e.g., ‘\under{}not underlined\under’ exports as ‘_not |
|
9107 |
underlined_’. |
|
9108 |
|
|
9109 |
If you would like to see entities displayed as UTF-8 characters, use |
|
9110 |
the following command(1): |
|
9111 |
|
|
9112 |
‘C-c C-x \’ |
|
9113 |
Toggle display of entities as UTF-8 characters. This does not |
|
9114 |
change the buffer content which remains plain ASCII, but it |
|
9115 |
overlays the UTF-8 character for display purposes only. |
|
9116 |
|
|
9117 |
In addition to regular entities defined above, Org exports in a |
|
9118 |
special way(2) the following commonly used character combinations: ‘\-’ |
|
9119 |
is treated as a shy hyphen, ‘--’ and ‘---’ are converted into dashes, |
|
9120 |
and ‘...’ becomes a compact set of dots. |
|
9121 |
|
|
9122 |
---------- Footnotes ---------- |
|
9123 |
|
|
9124 |
(1) You can turn this on by default by setting the variable |
|
9125 |
‘org-pretty-entities’, or on a per-file base with the ‘#+STARTUP’ option |
|
9126 |
‘entitiespretty’. |
|
9127 |
|
|
9128 |
(2) This behavior can be disabled with ‘-’ export setting (*note |
|
9129 |
Export settings::). |
|
9130 |
|
|
9131 |
|
|
9132 |
File: org, Node: Subscripts and superscripts, Next: Embedded LaTeX, Prev: Special symbols, Up: Markup |
|
9133 |
|
|
9134 |
11.7 Subscripts and superscripts |
|
9135 |
================================ |
|
9136 |
|
|
9137 |
‘^’ and ‘_’ are used to indicate super- and subscripts. To increase the |
|
9138 |
readability of ASCII text, it is not necessary—but OK—to surround |
|
9139 |
multi-character sub- and superscripts with curly braces. Those are, |
|
9140 |
however, mandatory, when more than one word is involved. For example |
|
9141 |
|
|
9142 |
The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, the |
|
9143 |
radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}. |
|
9144 |
|
|
9145 |
If you write a text where the underscore is often used in a different |
|
9146 |
context, Org’s convention to always interpret these as subscripts can |
|
9147 |
get in your way. Configure the variable ‘org-use-sub-superscripts’ to |
|
9148 |
change this convention. For example, when setting this variable to |
|
9149 |
‘{}’, ‘a_b’ will not be interpreted as a subscript, but ‘a_{b}’ will. |
|
9150 |
|
|
9151 |
‘C-c C-x \’ |
|
9152 |
In addition to showing entities as UTF-8 characters, this command |
|
9153 |
will also format sub- and superscripts in a WYSIWYM way. |
|
9154 |
|
|
9155 |
|
|
9156 |
File: org, Node: Embedded LaTeX, Prev: Subscripts and superscripts, Up: Markup |
|
9157 |
|
|
9158 |
11.8 Embedded LaTeX |
|
9159 |
=================== |
|
9160 |
|
|
9161 |
Plain ASCII is normally sufficient for almost all note taking. |
|
9162 |
Exceptions include scientific notes, which often require mathematical |
|
9163 |
symbols and the occasional formula. LaTeX(1) is widely used to typeset |
|
9164 |
scientific documents. Org mode supports embedding LaTeX code into its |
|
9165 |
files, because many academics are used to writing and reading LaTeX |
|
9166 |
source code, and because it can be readily processed to produce pretty |
|
9167 |
output for a number of export back-ends. |
|
9168 |
|
|
9169 |
* Menu: |
|
9170 |
|
|
9171 |
* LaTeX fragments:: Complex formulas made easy |
|
9172 |
* Previewing LaTeX fragments:: What will this snippet look like? |
|
9173 |
* CDLaTeX mode:: Speed up entering of formulas |
|
9174 |
|
|
9175 |
---------- Footnotes ---------- |
|
9176 |
|
|
9177 |
(1) LaTeX is a macro system based on Donald E. Knuth’s TeX system. |
|
9178 |
Many of the features described here as “LaTeX” are really from TeX, but |
|
9179 |
for simplicity I am blurring this distinction. |
|
9180 |
|
|
9181 |
|
|
9182 |
File: org, Node: LaTeX fragments, Next: Previewing LaTeX fragments, Up: Embedded LaTeX |
|
9183 |
|
|
9184 |
11.8.1 LaTeX fragments |
|
9185 |
---------------------- |
|
9186 |
|
|
9187 |
Org mode can contain LaTeX math fragments, and it supports ways to |
|
9188 |
process these for several export back-ends. When exporting to LaTeX, |
|
9189 |
the code is left as it is. When exporting to HTML, Org can use either |
|
9190 |
MathJax (http://www.mathjax.org) (*note Math formatting in HTML |
|
9191 |
export::) or transcode the math into images (see *note Previewing LaTeX |
|
9192 |
fragments::). |
|
9193 |
|
|
9194 |
LaTeX fragments don’t need any special marking at all. The following |
|
9195 |
snippets will be identified as LaTeX source code: |
|
9196 |
• Environments of any kind(1). The only requirement is that the |
|
9197 |
‘\begin’ statement appears on a new line, at the beginning of the |
|
9198 |
line or after whitespaces only. |
|
9199 |
• Text within the usual LaTeX math delimiters. To avoid conflicts |
|
9200 |
with currency specifications, single ‘$’ characters are only |
|
9201 |
recognized as math delimiters if the enclosed text contains at most |
|
9202 |
two line breaks, is directly attached to the ‘$’ characters with no |
|
9203 |
whitespace in between, and if the closing ‘$’ is followed by |
|
9204 |
whitespace or punctuation (parentheses and quotes are considered to |
|
9205 |
be punctuation in this context). For the other delimiters, there |
|
9206 |
is no such restriction, so when in doubt, use ‘\(...\)’ as inline |
|
9207 |
math delimiters. |
|
9208 |
|
|
9209 |
For example: |
|
9210 |
|
|
9211 |
\begin{equation} |
|
9212 |
x=\sqrt{b} |
|
9213 |
\end{equation} |
|
9214 |
|
|
9215 |
If $a^2=b$ and \( b=2 \), then the solution must be |
|
9216 |
either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]. |
|
9217 |
|
|
9218 |
LaTeX processing can be configured with the variable |
|
9219 |
‘org-export-with-latex’. The default setting is ‘t’ which means MathJax |
|
9220 |
for HTML, and no processing for ASCII and LaTeX back-ends. You can also |
|
9221 |
set this variable on a per-file basis using one of these lines: |
|
9222 |
|
|
9223 |
#+OPTIONS: tex:t Do the right thing automatically (MathJax) |
|
9224 |
#+OPTIONS: tex:nil Do not process LaTeX fragments at all |
|
9225 |
#+OPTIONS: tex:verbatim Verbatim export, for jsMath or so |
|
9226 |
|
|
9227 |
---------- Footnotes ---------- |
|
9228 |
|
|
9229 |
(1) When MathJax is used, only the environments recognized by MathJax |
|
9230 |
will be processed. When ‘dvipng’ program, ‘dvisvgm’ program or |
|
9231 |
‘imagemagick’ suite is used to create images, any LaTeX environment will |
|
9232 |
be handled. |
|
9233 |
|
|
9234 |
|
|
9235 |
File: org, Node: Previewing LaTeX fragments, Next: CDLaTeX mode, Prev: LaTeX fragments, Up: Embedded LaTeX |
|
9236 |
|
|
9237 |
11.8.2 Previewing LaTeX fragments |
|
9238 |
--------------------------------- |
|
9239 |
|
|
9240 |
If you have a working LaTeX installation and ‘dvipng’, ‘dvisvgm’ or |
|
9241 |
‘convert’ installed(1), LaTeX fragments can be processed to produce |
|
9242 |
images of the typeset expressions to be used for inclusion while |
|
9243 |
exporting to HTML (see *note LaTeX fragments::), or for inline |
|
9244 |
previewing within Org mode. |
|
9245 |
|
|
9246 |
You can customize the variables ‘org-format-latex-options’ and |
|
9247 |
‘org-format-latex-header’ to influence some aspects of the preview. In |
|
9248 |
particular, the ‘:scale’ (and for HTML export, ‘:html-scale’) property |
|
9249 |
of the former can be used to adjust the size of the preview images. |
|
9250 |
|
|
9251 |
‘C-c C-x C-l’ |
|
9252 |
Produce a preview image of the LaTeX fragment at point and overlay |
|
9253 |
it over the source code. If there is no fragment at point, process |
|
9254 |
all fragments in the current entry (between two headlines). When |
|
9255 |
called with a prefix argument, process the entire subtree. When |
|
9256 |
called with two prefix arguments, or when the cursor is before the |
|
9257 |
first headline, process the entire buffer. |
|
9258 |
‘C-c C-c’ |
|
9259 |
Remove the overlay preview images. |
|
9260 |
|
|
9261 |
You can turn on the previewing of all LaTeX fragments in a file with |
|
9262 |
|
|
9263 |
#+STARTUP: latexpreview |
|
9264 |
|
|
9265 |
To disable it, simply use |
|
9266 |
|
|
9267 |
#+STARTUP: nolatexpreview |
|
9268 |
|
|
9269 |
---------- Footnotes ---------- |
|
9270 |
|
|
9271 |
(1) These are respectively available at |
|
9272 |
<http://sourceforge.net/projects/dvipng/>, <http://dvisvgm.bplaced.net/> |
|
9273 |
and from the ‘imagemagick’ suite. Choose the converter by setting the |
|
9274 |
variable ‘org-preview-latex-default-process’ accordingly. |
|
9275 |
|
|
9276 |
|
|
9277 |
File: org, Node: CDLaTeX mode, Prev: Previewing LaTeX fragments, Up: Embedded LaTeX |
|
9278 |
|
|
9279 |
11.8.3 Using CDLaTeX to enter math |
|
9280 |
---------------------------------- |
|
9281 |
|
|
9282 |
CDLaTeX mode is a minor mode that is normally used in combination with a |
|
9283 |
major LaTeX mode like AUCTeX in order to speed-up insertion of |
|
9284 |
environments and math templates. Inside Org mode, you can make use of |
|
9285 |
some of the features of CDLaTeX mode. You need to install ‘cdlatex.el’ |
|
9286 |
and ‘texmathp.el’ (the latter comes also with AUCTeX) from |
|
9287 |
<https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex>. Don’t use CDLaTeX |
|
9288 |
mode itself under Org mode, but use the light version ‘org-cdlatex-mode’ |
|
9289 |
that comes as part of Org mode. Turn it on for the current buffer with |
|
9290 |
‘M-x org-cdlatex-mode <RET>’, or for all Org files with |
|
9291 |
|
|
9292 |
(add-hook 'org-mode-hook 'turn-on-org-cdlatex) |
|
9293 |
|
|
9294 |
When this mode is enabled, the following features are present (for |
|
9295 |
more details see the documentation of CDLaTeX mode): |
|
9296 |
• Environment templates can be inserted with ‘C-c {’. |
|
9297 |
• The <TAB> key will do template expansion if the cursor is inside a |
|
9298 |
LaTeX fragment(1). For example, <TAB> will expand ‘fr’ to |
|
9299 |
‘\frac{}{}’ and position the cursor correctly inside the first |
|
9300 |
brace. Another <TAB> will get you into the second brace. Even |
|
9301 |
outside fragments, <TAB> will expand environment abbreviations at |
|
9302 |
the beginning of a line. For example, if you write ‘equ’ at the |
|
9303 |
beginning of a line and press <TAB>, this abbreviation will be |
|
9304 |
expanded to an ‘equation’ environment. To get a list of all |
|
9305 |
abbreviations, type ‘M-x cdlatex-command-help <RET>’. |
|
9306 |
• Pressing ‘_’ and ‘^’ inside a LaTeX fragment will insert these |
|
9307 |
characters together with a pair of braces. If you use <TAB> to |
|
9308 |
move out of the braces, and if the braces surround only a single |
|
9309 |
character or macro, they are removed again (depending on the |
|
9310 |
variable ‘cdlatex-simplify-sub-super-scripts’). |
|
9311 |
• Pressing the grave accent ‘`’ followed by a character inserts math |
|
9312 |
macros, also outside LaTeX fragments. If you wait more than 1.5 |
|
9313 |
seconds after the grave accent, a help window will pop up. |
|
9314 |
• Pressing the apostrophe ‘'’ followed by another character modifies |
|
9315 |
the symbol before point with an accent or a font. If you wait more |
|
9316 |
than 1.5 seconds after the apostrophe, a help window will pop up. |
|
9317 |
Character modification will work only inside LaTeX fragments; |
|
9318 |
outside the quote is normal. |
|
9319 |
|
|
9320 |
---------- Footnotes ---------- |
|
9321 |
|
|
9322 |
(1) Org mode has a method to test if the cursor is inside such a |
|
9323 |
fragment, see the documentation of the function |
|
9324 |
‘org-inside-LaTeX-fragment-p’. |
|
9325 |
|
|
9326 |
|
|
9327 |
File: org, Node: Exporting, Next: Publishing, Prev: Markup, Up: Top |
|
9328 |
|
|
9329 |
12 Exporting |
|
9330 |
************ |
|
9331 |
|
|
9332 |
Sometimes, you may want to pretty print your notes, publish them on the |
|
9333 |
web or even share them with people not using Org. In these cases, the |
|
9334 |
Org export facilities can be used to convert your documents to a variety |
|
9335 |
of other formats, while retaining as much structure (*note Document |
|
9336 |
structure::) and markup (*note Markup::) as possible. |
|
9337 |
|
|
9338 |
Libraries responsible for such translation are called back-ends. Org |
|
9339 |
ships with the following ones |
|
9340 |
|
|
9341 |
• ascii (ASCII format) |
|
9342 |
• beamer (LaTeX Beamer format) |
|
9343 |
• html (HTML format) |
|
9344 |
• icalendar (iCalendar format) |
|
9345 |
• latex (LaTeX format) |
|
9346 |
• md (Markdown format) |
|
9347 |
• odt (OpenDocument Text format) |
|
9348 |
• org (Org format) |
|
9349 |
• texinfo (Texinfo format) |
|
9350 |
• man (Man page format) |
|
9351 |
|
|
9352 |
Org also uses additional libraries located in ‘contrib/’ directory |
|
9353 |
(*note Installation::). Users can install additional export libraries |
|
9354 |
for additional formats from the Emacs packaging system. For easy |
|
9355 |
discovery, these packages have a common naming scheme: ‘ox-NAME’, where |
|
9356 |
NAME is one of the formats. For example, ‘ox-koma-letter’ for |
|
9357 |
‘koma-letter’ back-end. |
|
9358 |
|
|
9359 |
Org loads back-ends for the following formats by default: ‘ascii’, |
|
9360 |
‘html’, ‘icalendar’, ‘latex’ and ‘odt’. |
|
9361 |
|
|
9362 |
Org can load additional back-ends either of two ways: through the |
|
9363 |
‘org-export-backends’ variable configuration; or, by requiring the |
|
9364 |
library in the Emacs init file like this: |
|
9365 |
|
|
9366 |
(require 'ox-md) |
|
9367 |
|
|
9368 |
* Menu: |
|
9369 |
|
|
9370 |
* The export dispatcher:: The main interface |
|
9371 |
* Export settings:: Common export settings |
|
9372 |
* Table of contents:: The if and where of the table of contents |
|
9373 |
* Include files:: Include additional files into a document |
|
9374 |
* Macro replacement:: Use macros to create templates |
|
9375 |
* Comment lines:: What will not be exported |
|
9376 |
* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding |
|
9377 |
* Beamer export:: Exporting as a Beamer presentation |
|
9378 |
* HTML export:: Exporting to HTML |
|
9379 |
* LaTeX export:: Exporting to LaTeX, and processing to PDF |
|
9380 |
* Markdown export:: Exporting to Markdown |
|
9381 |
* OpenDocument Text export:: Exporting to OpenDocument Text |
|
9382 |
* Org export:: Exporting to Org |
|
9383 |
* Texinfo export:: Exporting to Texinfo |
|
9384 |
* iCalendar export:: Exporting to iCalendar |
|
9385 |
* Other built-in back-ends:: Exporting to a man page |
|
9386 |
* Advanced configuration:: Fine-tuning the export output |
|
9387 |
* Export in foreign buffers:: Author tables and lists in Org syntax |
|
9388 |
|
|
9389 |
|
|
9390 |
File: org, Node: The export dispatcher, Next: Export settings, Up: Exporting |
|
9391 |
|
|
9392 |
12.1 The export dispatcher |
|
9393 |
========================== |
|
9394 |
|
|
9395 |
The export dispatcher is the main interface for Org’s exports. A |
|
9396 |
hierarchical menu presents the currently configured export formats. |
|
9397 |
Options are shown as easy toggle switches on the same screen. |
|
9398 |
|
|
9399 |
Org also has a minimal prompt interface for the export dispatcher. |
|
9400 |
When the variable ‘org-export-dispatch-use-expert-ui’ is set to a |
|
9401 |
non-‘nil’ value, Org prompts in the minibuffer. To switch back to the |
|
9402 |
hierarchical menu, press <?>. |
|
9403 |
|
|
9404 |
‘C-c C-e’ (‘org-export-dispatch’) |
|
9405 |
|
|
9406 |
Invokes the export dispatcher interface. The options show default |
|
9407 |
settings. The ‘C-u’ prefix argument preserves options from the |
|
9408 |
previous export, including any sub-tree selections. |
|
9409 |
|
|
9410 |
Org exports the entire buffer by default. If the Org buffer has an |
|
9411 |
active region, then Org exports just that region. |
|
9412 |
|
|
9413 |
These are the export options, the key combinations that toggle them |
|
9414 |
(*note Export settings::): |
|
9415 |
|
|
9416 |
‘C-a’ |
|
9417 |
Toggles asynchronous export. Asynchronous export uses an external |
|
9418 |
Emacs process with a specially configured initialization file to |
|
9419 |
complete the exporting process in the background thereby releasing |
|
9420 |
the current interface. This is particularly useful when exporting |
|
9421 |
long documents. |
|
9422 |
|
|
9423 |
Output from an asynchronous export is saved on the “the export |
|
9424 |
stack”. To view this stack, call the export dispatcher with a |
|
9425 |
double ‘C-u’ prefix argument. If already in the export dispatcher |
|
9426 |
menu, ‘&’ displays the stack. |
|
9427 |
|
|
9428 |
To make the background export process the default, customize the |
|
9429 |
variable, ‘org-export-in-background’. |
|
9430 |
|
|
9431 |
‘C-b’ |
|
9432 |
Toggle body-only export. Useful for excluding headers and footers |
|
9433 |
in the export. Affects only those back-end formats that have such |
|
9434 |
sections—like ‘<head>...</head>’ in HTML. |
|
9435 |
|
|
9436 |
‘C-s’ |
|
9437 |
Toggle sub-tree export. When turned on, Org exports only the |
|
9438 |
sub-tree starting from the cursor position at the time the export |
|
9439 |
dispatcher was invoked. Org uses the top heading of this sub-tree |
|
9440 |
as the document’s title. If the cursor is not on a heading, Org |
|
9441 |
uses the nearest enclosing header. If the cursor is in the |
|
9442 |
document preamble, Org signals an error and aborts export. |
|
9443 |
|
|
9444 |
To make the sub-tree export the default, customize the variable, |
|
9445 |
‘org-export-initial-scope’. |
|
9446 |
|
|
9447 |
‘C-v’ |
|
9448 |
Toggle visible-only export. Useful for exporting only visible |
|
9449 |
parts of an Org document by adjusting outline visibility settings. |
|
9450 |
|
|
9451 |
|
|
9452 |
File: org, Node: Export settings, Next: Table of contents, Prev: The export dispatcher, Up: Exporting |
|
9453 |
|
|
9454 |
12.2 Export settings |
|
9455 |
==================== |
|
9456 |
|
|
9457 |
Export options can be set: globally with variables; for an individual |
|
9458 |
file by making variables buffer-local with in-buffer settings (*note |
|
9459 |
In-buffer settings::), by setting individual keywords, or by specifying |
|
9460 |
them in a compact form with the ‘#+OPTIONS’ keyword; or for a tree by |
|
9461 |
setting properties (*note Properties and columns::). Options set at a |
|
9462 |
specific level override options set at a more general level. |
|
9463 |
|
|
9464 |
In-buffer settings may appear anywhere in the file, either directly |
|
9465 |
or indirectly through a file included using ‘#+SETUPFILE: filename or |
|
9466 |
URL’ syntax. Option keyword sets tailored to a particular back-end can |
|
9467 |
be inserted from the export dispatcher (*note The export dispatcher::) |
|
9468 |
using the ‘Insert template’ command by pressing ‘#’. To insert keywords |
|
9469 |
individually, a good way to make sure the keyword is correct is to type |
|
9470 |
‘#+’ and then to use ‘M-<TAB>’(1) for completion. |
|
9471 |
|
|
9472 |
The export keywords available for every back-end, and their |
|
9473 |
equivalent global variables, include: |
|
9474 |
|
|
9475 |
‘AUTHOR’ |
|
9476 |
The document author (‘user-full-name’). |
|
9477 |
|
|
9478 |
‘CREATOR’ |
|
9479 |
Entity responsible for output generation |
|
9480 |
(‘org-export-creator-string’). |
|
9481 |
|
|
9482 |
‘DATE’ |
|
9483 |
A date or a time-stamp(2). |
|
9484 |
|
|
9485 |
‘EMAIL’ |
|
9486 |
The email address (‘user-mail-address’). |
|
9487 |
|
|
9488 |
‘LANGUAGE’ |
|
9489 |
Language to use for translating certain strings |
|
9490 |
(‘org-export-default-language’). With ‘#+LANGUAGE: fr’, for |
|
9491 |
example, Org translates _Table of contents_ to the French _Table |
|
9492 |
des matières_. |
|
9493 |
|
|
9494 |
‘SELECT_TAGS’ |
|
9495 |
The default value is ‘:export:’. When a tree is tagged with |
|
9496 |
‘:export:’ (‘org-export-select-tags’), Org selects that tree and |
|
9497 |
its sub-trees for export. Org excludes trees with ‘:noexport:’ |
|
9498 |
tags, see below. When selectively exporting files with ‘:export:’ |
|
9499 |
tags set, Org does not export any text that appears before the |
|
9500 |
first headline. |
|
9501 |
|
|
9502 |
‘EXCLUDE_TAGS’ |
|
9503 |
The default value is ‘:noexport:’. When a tree is tagged with |
|
9504 |
‘:noexport:’ (‘org-export-exclude-tags’), Org excludes that tree |
|
9505 |
and its sub-trees from export. Entries tagged with ‘:noexport:’ |
|
9506 |
will be unconditionally excluded from the export, even if they have |
|
9507 |
an ‘:export:’ tag. Even if a sub-tree is not exported, Org will |
|
9508 |
execute any code blocks contained in them. |
|
9509 |
|
|
9510 |
‘TITLE’ |
|
9511 |
Org displays this title. For long titles, use multiple ‘#+TITLE’ |
|
9512 |
lines. |
|
9513 |
|
|
9514 |
‘EXPORT_FILE_NAME’ |
|
9515 |
The name of the output file to be generated. Otherwise, Org |
|
9516 |
generates the file name based on the buffer name and the extension |
|
9517 |
based on the back-end format. |
|
9518 |
|
|
9519 |
The ‘#+OPTIONS’ keyword is a compact form. To configure multiple |
|
9520 |
options, use several ‘#+OPTIONS’ lines. ‘#+OPTIONS’ recognizes the |
|
9521 |
following arguments. |
|
9522 |
|
|
9523 |
‘':’ |
|
9524 |
Toggle smart quotes (‘org-export-with-smart-quotes’). Depending on |
|
9525 |
the language used, when activated, Org treats pairs of double |
|
9526 |
quotes as primary quotes, pairs of single quotes as secondary |
|
9527 |
quotes, and single quote marks as apostrophes. |
|
9528 |
|
|
9529 |
‘*:’ |
|
9530 |
Toggle emphasized text (‘org-export-with-emphasize’). |
|
9531 |
|
|
9532 |
‘-:’ |
|
9533 |
Toggle conversion of special strings |
|
9534 |
(‘org-export-with-special-strings’). |
|
9535 |
|
|
9536 |
‘::’ |
|
9537 |
Toggle fixed-width sections (‘org-export-with-fixed-width’). |
|
9538 |
|
|
9539 |
‘<:’ |
|
9540 |
Toggle inclusion of time/date active/inactive stamps |
|
9541 |
(‘org-export-with-timestamps’). |
|
9542 |
|
|
9543 |
‘\n:’ |
|
9544 |
Toggles whether to preserve line breaks |
|
9545 |
(‘org-export-preserve-breaks’). |
|
9546 |
|
|
9547 |
‘^:’ |
|
9548 |
Toggle TeX-like syntax for sub- and superscripts. If you write |
|
9549 |
"^:{}", ‘a_{b}’ will be interpreted, but the simple ‘a_b’ will be |
|
9550 |
left as it is (‘org-export-with-sub-superscripts’). |
|
9551 |
|
|
9552 |
‘arch:’ |
|
9553 |
Configure how archived trees are exported. When set to ‘headline’, |
|
9554 |
the export process skips the contents and processes only the |
|
9555 |
headlines (‘org-export-with-archived-trees’). |
|
9556 |
|
|
9557 |
‘author:’ |
|
9558 |
Toggle inclusion of author name into exported file |
|
9559 |
(‘org-export-with-author’). |
|
9560 |
|
|
9561 |
‘broken-links:’ |
|
9562 |
Toggles if Org should continue exporting upon finding a broken |
|
9563 |
internal link. When set to ‘mark’, Org clearly marks the problem |
|
9564 |
link in the output (‘org-export-with-broken-links’). |
|
9565 |
|
|
9566 |
‘c:’ |
|
9567 |
Toggle inclusion of CLOCK keywords (‘org-export-with-clocks’). |
|
9568 |
|
|
9569 |
‘creator:’ |
|
9570 |
Toggle inclusion of creator information in the exported file |
|
9571 |
(‘org-export-with-creator’). |
|
9572 |
|
|
9573 |
‘d:’ |
|
9574 |
Toggles inclusion of drawers, or list of drawers to include, or |
|
9575 |
list of drawers to exclude (‘org-export-with-drawers’). |
|
9576 |
|
|
9577 |
‘date:’ |
|
9578 |
Toggle inclusion of a date into exported file |
|
9579 |
(‘org-export-with-date’). |
|
9580 |
|
|
9581 |
‘e:’ |
|
9582 |
Toggle inclusion of entities (‘org-export-with-entities’). |
|
9583 |
|
|
9584 |
‘email:’ |
|
9585 |
Toggle inclusion of the author’s e-mail into exported file |
|
9586 |
(‘org-export-with-email’). |
|
9587 |
|
|
9588 |
‘f:’ |
|
9589 |
Toggle the inclusion of footnotes (‘org-export-with-footnotes’). |
|
9590 |
|
|
9591 |
‘H:’ |
|
9592 |
Set the number of headline levels for export |
|
9593 |
(‘org-export-headline-levels’). Below that level, headlines are |
|
9594 |
treated differently. In most back-ends, they become list items. |
|
9595 |
|
|
9596 |
‘inline:’ |
|
9597 |
Toggle inclusion of inlinetasks (‘org-export-with-inlinetasks’). |
|
9598 |
|
|
9599 |
‘num:’ |
|
9600 |
Toggle section-numbers (‘org-export-with-section-numbers’). When |
|
9601 |
set to number ‘n’, Org numbers only those headlines at level ‘n’ or |
|
9602 |
above. Setting ‘UNNUMBERED’ property to non-‘nil’ disables |
|
9603 |
numbering of a heading. Since subheadings inherit from this |
|
9604 |
property, it affects their numbering, too. |
|
9605 |
|
|
9606 |
‘p:’ |
|
9607 |
Toggle export of planning information (‘org-export-with-planning’). |
|
9608 |
“Planning information” comes from lines located right after the |
|
9609 |
headline and contain any combination of these cookies: |
|
9610 |
‘SCHEDULED:’, ‘DEADLINE:’, or ‘CLOSED:’. |
|
9611 |
|
|
9612 |
‘pri:’ |
|
9613 |
Toggle inclusion of priority cookies (‘org-export-with-priority’). |
|
9614 |
|
|
9615 |
‘prop:’ |
|
9616 |
Toggle inclusion of property drawers, or list the properties to |
|
9617 |
include (‘org-export-with-properties’). |
|
9618 |
|
|
9619 |
‘stat:’ |
|
9620 |
Toggle inclusion of statistics cookies |
|
9621 |
(‘org-export-with-statistics-cookies’). |
|
9622 |
|
|
9623 |
‘tags:’ |
|
9624 |
Toggle inclusion of tags, may also be ‘not-in-toc’ |
|
9625 |
(‘org-export-with-tags’). |
|
9626 |
|
|
9627 |
‘tasks:’ |
|
9628 |
Toggle inclusion of tasks (TODO items); or ‘nil’ to remove all |
|
9629 |
tasks; or ‘todo’ to remove DONE tasks; or list the keywords to keep |
|
9630 |
(‘org-export-with-tasks’). |
|
9631 |
|
|
9632 |
‘tex:’ |
|
9633 |
‘nil’ does not export; ‘t’ exports; ‘verbatim’ keeps everything in |
|
9634 |
verbatim (‘org-export-with-latex’). |
|
9635 |
|
|
9636 |
‘timestamp:’ |
|
9637 |
Toggle inclusion of the creation time in the exported file |
|
9638 |
(‘org-export-time-stamp-file’). |
|
9639 |
|
|
9640 |
‘title:’ |
|
9641 |
Toggle inclusion of title (‘org-export-with-title’). |
|
9642 |
|
|
9643 |
‘toc:’ |
|
9644 |
Toggle inclusion of the table of contents, or set the level limit |
|
9645 |
(‘org-export-with-toc’). |
|
9646 |
|
|
9647 |
‘todo:’ |
|
9648 |
Toggle inclusion of TODO keywords into exported text |
|
9649 |
(‘org-export-with-todo-keywords’). |
|
9650 |
|
|
9651 |
‘|:’ |
|
9652 |
Toggle inclusion of tables (‘org-export-with-tables’). |
|
9653 |
|
|
9654 |
When exporting sub-trees, special node properties in them can |
|
9655 |
override the above keywords. They are special because they have an |
|
9656 |
‘EXPORT_’ prefix. For example, ‘DATE’ and ‘EXPORT_FILE_NAME’ keywords |
|
9657 |
become, respectively, ‘EXPORT_DATE’ and ‘EXPORT_FILE_NAME’. Except for |
|
9658 |
‘SETUPFILE’, all other keywords listed above have an ‘EXPORT_’ |
|
9659 |
equivalent. |
|
9660 |
|
|
9661 |
If ‘org-export-allow-bind-keywords’ is non-‘nil’, Emacs variables can |
|
9662 |
become buffer-local during export by using the BIND keyword. Its syntax |
|
9663 |
is ‘#+BIND: variable value’. This is particularly useful for in-buffer |
|
9664 |
settings that cannot be changed using keywords. |
|
9665 |
|
|
9666 |
---------- Footnotes ---------- |
|
9667 |
|
|
9668 |
(1) Many desktops intercept ‘M-<TAB>’ to switch windows. Use ‘C-M-i’ |
|
9669 |
or ‘<ESC> <TAB>’ instead. |
|
9670 |
|
|
9671 |
(2) The variable ‘org-export-date-timestamp-format’ defines how this |
|
9672 |
time-stamp will be exported. |
|
9673 |
|
|
9674 |
|
|
9675 |
File: org, Node: Table of contents, Next: Include files, Prev: Export settings, Up: Exporting |
|
9676 |
|
|
9677 |
12.3 Table of contents |
|
9678 |
====================== |
|
9679 |
|
|
9680 |
Org normally inserts the table of contents directly before the first |
|
9681 |
headline of the file. Org sets the TOC depth the same as the headline |
|
9682 |
levels in the file. Use a lower number for lower TOC depth. To turn |
|
9683 |
off TOC entirely, use ‘nil’. This is configured in the |
|
9684 |
‘org-export-with-toc’ variable or as keywords in an Org file as: |
|
9685 |
|
|
9686 |
#+OPTIONS: toc:2 only include two levels in TOC |
|
9687 |
#+OPTIONS: toc:nil no default TOC at all |
|
9688 |
|
|
9689 |
To move the table of contents to a different location, first turn off |
|
9690 |
the default with ‘org-export-with-toc’ variable or with ‘#+OPTIONS: |
|
9691 |
toc:nil’. Then insert ‘#+TOC: headlines N’ at the desired location(s). |
|
9692 |
|
|
9693 |
#+OPTIONS: toc:nil no default TOC |
|
9694 |
... |
|
9695 |
#+TOC: headlines 2 insert TOC here, with two headline levels |
|
9696 |
|
|
9697 |
To adjust the TOC depth for a specific section of the Org document, |
|
9698 |
append an additional ‘local’ parameter. This parameter becomes a |
|
9699 |
relative depth for the current level. |
|
9700 |
|
|
9701 |
Note that for this feature to work properly in LaTeX export, the Org |
|
9702 |
file requires the inclusion of the ‘titletoc’ package. Because of |
|
9703 |
compatibility issues, ‘titletoc’ has to be loaded _before_ ‘hyperref’. |
|
9704 |
Customize the ‘org-latex-default-packages-alist’ variable. |
|
9705 |
|
|
9706 |
* Section #+TOC: headlines 1 local insert local TOC, with direct children |
|
9707 |
only |
|
9708 |
|
|
9709 |
Use the ‘TOC’ keyword to generate list of tables (resp. all listings) |
|
9710 |
with captions. |
|
9711 |
|
|
9712 |
#+TOC: listings build a list of listings |
|
9713 |
#+TOC: tables build a list of tables |
|
9714 |
|
|
9715 |
Normally Org uses the headline for its entry in the table of |
|
9716 |
contents. But with ‘ALT_TITLE’ property, a different entry can be |
|
9717 |
specified for the table of contents. |
|
9718 |
|
|
9719 |
|
|
9720 |
File: org, Node: Include files, Next: Macro replacement, Prev: Table of contents, Up: Exporting |
|
9721 |
|
|
9722 |
12.4 Include files |
|
9723 |
================== |
|
9724 |
|
|
9725 |
Include other files during export. For example, to include your |
|
9726 |
‘.emacs’ file, you could use: |
|
9727 |
|
|
9728 |
#+INCLUDE: "~/.emacs" src emacs-lisp |
|
9729 |
|
|
9730 |
The first parameter is the file name to include. The optional second |
|
9731 |
parameter specifies the block type: ‘example’, ‘export’ or ‘src’. The |
|
9732 |
optional third parameter specifies the source code language to use for |
|
9733 |
formatting the contents. This is relevant to both ‘export’ and ‘src’ |
|
9734 |
block types. |
|
9735 |
|
|
9736 |
If an include file is specified as having a markup language, Org |
|
9737 |
neither checks for valid syntax nor changes the contents in any way. |
|
9738 |
For ‘example’ and ‘src’ blocks, Org code-escapes the contents before |
|
9739 |
inclusion. |
|
9740 |
|
|
9741 |
If an include file is not specified as having any markup language, |
|
9742 |
Org assumes it be in Org format and proceeds as usual with a few |
|
9743 |
exceptions. Org makes the footnote labels (*note Footnotes::) in the |
|
9744 |
included file local to that file. The contents of the included file |
|
9745 |
will belong to the same structure—headline, item—containing the |
|
9746 |
‘INCLUDE’ keyword. In particular, headlines within the file will become |
|
9747 |
children of the current section. That behavior can be changed by |
|
9748 |
providing an additional keyword parameter, ‘:minlevel’. It shifts the |
|
9749 |
headlines in the included file to become the lowest level. For example, |
|
9750 |
this syntax makes the included file a sibling of the current top-level |
|
9751 |
headline: |
|
9752 |
|
|
9753 |
#+INCLUDE: "~/my-book/chapter2.org" :minlevel 1 |
|
9754 |
|
|
9755 |
Inclusion of only portions of files are specified using ranges |
|
9756 |
parameter with ‘:lines’ keyword. The line at the upper end of the range |
|
9757 |
will not be included. The start and/or the end of the range may be |
|
9758 |
omitted to use the obvious defaults. |
|
9759 |
|
|
9760 |
#+INCLUDE: "~/.emacs" :lines "5-10" Include lines 5 to 10, 10 excluded |
|
9761 |
#+INCLUDE: "~/.emacs" :lines "-10" Include lines 1 to 10, 10 excluded |
|
9762 |
#+INCLUDE: "~/.emacs" :lines "10-" Include lines from 10 to EOF |
|
9763 |
|
|
9764 |
Inclusions may specify a file-link to extract an object matched by |
|
9765 |
‘org-link-search’(1) (*note Search options::). |
|
9766 |
|
|
9767 |
To extract only the contents of the matched object, set |
|
9768 |
‘:only-contents’ property to non-‘nil’. This will omit any planning |
|
9769 |
lines or property drawers. The ranges for ‘:lines’ keyword are relative |
|
9770 |
to the requested element. Some examples: |
|
9771 |
|
|
9772 |
#+INCLUDE: "./paper.org::#theory" :only-contents t |
|
9773 |
Include the body of the heading with the custom id ‘theory’ |
|
9774 |
#+INCLUDE: "./paper.org::mytable" Include named element. |
|
9775 |
#+INCLUDE: "./paper.org::*conclusion" :lines 1-20 |
|
9776 |
Include the first 20 lines of the headline named ‘conclusion’. |
|
9777 |
|
|
9778 |
‘C-c '’ |
|
9779 |
Visit the include file at point. |
|
9780 |
|
|
9781 |
---------- Footnotes ---------- |
|
9782 |
|
|
9783 |
(1) Note that ‘org-link-search-must-match-exact-headline’ is locally |
|
9784 |
bound to non-‘nil’. Therefore, ‘org-link-search’ only matches headlines |
|
9785 |
and named elements. |
|
9786 |
|
|
9787 |
|
|
9788 |
File: org, Node: Macro replacement, Next: Comment lines, Prev: Include files, Up: Exporting |
|
9789 |
|
|
9790 |
12.5 Macro replacement |
|
9791 |
====================== |
|
9792 |
|
|
9793 |
Macros replace text snippets during export. Macros are defined globally |
|
9794 |
in ‘org-export-global-macros’, or document-wise with the following |
|
9795 |
syntax: |
|
9796 |
|
|
9797 |
#+MACRO: name replacement text $1, $2 are arguments |
|
9798 |
|
|
9799 |
which can be referenced using ‘{{{name(arg1, arg2)}}}’(1). |
|
9800 |
|
|
9801 |
Org recognizes macro references in following Org markup areas: |
|
9802 |
paragraphs, headlines, verse blocks, tables cells and lists. Org also |
|
9803 |
recognizes macro references in keywords, such as ‘#+CAPTION’, ‘#+TITLE’, |
|
9804 |
‘#+AUTHOR’, ‘#+DATE’, and for some back-end specific export options. |
|
9805 |
|
|
9806 |
Org comes with following pre-defined macros: |
|
9807 |
|
|
9808 |
‘{{{title}}}’ |
|
9809 |
‘{{{author}}}’ |
|
9810 |
‘{{{email}}}’ |
|
9811 |
Org replaces these macro references with available information at |
|
9812 |
the time of export. |
|
9813 |
|
|
9814 |
‘{{{date}}}’ |
|
9815 |
‘{{{date(FORMAT)}}}’ |
|
9816 |
This macro refers to the ‘#+DATE’ keyword. FORMAT is an optional |
|
9817 |
argument to the ‘{{{date}}}’ macro that will be used only if |
|
9818 |
‘#+DATE’ is a single timestamp. FORMAT should be a format string |
|
9819 |
understood by ‘format-time-string’. |
|
9820 |
|
|
9821 |
‘{{{time(FORMAT)}}}’ |
|
9822 |
‘{{{modification-time(FORMAT, VC)}}}’ |
|
9823 |
These macros refer to the document’s date and time of export and |
|
9824 |
date and time of modification. FORMAT is a string understood by |
|
9825 |
‘format-time-string’. If the second argument to the |
|
9826 |
‘modification-time’ macro is non-‘nil’, Org uses ‘vc.el’ to |
|
9827 |
retrieve the document’s modification time from the version control |
|
9828 |
system. Otherwise Org reads the file attributes. |
|
9829 |
|
|
9830 |
‘{{{input-file}}}’ |
|
9831 |
This macro refers to the filename of the exported file. |
|
9832 |
|
|
9833 |
‘{{{property(PROPERTY-NAME)}}}’ |
|
9834 |
‘{{{property(PROPERTY-NAME,SEARCH-OPTION)}}}’ |
|
9835 |
This macro returns the value of property PROPERTY-NAME in the |
|
9836 |
current entry. If SEARCH-OPTION (*note Search options::) refers to |
|
9837 |
a remote entry, that will be used instead. |
|
9838 |
|
|
9839 |
‘{{{n}}}’ |
|
9840 |
‘{{{n(NAME)}}}’ |
|
9841 |
‘{{{n(NAME,ACTION)}}}’ |
|
9842 |
This macro implements custom counters by returning the number of |
|
9843 |
times the macro has been expanded so far while exporting the |
|
9844 |
buffer. You can create more than one counter using different NAME |
|
9845 |
values. If ACTION is ‘-’, previous value of the counter is held, |
|
9846 |
i.e. the specified counter is not incremented. If the value is a |
|
9847 |
number, the specified counter is set to that value. If it is any |
|
9848 |
other non-empty string, the specified counter is reset to 1. You |
|
9849 |
may leave NAME empty to reset the default counter. |
|
9850 |
|
|
9851 |
The surrounding brackets can be made invisible by setting |
|
9852 |
‘org-hide-macro-markers’ non-‘nil’. |
|
9853 |
|
|
9854 |
Org expands macros at the very beginning of the export process. |
|
9855 |
|
|
9856 |
---------- Footnotes ---------- |
|
9857 |
|
|
9858 |
(1) Since commas separate the arguments, commas within arguments have |
|
9859 |
to be escaped with the backslash character. So only those backslash |
|
9860 |
characters before a comma need escaping with another backslash |
|
9861 |
character. |
|
9862 |
|
|
9863 |
|
|
9864 |
File: org, Node: Comment lines, Next: ASCII/Latin-1/UTF-8 export, Prev: Macro replacement, Up: Exporting |
|
9865 |
|
|
9866 |
12.6 Comment lines |
|
9867 |
================== |
|
9868 |
|
|
9869 |
Lines starting with zero or more whitespace characters followed by one |
|
9870 |
‘#’ and a whitespace are treated as comments and, as such, are not |
|
9871 |
exported. |
|
9872 |
|
|
9873 |
Likewise, regions surrounded by ‘#+BEGIN_COMMENT’ ... |
|
9874 |
‘#+END_COMMENT’ are not exported. |
|
9875 |
|
|
9876 |
Finally, a ‘COMMENT’ keyword at the beginning of an entry, but after |
|
9877 |
any other keyword or priority cookie, comments out the entire subtree. |
|
9878 |
In this case, the subtree is not exported and no code block within it is |
|
9879 |
executed either(1). The command below helps changing the comment status |
|
9880 |
of a headline. |
|
9881 |
|
|
9882 |
‘C-c ;’ |
|
9883 |
Toggle the ‘COMMENT’ keyword at the beginning of an entry. |
|
9884 |
|
|
9885 |
---------- Footnotes ---------- |
|
9886 |
|
|
9887 |
(1) For a less drastic behavior, consider using a select tag (*note |
|
9888 |
Export settings::) instead. |
|
9889 |
|
|
9890 |
|
|
9891 |
File: org, Node: ASCII/Latin-1/UTF-8 export, Next: Beamer export, Prev: Comment lines, Up: Exporting |
|
9892 |
|
|
9893 |
12.7 ASCII/Latin-1/UTF-8 export |
|
9894 |
=============================== |
|
9895 |
|
|
9896 |
ASCII export produces an output file containing only plain ASCII |
|
9897 |
characters. This is the most simplest and direct text output. It does |
|
9898 |
not contain any Org markup either. Latin-1 and UTF-8 export use |
|
9899 |
additional characters and symbols available in these encoding standards. |
|
9900 |
All three of these export formats offer the most basic of text output |
|
9901 |
for maximum portability. |
|
9902 |
|
|
9903 |
On export, Org fills and justifies text according to the text width |
|
9904 |
set in ‘org-ascii-text-width’. |
|
9905 |
|
|
9906 |
Org exports links using a footnote-like style where the descriptive |
|
9907 |
part is in the text and the link is in a note before the next heading. |
|
9908 |
See the variable ‘org-ascii-links-to-notes’ for details. |
|
9909 |
|
|
9910 |
ASCII export commands |
|
9911 |
--------------------- |
|
9912 |
|
|
9913 |
‘C-c C-e t a/l/u (org-ascii-export-to-ascii)’ |
|
9914 |
Export as an ASCII file with a ‘.txt’ extension. For ‘myfile.org’, |
|
9915 |
Org exports to ‘myfile.txt’, overwriting without warning. For |
|
9916 |
‘myfile.txt’, Org exports to ‘myfile.txt.txt’ in order to prevent |
|
9917 |
data loss. |
|
9918 |
‘C-c C-e t A/L/U (org-ascii-export-as-ascii)’ |
|
9919 |
Export to a temporary buffer. Does not create a file. |
|
9920 |
|
|
9921 |
ASCII specific export settings |
|
9922 |
------------------------------ |
|
9923 |
|
|
9924 |
The ASCII export back-end has one extra keyword for customizing ASCII |
|
9925 |
output. Setting this keyword works similar to the general options |
|
9926 |
(*note Export settings::). |
|
9927 |
|
|
9928 |
‘SUBTITLE’ |
|
9929 |
The document subtitle. For long subtitles, use multiple |
|
9930 |
‘#+SUBTITLE’ lines in the Org file. Org prints them on one |
|
9931 |
continuous line, wrapping into multiple lines if necessary. |
|
9932 |
|
|
9933 |
Header and sectioning structure |
|
9934 |
------------------------------- |
|
9935 |
|
|
9936 |
Org converts the first three outline levels into headlines for ASCII |
|
9937 |
export. The remaining levels are turned into lists. To change this |
|
9938 |
cut-off point where levels become lists, *note Export settings::. |
|
9939 |
|
|
9940 |
Quoting ASCII text |
|
9941 |
------------------ |
|
9942 |
|
|
9943 |
To insert text within the Org file by the ASCII back-end, use one the |
|
9944 |
following constructs, inline, keyword, or export block: |
|
9945 |
|
|
9946 |
Inline text @@ascii:and additional text@@ within a paragraph. |
|
9947 |
|
|
9948 |
#+ASCII: Some text |
|
9949 |
|
|
9950 |
#+BEGIN_EXPORT ascii |
|
9951 |
Org exports text in this block only when using ASCII back-end. |
|
9952 |
#+END_EXPORT |
|
9953 |
|
|
9954 |
ASCII specific attributes |
|
9955 |
------------------------- |
|
9956 |
|
|
9957 |
ASCII back-end recognizes only one attribute, ‘:width’, which specifies |
|
9958 |
the width of a horizontal rule in number of characters. The keyword and |
|
9959 |
syntax for specifying widths is: |
|
9960 |
|
|
9961 |
#+ATTR_ASCII: :width 10 |
|
9962 |
----- |
|
9963 |
|
|
9964 |
ASCII special blocks |
|
9965 |
-------------------- |
|
9966 |
|
|
9967 |
Besides ‘#+BEGIN_CENTER’ blocks (*note Paragraphs::), ASCII back-end has |
|
9968 |
these two left and right justification blocks: |
|
9969 |
|
|
9970 |
#+BEGIN_JUSTIFYLEFT |
|
9971 |
It's just a jump to the left... |
|
9972 |
#+END_JUSTIFYLEFT |
|
9973 |
|
|
9974 |
#+BEGIN_JUSTIFYRIGHT |
|
9975 |
...and then a step to the right. |
|
9976 |
#+END_JUSTIFYRIGHT |
|
9977 |
|
|
9978 |
|
|
9979 |
File: org, Node: Beamer export, Next: HTML export, Prev: ASCII/Latin-1/UTF-8 export, Up: Exporting |
|
9980 |
|
|
9981 |
12.8 Beamer export |
|
9982 |
================== |
|
9983 |
|
|
9984 |
Org uses _Beamer_ export to convert an Org file tree structure into a |
|
9985 |
high-quality interactive slides for presentations. _Beamer_ is a LaTeX |
|
9986 |
document class for creating presentations in PDF, HTML, and other |
|
9987 |
popular display formats. |
|
9988 |
|
|
9989 |
* Menu: |
|
9990 |
|
|
9991 |
* Beamer export commands:: For creating Beamer documents. |
|
9992 |
* Beamer specific export settings:: For customizing Beamer export. |
|
9993 |
* Sectioning Frames and Blocks in Beamer:: For composing Beamer slides. |
|
9994 |
* Beamer specific syntax:: For using in Org documents. |
|
9995 |
* Editing support:: For using helper functions. |
|
9996 |
* A Beamer example:: A complete presentation. |
|
9997 |
|
|
9998 |
|
|
9999 |
File: org, Node: Beamer export commands, Next: Beamer specific export settings, Up: Beamer export |
|
10000 |
|
|
10001 |
12.8.1 Beamer export commands |
|
10002 |
----------------------------- |
|
10003 |
|
|
10004 |
‘C-c C-e l b (org-beamer-export-to-latex)’ |
|
10005 |
Export as LaTeX file with a ‘.tex’ extension. For ‘myfile.org’, |
|
10006 |
Org exports to ‘myfile.tex’, overwriting without warning. |
|
10007 |
‘C-c C-e l B (org-beamer-export-as-latex)’ |
|
10008 |
Export to a temporary buffer. Does not create a file. |
|
10009 |
‘C-c C-e l P (org-beamer-export-to-pdf)’ |
|
10010 |
Export as LaTeX file and then convert it to PDF format. |
|
10011 |
‘C-c C-e l O’ |
|
10012 |
Export as LaTeX file, convert it to PDF format, and then open the |
|
10013 |
PDF file. |
|
10014 |
|
|
10015 |
|
|
10016 |
File: org, Node: Beamer specific export settings, Next: Sectioning Frames and Blocks in Beamer, Prev: Beamer export commands, Up: Beamer export |
|
10017 |
|
|
10018 |
12.8.2 Beamer specific export settings |
|
10019 |
-------------------------------------- |
|
10020 |
|
|
10021 |
Beamer export back-end has several additional keywords for customizing |
|
10022 |
Beamer output. These keywords work similar to the general options |
|
10023 |
settings (*note Export settings::). |
|
10024 |
|
|
10025 |
‘BEAMER_THEME’ |
|
10026 |
The Beamer layout theme (‘org-beamer-theme’). Use square brackets |
|
10027 |
for options. For example: |
|
10028 |
#+BEAMER_THEME: Rochester [height=20pt] |
|
10029 |
|
|
10030 |
‘BEAMER_FONT_THEME’ |
|
10031 |
The Beamer font theme. |
|
10032 |
|
|
10033 |
‘BEAMER_INNER_THEME’ |
|
10034 |
The Beamer inner theme. |
|
10035 |
|
|
10036 |
‘BEAMER_OUTER_THEME’ |
|
10037 |
The Beamer outer theme. |
|
10038 |
|
|
10039 |
‘BEAMER_HEADER’ |
|
10040 |
Arbitrary lines inserted in the preamble, just before the |
|
10041 |
‘hyperref’ settings. |
|
10042 |
|
|
10043 |
‘DESCRIPTION’ |
|
10044 |
The document description. For long descriptions, use multiple |
|
10045 |
‘#+DESCRIPTION’ keywords. By default, ‘hyperref’ inserts |
|
10046 |
‘#+DESCRIPTION’ as metadata. Use ‘org-latex-hyperref-template’ to |
|
10047 |
configure document metadata. Use ‘org-latex-title-command’ to |
|
10048 |
configure typesetting of description as part of front matter. |
|
10049 |
|
|
10050 |
‘KEYWORDS’ |
|
10051 |
The keywords for defining the contents of the document. Use |
|
10052 |
multiple ‘#+KEYWORDS’ lines if necessary. By default, ‘hyperref’ |
|
10053 |
inserts ‘#+KEYWORDS’ as metadata. Use |
|
10054 |
‘org-latex-hyperref-template’ to configure document metadata. Use |
|
10055 |
‘org-latex-title-command’ to configure typesetting of keywords as |
|
10056 |
part of front matter. |
|
10057 |
|
|
10058 |
‘SUBTITLE’ |
|
10059 |
Document’s subtitle. For typesetting, use |
|
10060 |
‘org-beamer-subtitle-format’ string. Use |
|
10061 |
‘org-latex-hyperref-template’ to configure document metadata. Use |
|
10062 |
‘org-latex-title-command’ to configure typesetting of subtitle as |
|
10063 |
part of front matter. |
|
10064 |
|
|
10065 |
|
|
10066 |
File: org, Node: Sectioning Frames and Blocks in Beamer, Next: Beamer specific syntax, Prev: Beamer specific export settings, Up: Beamer export |
|
10067 |
|
|
10068 |
12.8.3 Sectioning, Frames and Blocks in Beamer |
|
10069 |
---------------------------------------------- |
|
10070 |
|
|
10071 |
Org transforms heading levels into Beamer’s sectioning elements, frames |
|
10072 |
and blocks. Any Org tree with a not-too-deep-level nesting should in |
|
10073 |
principle be exportable as a Beamer presentation. |
|
10074 |
|
|
10075 |
− Org headlines become Beamer frames when the heading level in Org is |
|
10076 |
equal to ‘org-beamer-frame-level’ or ‘H’ value in an ‘OPTIONS’ line |
|
10077 |
(*note Export settings::). |
|
10078 |
|
|
10079 |
Org overrides headlines to frames conversion for the current tree |
|
10080 |
of an Org file if it encounters the ‘BEAMER_ENV’ property set to |
|
10081 |
‘frame’ or ‘fullframe’. Org ignores whatever |
|
10082 |
‘org-beamer-frame-level’ happens to be for that headline level in |
|
10083 |
the Org tree. In Beamer terminology, a ‘fullframe’ is a frame |
|
10084 |
without its title. |
|
10085 |
|
|
10086 |
− Org exports a Beamer frame’s objects as ‘block’ environments. Org |
|
10087 |
can enforce wrapping in special block types when ‘BEAMER_ENV’ |
|
10088 |
property is set(1). For valid values see |
|
10089 |
‘org-beamer-environments-default’. To add more values, see |
|
10090 |
‘org-beamer-environments-extra’. |
|
10091 |
|
|
10092 |
− If ‘BEAMER_ENV’ is set to ‘appendix’, Org exports the entry as an |
|
10093 |
appendix. When set to ‘note’, Org exports the entry as a note |
|
10094 |
within the frame or between frames, depending on the entry’s |
|
10095 |
heading level. When set to ‘noteNH’, Org exports the entry as a |
|
10096 |
note without its title. When set to ‘againframe’, Org exports the |
|
10097 |
entry with ‘\againframe’ command, which makes setting the |
|
10098 |
‘BEAMER_REF’ property mandatory because ‘\againframe’ needs frame |
|
10099 |
to resume. |
|
10100 |
|
|
10101 |
When ‘ignoreheading’ is set, Org export ignores the entry’s |
|
10102 |
headline but not its content. This is useful for inserting content |
|
10103 |
between frames. It is also useful for properly closing a ‘column’ |
|
10104 |
environment. |
|
10105 |
|
|
10106 |
When ‘BEAMER_ACT’ is set for a headline, Org export translates that |
|
10107 |
headline as an overlay or action specification. When enclosed in square |
|
10108 |
brackets, Org export makes the overlay specification a default. Use |
|
10109 |
‘BEAMER_OPT’ to set any options applicable to the current Beamer frame |
|
10110 |
or block. The Beamer export back-end wraps with appropriate angular or |
|
10111 |
square brackets. It also adds the ‘fragile’ option for any code that |
|
10112 |
may require a verbatim block. |
|
10113 |
|
|
10114 |
To create a column on the Beamer slide, use the ‘BEAMER_COL’ property |
|
10115 |
for its headline in the Org file. Set the value of ‘BEAMER_COL’ to a |
|
10116 |
decimal number representing the fraction of the total text width. |
|
10117 |
Beamer export uses this value to set the column’s width and fills the |
|
10118 |
column with the contents of the Org entry. If the Org entry has no |
|
10119 |
specific environment defined, Beamer export ignores the heading. If the |
|
10120 |
Org entry has a defined environment, Beamer export uses the heading as |
|
10121 |
title. Behind the scenes, Beamer export automatically handles LaTeX |
|
10122 |
column separations for contiguous headlines. To manually adjust them |
|
10123 |
for any unique configurations needs, use the ‘BEAMER_ENV’ property. |
|
10124 |
|
|
10125 |
---------- Footnotes ---------- |
|
10126 |
|
|
10127 |
(1) If ‘BEAMER_ENV’ is set, Org export adds ‘:B_environment:’ tag to |
|
10128 |
make it visible. The tag serves as a visual aid and has no semantic |
|
10129 |
relevance. |
|
10130 |
|
|
10131 |
|
|
10132 |
File: org, Node: Beamer specific syntax, Next: Editing support, Prev: Sectioning Frames and Blocks in Beamer, Up: Beamer export |
|
10133 |
|
|
10134 |
12.8.4 Beamer specific syntax |
|
10135 |
----------------------------- |
|
10136 |
|
|
10137 |
Since Org’s Beamer export back-end is an extension of the LaTeX |
|
10138 |
back-end, it recognizes other LaTeX specific syntax—for example, |
|
10139 |
‘#+LATEX:’ or ‘#+ATTR_LATEX:’. *Note LaTeX export::, for details. |
|
10140 |
|
|
10141 |
Beamer export wraps the table of contents generated with ‘toc:t’ |
|
10142 |
‘OPTION’ keyword in a ‘frame’ environment. Beamer export does not wrap |
|
10143 |
the table of contents generated with ‘TOC’ keyword (*note Table of |
|
10144 |
contents::). Use square brackets for specifying options. |
|
10145 |
|
|
10146 |
#+TOC: headlines [currentsection] |
|
10147 |
|
|
10148 |
Insert Beamer-specific code using the following constructs: |
|
10149 |
|
|
10150 |
#+BEAMER: \pause |
|
10151 |
|
|
10152 |
#+BEGIN_EXPORT beamer |
|
10153 |
Only Beamer export back-end will export this line. |
|
10154 |
#+END_BEAMER |
|
10155 |
|
|
10156 |
Text @@beamer:some code@@ within a paragraph. |
|
10157 |
|
|
10158 |
Inline constructs, such as the last one above, are useful for adding |
|
10159 |
overlay specifications to objects with ‘bold’, ‘item’, ‘link’, |
|
10160 |
‘radio-target’ and ‘target’ types. Enclose the value in angular |
|
10161 |
brackets and place the specification at the beginning the object as |
|
10162 |
shown in this example: |
|
10163 |
|
|
10164 |
A *@@beamer:<2->@@useful* feature |
|
10165 |
|
|
10166 |
Beamer export recognizes the ‘ATTR_BEAMER’ keyword with the following |
|
10167 |
attributes from Beamer configurations: ‘:environment’ for changing local |
|
10168 |
Beamer environment, ‘:overlay’ for specifying Beamer overlays in angular |
|
10169 |
or square brackets, and ‘:options’ for inserting optional arguments. |
|
10170 |
|
|
10171 |
#+ATTR_BEAMER: :environment nonindentlist |
|
10172 |
- item 1, not indented |
|
10173 |
- item 2, not indented |
|
10174 |
- item 3, not indented |
|
10175 |
|
|
10176 |
#+ATTR_BEAMER: :overlay <+-> |
|
10177 |
- item 1 |
|
10178 |
- item 2 |
|
10179 |
|
|
10180 |
#+ATTR_BEAMER: :options [Lagrange] |
|
10181 |
Let $G$ be a finite group, and let $H$ be |
|
10182 |
a subgroup of $G$. Then the order of $H$ divides the order of $G$. |
|
10183 |
|
|
10184 |
|
|
10185 |
File: org, Node: Editing support, Next: A Beamer example, Prev: Beamer specific syntax, Up: Beamer export |
|
10186 |
|
|
10187 |
12.8.5 Editing support |
|
10188 |
---------------------- |
|
10189 |
|
|
10190 |
The ‘org-beamer-mode’ is a special minor mode for faster editing of |
|
10191 |
Beamer documents. |
|
10192 |
|
|
10193 |
#+STARTUP: beamer |
|
10194 |
|
|
10195 |
‘C-c C-b (org-beamer-select-environment)’ |
|
10196 |
The ‘org-beamer-mode’ provides this key for quicker selections in |
|
10197 |
Beamer normal environments, and for selecting the ‘BEAMER_COL’ |
|
10198 |
property. |
|
10199 |
|
|
10200 |
|
|
10201 |
File: org, Node: A Beamer example, Prev: Editing support, Up: Beamer export |
|
10202 |
|
|
10203 |
12.8.6 A Beamer example |
|
10204 |
----------------------- |
|
10205 |
|
|
10206 |
Here is an example of an Org document ready for Beamer export. |
|
10207 |
|
|
10208 |
#+TITLE: Example Presentation |
|
10209 |
#+AUTHOR: Carsten Dominik |
|
10210 |
#+OPTIONS: H:2 toc:t num:t |
|
10211 |
#+LATEX_CLASS: beamer |
|
10212 |
#+LATEX_CLASS_OPTIONS: [presentation] |
|
10213 |
#+BEAMER_THEME: Madrid |
|
10214 |
#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt) |
|
10215 |
|
|
10216 |
* This is the first structural section |
|
10217 |
|
|
10218 |
** Frame 1 |
|
10219 |
*** Thanks to Eric Fraga :B_block: |
|
10220 |
:PROPERTIES: |
|
10221 |
:BEAMER_COL: 0.48 |
|
10222 |
:BEAMER_ENV: block |
|
10223 |
:END: |
|
10224 |
for the first viable Beamer setup in Org |
|
10225 |
*** Thanks to everyone else :B_block: |
|
10226 |
:PROPERTIES: |
|
10227 |
:BEAMER_COL: 0.48 |
|
10228 |
:BEAMER_ACT: <2-> |
|
10229 |
:BEAMER_ENV: block |
|
10230 |
:END: |
|
10231 |
for contributing to the discussion |
|
10232 |
**** This will be formatted as a beamer note :B_note: |
|
10233 |
:PROPERTIES: |
|
10234 |
:BEAMER_env: note |
|
10235 |
:END: |
|
10236 |
** Frame 2 (where we will not use columns) |
|
10237 |
*** Request |
|
10238 |
Please test this stuff! |
|
10239 |
|
|
10240 |
|
|
10241 |
File: org, Node: HTML export, Next: LaTeX export, Prev: Beamer export, Up: Exporting |
|
10242 |
|
|
10243 |
12.9 HTML export |
|
10244 |
================ |
|
10245 |
|
|
10246 |
Org mode contains an HTML exporter with extensive HTML formatting |
|
10247 |
compatible with XHTML 1.0 strict standard. |
|
10248 |
|
|
10249 |
* Menu: |
|
10250 |
|
|
10251 |
* HTML Export commands:: Invoking HTML export |
|
10252 |
* HTML Specific export settings:: Settings for HTML export |
|
10253 |
* HTML doctypes:: Exporting various (X)HTML flavors |
|
10254 |
* HTML preamble and postamble:: Inserting preamble and postamble |
|
10255 |
* Quoting HTML tags:: Using direct HTML in Org files |
|
10256 |
* Links in HTML export:: Interpreting and formatting links |
|
10257 |
* Tables in HTML export:: Formatting and modifying tables |
|
10258 |
* Images in HTML export:: Inserting figures with HTML output |
|
10259 |
* Math formatting in HTML export:: Handling math equations |
|
10260 |
* Text areas in HTML export:: Showing an alternate approach, an example |
|
10261 |
* CSS support:: Styling HTML output |
|
10262 |
* JavaScript support:: Folding scripting in the web browser |
|
10263 |
|
|
10264 |
|
|
10265 |
File: org, Node: HTML Export commands, Next: HTML Specific export settings, Up: HTML export |
|
10266 |
|
|
10267 |
12.9.1 HTML export commands |
|
10268 |
--------------------------- |
|
10269 |
|
|
10270 |
‘C-c C-e h h (org-html-export-to-html)’ |
|
10271 |
Export as HTML file with a ‘.html’ extension. For ‘myfile.org’, |
|
10272 |
Org exports to ‘myfile.html’, overwriting without warning. ‘C-c |
|
10273 |
C-e h o’ Exports to HTML and opens it in a web browser. |
|
10274 |
|
|
10275 |
‘C-c C-e h H (org-html-export-as-html)’ |
|
10276 |
Exports to a temporary buffer. Does not create a file. |
|
10277 |
|
|
10278 |
|
|
10279 |
File: org, Node: HTML Specific export settings, Next: HTML doctypes, Prev: HTML Export commands, Up: HTML export |
|
10280 |
|
|
10281 |
12.9.2 HTML Specific export settings |
|
10282 |
------------------------------------ |
|
10283 |
|
|
10284 |
HTML export has a number of keywords, similar to the general options |
|
10285 |
settings described in *note Export settings::. |
|
10286 |
|
|
10287 |
‘DESCRIPTION’ |
|
10288 |
This is the document’s description, which the HTML exporter inserts |
|
10289 |
it as a HTML meta tag in the HTML file. For long descriptions, use |
|
10290 |
multiple ‘#+DESCRIPTION’ lines. The exporter takes care of |
|
10291 |
wrapping the lines properly. |
|
10292 |
|
|
10293 |
‘HTML_DOCTYPE’ |
|
10294 |
Specify the document type, for example: HTML5 (‘org-html-doctype’). |
|
10295 |
|
|
10296 |
‘HTML_CONTAINER’ |
|
10297 |
Specify the HTML container, such as ‘div’, for wrapping sections |
|
10298 |
and elements (‘org-html-container-element’). |
|
10299 |
|
|
10300 |
‘HTML_LINK_HOME’ |
|
10301 |
The URL for home link (‘org-html-link-home’). |
|
10302 |
|
|
10303 |
‘HTML_LINK_UP’ |
|
10304 |
The URL for the up link of exported HTML pages |
|
10305 |
(‘org-html-link-up’). |
|
10306 |
|
|
10307 |
‘HTML_MATHJAX’ |
|
10308 |
Options for MathJax (‘org-html-mathjax-options’). MathJax is used |
|
10309 |
to typeset LaTeX math in HTML documents. *Note Math formatting in |
|
10310 |
HTML export::, for an example. |
|
10311 |
|
|
10312 |
‘HTML_HEAD’ |
|
10313 |
Arbitrary lines for appending to the HTML document’s head |
|
10314 |
(‘org-html-head’). |
|
10315 |
|
|
10316 |
‘HTML_HEAD_EXTRA’ |
|
10317 |
More arbitrary lines for appending to the HTML document’s head |
|
10318 |
(‘org-html-head-extra’). |
|
10319 |
|
|
10320 |
‘KEYWORDS’ |
|
10321 |
Keywords to describe the document’s content. HTML exporter inserts |
|
10322 |
these keywords as HTML meta tags. For long keywords, use multiple |
|
10323 |
‘#+KEYWORDS’ lines. |
|
10324 |
|
|
10325 |
‘LATEX_HEADER’ |
|
10326 |
Arbitrary lines for appending to the preamble; HTML exporter |
|
10327 |
appends when transcoding LaTeX fragments to images (*note Math |
|
10328 |
formatting in HTML export::). |
|
10329 |
|
|
10330 |
‘SUBTITLE’ |
|
10331 |
The document’s subtitle. HTML exporter formats subtitle if |
|
10332 |
document type is ‘HTML5’ and the CSS has a ‘subtitle’ class. |
|
10333 |
|
|
10334 |
Some of these keywords are explained in more detail in the following |
|
10335 |
sections of the manual. |
|
10336 |
|
|
10337 |
|
|
10338 |
File: org, Node: HTML doctypes, Next: HTML preamble and postamble, Prev: HTML Specific export settings, Up: HTML export |
|
10339 |
|
|
10340 |
12.9.3 HTML doctypes |
|
10341 |
-------------------- |
|
10342 |
|
|
10343 |
Org can export to various (X)HTML flavors. |
|
10344 |
|
|
10345 |
Set the ‘org-html-doctype’ variable for different (X)HTML variants. |
|
10346 |
Depending on the variant, the HTML exporter adjusts the syntax of HTML |
|
10347 |
conversion accordingly. Org includes the following ready-made variants: |
|
10348 |
|
|
10349 |
• “html4-strict” |
|
10350 |
• “html4-transitional” |
|
10351 |
• “html4-frameset” |
|
10352 |
• “xhtml-strict” |
|
10353 |
• “xhtml-transitional” |
|
10354 |
• “xhtml-frameset” |
|
10355 |
• “xhtml-11” |
|
10356 |
• “html5” |
|
10357 |
• “xhtml5” |
|
10358 |
|
|
10359 |
See the variable ‘org-html-doctype-alist’ for details. The default is |
|
10360 |
“xhtml-strict”. |
|
10361 |
|
|
10362 |
Org’s HTML exporter does not by default enable new block elements |
|
10363 |
introduced with the HTML5 standard. To enable them, set |
|
10364 |
‘org-html-html5-fancy’ to non-‘nil’. Or use an ‘OPTIONS’ line in the |
|
10365 |
file to set ‘html5-fancy’. HTML5 documents can now have arbitrary |
|
10366 |
‘#+BEGIN’ and ‘#+END’ blocks. For example: |
|
10367 |
|
|
10368 |
#+BEGIN_aside |
|
10369 |
Lorem ipsum |
|
10370 |
#+END_aside |
|
10371 |
|
|
10372 |
Will export to: |
|
10373 |
|
|
10374 |
<aside> |
|
10375 |
<p>Lorem ipsum</p> |
|
10376 |
</aside> |
|
10377 |
|
|
10378 |
While this: |
|
10379 |
|
|
10380 |
#+ATTR_HTML: :controls controls :width 350 |
|
10381 |
#+BEGIN_video |
|
10382 |
#+HTML: <source src="movie.mp4" type="video/mp4"> |
|
10383 |
#+HTML: <source src="movie.ogg" type="video/ogg"> |
|
10384 |
Your browser does not support the video tag. |
|
10385 |
#+END_video |
|
10386 |
|
|
10387 |
Exports to: |
|
10388 |
|
|
10389 |
<video controls="controls" width="350"> |
|
10390 |
<source src="movie.mp4" type="video/mp4"> |
|
10391 |
<source src="movie.ogg" type="video/ogg"> |
|
10392 |
<p>Your browser does not support the video tag.</p> |
|
10393 |
</video> |
|
10394 |
|
|
10395 |
When special blocks do not have a corresponding HTML5 element, the |
|
10396 |
HTML exporter reverts to standard translation (see |
|
10397 |
‘org-html-html5-elements’). For example, ‘#+BEGIN_lederhosen’ exports |
|
10398 |
to ‘<div class="lederhosen">’. |
|
10399 |
|
|
10400 |
Special blocks cannot have headlines. For the HTML exporter to wrap |
|
10401 |
the headline and its contents in ‘<section>’ or ‘<article>’ tags, set |
|
10402 |
the ‘HTML_CONTAINER’ property for the headline. |
|
10403 |
|
|
10404 |
|
|
10405 |
File: org, Node: HTML preamble and postamble, Next: Quoting HTML tags, Prev: HTML doctypes, Up: HTML export |
|
10406 |
|
|
10407 |
12.9.4 HTML preamble and postamble |
|
10408 |
---------------------------------- |
|
10409 |
|
|
10410 |
The HTML exporter has delineations for preamble and postamble. The |
|
10411 |
default value for ‘org-html-preamble’ is ‘t’, which makes the HTML |
|
10412 |
exporter insert the preamble. See the variable |
|
10413 |
‘org-html-preamble-format’ for the format string. |
|
10414 |
|
|
10415 |
Set ‘org-html-preamble’ to a string to override the default format |
|
10416 |
string. If the string is a function, the HTML exporter expects the |
|
10417 |
function to return a string upon execution. The HTML exporter inserts |
|
10418 |
this string in the preamble. The HTML exporter will not insert a |
|
10419 |
preamble if ‘org-html-preamble’ is set ‘nil’. |
|
10420 |
|
|
10421 |
The default value for ‘org-html-postamble’ is ‘auto’, which makes the |
|
10422 |
HTML exporter build a postamble from looking up author’s name, email |
|
10423 |
address, creator’s name, and date. Set ‘org-html-postamble’ to ‘t’ to |
|
10424 |
insert the postamble in the format specified in the |
|
10425 |
‘org-html-postamble-format’ variable. The HTML exporter will not insert |
|
10426 |
a postamble if ‘org-html-postamble’ is set to ‘nil’. |
|
10427 |
|
|
10428 |
|
|
10429 |
File: org, Node: Quoting HTML tags, Next: Links in HTML export, Prev: HTML preamble and postamble, Up: HTML export |
|
10430 |
|
|
10431 |
12.9.5 Quoting HTML tags |
|
10432 |
------------------------ |
|
10433 |
|
|
10434 |
The HTML export back-end transforms ‘<’ and ‘>’ to ‘<’ and ‘>’. |
|
10435 |
To include raw HTML code in the Org file so the HTML export back-end can |
|
10436 |
insert that HTML code in the output, use this inline syntax: ‘@@html:’. |
|
10437 |
For example: ‘@@html:<b>@@bold text@@html:</b>@@’. For larger raw HTML |
|
10438 |
code blocks, use these HTML export code blocks: |
|
10439 |
|
|
10440 |
#+HTML: Literal HTML code for export |
|
10441 |
|
|
10442 |
or |
|
10443 |
|
|
10444 |
#+BEGIN_EXPORT html |
|
10445 |
All lines between these markers are exported literally |
|
10446 |
#+END_EXPORT |
|
10447 |
|
|
10448 |
|
|
10449 |
File: org, Node: Links in HTML export, Next: Tables in HTML export, Prev: Quoting HTML tags, Up: HTML export |
|
10450 |
|
|
10451 |
12.9.6 Links in HTML export |
|
10452 |
--------------------------- |
|
10453 |
|
|
10454 |
The HTML export back-end transforms Org’s internal links (*note Internal |
|
10455 |
links::) to equivalent HTML links in the output. The back-end similarly |
|
10456 |
handles Org’s automatic links created by radio targets (*note Radio |
|
10457 |
targets::) similarly. For Org links to external files, the back-end |
|
10458 |
transforms the links to _relative_ paths. |
|
10459 |
|
|
10460 |
For Org links to other ‘.org’ files, the back-end automatically |
|
10461 |
changes the file extension to ‘.html’ and makes file paths relative. If |
|
10462 |
the ‘.org’ files have an equivalent ‘.html’ version at the same |
|
10463 |
location, then the converted links should work without any further |
|
10464 |
manual intervention. However, to disable this automatic path |
|
10465 |
translation, set ‘org-html-link-org-files-as-html’ to ‘nil’. When |
|
10466 |
disabled, the HTML export back-end substitutes the ‘id:’-based links in |
|
10467 |
the HTML output. For more about linking files when publishing to a |
|
10468 |
directory, *note Publishing links::. |
|
10469 |
|
|
10470 |
Org files can also have special directives to the HTML export |
|
10471 |
back-end. For example, by using ‘#+ATTR_HTML’ lines to specify new |
|
10472 |
format attributes to ‘<a>’ or ‘<img>’ tags. This example shows changing |
|
10473 |
the link’s ‘title’ and ‘style’: |
|
10474 |
|
|
10475 |
#+ATTR_HTML: :title The Org mode homepage :style color:red; |
|
10476 |
[[https://orgmode.org]] |
|
10477 |
|
|
10478 |
|
|
10479 |
File: org, Node: Tables in HTML export, Next: Images in HTML export, Prev: Links in HTML export, Up: HTML export |
|
10480 |
|
|
10481 |
12.9.7 Tables in HTML export |
|
10482 |
---------------------------- |
|
10483 |
|
|
10484 |
The HTML export back-end uses ‘org-html-table-default-attributes’ when |
|
10485 |
exporting Org tables to HTML. By default, the exporter does not draw |
|
10486 |
frames and cell borders. To change for this for a table, use the |
|
10487 |
following lines before the table in the Org file: |
|
10488 |
|
|
10489 |
#+CAPTION: This is a table with lines around and between cells |
|
10490 |
#+ATTR_HTML: :border 2 :rules all :frame border |
|
10491 |
|
|
10492 |
The HTML export back-end preserves column groupings in Org tables |
|
10493 |
(*note Column groups::) when exporting to HTML. |
|
10494 |
|
|
10495 |
Additional options for customizing tables for HTML export. |
|
10496 |
|
|
10497 |
‘org-html-table-align-individual-fields’ |
|
10498 |
Non-‘nil’ attaches style attributes for alignment to each table |
|
10499 |
field. |
|
10500 |
|
|
10501 |
‘org-html-table-caption-above’ |
|
10502 |
Non-‘nil’ places caption string at the beginning of the table. |
|
10503 |
|
|
10504 |
‘org-html-table-data-tags’ |
|
10505 |
Opening and ending tags for table data fields. |
|
10506 |
|
|
10507 |
‘org-html-table-default-attributes’ |
|
10508 |
Default attributes and values for table tags. |
|
10509 |
|
|
10510 |
‘org-html-table-header-tags’ |
|
10511 |
Opening and ending tags for table’s header fields. |
|
10512 |
|
|
10513 |
‘org-html-table-row-tags’ |
|
10514 |
Opening and ending tags for table rows. |
|
10515 |
|
|
10516 |
‘org-html-table-use-header-tags-for-first-column’ |
|
10517 |
Non-‘nil’ formats column one in tables with header tags. |
|
10518 |
|
|
10519 |
|
|
10520 |
File: org, Node: Images in HTML export, Next: Math formatting in HTML export, Prev: Tables in HTML export, Up: HTML export |
|
10521 |
|
|
10522 |
12.9.8 Images in HTML export |
|
10523 |
---------------------------- |
|
10524 |
|
|
10525 |
The HTML export back-end has features to convert Org image links to HTML |
|
10526 |
inline images and HTML clickable image links. |
|
10527 |
|
|
10528 |
When the link in the Org file has no description, the HTML export |
|
10529 |
back-end by default in-lines that image. For example: |
|
10530 |
‘[[file:myimg.jpg]]’ is in-lined, while ‘[[file:myimg.jpg][the image]]’ |
|
10531 |
links to the text, ‘the image’. |
|
10532 |
|
|
10533 |
For more details, see the variable ‘org-html-inline-images’. |
|
10534 |
|
|
10535 |
On the other hand, if the description part of the Org link is itself |
|
10536 |
another link, such as ‘file:’ or ‘http:’ URL pointing to an image, the |
|
10537 |
HTML export back-end in-lines this image and links to the main image. |
|
10538 |
This Org syntax enables the back-end to link low-resolution thumbnail to |
|
10539 |
the high-resolution version of the image, as shown in this example: |
|
10540 |
|
|
10541 |
[[file:highres.jpg][file:thumb.jpg]] |
|
10542 |
|
|
10543 |
To change attributes of in-lined images, use ‘#+ATTR_HTML’ lines in |
|
10544 |
the Org file. This example shows realignment to right, and adds ‘alt’ |
|
10545 |
and ‘title’ attributes in support of text viewers and modern web |
|
10546 |
accessibility standards. |
|
10547 |
|
|
10548 |
#+CAPTION: A black cat stalking a spider |
|
10549 |
#+ATTR_HTML: :alt cat/spider image :title Action! :align right |
|
10550 |
[[./img/a.jpg]] |
|
10551 |
|
|
10552 |
The HTML export back-end copies the ‘http’ links from the Org file as |
|
10553 |
is. |
|
10554 |
|
|
10555 |
|
|
10556 |
File: org, Node: Math formatting in HTML export, Next: Text areas in HTML export, Prev: Images in HTML export, Up: HTML export |
|
10557 |
|
|
10558 |
12.9.9 Math formatting in HTML export |
|
10559 |
------------------------------------- |
|
10560 |
|
|
10561 |
LaTeX math snippets (*note LaTeX fragments::) can be displayed in two |
|
10562 |
different ways on HTML pages. The default is to use MathJax |
|
10563 |
(http://www.mathjax.org) which should work out of the box with Org(1). |
|
10564 |
Some MathJax display options can be configured via |
|
10565 |
‘org-html-mathjax-options’, or in the buffer. For example, with the |
|
10566 |
following settings, |
|
10567 |
#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler |
|
10568 |
equation labels will be displayed on the left margin and equations |
|
10569 |
will be five ems from the left margin. |
|
10570 |
|
|
10571 |
See the docstring of ‘org-html-mathjax-options’ for all supported |
|
10572 |
variables. The MathJax template can be configure via |
|
10573 |
‘org-html-mathjax-template’. |
|
10574 |
|
|
10575 |
If you prefer, you can also request that LaTeX fragments are |
|
10576 |
processed into small images that will be inserted into the browser page. |
|
10577 |
Before the availability of MathJax, this was the default method for Org |
|
10578 |
files. This method requires that the ‘dvipng’ program, ‘dvisvgm’ or |
|
10579 |
‘imagemagick’ suite is available on your system. You can still get this |
|
10580 |
processing with |
|
10581 |
|
|
10582 |
#+OPTIONS: tex:dvipng |
|
10583 |
|
|
10584 |
#+OPTIONS: tex:dvisvgm |
|
10585 |
|
|
10586 |
or: |
|
10587 |
|
|
10588 |
#+OPTIONS: tex:imagemagick |
|
10589 |
|
|
10590 |
---------- Footnotes ---------- |
|
10591 |
|
|
10592 |
(1) By default Org loads MathJax from cdnjs.com (https://cdnjs.com) |
|
10593 |
as recommended by MathJax (http://www.mathjax.org). |
|
10594 |
|
|
10595 |
|
|
10596 |
File: org, Node: Text areas in HTML export, Next: CSS support, Prev: Math formatting in HTML export, Up: HTML export |
|
10597 |
|
|
10598 |
12.9.10 Text areas in HTML export |
|
10599 |
--------------------------------- |
|
10600 |
|
|
10601 |
Before Org mode’s Babel, one popular approach to publishing code in HTML |
|
10602 |
was by using ‘:textarea’. The advantage of this approach was that |
|
10603 |
copying and pasting was built into browsers with simple JavaScript |
|
10604 |
commands. Even editing before pasting was made simple. |
|
10605 |
|
|
10606 |
The HTML export back-end can create such text areas. It requires an |
|
10607 |
‘#+ATTR_HTML:’ line as shown in the example below with the ‘:textarea’ |
|
10608 |
option. This must be followed by either an ‘example’ or a ‘src’ code |
|
10609 |
block. Other Org block types will not honor the ‘:textarea’ option. |
|
10610 |
|
|
10611 |
By default, the HTML export back-end creates a text area 80 |
|
10612 |
characters wide and height just enough to fit the content. Override |
|
10613 |
these defaults with ‘:width’ and ‘:height’ options on the ‘#+ATTR_HTML:’ |
|
10614 |
line. |
|
10615 |
|
|
10616 |
#+ATTR_HTML: :textarea t :width 40 |
|
10617 |
#+BEGIN_EXAMPLE |
|
10618 |
(defun org-xor (a b) |
|
10619 |
"Exclusive or." |
|
10620 |
(if a (not b) b)) |
|
10621 |
#+END_EXAMPLE |
|
10622 |
|
|
10623 |
|
|
10624 |
File: org, Node: CSS support, Next: JavaScript support, Prev: Text areas in HTML export, Up: HTML export |
|
10625 |
|
|
10626 |
12.9.11 CSS support |
|
10627 |
------------------- |
|
10628 |
|
|
10629 |
You can modify the CSS style definitions for the exported file. The |
|
10630 |
HTML exporter assigns the following special CSS classes(1) to |
|
10631 |
appropriate parts of the document—your style specifications may change |
|
10632 |
these, in addition to any of the standard classes like for headlines, |
|
10633 |
tables, etc. |
|
10634 |
p.author author information, including email |
|
10635 |
p.date publishing date |
|
10636 |
p.creator creator info, about org mode version |
|
10637 |
.title document title |
|
10638 |
.subtitle document subtitle |
|
10639 |
.todo TODO keywords, all not-done states |
|
10640 |
.done the DONE keywords, all states that count as done |
|
10641 |
.WAITING each TODO keyword also uses a class named after itself |
|
10642 |
.timestamp timestamp |
|
10643 |
.timestamp-kwd keyword associated with a timestamp, like ‘SCHEDULED’ |
|
10644 |
.timestamp-wrapper span around keyword plus timestamp |
|
10645 |
.tag tag in a headline |
|
10646 |
._HOME each tag uses itself as a class, "@" replaced by "_" |
|
10647 |
.target target for links |
|
10648 |
.linenr the line number in a code example |
|
10649 |
.code-highlighted for highlighting referenced code lines |
|
10650 |
div.outline-N div for outline level N (headline plus text)) |
|
10651 |
div.outline-text-N extra div for text at outline level N |
|
10652 |
.section-number-N section number in headlines, different for each level |
|
10653 |
.figure-number label like "Figure 1:" |
|
10654 |
.table-number label like "Table 1:" |
|
10655 |
.listing-number label like "Listing 1:" |
|
10656 |
div.figure how to format an in-lined image |
|
10657 |
pre.src formatted source code |
|
10658 |
pre.example normal example |
|
10659 |
p.verse verse paragraph |
|
10660 |
div.footnotes footnote section headline |
|
10661 |
p.footnote footnote definition paragraph, containing a footnote |
|
10662 |
.footref a footnote reference number (always a <sup>) |
|
10663 |
.footnum footnote number in footnote definition (always <sup>) |
|
10664 |
.org-svg default class for a linked ‘.svg’ image |
|
10665 |
|
|
10666 |
The HTML export back-end includes a compact default style in each |
|
10667 |
exported HTML file. To override the default style with another style, |
|
10668 |
use these keywords in the Org file. They will replace the global |
|
10669 |
defaults the HTML exporter uses. |
|
10670 |
|
|
10671 |
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" /> |
|
10672 |
#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" /> |
|
10673 |
|
|
10674 |
To just turn off the default style, customize |
|
10675 |
‘org-html-head-include-default-style’ variable, or use this option line |
|
10676 |
in the Org file. |
|
10677 |
|
|
10678 |
#+OPTIONS: html-style:nil |
|
10679 |
|
|
10680 |
For longer style definitions, either use several ‘#+HTML_HEAD’ and |
|
10681 |
‘#+HTML_HEAD_EXTRA’ lines, or use ‘<style>’ ‘</style>’ blocks around |
|
10682 |
them. Both of these approaches can avoid referring to an external file. |
|
10683 |
|
|
10684 |
In order to add styles to a sub-tree, use the |
|
10685 |
‘:HTML_CONTAINER_CLASS:’ property to assign a class to the tree. In |
|
10686 |
order to specify CSS styles for a particular headline, you can use the |
|
10687 |
id specified in a ‘:CUSTOM_ID:’ property. |
|
10688 |
|
|
10689 |
Never change the ‘org-html-style-default’ constant. Instead use |
|
10690 |
other simpler ways of customizing as described above. |
|
10691 |
|
|
10692 |
---------- Footnotes ---------- |
|
10693 |
|
|
10694 |
(1) If the classes on TODO keywords and tags lead to conflicts, use |
|
10695 |
the variables ‘org-html-todo-kwd-class-prefix’ and |
|
10696 |
‘org-html-tag-class-prefix’ to make them unique. |
|
10697 |
|
|
10698 |
|
|
10699 |
File: org, Node: JavaScript support, Prev: CSS support, Up: HTML export |
|
10700 |
|
|
10701 |
12.9.12 JavaScript supported display of web pages |
|
10702 |
------------------------------------------------- |
|
10703 |
|
|
10704 |
Sebastian Rose has written a JavaScript program especially designed to |
|
10705 |
enhance the web viewing experience of HTML files created with Org. This |
|
10706 |
program enhances large files in two different ways of viewing. One is |
|
10707 |
an _Info_-like mode where each section is displayed separately and |
|
10708 |
navigation can be done with the ‘n’ and ‘p’ keys (and some other keys as |
|
10709 |
well, press ‘?’ for an overview of the available keys). The second one |
|
10710 |
has a _folding_ view, much like Org provides inside Emacs. The script |
|
10711 |
is available at <https://orgmode.org/org-info.js> and the documentation |
|
10712 |
at <https://orgmode.org/worg/code/org-info-js/>. The script is hosted |
|
10713 |
on <https://orgmode.org>, but for reliability, prefer installing it on |
|
10714 |
your own web server. |
|
10715 |
|
|
10716 |
To use this program, just add this line to the Org file: |
|
10717 |
|
|
10718 |
#+INFOJS_OPT: view:info toc:nil |
|
10719 |
|
|
10720 |
The HTML header now has the code needed to automatically invoke the |
|
10721 |
script. For setting options, use the syntax from the above line for |
|
10722 |
options described below: |
|
10723 |
|
|
10724 |
path: The path to the script. The default grabs the script from |
|
10725 |
<https://orgmode.org/org-info.js>, but you might want to have |
|
10726 |
a local copy and use a path like ‘../scripts/org-info.js’. |
|
10727 |
view: Initial view when the website is first shown. Possible values are: |
|
10728 |
info Info-like interface with one section per page. |
|
10729 |
overview Folding interface, initially showing only top-level. |
|
10730 |
content Folding interface, starting with all headlines visible. |
|
10731 |
showall Folding interface, all headlines and text visible. |
|
10732 |
sdepth: Maximum headline level that will still become an independent |
|
10733 |
section for info and folding modes. The default is taken from |
|
10734 |
‘org-export-headline-levels’ (= the ‘H’ switch in ‘#+OPTIONS’). |
|
10735 |
If this is smaller than in ‘org-export-headline-levels’, each |
|
10736 |
info/folding section can still contain child headlines. |
|
10737 |
toc: Should the table of contents _initially_ be visible? |
|
10738 |
Even when ‘nil’, you can always get to the "toc" with ‘i’. |
|
10739 |
tdepth: The depth of the table of contents. The defaults are taken from |
|
10740 |
the variables ‘org-export-headline-levels’ and ‘org-export-with-toc’. |
|
10741 |
ftoc: Does the CSS of the page specify a fixed position for the "toc"? |
|
10742 |
If yes, the toc will never be displayed as a section. |
|
10743 |
ltoc: Should there be short contents (children) in each section? |
|
10744 |
Make this ‘above’ if the section should be above initial text. |
|
10745 |
mouse: Headings are highlighted when the mouse is over them. Should be |
|
10746 |
‘underline’ (default) or a background color like ‘#cccccc’. |
|
10747 |
buttons: Should view-toggle buttons be everywhere? When ‘nil’ (the |
|
10748 |
default), only one such button will be present. |
|
10749 |
You can choose default values for these options by customizing the |
|
10750 |
variable ‘org-html-infojs-options’. If you want the script to always |
|
10751 |
apply to your pages, configure the variable ‘org-html-use-infojs’. |
|
10752 |
|
|
10753 |
|
|
10754 |
File: org, Node: LaTeX export, Next: Markdown export, Prev: HTML export, Up: Exporting |
|
10755 |
|
|
10756 |
12.10 LaTeX export |
|
10757 |
================== |
|
10758 |
|
|
10759 |
The LaTeX export back-end can handle complex documents, incorporate |
|
10760 |
standard or custom LaTeX document classes, generate documents using |
|
10761 |
alternate LaTeX engines, and produce fully linked PDF files with |
|
10762 |
indexes, bibliographies, and tables of contents, destined for |
|
10763 |
interactive online viewing or high-quality print publication. |
|
10764 |
|
|
10765 |
While the details are covered in-depth in this section, here are some |
|
10766 |
quick references to variables for the impatient: for engines, see |
|
10767 |
‘org-latex-compiler’; for build sequences, see ‘org-latex-pdf-process’; |
|
10768 |
for packages, see ‘org-latex-default-packages-alist’ and |
|
10769 |
‘org-latex-packages-alist’. |
|
10770 |
|
|
10771 |
An important note about the LaTeX export back-end: it is sensitive to |
|
10772 |
blank lines in the Org document. That’s because LaTeX itself depends on |
|
10773 |
blank lines to tell apart syntactical elements, such as paragraphs. |
|
10774 |
|
|
10775 |
* Menu: |
|
10776 |
|
|
10777 |
* LaTeX export commands:: For producing LaTeX and PDF documents. |
|
10778 |
* LaTeX specific export settings:: Unique to this LaTeX back-end. |
|
10779 |
* LaTeX header and sectioning:: For file structure. |
|
10780 |
* Quoting LaTeX code:: Directly in the Org document. |
|
10781 |
* Tables in LaTeX export:: Attributes specific to tables. |
|
10782 |
* Images in LaTeX export:: Attributes specific to images. |
|
10783 |
* Plain lists in LaTeX export:: Attributes specific to lists. |
|
10784 |
* Source blocks in LaTeX export:: Attributes specific to source code blocks. |
|
10785 |
* Example blocks in LaTeX export:: Attributes specific to example blocks. |
|
10786 |
* Special blocks in LaTeX export:: Attributes specific to special blocks. |
|
10787 |
* Horizontal rules in LaTeX export:: Attributes specific to horizontal rules. |
|
10788 |
|
|
10789 |
|
|
10790 |
File: org, Node: LaTeX export commands, Next: LaTeX specific export settings, Up: LaTeX export |
|
10791 |
|
|
10792 |
12.10.1 LaTeX export commands |
|
10793 |
----------------------------- |
|
10794 |
|
|
10795 |
‘C-c C-e l l (org-latex-export-to-latex)’ |
|
10796 |
Export as LaTeX file with a ‘.tex’ extension. For ‘myfile.org’, |
|
10797 |
Org exports to ‘myfile.tex’, overwriting without warning. ‘C-c C-e |
|
10798 |
l l’ Exports to LaTeX file. |
|
10799 |
|
|
10800 |
‘C-c C-e l L (org-latex-export-as-latex)’ |
|
10801 |
Export to a temporary buffer. Do not create a file. |
|
10802 |
‘C-c C-e l p (org-latex-export-to-pdf)’ |
|
10803 |
Export as LaTeX file and convert it to PDF file. |
|
10804 |
‘C-c C-e l o’ |
|
10805 |
Export as LaTeX file and convert it to PDF, then open the PDF using |
|
10806 |
the default viewer. |
|
10807 |
|
|
10808 |
The LaTeX export back-end can use any of these LaTeX engines: |
|
10809 |
‘pdflatex’, ‘xelatex’, and ‘lualatex’. These engines compile LaTeX |
|
10810 |
files with different compilers, packages, and output options. The LaTeX |
|
10811 |
export back-end finds the compiler version to use from |
|
10812 |
‘org-latex-compiler’ variable or the ‘#+LATEX_COMPILER’ keyword in the |
|
10813 |
Org file. See the docstring for the ‘org-latex-default-packages-alist’ |
|
10814 |
for loading packages with certain compilers. Also see |
|
10815 |
‘org-latex-bibtex-compiler’ to set the bibliography compiler(1). |
|
10816 |
|
|
10817 |
---------- Footnotes ---------- |
|
10818 |
|
|
10819 |
(1) This does not allow setting different bibliography compilers for |
|
10820 |
different files. However, “smart” LaTeX compilation systems, such as |
|
10821 |
‘latexmk’, can select the correct bibliography compiler. |
|
10822 |
|
|
10823 |
|
|
10824 |
File: org, Node: LaTeX specific export settings, Next: LaTeX header and sectioning, Prev: LaTeX export commands, Up: LaTeX export |
|
10825 |
|
|
10826 |
12.10.2 LaTeX specific export settings |
|
10827 |
-------------------------------------- |
|
10828 |
|
|
10829 |
The LaTeX export back-end has several additional keywords for |
|
10830 |
customizing LaTeX output. Setting these keywords works similar to the |
|
10831 |
general options (*note Export settings::). |
|
10832 |
|
|
10833 |
‘DESCRIPTION’ |
|
10834 |
The document’s description. The description along with author |
|
10835 |
name, keywords, and related file metadata are inserted in the |
|
10836 |
output file by the ‘hyperref’ package. See |
|
10837 |
‘org-latex-hyperref-template’ for customizing metadata items. See |
|
10838 |
‘org-latex-title-command’ for typesetting description into the |
|
10839 |
document’s front matter. Use multiple ‘#+DESCRIPTION’ lines for |
|
10840 |
long descriptions. |
|
10841 |
|
|
10842 |
‘LATEX_CLASS’ |
|
10843 |
This is LaTeX document class, such as ‘article’, ‘report’, ‘book’, |
|
10844 |
and so on, which contain predefined preamble and headline level |
|
10845 |
mapping that the LaTeX export back-end needs. The back-end reads |
|
10846 |
the default class name from the ‘org-latex-default-class’ variable. |
|
10847 |
Org has ‘article’ as the default class. A valid default class must |
|
10848 |
be an element of ‘org-latex-classes’. |
|
10849 |
|
|
10850 |
‘LATEX_CLASS_OPTIONS’ |
|
10851 |
Options the LaTeX export back-end uses when calling the LaTeX |
|
10852 |
document class. |
|
10853 |
|
|
10854 |
‘LATEX_COMPILER’ |
|
10855 |
The compiler, such as ‘pdflatex’, ‘xelatex’, ‘lualatex’, for |
|
10856 |
producing the PDF (‘org-latex-compiler’). |
|
10857 |
|
|
10858 |
‘LATEX_HEADER’ |
|
10859 |
Arbitrary lines to add to the document’s preamble, before the |
|
10860 |
‘hyperref’ settings. See ‘org-latex-classes’ for adjusting the |
|
10861 |
structure and order of the LaTeX headers. |
|
10862 |
|
|
10863 |
‘LATEX_HEADER_EXTRA’ |
|
10864 |
Arbitrary lines to add to the document’s preamble, before the |
|
10865 |
‘hyperref’ settings. See ‘org-latex-classes’ for adjusting the |
|
10866 |
structure and order of the LaTeX headers. |
|
10867 |
|
|
10868 |
‘KEYWORDS’ |
|
10869 |
The keywords for the document. The description along with author |
|
10870 |
name, keywords, and related file metadata are inserted in the |
|
10871 |
output file by the ‘hyperref’ package. See |
|
10872 |
‘org-latex-hyperref-template’ for customizing metadata items. See |
|
10873 |
‘org-latex-title-command’ for typesetting description into the |
|
10874 |
document’s front matter. Use multiple ‘#+KEYWORDS’ lines if |
|
10875 |
necessary. |
|
10876 |
|
|
10877 |
‘SUBTITLE’ |
|
10878 |
The document’s subtitle. It is typeset as per |
|
10879 |
‘org-latex-subtitle-format’. If ‘org-latex-subtitle-separate’ is |
|
10880 |
non-‘nil’, it is typed as part of the ‘\title’-macro. See |
|
10881 |
‘org-latex-hyperref-template’ for customizing metadata items. See |
|
10882 |
‘org-latex-title-command’ for typesetting description into the |
|
10883 |
document’s front matter. |
|
10884 |
|
|
10885 |
The following sections have further details. |
|
10886 |
|
|
10887 |
|
|
10888 |
File: org, Node: LaTeX header and sectioning, Next: Quoting LaTeX code, Prev: LaTeX specific export settings, Up: LaTeX export |
|
10889 |
|
|
10890 |
12.10.3 LaTeX header and sectioning structure |
|
10891 |
--------------------------------------------- |
|
10892 |
|
|
10893 |
The LaTeX export back-end converts the first three of Org’s outline |
|
10894 |
levels into LaTeX headlines. The remaining Org levels are exported as |
|
10895 |
‘itemize’ or ‘enumerate’ lists. To change this globally for the cut-off |
|
10896 |
point between levels and lists, (*note Export settings::). |
|
10897 |
|
|
10898 |
By default, the LaTeX export back-end uses the ‘article’ class. |
|
10899 |
|
|
10900 |
To change the default class globally, edit ‘org-latex-default-class’. |
|
10901 |
To change the default class locally in an Org file, add option lines |
|
10902 |
‘#+LATEX_CLASS: myclass’. To change the default class for just a part |
|
10903 |
of the Org file, set a sub-tree property, ‘EXPORT_LATEX_CLASS’. The |
|
10904 |
class name entered here must be valid member of ‘org-latex-classes’. |
|
10905 |
This variable defines a header template for each class into which the |
|
10906 |
exporter splices the values of ‘org-latex-default-packages-alist’ and |
|
10907 |
‘org-latex-packages-alist’. Use the same three variables to define |
|
10908 |
custom sectioning or custom classes. |
|
10909 |
|
|
10910 |
The LaTeX export back-end sends the ‘LATEX_CLASS_OPTIONS’ keyword and |
|
10911 |
‘EXPORT_LATEX_CLASS_OPTIONS’ property as options to the LaTeX |
|
10912 |
‘\documentclass’ macro. The options and the syntax for specifying them, |
|
10913 |
including enclosing them in square brackets, follow LaTeX conventions. |
|
10914 |
|
|
10915 |
#+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn] |
|
10916 |
|
|
10917 |
The LaTeX export back-end appends values from ‘LATEX_HEADER’ and |
|
10918 |
‘LATEX_HEADER_EXTRA’ keywords to the LaTeX header. The docstring for |
|
10919 |
‘org-latex-classes’ explains in more detail. Also note that LaTeX |
|
10920 |
export back-end does not append ‘LATEX_HEADER_EXTRA’ to the header when |
|
10921 |
previewing LaTeX snippets (*note Previewing LaTeX fragments::). |
|
10922 |
|
|
10923 |
A sample Org file with the above headers: |
|
10924 |
|
|
10925 |
#+LATEX_CLASS: article |
|
10926 |
#+LATEX_CLASS_OPTIONS: [a4paper] |
|
10927 |
#+LATEX_HEADER: \usepackage{xyz} |
|
10928 |
|
|
10929 |
* Headline 1 |
|
10930 |
some text |
|
10931 |
* Headline 2 |
|
10932 |
some more text |
|
10933 |
|
|
10934 |
|
|
10935 |
File: org, Node: Quoting LaTeX code, Next: Tables in LaTeX export, Prev: LaTeX header and sectioning, Up: LaTeX export |
|
10936 |
|
|
10937 |
12.10.4 Quoting LaTeX code |
|
10938 |
-------------------------- |
|
10939 |
|
|
10940 |
The LaTeX export back-end can insert any arbitrary LaTeX code, *note |
|
10941 |
Embedded LaTeX::. There are three ways to embed such code in the Org |
|
10942 |
file and they all use different quoting syntax. |
|
10943 |
|
|
10944 |
Inserting in-line quoted with symbols: |
|
10945 |
Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph. |
|
10946 |
|
|
10947 |
Inserting as one or more keyword lines in the Org file: |
|
10948 |
#+LATEX: any arbitrary LaTeX code |
|
10949 |
|
|
10950 |
Inserting as an export block in the Org file, where the back-end |
|
10951 |
exports any code between begin and end markers: |
|
10952 |
#+BEGIN_EXPORT latex |
|
10953 |
any arbitrary LaTeX code |
|
10954 |
#+END_EXPORT |
|
10955 |
|
|
10956 |
|
|
10957 |
File: org, Node: Tables in LaTeX export, Next: Images in LaTeX export, Prev: Quoting LaTeX code, Up: LaTeX export |
|
10958 |
|
|
10959 |
12.10.5 Tables in LaTeX export |
|
10960 |
------------------------------ |
|
10961 |
|
|
10962 |
The LaTeX export back-end can pass several LaTeX attributes for table |
|
10963 |
contents and layout. Besides specifying label and caption (*note Images |
|
10964 |
and tables::), the other valid LaTeX attributes include: |
|
10965 |
|
|
10966 |
‘:mode’ |
|
10967 |
The LaTeX export back-end wraps the table differently depending on |
|
10968 |
the mode for accurate rendering of math symbols. Mode is either |
|
10969 |
‘table’, ‘math’, ‘inline-math’ or ‘verbatim’. For ‘math’ or |
|
10970 |
‘inline-math’ mode, LaTeX export back-end wraps the table in a math |
|
10971 |
environment, but every cell in it is exported as-is. The LaTeX |
|
10972 |
export back-end determines the default mode from |
|
10973 |
‘org-latex-default-table-mode’. For , The LaTeX export back-end |
|
10974 |
merges contiguous tables in the same mode into a single |
|
10975 |
environment. |
|
10976 |
‘:environment’ |
|
10977 |
Set the default LaTeX table environment for the LaTeX export |
|
10978 |
back-end to use when exporting Org tables. Common LaTeX table |
|
10979 |
environments are provided by these packages: ‘tabularx’, |
|
10980 |
‘longtable’, ‘array’, ‘tabu’, and ‘bmatrix’. For packages, such as |
|
10981 |
‘tabularx’ and ‘tabu’, or any newer replacements, include them in |
|
10982 |
the ‘org-latex-packages-alist’ variable so the LaTeX export |
|
10983 |
back-end can insert the appropriate load package headers in the |
|
10984 |
converted LaTeX file. Look in the docstring for the |
|
10985 |
‘org-latex-packages-alist’ variable for configuring these packages |
|
10986 |
for LaTeX snippet previews, if any. |
|
10987 |
‘:caption’ |
|
10988 |
Use ‘#+CAPTION’ keyword to set a simple caption for a table (*note |
|
10989 |
Images and tables::). For custom captions, use ‘:caption’ |
|
10990 |
attribute, which accepts raw LaTeX code. ‘:caption’ value |
|
10991 |
overrides ‘#+CAPTION’ value. |
|
10992 |
‘:float’ |
|
10993 |
‘:placement’ |
|
10994 |
The table environments by default are not floats in LaTeX. To make |
|
10995 |
them floating objects use ‘:float’ with one of the following |
|
10996 |
options: ‘sideways’, ‘multicolumn’, ‘t’, and ‘nil’. Note that |
|
10997 |
‘sidewaystable’ has been deprecated since Org 8.3. LaTeX floats |
|
10998 |
can also have additional layout ‘:placement’ attributes. These are |
|
10999 |
the usual ‘[h t b p ! H]’ permissions specified in square brackets. |
|
11000 |
Note that for ‘:float sideways’ tables, the LaTeX export back-end |
|
11001 |
ignores ‘:placement’ attributes. |
|
11002 |
‘:align’ |
|
11003 |
‘:font’ |
|
11004 |
‘:width’ |
|
11005 |
The LaTeX export back-end uses these attributes for regular tables |
|
11006 |
to set their alignments, fonts, and widths. |
|
11007 |
‘:spread’ |
|
11008 |
When ‘:spread’ is non-‘nil’, the LaTeX export back-end spreads or |
|
11009 |
shrinks the table by the ‘:width’ for ‘tabu’ and ‘longtabu’ |
|
11010 |
environments. ‘:spread’ has no effect if ‘:width’ is not set. |
|
11011 |
‘:booktabs’ |
|
11012 |
‘:center’ |
|
11013 |
‘:rmlines’ |
|
11014 |
All three commands are toggles. ‘:booktabs’ brings in modern |
|
11015 |
typesetting enhancements to regular tables. The ‘booktabs’ package |
|
11016 |
has to be loaded through ‘org-latex-packages-alist’. ‘:center’ is |
|
11017 |
for centering the table. ‘:rmlines’ removes all but the very first |
|
11018 |
horizontal line made of ASCII characters from "table.el" tables |
|
11019 |
only. |
|
11020 |
‘:math-prefix’ |
|
11021 |
‘:math-suffix’ |
|
11022 |
‘:math-arguments’ |
|
11023 |
The LaTeX export back-end inserts ‘:math-prefix’ string value in a |
|
11024 |
math environment before the table. The LaTeX export back-end |
|
11025 |
inserts ‘:math-suffix’ string value in a math environment after the |
|
11026 |
table. The LaTeX export back-end inserts ‘:math-arguments’ string |
|
11027 |
value between the macro name and the table’s contents. |
|
11028 |
‘:math-arguments’ comes in use for matrix macros that require more |
|
11029 |
than one argument, such as ‘qbordermatrix’. |
|
11030 |
|
|
11031 |
LaTeX table attributes help formatting tables for a wide range of |
|
11032 |
situations, such as matrix product or spanning multiple pages: |
|
11033 |
|
|
11034 |
#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l |
|
11035 |
| ..... | ..... | |
|
11036 |
| ..... | ..... | |
|
11037 |
|
|
11038 |
#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times |
|
11039 |
| a | b | |
|
11040 |
| c | d | |
|
11041 |
#+ATTR_LATEX: :mode math :environment bmatrix |
|
11042 |
| 1 | 2 | |
|
11043 |
| 3 | 4 | |
|
11044 |
|
|
11045 |
Set the caption with the LaTeX command |
|
11046 |
‘\bicaption{HeadingA}{HeadingB}’: |
|
11047 |
|
|
11048 |
#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} |
|
11049 |
| ..... | ..... | |
|
11050 |
| ..... | ..... | |
|
11051 |
|
|
11052 |
|
|
11053 |
File: org, Node: Images in LaTeX export, Next: Plain lists in LaTeX export, Prev: Tables in LaTeX export, Up: LaTeX export |
|
11054 |
|
|
11055 |
12.10.6 Images in LaTeX export |
|
11056 |
------------------------------ |
|
11057 |
|
|
11058 |
The LaTeX export back-end processes image links in Org files that do not |
|
11059 |
have descriptions, such as these links ‘[[file:img.jpg]]’ or |
|
11060 |
‘[[./img.jpg]]’, as direct image insertions in the final PDF output. In |
|
11061 |
the PDF, they are no longer links but actual images embedded on the |
|
11062 |
page. The LaTeX export back-end uses ‘\includegraphics’ macro to insert |
|
11063 |
the image. But for TikZ(1) images, the back-end uses an ‘\input’ macro |
|
11064 |
wrapped within a ‘tikzpicture’ environment. |
|
11065 |
|
|
11066 |
For specifying image ‘:width’, ‘:height’, and other ‘:options’, use |
|
11067 |
this syntax: |
|
11068 |
|
|
11069 |
#+ATTR_LATEX: :width 5cm :options angle=90 |
|
11070 |
[[./img/sed-hr4049.pdf]] |
|
11071 |
|
|
11072 |
For custom commands for captions, use the ‘:caption’ attribute. It |
|
11073 |
will override the default ‘#+CAPTION’ value: |
|
11074 |
|
|
11075 |
#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} |
|
11076 |
[[./img/sed-hr4049.pdf]] |
|
11077 |
|
|
11078 |
When captions follow the method as described in *note Images and |
|
11079 |
tables::, the LaTeX export back-end wraps the picture in a floating |
|
11080 |
‘figure’ environment. To float an image without specifying a caption, |
|
11081 |
set the ‘:float’ attribute to one of the following: |
|
11082 |
− ‘t’: for a standard ‘figure’ environment; used by default whenever |
|
11083 |
an image has a caption. |
|
11084 |
− ‘multicolumn’: to span the image across multiple columns of a page; |
|
11085 |
the back-end wraps the image in a ‘figure*’ environment. |
|
11086 |
− ‘wrap’: for text to flow around the image on the right; the figure |
|
11087 |
occupies the left half of the page. |
|
11088 |
− ‘sideways’: for a new page with the image sideways, rotated ninety |
|
11089 |
degrees, in a ‘sidewaysfigure’ environment; overrides ‘:placement’ |
|
11090 |
setting. |
|
11091 |
− ‘nil’: to avoid a ‘:float’ even if using a caption. |
|
11092 |
Use the ‘placement’ attribute to modify a floating environment’s |
|
11093 |
placement. |
|
11094 |
|
|
11095 |
#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement |
|
11096 |
{r}{0.4\textwidth} [[./img/hst.png]] |
|
11097 |
|
|
11098 |
The LaTeX export back-end centers all images by default. Setting |
|
11099 |
‘:center’ attribute to ‘nil’ disables centering. To disable centering |
|
11100 |
globally, set ‘org-latex-images-centered’ to ‘t’. |
|
11101 |
|
|
11102 |
Set the ‘:comment-include’ attribute to non-‘nil’ value for the LaTeX |
|
11103 |
export back-end to comment out the ‘\includegraphics’ macro. |
|
11104 |
|
|
11105 |
---------- Footnotes ---------- |
|
11106 |
|
|
11107 |
(1) <http://sourceforge.net/projects/pgf/> |
|
11108 |
|
|
11109 |
|
|
11110 |
File: org, Node: Plain lists in LaTeX export, Next: Source blocks in LaTeX export, Prev: Images in LaTeX export, Up: LaTeX export |
|
11111 |
|
|
11112 |
12.10.7 Plain lists in LaTeX export |
|
11113 |
----------------------------------- |
|
11114 |
|
|
11115 |
The LaTeX export back-end accepts the ‘:environment’ and ‘:options’ |
|
11116 |
attributes for plain lists. Both attributes work together for |
|
11117 |
customizing lists, as shown in the examples: |
|
11118 |
|
|
11119 |
#+LATEX_HEADER: \usepackage[inline]{enumitem} |
|
11120 |
Some ways to say "Hello": |
|
11121 |
#+ATTR_LATEX: :environment itemize* |
|
11122 |
#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}] |
|
11123 |
- Hola |
|
11124 |
- Bonjour |
|
11125 |
- Guten Tag. |
|
11126 |
|
|
11127 |
Since LaTeX supports only four levels of nesting for lists, use an |
|
11128 |
external package, such as ‘enumitem’ in LaTeX, for levels deeper than |
|
11129 |
four: |
|
11130 |
|
|
11131 |
#+LATEX_HEADER: \usepackage{enumitem} |
|
11132 |
#+LATEX_HEADER: \renewlist{itemize}{itemize}{9} |
|
11133 |
#+LATEX_HEADER: \setlist[itemize]{label=$\circ$} |
|
11134 |
- One |
|
11135 |
- Two |
|
11136 |
- Three |
|
11137 |
- Four |
|
11138 |
- Five |
|
11139 |
|
|
11140 |
|
|
11141 |
File: org, Node: Source blocks in LaTeX export, Next: Example blocks in LaTeX export, Prev: Plain lists in LaTeX export, Up: LaTeX export |
|
11142 |
|
|
11143 |
12.10.8 Source blocks in LaTeX export |
|
11144 |
------------------------------------- |
|
11145 |
|
|
11146 |
The LaTeX export back-end can make source code blocks into floating |
|
11147 |
objects through the attributes ‘:float’ and ‘:options’. For ‘:float’: |
|
11148 |
|
|
11149 |
− ‘t’: makes a source block float; by default floats any source block |
|
11150 |
with a caption. |
|
11151 |
− ‘multicolumn’: spans the source block across multiple columns of a |
|
11152 |
page. |
|
11153 |
− ‘nil’: avoids a ‘:float’ even if using a caption; useful for source |
|
11154 |
code blocks that may not fit on a page. |
|
11155 |
|
|
11156 |
#+ATTR_LATEX: :float nil |
|
11157 |
#+BEGIN_SRC emacs-lisp |
|
11158 |
Lisp code that may not fit in a single page. |
|
11159 |
#+END_SRC |
|
11160 |
|
|
11161 |
The LaTeX export back-end passes string values in ‘:options’ to LaTeX |
|
11162 |
packages for customization of that specific source block. In the |
|
11163 |
example below, the ‘:options’ are set for Minted. Minted is a source |
|
11164 |
code highlighting LaTeXpackage with many configurable options. |
|
11165 |
|
|
11166 |
#+ATTR_LATEX: :options commentstyle=\bfseries |
|
11167 |
#+BEGIN_SRC emacs-lisp |
|
11168 |
(defun Fib (n) |
|
11169 |
(if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2))))) |
|
11170 |
#+END_SRC |
|
11171 |
|
|
11172 |
To apply similar configuration options for all source blocks in a |
|
11173 |
file, use the ‘org-latex-listings-options’ and |
|
11174 |
‘org-latex-minted-options’ variables. |
|
11175 |
|
|
11176 |
|
|
11177 |
File: org, Node: Example blocks in LaTeX export, Next: Special blocks in LaTeX export, Prev: Source blocks in LaTeX export, Up: LaTeX export |
|
11178 |
|
|
11179 |
12.10.9 Example blocks in LaTeX export |
|
11180 |
-------------------------------------- |
|
11181 |
|
|
11182 |
The LaTeX export back-end wraps the contents of example blocks in a |
|
11183 |
‘verbatim’ environment. To change this behavior to use another |
|
11184 |
environment globally, specify an appropriate export filter (*note |
|
11185 |
Advanced configuration::). To change this behavior to use another |
|
11186 |
environment for each block, use the ‘:environment’ parameter to specify |
|
11187 |
a custom environment. |
|
11188 |
|
|
11189 |
#+ATTR_LATEX: :environment myverbatim |
|
11190 |
#+BEGIN_EXAMPLE |
|
11191 |
This sentence is false. |
|
11192 |
#+END_EXAMPLE |
|
11193 |
|
|
11194 |
|
|
11195 |
File: org, Node: Special blocks in LaTeX export, Next: Horizontal rules in LaTeX export, Prev: Example blocks in LaTeX export, Up: LaTeX export |
|
11196 |
|
|
11197 |
12.10.10 Special blocks in LaTeX export |
|
11198 |
--------------------------------------- |
|
11199 |
|
|
11200 |
For other special blocks in the Org file, the LaTeX export back-end |
|
11201 |
makes a special environment of the same name. The back-end also takes |
|
11202 |
‘:options’, if any, and appends as-is to that environment’s opening |
|
11203 |
string. For example: |
|
11204 |
|
|
11205 |
#+BEGIN_abstract |
|
11206 |
We demonstrate how to solve the Syracuse problem. |
|
11207 |
#+END_abstract |
|
11208 |
|
|
11209 |
#+ATTR_LATEX: :options [Proof of important theorem] |
|
11210 |
#+BEGIN_proof |
|
11211 |
... |
|
11212 |
Therefore, any even number greater than 2 is the sum of two primes. |
|
11213 |
#+END_proof |
|
11214 |
|
|
11215 |
exports to |
|
11216 |
|
|
11217 |
\begin{abstract} |
|
11218 |
We demonstrate how to solve the Syracuse problem. |
|
11219 |
\end{abstract} |
|
11220 |
|
|
11221 |
\begin{proof}[Proof of important theorem] |
|
11222 |
... |
|
11223 |
Therefore, any even number greater than 2 is the sum of two primes. |
|
11224 |
\end{proof} |
|
11225 |
|
|
11226 |
If you need to insert a specific caption command, use ‘:caption’ |
|
11227 |
attribute. It will override standard ‘#+CAPTION’ value, if any. For |
|
11228 |
example: |
|
11229 |
|
|
11230 |
#+ATTR_LATEX: :caption \MyCaption{HeadingA} |
|
11231 |
#+BEGIN_proof |
|
11232 |
... |
|
11233 |
#+END_proof |
|
11234 |
|
|
11235 |
|
|
11236 |
File: org, Node: Horizontal rules in LaTeX export, Prev: Special blocks in LaTeX export, Up: LaTeX export |
|
11237 |
|
|
11238 |
12.10.11 Horizontal rules in LaTeX export |
|
11239 |
----------------------------------------- |
|
11240 |
|
|
11241 |
The LaTeX export back-end converts horizontal rules by the specified |
|
11242 |
‘:width’ and ‘:thickness’ attributes. For example: |
|
11243 |
|
|
11244 |
#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt |
|
11245 |
----- |
|
11246 |
|
|
11247 |
|
|
11248 |
File: org, Node: Markdown export, Next: OpenDocument Text export, Prev: LaTeX export, Up: Exporting |
|
11249 |
|
|
11250 |
12.11 Markdown export |
|
11251 |
===================== |
|
11252 |
|
|
11253 |
The Markdown export back-end, ‘md’, converts an Org file to Markdown |
|
11254 |
format, as defined at <http://daringfireball.net/projects/markdown/>. |
|
11255 |
|
|
11256 |
The ‘md’ back-end is built on top of the HTML back-end (*note HTML |
|
11257 |
export::). As a consequence, it converts every Org construct not |
|
11258 |
supported by Markdown syntax, such as tables, to HTML. |
|
11259 |
|
|
11260 |
Markdown export commands |
|
11261 |
------------------------ |
|
11262 |
|
|
11263 |
‘C-c C-e m m (org-md-export-to-markdown)’ |
|
11264 |
Export to a text file with Markdown syntax. For ‘myfile.org’, Org |
|
11265 |
exports to ‘myfile.md’, overwritten without warning. |
|
11266 |
‘C-c C-e m M (org-md-export-as-markdown)’ |
|
11267 |
Export to a temporary buffer. Does not create a file. |
|
11268 |
‘C-c C-e m o’ |
|
11269 |
Export as a text file with Markdown syntax, then open it. |
|
11270 |
|
|
11271 |
Header and sectioning structure |
|
11272 |
------------------------------- |
|
11273 |
|
|
11274 |
Based on ‘org-md-headline-style’, markdown export can generate headlines |
|
11275 |
of both ‘atx’ and ‘setext’ types. ‘atx’ limits headline levels to two. |
|
11276 |
‘setext’ limits headline levels to six. Beyond these limits, the export |
|
11277 |
back-end converts headlines to lists. To set a limit to a level before |
|
11278 |
the absolute limit (*note Export settings::). |
|
11279 |
|
|
11280 |
|
|
11281 |
File: org, Node: OpenDocument Text export, Next: Org export, Prev: Markdown export, Up: Exporting |
|
11282 |
|
|
11283 |
12.12 OpenDocument Text export |
|
11284 |
============================== |
|
11285 |
|
|
11286 |
The ODT export back-end handles creating of OpenDocument Text (ODT) |
|
11287 |
format files. The format complies with ‘OpenDocument-v1.2 |
|
11288 |
specification’(1) and is compatible with LibreOffice 3.4. |
|
11289 |
|
|
11290 |
* Menu: |
|
11291 |
|
|
11292 |
* Pre-requisites for ODT export:: Required packages. |
|
11293 |
* ODT export commands:: Invoking export. |
|
11294 |
* ODT specific export settings:: Configuration options. |
|
11295 |
* Extending ODT export:: Producing ‘.doc’, ‘.pdf’ files. |
|
11296 |
* Applying custom styles:: Styling the output. |
|
11297 |
* Links in ODT export:: Handling and formatting links. |
|
11298 |
* Tables in ODT export:: Org table conversions. |
|
11299 |
* Images in ODT export:: Inserting images. |
|
11300 |
* Math formatting in ODT export:: Formatting LaTeX fragments. |
|
11301 |
* Labels and captions in ODT export:: Rendering objects. |
|
11302 |
* Literal examples in ODT export:: For source code and example blocks. |
|
11303 |
* Advanced topics in ODT export:: For power users. |
|
11304 |
|
|
11305 |
---------- Footnotes ---------- |
|
11306 |
|
|
11307 |
(1) Open Document Format for Office Applications (OpenDocument) |
|
11308 |
Version 1.2 |
|
11309 |
(http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html) |
|
11310 |
|
|
11311 |
|
|
11312 |
File: org, Node: Pre-requisites for ODT export, Next: ODT export commands, Up: OpenDocument Text export |
|
11313 |
|
|
11314 |
12.12.1 Pre-requisites for ODT export |
|
11315 |
------------------------------------- |
|
11316 |
|
|
11317 |
The ODT export back-end relies on the ‘zip’ program to create the final |
|
11318 |
compressed ODT output. Check if ‘zip’ is locally available and |
|
11319 |
executable. Without ‘zip’, export cannot finish. |
|
11320 |
|
|
11321 |
|
|
11322 |
File: org, Node: ODT export commands, Next: ODT specific export settings, Prev: Pre-requisites for ODT export, Up: OpenDocument Text export |
|
11323 |
|
|
11324 |
12.12.2 ODT export commands |
|
11325 |
--------------------------- |
|
11326 |
|
|
11327 |
‘C-c C-e o o (org-odt-export-to-odt)’ |
|
11328 |
|
|
11329 |
Export as OpenDocument Text file. |
|
11330 |
|
|
11331 |
If ‘org-odt-preferred-output-format’ is specified, the ODT export |
|
11332 |
back-end automatically converts the exported file to that format. |
|
11333 |
*Note Automatically exporting to other formats: |
|
11334 |
x-export-to-other-formats. |
|
11335 |
|
|
11336 |
For ‘myfile.org’, Org exports to ‘myfile.odt’, overwriting without |
|
11337 |
warning. The ODT export back-end exports a region only if a region |
|
11338 |
was active. Note for exporting active regions, the |
|
11339 |
‘transient-mark-mode’ has to be turned on. |
|
11340 |
|
|
11341 |
If the selected region is a single tree, the ODT export back-end |
|
11342 |
makes the tree head the document title. Incidentally, ‘C-c @’ |
|
11343 |
selects the current sub-tree. If the tree head entry has, or |
|
11344 |
inherits, an ‘EXPORT_FILE_NAME’ property, the ODT export back-end |
|
11345 |
uses that for file name. |
|
11346 |
|
|
11347 |
‘C-c C-e o O’ Export to an OpenDocument Text file format and open |
|
11348 |
it. |
|
11349 |
|
|
11350 |
When ‘org-odt-preferred-output-format’ is specified, open the |
|
11351 |
converted file instead. *Note Automatically exporting to other |
|
11352 |
formats: x-export-to-other-formats. |
|
11353 |
|
|
11354 |
|
|
11355 |
File: org, Node: ODT specific export settings, Next: Extending ODT export, Prev: ODT export commands, Up: OpenDocument Text export |
|
11356 |
|
|
11357 |
12.12.3 ODT specific export settings |
|
11358 |
------------------------------------ |
|
11359 |
|
|
11360 |
The ODT export back-end has several additional keywords for customizing |
|
11361 |
ODT output. Setting these keywords works similar to the general options |
|
11362 |
(*note Export settings::). |
|
11363 |
|
|
11364 |
‘DESCRIPTION’ |
|
11365 |
This is the document’s description, which the ODT export back-end |
|
11366 |
inserts as document metadata. For long descriptions, use multiple |
|
11367 |
‘#+DESCRIPTION’ lines. |
|
11368 |
|
|
11369 |
‘KEYWORDS’ |
|
11370 |
The keywords for the document. The ODT export back-end inserts the |
|
11371 |
description along with author name, keywords, and related file |
|
11372 |
metadata as metadata in the output file. Use multiple ‘#+KEYWORDS’ |
|
11373 |
lines if necessary. |
|
11374 |
|
|
11375 |
‘ODT_STYLES_FILE’ |
|
11376 |
The ODT export back-end uses the ‘org-odt-styles-file’ by default. |
|
11377 |
See *note Applying custom styles:: for details. |
|
11378 |
|
|
11379 |
‘SUBTITLE’ |
|
11380 |
The document subtitle. |
|
11381 |
|
|
11382 |
|
|
11383 |
File: org, Node: Extending ODT export, Next: Applying custom styles, Prev: ODT specific export settings, Up: OpenDocument Text export |
|
11384 |
|
|
11385 |
12.12.4 Extending ODT export |
|
11386 |
---------------------------- |
|
11387 |
|
|
11388 |
The ODT export back-end can produce documents in other formats besides |
|
11389 |
ODT using a specialized ODT converter process. Its common interface |
|
11390 |
works with popular converters to produce formats such as ‘doc’, or |
|
11391 |
convert a document from one format, say ‘csv’, to another format, say |
|
11392 |
‘xls’. |
|
11393 |
|
|
11394 |
Customize ‘org-odt-convert-process’ variable to point to ‘unoconv’, |
|
11395 |
which is the ODT’s preferred converter. Working installations of |
|
11396 |
LibreOffice would already have ‘unoconv’ installed. Alternatively, |
|
11397 |
other converters may be substituted here. *Note Configuring a document |
|
11398 |
converter::. |
|
11399 |
|
|
11400 |
Automatically exporting to other formats |
|
11401 |
........................................ |
|
11402 |
|
|
11403 |
If ODT format is just an intermediate step to get to other formats, such |
|
11404 |
as ‘doc’, ‘docx’, ‘rtf’, or ‘pdf’, etc., then extend the ODT export |
|
11405 |
back-end to directly produce that format. Specify the final format in |
|
11406 |
the ‘org-odt-preferred-output-format’ variable. This is one way to |
|
11407 |
extend (*note Exporting to ODT: x-export-to-odt.). |
|
11408 |
|
|
11409 |
Converting between document formats |
|
11410 |
................................... |
|
11411 |
|
|
11412 |
The Org export back-end is made to be inter-operable with a wide range |
|
11413 |
of text document format converters. Newer generation converters, such |
|
11414 |
as LibreOffice and Pandoc, can handle hundreds of formats at once. Org |
|
11415 |
provides a consistent interaction with whatever converter is installed. |
|
11416 |
Here are some generic commands: |
|
11417 |
|
|
11418 |
‘M-x org-odt-convert <RET>’ |
|
11419 |
Convert an existing document from one format to another. With a |
|
11420 |
prefix argument, opens the newly produced file. |
|
11421 |
|
|
11422 |
|
|
11423 |
File: org, Node: Applying custom styles, Next: Links in ODT export, Prev: Extending ODT export, Up: OpenDocument Text export |
|
11424 |
|
|
11425 |
12.12.5 Applying custom styles |
|
11426 |
------------------------------ |
|
11427 |
|
|
11428 |
The ODT export back-end comes with many OpenDocument styles (*note |
|
11429 |
Working with OpenDocument style files::). To expand or further |
|
11430 |
customize these built-in style sheets, either edit the style sheets |
|
11431 |
directly or generate them using an application such as LibreOffice. The |
|
11432 |
example here shows creating a style using LibreOffice. |
|
11433 |
|
|
11434 |
Applying custom styles: the easy way |
|
11435 |
.................................... |
|
11436 |
|
|
11437 |
1. Create a sample ‘example.org’ file with settings as shown below, |
|
11438 |
and export it to ODT format. |
|
11439 |
|
|
11440 |
#+OPTIONS: H:10 num:t |
|
11441 |
|
|
11442 |
2. Open the above ‘example.odt’ using LibreOffice. Use the ‘Stylist’ |
|
11443 |
to locate the target styles, which typically have the ‘Org’ prefix. |
|
11444 |
Open one, modify, and save as either OpenDocument Text (‘.odt’) or |
|
11445 |
OpenDocument Template (‘.ott’) file. |
|
11446 |
|
|
11447 |
3. Customize the variable ‘org-odt-styles-file’ and point it to the |
|
11448 |
newly created file. For additional configuration options *note |
|
11449 |
Overriding factory styles: x-overriding-factory-styles. |
|
11450 |
|
|
11451 |
To apply and ODT style to a particular file, use the |
|
11452 |
‘#+ODT_STYLES_FILE’ option as shown in the example below: |
|
11453 |
|
|
11454 |
#+ODT_STYLES_FILE: "/path/to/example.ott" |
|
11455 |
|
|
11456 |
or |
|
11457 |
|
|
11458 |
#+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")) |
|
11459 |
|
|
11460 |
Using third-party styles and templates |
|
11461 |
...................................... |
|
11462 |
|
|
11463 |
The ODT export back-end relies on many templates and style names. Using |
|
11464 |
third-party styles and templates can lead to mismatches. Templates |
|
11465 |
derived from built in ODT templates and styles seem to have fewer |
|
11466 |
problems. |
|
11467 |
|
|
11468 |
|
|
11469 |
File: org, Node: Links in ODT export, Next: Tables in ODT export, Prev: Applying custom styles, Up: OpenDocument Text export |
|
11470 |
|
|
11471 |
12.12.6 Links in ODT export |
|
11472 |
--------------------------- |
|
11473 |
|
|
11474 |
ODT export back-end creates native cross-references for internal links |
|
11475 |
and Internet-style links for all other link types. |
|
11476 |
|
|
11477 |
A link with no description and pointing to a |
|
11478 |
regular—un-itemized—outline heading is replaced with a cross-reference |
|
11479 |
and section number of the heading. |
|
11480 |
|
|
11481 |
A ‘\ref{label}’-style reference to an image, table etc. is replaced |
|
11482 |
with a cross-reference and sequence number of the labeled entity. *Note |
|
11483 |
Labels and captions in ODT export::. |
|
11484 |
|
|
11485 |
|
|
11486 |
File: org, Node: Tables in ODT export, Next: Images in ODT export, Prev: Links in ODT export, Up: OpenDocument Text export |
|
11487 |
|
|
11488 |
12.12.7 Tables in ODT export |
|
11489 |
---------------------------- |
|
11490 |
|
|
11491 |
The ODT export back-end handles native Org mode tables (*note Tables::) |
|
11492 |
and simple ‘table.el’ tables. Complex ‘table.el’ tables having column |
|
11493 |
or row spans are not supported. Such tables are stripped from the |
|
11494 |
exported document. |
|
11495 |
|
|
11496 |
By default, the ODT export back-end exports a table with top and |
|
11497 |
bottom frames and with ruled lines separating row and column groups |
|
11498 |
(*note Column groups::). All tables are typeset to occupy the same |
|
11499 |
width. The ODT export back-end honors any table alignments and relative |
|
11500 |
widths for columns (*note Column width and alignment::). |
|
11501 |
|
|
11502 |
Note that the ODT export back-end interprets column widths as |
|
11503 |
weighted ratios, the default weight being 1. |
|
11504 |
|
|
11505 |
Specifying ‘:rel-width’ property on an ‘#+ATTR_ODT’ line controls the |
|
11506 |
width of the table. For example: |
|
11507 |
|
|
11508 |
#+ATTR_ODT: :rel-width 50 |
|
11509 |
| Area/Month | Jan | Feb | Mar | Sum | |
|
11510 |
|---------------+-------+-------+-------+-------| |
|
11511 |
| / | < | | | < | |
|
11512 |
| <l13> | <r5> | <r5> | <r5> | <r6> | |
|
11513 |
| North America | 1 | 21 | 926 | 948 | |
|
11514 |
| Middle East | 6 | 75 | 844 | 925 | |
|
11515 |
| Asia Pacific | 9 | 27 | 790 | 826 | |
|
11516 |
|---------------+-------+-------+-------+-------| |
|
11517 |
| Sum | 16 | 123 | 2560 | 2699 | |
|
11518 |
|
|
11519 |
On export, the above table takes 50% of text width area. The |
|
11520 |
exporter sizes the columns in the ratio: 13:5:5:5:6. The first column |
|
11521 |
is left-aligned and rest of the columns, right-aligned. Vertical rules |
|
11522 |
separate the header and the last column. Horizontal rules separate the |
|
11523 |
header and the last row. |
|
11524 |
|
|
11525 |
For even more customization, create custom table styles and associate |
|
11526 |
them with a table using the ‘#+ATTR_ODT’ line. *Note Customizing tables |
|
11527 |
in ODT export::. |
|
11528 |
|
|
11529 |
|
|
11530 |
File: org, Node: Images in ODT export, Next: Math formatting in ODT export, Prev: Tables in ODT export, Up: OpenDocument Text export |
|
11531 |
|
|
11532 |
12.12.8 Images in ODT export |
|
11533 |
---------------------------- |
|
11534 |
|
|
11535 |
Embedding images |
|
11536 |
................ |
|
11537 |
|
|
11538 |
The ODT export back-end processes image links in Org files that do not |
|
11539 |
have descriptions, such as these links ‘[[file:img.jpg]]’ or |
|
11540 |
‘[[./img.jpg]]’, as direct image insertions in the final output. Either |
|
11541 |
of these examples works: |
|
11542 |
|
|
11543 |
[[file:img.png]] |
|
11544 |
|
|
11545 |
[[./img.png]] |
|
11546 |
|
|
11547 |
Embedding clickable images |
|
11548 |
.......................... |
|
11549 |
|
|
11550 |
For clickable images, provide a link whose description is another link |
|
11551 |
to an image file. For example, to embed an image ‘org-mode-unicorn.png’ |
|
11552 |
which when clicked jumps to <https://orgmode.org> website, do the |
|
11553 |
following |
|
11554 |
|
|
11555 |
[[https://orgmode.org][./org-mode-unicorn.png]] |
|
11556 |
|
|
11557 |
Sizing and scaling of embedded images |
|
11558 |
..................................... |
|
11559 |
|
|
11560 |
Control the size and scale of the embedded images with the ‘#+ATTR_ODT’ |
|
11561 |
attribute. |
|
11562 |
|
|
11563 |
The ODT export back-end starts with establishing the size of the |
|
11564 |
image in the final document. The dimensions of this size is measured in |
|
11565 |
centimeters. The back-end then queries the image file for its |
|
11566 |
dimensions measured in pixels. For this measurement, the back-end |
|
11567 |
relies on ImageMagick’s ‘identify’ program or Emacs ‘create-image’ and |
|
11568 |
‘image-size’ API. ImageMagick is the preferred choice for large file |
|
11569 |
sizes or frequent batch operations. The back-end then converts the |
|
11570 |
pixel dimensions using ‘org-odt-pixels-per-inch’ into the familiar 72 |
|
11571 |
dpi or 96 dpi. The default value for this is in |
|
11572 |
‘display-pixels-per-inch’, which can be tweaked for better results based |
|
11573 |
on the capabilities of the output device. Here are some common image |
|
11574 |
scaling operations: |
|
11575 |
|
|
11576 |
Explicitly size the image |
|
11577 |
To embed ‘img.png’ as a 10 cm x 10 cm image, do the following: |
|
11578 |
|
|
11579 |
#+ATTR_ODT: :width 10 :height 10 |
|
11580 |
[[./img.png]] |
|
11581 |
|
|
11582 |
Scale the image |
|
11583 |
To embed ‘img.png’ at half its size, do the following: |
|
11584 |
|
|
11585 |
#+ATTR_ODT: :scale 0.5 |
|
11586 |
[[./img.png]] |
|
11587 |
|
|
11588 |
Scale the image to a specific width |
|
11589 |
To embed ‘img.png’ with a width of 10 cm while retaining the |
|
11590 |
original height:width ratio, do the following: |
|
11591 |
|
|
11592 |
#+ATTR_ODT: :width 10 |
|
11593 |
[[./img.png]] |
|
11594 |
|
|
11595 |
Scale the image to a specific height |
|
11596 |
To embed ‘img.png’ with a height of 10 cm while retaining the |
|
11597 |
original height:width ratio, do the following |
|
11598 |
|
|
11599 |
#+ATTR_ODT: :height 10 |
|
11600 |
[[./img.png]] |
|
11601 |
|
|
11602 |
Anchoring of images |
|
11603 |
................... |
|
11604 |
|
|
11605 |
The ODT export back-end can anchor images to ‘"as-char"’, ‘"paragraph"’, |
|
11606 |
or ‘"page"’. Set the preferred anchor using the ‘:anchor’ property of |
|
11607 |
the ‘#+ATTR_ODT’ line. |
|
11608 |
|
|
11609 |
To create an image that is anchored to a page: |
|
11610 |
#+ATTR_ODT: :anchor "page" |
|
11611 |
[[./img.png]] |
|
11612 |
|
|
11613 |
|
|
11614 |
File: org, Node: Math formatting in ODT export, Next: Labels and captions in ODT export, Prev: Images in ODT export, Up: OpenDocument Text export |
|
11615 |
|
|
11616 |
12.12.9 Math formatting in ODT export |
|
11617 |
------------------------------------- |
|
11618 |
|
|
11619 |
The ODT export back-end has special support built-in for handling math. |
|
11620 |
|
|
11621 |
* Menu: |
|
11622 |
|
|
11623 |
* Working with LaTeX math snippets:: Embedding in LaTeX format. |
|
11624 |
* Working with MathML or OpenDocument formula files:: Embedding in native format. |
|
11625 |
|
|
11626 |
|
|
11627 |
File: org, Node: Working with LaTeX math snippets, Next: Working with MathML or OpenDocument formula files, Up: Math formatting in ODT export |
|
11628 |
|
|
11629 |
Working with LaTeX math snippets |
|
11630 |
................................ |
|
11631 |
|
|
11632 |
LaTeX math snippets (*note LaTeX fragments::) can be embedded in an ODT |
|
11633 |
document in one of the following ways: |
|
11634 |
|
|
11635 |
1. MathML |
|
11636 |
|
|
11637 |
Add this line to the Org file. This option is activated on a |
|
11638 |
per-file basis. |
|
11639 |
|
|
11640 |
#+OPTIONS: LaTeX:t |
|
11641 |
|
|
11642 |
With this option, LaTeX fragments are first converted into MathML |
|
11643 |
fragments using an external LaTeX-to-MathML converter program. The |
|
11644 |
resulting MathML fragments are then embedded as an OpenDocument |
|
11645 |
Formula in the exported document. |
|
11646 |
|
|
11647 |
To specify the LaTeX-to-MathML converter, customize the variables |
|
11648 |
‘org-latex-to-mathml-convert-command’ and |
|
11649 |
‘org-latex-to-mathml-jar-file’. |
|
11650 |
|
|
11651 |
To use MathToWeb(1) as the preferred converter, configure the above |
|
11652 |
variables as |
|
11653 |
|
|
11654 |
(setq org-latex-to-mathml-convert-command |
|
11655 |
"java -jar %j -unicode -force -df %o %I" |
|
11656 |
org-latex-to-mathml-jar-file |
|
11657 |
"/path/to/mathtoweb.jar") |
|
11658 |
To use LaTeXML(2) use |
|
11659 |
(setq org-latex-to-mathml-convert-command |
|
11660 |
"latexmlmath \"%i\" --presentationmathml=%o") |
|
11661 |
|
|
11662 |
To quickly verify the reliability of the LaTeX-to-MathML converter, |
|
11663 |
use the following commands: |
|
11664 |
|
|
11665 |
‘M-x org-odt-export-as-odf <RET>’ |
|
11666 |
Convert a LaTeX math snippet to an OpenDocument formula |
|
11667 |
(‘.odf’) file. |
|
11668 |
|
|
11669 |
‘M-x org-odt-export-as-odf-and-open <RET>’ |
|
11670 |
Convert a LaTeX math snippet to an OpenDocument formula |
|
11671 |
(‘.odf’) file and open the formula file with the |
|
11672 |
system-registered application. |
|
11673 |
|
|
11674 |
2. PNG images |
|
11675 |
|
|
11676 |
Add this line to the Org file. This option is activated on a |
|
11677 |
per-file basis. |
|
11678 |
|
|
11679 |
#+OPTIONS: tex:dvipng |
|
11680 |
|
|
11681 |
#+OPTIONS: tex:dvisvgm |
|
11682 |
|
|
11683 |
or: |
|
11684 |
|
|
11685 |
#+OPTIONS: tex:imagemagick |
|
11686 |
|
|
11687 |
Under this option, LaTeX fragments are processed into PNG or SVG |
|
11688 |
images and the resulting images are embedded in the exported |
|
11689 |
document. This method requires ‘dvipng’ program, ‘dvisvgm’ or |
|
11690 |
‘imagemagick’ programs. |
|
11691 |
|
|
11692 |
---------- Footnotes ---------- |
|
11693 |
|
|
11694 |
(1) See MathToWeb |
|
11695 |
(http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl). |
|
11696 |
|
|
11697 |
(2) See <http://dlmf.nist.gov/LaTeXML/>. |
|
11698 |
|
|
11699 |
|
|
11700 |
File: org, Node: Working with MathML or OpenDocument formula files, Prev: Working with LaTeX math snippets, Up: Math formatting in ODT export |
|
11701 |
|
|
11702 |
Working with MathML or OpenDocument formula files |
|
11703 |
................................................. |
|
11704 |
|
|
11705 |
When embedding LaTeX math snippets in ODT documents is not reliable, |
|
11706 |
there is one more option to try. Embed an equation by linking to its |
|
11707 |
MathML (‘.mml’) source or its OpenDocument formula (‘.odf’) file as |
|
11708 |
shown below: |
|
11709 |
|
|
11710 |
[[./equation.mml]] |
|
11711 |
|
|
11712 |
or |
|
11713 |
|
|
11714 |
[[./equation.odf]] |
|
11715 |
|
|
11716 |
|
|
11717 |
File: org, Node: Labels and captions in ODT export, Next: Literal examples in ODT export, Prev: Math formatting in ODT export, Up: OpenDocument Text export |
|
11718 |
|
|
11719 |
12.12.10 Labels and captions in ODT export |
|
11720 |
------------------------------------------ |
|
11721 |
|
|
11722 |
ODT format handles labeling and captioning of objects based on their |
|
11723 |
types. Inline images, tables, LaTeX fragments, and Math formulas are |
|
11724 |
numbered and captioned separately. Each object also gets a unique |
|
11725 |
sequence number based on its order of first appearance in the Org file. |
|
11726 |
Each category has its own sequence. A caption is just a label applied |
|
11727 |
to these objects. |
|
11728 |
|
|
11729 |
#+CAPTION: Bell curve |
|
11730 |
#+LABEL: fig:SED-HR4049 |
|
11731 |
[[./img/a.png]] |
|
11732 |
|
|
11733 |
When rendered, it may show as follows in the exported document: |
|
11734 |
|
|
11735 |
Figure 2: Bell curve |
|
11736 |
|
|
11737 |
To modify the category component of the caption, customize the option |
|
11738 |
‘org-odt-category-map-alist’. For example, to tag embedded images with |
|
11739 |
the string ‘Illustration’ instead of the default string ‘Figure’, use |
|
11740 |
the following setting: |
|
11741 |
|
|
11742 |
(setq org-odt-category-map-alist |
|
11743 |
'(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p))) |
|
11744 |
|
|
11745 |
With the above modification, the previous example changes to: |
|
11746 |
|
|
11747 |
Illustration 2: Bell curve |
|
11748 |
|
|
11749 |
|
|
11750 |
File: org, Node: Literal examples in ODT export, Next: Advanced topics in ODT export, Prev: Labels and captions in ODT export, Up: OpenDocument Text export |
|
11751 |
|
|
11752 |
12.12.11 Literal examples in ODT export |
|
11753 |
--------------------------------------- |
|
11754 |
|
|
11755 |
The ODT export back-end supports literal examples (*note Literal |
|
11756 |
examples::) with full fontification. Internally, the ODT export |
|
11757 |
back-end relies on ‘htmlfontify.el’ to generate the style definitions |
|
11758 |
needed for fancy listings. The auto-generated styles get ‘OrgSrc’ |
|
11759 |
prefix and inherit colors from the faces used by Emacs ‘font-lock’ |
|
11760 |
library for that source language. |
|
11761 |
|
|
11762 |
For custom fontification styles, customize the |
|
11763 |
‘org-odt-create-custom-styles-for-srcblocks’ option. |
|
11764 |
|
|
11765 |
To turn off fontification of literal examples, customize the |
|
11766 |
‘org-odt-fontify-srcblocks’ option. |
|
11767 |
|
|
11768 |
|
|
11769 |
File: org, Node: Advanced topics in ODT export, Prev: Literal examples in ODT export, Up: OpenDocument Text export |
|
11770 |
|
|
11771 |
12.12.12 Advanced topics in ODT export |
|
11772 |
-------------------------------------- |
|
11773 |
|
|
11774 |
The ODT export back-end has extensive features useful for power users |
|
11775 |
and frequent uses of ODT formats. |
|
11776 |
|
|
11777 |
* Menu: |
|
11778 |
|
|
11779 |
* Configuring a document converter:: Registering a document converter. |
|
11780 |
* Working with OpenDocument style files:: Exploring internals. |
|
11781 |
* Creating one-off styles:: Customizing styles, highlighting. |
|
11782 |
* Customizing tables in ODT export:: Defining table templates. |
|
11783 |
* Validating OpenDocument XML:: Debugging corrupted OpenDocument files. |
|
11784 |
|
|
11785 |
|
|
11786 |
File: org, Node: Configuring a document converter, Next: Working with OpenDocument style files, Up: Advanced topics in ODT export |
|
11787 |
|
|
11788 |
Configuring a document converter |
|
11789 |
................................ |
|
11790 |
|
|
11791 |
The ODT export back-end works with popular converters with little or no |
|
11792 |
extra configuration. *Note Extending ODT export::. The following is |
|
11793 |
for unsupported converters or tweaking existing defaults. |
|
11794 |
|
|
11795 |
1. Register the converter |
|
11796 |
|
|
11797 |
Add the name of the converter to the ‘org-odt-convert-processes’ |
|
11798 |
variable. Note that it also requires how the converter is invoked |
|
11799 |
on the command line. See the variable’s docstring for details. |
|
11800 |
|
|
11801 |
2. Configure its capabilities |
|
11802 |
|
|
11803 |
Specify which formats the converter can handle by customizing the |
|
11804 |
variable ‘org-odt-convert-capabilities’. Use the entry for the |
|
11805 |
default values in this variable for configuring the new converter. |
|
11806 |
Also see its docstring for details. |
|
11807 |
|
|
11808 |
3. Choose the converter |
|
11809 |
|
|
11810 |
Select the newly added converter as the preferred one by |
|
11811 |
customizing the option ‘org-odt-convert-process’. |
|
11812 |
|
|
11813 |
|
|
11814 |
File: org, Node: Working with OpenDocument style files, Next: Creating one-off styles, Prev: Configuring a document converter, Up: Advanced topics in ODT export |
|
11815 |
|
|
11816 |
Working with OpenDocument style files |
|
11817 |
..................................... |
|
11818 |
|
|
11819 |
This section explores the internals of the ODT exporter; the means by |
|
11820 |
which it produces styled documents; the use of automatic and custom |
|
11821 |
OpenDocument styles. |
|
11822 |
|
|
11823 |
a) Factory styles |
|
11824 |
................. |
|
11825 |
|
|
11826 |
The ODT exporter relies on two files for generating its output. These |
|
11827 |
files are bundled with the distribution under the directory pointed to |
|
11828 |
by the variable ‘org-odt-styles-dir’. The two files are: |
|
11829 |
|
|
11830 |
• ‘OrgOdtStyles.xml’ |
|
11831 |
|
|
11832 |
This file contributes to the ‘styles.xml’ file of the final ‘ODT’ |
|
11833 |
document. This file gets modified for the following purposes: |
|
11834 |
|
|
11835 |
1. To control outline numbering based on user settings. |
|
11836 |
|
|
11837 |
2. To add styles generated by ‘htmlfontify.el’ for fontification |
|
11838 |
of code blocks. |
|
11839 |
|
|
11840 |
• ‘OrgOdtContentTemplate.xml’ |
|
11841 |
|
|
11842 |
This file contributes to the ‘content.xml’ file of the final ‘ODT’ |
|
11843 |
document. The contents of the Org outline are inserted between the |
|
11844 |
‘<office:text>’...‘</office:text>’ elements of this file. |
|
11845 |
|
|
11846 |
Apart from serving as a template file for the final ‘content.xml’, |
|
11847 |
the file serves the following purposes: |
|
11848 |
|
|
11849 |
1. It contains automatic styles for formatting of tables which |
|
11850 |
are referenced by the exporter. |
|
11851 |
|
|
11852 |
2. It contains ‘<text:sequence-decl>’...‘</text:sequence-decl>’ |
|
11853 |
elements that control numbering of tables, images, equations, |
|
11854 |
and similar entities. |
|
11855 |
|
|
11856 |
b) Overriding factory styles |
|
11857 |
............................ |
|
11858 |
|
|
11859 |
The following two variables control the location from where the ODT |
|
11860 |
exporter picks up the custom styles and content template files. |
|
11861 |
Customize these variables to override the factory styles used by the |
|
11862 |
exporter. |
|
11863 |
|
|
11864 |
• ‘org-odt-styles-file’ |
|
11865 |
|
|
11866 |
The ODT export back-end uses the file pointed to by this variable, |
|
11867 |
such as ‘styles.xml’, for the final output. It can take one of the |
|
11868 |
following values: |
|
11869 |
|
|
11870 |
1. A ‘styles.xml’ file |
|
11871 |
|
|
11872 |
Use this file instead of the default ‘styles.xml’ |
|
11873 |
|
|
11874 |
2. A ‘.odt’ or ‘.ott’ file |
|
11875 |
|
|
11876 |
Use the ‘styles.xml’ contained in the specified OpenDocument |
|
11877 |
Text or Template file |
|
11878 |
|
|
11879 |
3. A ‘.odt’ or ‘.ott’ file and a subset of files contained within |
|
11880 |
them |
|
11881 |
|
|
11882 |
Use the ‘styles.xml’ contained in the specified OpenDocument |
|
11883 |
Text or Template file. Additionally extract the specified |
|
11884 |
member files and embed those within the final ‘ODT’ document. |
|
11885 |
|
|
11886 |
Use this option if the ‘styles.xml’ file references additional |
|
11887 |
files like header and footer images. |
|
11888 |
|
|
11889 |
4. ‘nil’ |
|
11890 |
|
|
11891 |
Use the default ‘styles.xml’ |
|
11892 |
|
|
11893 |
• ‘org-odt-content-template-file’ |
|
11894 |
|
|
11895 |
Use this variable to specify the blank ‘content.xml’ that will be |
|
11896 |
used in the final output. |
|
11897 |
|
|
11898 |
|
|
11899 |
File: org, Node: Creating one-off styles, Next: Customizing tables in ODT export, Prev: Working with OpenDocument style files, Up: Advanced topics in ODT export |
|
11900 |
|
|
11901 |
Creating one-off styles |
|
11902 |
....................... |
|
11903 |
|
|
11904 |
The ODT export back-end can read embedded raw OpenDocument XML from the |
|
11905 |
Org file. Such direct formatting are useful for one-off instances. |
|
11906 |
|
|
11907 |
1. Embedding ODT tags as part of regular text |
|
11908 |
|
|
11909 |
Enclose OpenDocument syntax in ‘@@odt:...@@’ for inline markup. |
|
11910 |
For example, to highlight a region of text do the following: |
|
11911 |
|
|
11912 |
@@odt:<text:span text:style-name="Highlight">This is highlighted |
|
11913 |
text</text:span>@@. But this is regular text. |
|
11914 |
|
|
11915 |
*Hint:* To see the above example in action, edit the ‘styles.xml’ |
|
11916 |
(*note Factory styles: x-orgodtstyles-xml.) and add a custom |
|
11917 |
‘Highlight’ style as shown below: |
|
11918 |
|
|
11919 |
<style:style style:name="Highlight" style:family="text"> |
|
11920 |
<style:text-properties fo:background-color="#ff0000"/> |
|
11921 |
</style:style> |
|
11922 |
|
|
11923 |
2. Embedding a one-line OpenDocument XML |
|
11924 |
|
|
11925 |
The ODT export back-end can read one-liner options with ‘#+ODT:’ in |
|
11926 |
the Org file. For example, to force a page break: |
|
11927 |
|
|
11928 |
#+ODT: <text:p text:style-name="PageBreak"/> |
|
11929 |
|
|
11930 |
*Hint:* To see the above example in action, edit your ‘styles.xml’ |
|
11931 |
(*note Factory styles: x-orgodtstyles-xml.) and add a custom |
|
11932 |
‘PageBreak’ style as shown below. |
|
11933 |
|
|
11934 |
<style:style style:name="PageBreak" style:family="paragraph" |
|
11935 |
style:parent-style-name="Text_20_body"> |
|
11936 |
<style:paragraph-properties fo:break-before="page"/> |
|
11937 |
</style:style> |
|
11938 |
|
|
11939 |
3. Embedding a block of OpenDocument XML |
|
11940 |
|
|
11941 |
The ODT export back-end can also read ODT export blocks for |
|
11942 |
OpenDocument XML. Such blocks use the ‘#+BEGIN_EXPORT |
|
11943 |
odt’...‘#+END_EXPORT’ constructs. |
|
11944 |
|
|
11945 |
For example, to create a one-off paragraph that uses bold text, do |
|
11946 |
the following: |
|
11947 |
|
|
11948 |
#+BEGIN_EXPORT odt |
|
11949 |
<text:p text:style-name="Text_20_body_20_bold"> |
|
11950 |
This paragraph is specially formatted and uses bold text. |
|
11951 |
</text:p> |
|
11952 |
#+END_EXPORT |
|
11953 |
|
|
11954 |
|
|
11955 |
File: org, Node: Customizing tables in ODT export, Next: Validating OpenDocument XML, Prev: Creating one-off styles, Up: Advanced topics in ODT export |
|
11956 |
|
|
11957 |
Customizing tables in ODT export |
|
11958 |
................................ |
|
11959 |
|
|
11960 |
Override the default table format by specifying a custom table style |
|
11961 |
with the ‘#+ATTR_ODT’ line. For a discussion on default formatting of |
|
11962 |
tables *note Tables in ODT export::. |
|
11963 |
|
|
11964 |
This feature closely mimics the way table templates are defined in |
|
11965 |
the OpenDocument-v1.2 specification.(1) |
|
11966 |
|
|
11967 |
For quick preview of this feature, install the settings below and |
|
11968 |
export the table that follows: |
|
11969 |
|
|
11970 |
(setq org-odt-table-styles |
|
11971 |
(append org-odt-table-styles |
|
11972 |
'(("TableWithHeaderRowAndColumn" "Custom" |
|
11973 |
((use-first-row-styles . t) |
|
11974 |
(use-first-column-styles . t))) |
|
11975 |
("TableWithFirstRowandLastRow" "Custom" |
|
11976 |
((use-first-row-styles . t) |
|
11977 |
(use-last-row-styles . t)))))) |
|
11978 |
|
|
11979 |
#+ATTR_ODT: :style TableWithHeaderRowAndColumn |
|
11980 |
| Name | Phone | Age | |
|
11981 |
| Peter | 1234 | 17 | |
|
11982 |
| Anna | 4321 | 25 | |
|
11983 |
|
|
11984 |
The example above used ‘Custom’ template and installed two table |
|
11985 |
styles ‘TableWithHeaderRowAndColumn’ and ‘TableWithFirstRowandLastRow’. |
|
11986 |
*Important:* The OpenDocument styles needed for producing the above |
|
11987 |
template were pre-defined. They are available in the section marked |
|
11988 |
‘Custom Table Template’ in ‘OrgOdtContentTemplate.xml’ (*note Factory |
|
11989 |
styles: x-orgodtcontenttemplate-xml. For adding new templates, define |
|
11990 |
new styles here. |
|
11991 |
|
|
11992 |
To use this feature proceed as follows: |
|
11993 |
|
|
11994 |
1. Create a table template(2) |
|
11995 |
|
|
11996 |
A table template is set of ‘table-cell’ and ‘paragraph’ styles for |
|
11997 |
each of the following table cell categories: |
|
11998 |
|
|
11999 |
− Body |
|
12000 |
− First column |
|
12001 |
− Last column |
|
12002 |
− First row |
|
12003 |
− Last row |
|
12004 |
− Even row |
|
12005 |
− Odd row |
|
12006 |
− Even column |
|
12007 |
− Odd Column |
|
12008 |
|
|
12009 |
The names for the above styles must be chosen based on the name of |
|
12010 |
the table template using a well-defined convention. |
|
12011 |
|
|
12012 |
The naming convention is better illustrated with an example. For a |
|
12013 |
table template with the name ‘Custom’, the needed style names are |
|
12014 |
listed in the following table. |
|
12015 |
|
|
12016 |
Table cell type ‘table-cell’ style ‘paragraph’ style |
|
12017 |
------------------------------------------------------------------------------- |
|
12018 |
Body ‘CustomTableCell’ ‘CustomTableParagraph’ |
|
12019 |
First column ‘CustomFirstColumnTableCell’‘CustomFirstColumnTableParagraph’ |
|
12020 |
Last column ‘CustomLastColumnTableCell’ ‘CustomLastColumnTableParagraph’ |
|
12021 |
First row ‘CustomFirstRowTableCell’ ‘CustomFirstRowTableParagraph’ |
|
12022 |
Last row ‘CustomLastRowTableCell’ ‘CustomLastRowTableParagraph’ |
|
12023 |
Even row ‘CustomEvenRowTableCell’ ‘CustomEvenRowTableParagraph’ |
|
12024 |
Odd row ‘CustomOddRowTableCell’ ‘CustomOddRowTableParagraph’ |
|
12025 |
Even column ‘CustomEvenColumnTableCell’ ‘CustomEvenColumnTableParagraph’ |
|
12026 |
Odd column ‘CustomOddColumnTableCell’ ‘CustomOddColumnTableParagraph’ |
|
12027 |
|
|
12028 |
To create a table template with the name ‘Custom’, define the above |
|
12029 |
styles in the |
|
12030 |
‘<office:automatic-styles>’...‘</office:automatic-styles>’ element |
|
12031 |
of the content template file (*note Factory styles: |
|
12032 |
x-orgodtcontenttemplate-xml.). |
|
12033 |
|
|
12034 |
2. Define a table style(3) |
|
12035 |
|
|
12036 |
To define a table style, create an entry for the style in the |
|
12037 |
variable ‘org-odt-table-styles’ and specify the following: |
|
12038 |
|
|
12039 |
− the name of the table template created in step (1) |
|
12040 |
− the set of cell styles in that template that are to be |
|
12041 |
activated |
|
12042 |
|
|
12043 |
For example, the entry below defines two different table styles |
|
12044 |
‘TableWithHeaderRowAndColumn’ and ‘TableWithFirstRowandLastRow’ |
|
12045 |
based on the same template ‘Custom’. The styles achieve their |
|
12046 |
intended effect by selectively activating the individual cell |
|
12047 |
styles in that template. |
|
12048 |
|
|
12049 |
(setq org-odt-table-styles |
|
12050 |
(append org-odt-table-styles |
|
12051 |
'(("TableWithHeaderRowAndColumn" "Custom" |
|
12052 |
((use-first-row-styles . t) |
|
12053 |
(use-first-column-styles . t))) |
|
12054 |
("TableWithFirstRowandLastRow" "Custom" |
|
12055 |
((use-first-row-styles . t) |
|
12056 |
(use-last-row-styles . t)))))) |
|
12057 |
|
|
12058 |
3. Associate a table with the table style |
|
12059 |
|
|
12060 |
To do this, specify the table style created in step (2) as part of |
|
12061 |
the ‘ATTR_ODT’ line as shown below. |
|
12062 |
|
|
12063 |
#+ATTR_ODT: :style "TableWithHeaderRowAndColumn" |
|
12064 |
| Name | Phone | Age | |
|
12065 |
| Peter | 1234 | 17 | |
|
12066 |
| Anna | 4321 | 25 | |
|
12067 |
|
|
12068 |
---------- Footnotes ---------- |
|
12069 |
|
|
12070 |
(1) OpenDocument-v1.2 Specification |
|
12071 |
(http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html) |
|
12072 |
|
|
12073 |
(2) See the ‘<table:table-template>’ element of the OpenDocument-v1.2 |
|
12074 |
specification |
|
12075 |
|
|
12076 |
(3) See the attributes ‘table:template-name’, |
|
12077 |
‘table:use-first-row-styles’, ‘table:use-last-row-styles’, |
|
12078 |
‘table:use-first-column-styles’, ‘table:use-last-column-styles’, |
|
12079 |
‘table:use-banding-rows-styles’, and ‘table:use-banding-column-styles’ |
|
12080 |
of the ‘<table:table>’ element in the OpenDocument-v1.2 specification |
|
12081 |
|
|
12082 |
|
|
12083 |
File: org, Node: Validating OpenDocument XML, Prev: Customizing tables in ODT export, Up: Advanced topics in ODT export |
|
12084 |
|
|
12085 |
Validating OpenDocument XML |
|
12086 |
........................... |
|
12087 |
|
|
12088 |
Sometimes ODT format files may not open due to ‘.odt’ file corruption. |
|
12089 |
To verify if the ‘.odt’ file is corrupt, validate it against the |
|
12090 |
OpenDocument RELAX NG Compact Syntax—RNC—schema. But first the ‘.odt’ |
|
12091 |
files have to be decompressed using ‘zip’. Note that ‘.odt’ files are |
|
12092 |
‘zip’ archives: *note (emacs)File Archives::. The contents of ‘.odt’ |
|
12093 |
files are in ‘.xml’. For general help with validation—and |
|
12094 |
schema-sensitive editing—of XML files: *note (nxml-mode)Introduction::. |
|
12095 |
|
|
12096 |
Customize ‘org-odt-schema-dir’ to point to a directory with |
|
12097 |
OpenDocument ‘.rnc’ files and the needed schema-locating rules. The ODT |
|
12098 |
export back-end takes care of updating the ‘rng-schema-locating-files’. |
|
12099 |
|
|
12100 |
|
|
12101 |
File: org, Node: Org export, Next: Texinfo export, Prev: OpenDocument Text export, Up: Exporting |
|
12102 |
|
|
12103 |
12.13 Org export |
|
12104 |
================ |
|
12105 |
|
|
12106 |
‘org’ export back-end creates a normalized version of the Org document |
|
12107 |
in current buffer. The exporter evaluates Babel code (*note Evaluating |
|
12108 |
code blocks::) and removes content specific to other back-ends. |
|
12109 |
|
|
12110 |
Org export commands |
|
12111 |
------------------- |
|
12112 |
|
|
12113 |
‘C-c C-e O o (org-org-export-to-org)’ |
|
12114 |
Export as an Org file with a ‘.org’ extension. For ‘myfile.org’, |
|
12115 |
Org exports to ‘myfile.org.org’, overwriting without warning. |
|
12116 |
|
|
12117 |
‘C-c C-e O O (org-org-export-as-org)’ |
|
12118 |
Export to a temporary buffer. Does not create a file. |
|
12119 |
‘C-c C-e O v’ |
|
12120 |
Export to an Org file, then open it. |
|
12121 |
|
|
12122 |
|
|
12123 |
File: org, Node: Texinfo export, Next: iCalendar export, Prev: Org export, Up: Exporting |
|
12124 |
|
|
12125 |
12.14 Texinfo export |
|
12126 |
==================== |
|
12127 |
|
|
12128 |
The ‘texinfo’ export back-end generates documents with Texinfo code that |
|
12129 |
can compile to Info format. |
|
12130 |
|
|
12131 |
* Menu: |
|
12132 |
|
|
12133 |
* Texinfo export commands:: Invoking commands. |
|
12134 |
* Texinfo specific export settings:: Setting the environment. |
|
12135 |
* Texinfo file header:: Generating the header. |
|
12136 |
* Texinfo title and copyright page:: Creating preamble pages. |
|
12137 |
* Info directory file:: Installing a manual in Info file hierarchy. |
|
12138 |
* Headings and sectioning structure:: Building document structure. |
|
12139 |
* Indices:: Creating indices. |
|
12140 |
* Quoting Texinfo code:: Incorporating literal Texinfo code. |
|
12141 |
* Plain lists in Texinfo export:: List attributes. |
|
12142 |
* Tables in Texinfo export:: Table attributes. |
|
12143 |
* Images in Texinfo export:: Image attributes. |
|
12144 |
* Special blocks in Texinfo export:: Special block attributes. |
|
12145 |
* A Texinfo example:: Processing Org to Texinfo. |
|
12146 |
|
|
12147 |
|
|
12148 |
File: org, Node: Texinfo export commands, Next: Texinfo specific export settings, Up: Texinfo export |
|
12149 |
|
|
12150 |
12.14.1 Texinfo export commands |
|
12151 |
------------------------------- |
|
12152 |
|
|
12153 |
‘C-c C-e i t (org-texinfo-export-to-texinfo)’ |
|
12154 |
Export as a Texinfo file with ‘.texi’ extension. For ‘myfile.org’, |
|
12155 |
Org exports to ‘myfile.texi’, overwriting without warning. |
|
12156 |
‘C-c C-e i i (org-texinfo-export-to-info)’ |
|
12157 |
Export to Texinfo format first and then process it to make an Info |
|
12158 |
file. To generate other formats, such as DocBook, customize the |
|
12159 |
‘org-texinfo-info-process’ variable. |
|
12160 |
|
|
12161 |
|
|
12162 |
File: org, Node: Texinfo specific export settings, Next: Texinfo file header, Prev: Texinfo export commands, Up: Texinfo export |
|
12163 |
|
|
12164 |
12.14.2 Texinfo specific export settings |
|
12165 |
---------------------------------------- |
|
12166 |
|
|
12167 |
The Texinfo export back-end has several additional keywords for |
|
12168 |
customizing Texinfo output. Setting these keywords works similar to the |
|
12169 |
general options (*note Export settings::). |
|
12170 |
|
|
12171 |
‘SUBTITLE’ |
|
12172 |
The document subtitle. |
|
12173 |
|
|
12174 |
‘SUBAUTHOR’ |
|
12175 |
The document subauthor. |
|
12176 |
|
|
12177 |
‘TEXINFO_FILENAME’ |
|
12178 |
The Texinfo filename. |
|
12179 |
|
|
12180 |
‘TEXINFO_CLASS’ |
|
12181 |
The default document class (‘org-texinfo-default-class’), which |
|
12182 |
must be a member of ‘org-texinfo-classes’. |
|
12183 |
|
|
12184 |
‘TEXINFO_HEADER’ |
|
12185 |
Arbitrary lines inserted at the end of the header. |
|
12186 |
|
|
12187 |
‘TEXINFO_POST_HEADER’ |
|
12188 |
Arbitrary lines inserted after the end of the header. |
|
12189 |
|
|
12190 |
‘TEXINFO_DIR_CATEGORY’ |
|
12191 |
The directory category of the document. |
|
12192 |
|
|
12193 |
‘TEXINFO_DIR_TITLE’ |
|
12194 |
The directory title of the document. |
|
12195 |
|
|
12196 |
‘TEXINFO_DIR_DESC’ |
|
12197 |
The directory description of the document. |
|
12198 |
|
|
12199 |
‘TEXINFO_PRINTED_TITLE’ |
|
12200 |
The printed title of the document. |
|
12201 |
|
|
12202 |
|
|
12203 |
File: org, Node: Texinfo file header, Next: Texinfo title and copyright page, Prev: Texinfo specific export settings, Up: Texinfo export |
|
12204 |
|
|
12205 |
12.14.3 Texinfo file header |
|
12206 |
--------------------------- |
|
12207 |
|
|
12208 |
After creating the header for a Texinfo file, the Texinfo back-end |
|
12209 |
automatically generates a name and destination path for the Info file. |
|
12210 |
To override this default with a more sensible path and name, specify the |
|
12211 |
‘#+TEXINFO_FILENAME’ keyword. |
|
12212 |
|
|
12213 |
Along with the output’s file name, the Texinfo header also contains |
|
12214 |
language details (*note Export settings::) and encoding system as set in |
|
12215 |
the ‘org-texinfo-coding-system’ variable. Insert ‘#+TEXINFO_HEADER’ |
|
12216 |
keywords for each additional command in the header, for example: |
|
12217 |
@code{@synindex}. |
|
12218 |
|
|
12219 |
Instead of repeatedly installing the same set of commands, define a |
|
12220 |
class in ‘org-texinfo-classes’ once, and then activate it in the |
|
12221 |
document by setting the ‘#+TEXINFO_CLASS’ keyword to that class. |
|
12222 |
|
|
12223 |
|
|
12224 |
File: org, Node: Texinfo title and copyright page, Next: Info directory file, Prev: Texinfo file header, Up: Texinfo export |
|
12225 |
|
|
12226 |
12.14.4 Texinfo title and copyright page |
|
12227 |
---------------------------------------- |
|
12228 |
|
|
12229 |
The default template for hard copy output has a title page with |
|
12230 |
‘#+TITLE’ and ‘#+AUTHOR’ (*note Export settings::). To replace the |
|
12231 |
regular ‘#+TITLE’ with something different for the printed version, use |
|
12232 |
the ‘#+TEXINFO_PRINTED_TITLE’ and ‘#+SUBTITLE’ keywords. Both expect |
|
12233 |
raw Texinfo code for setting their values. |
|
12234 |
|
|
12235 |
If one ‘#+AUTHOR’ is not sufficient, add multiple ‘#+SUBAUTHOR’ |
|
12236 |
keywords. They have to be set in raw Texinfo code. |
|
12237 |
|
|
12238 |
#+AUTHOR: Jane Smith |
|
12239 |
#+SUBAUTHOR: John Doe |
|
12240 |
#+TEXINFO_PRINTED_TITLE: This Long Title@inlinefmt{tex,@*} Is Broken in @TeX{} |
|
12241 |
|
|
12242 |
Copying material is defined in a dedicated headline with a non-‘nil’ |
|
12243 |
‘:COPYING:’ property. The back-end inserts the contents within a |
|
12244 |
‘@copying’ command at the beginning of the document. The heading itself |
|
12245 |
does not appear in the structure of the document. |
|
12246 |
|
|
12247 |
Copyright information is printed on the back of the title page. |
|
12248 |
|
|
12249 |
* Legalese |
|
12250 |
:PROPERTIES: |
|
12251 |
:COPYING: t |
|
12252 |
:END: |
|
12253 |
|
|
12254 |
This is a short example of a complete Texinfo file, version 1.0. |
|
12255 |
|
|
12256 |
Copyright \copy 2018 Free Software Foundation, Inc. |
|
12257 |
|
|
12258 |
|
|
12259 |
File: org, Node: Info directory file, Next: Headings and sectioning structure, Prev: Texinfo title and copyright page, Up: Texinfo export |
|
12260 |
|
|
12261 |
12.14.5 Info directory file |
|
12262 |
--------------------------- |
|
12263 |
|
|
12264 |
The end result of the Texinfo export process is the creation of an Info |
|
12265 |
file. This Info file’s metadata has variables for category, title, and |
|
12266 |
description: ‘#+TEXINFO_DIR_CATEGORY’, ‘#+TEXINFO_DIR_TITLE’, and |
|
12267 |
‘#+TEXINFO_DIR_DESC’ that establish where in the Info hierarchy the file |
|
12268 |
fits. |
|
12269 |
|
|
12270 |
Here is an example that writes to the Info directory file: |
|
12271 |
|
|
12272 |
#+TEXINFO_DIR_CATEGORY: Emacs |
|
12273 |
#+TEXINFO_DIR_TITLE: Org Mode: (org) |
|
12274 |
#+TEXINFO_DIR_DESC: Outline-based notes management and organizer |
|
12275 |
|
|
12276 |
|
|
12277 |
File: org, Node: Headings and sectioning structure, Next: Indices, Prev: Info directory file, Up: Texinfo export |
|
12278 |
|
|
12279 |
12.14.6 Headings and sectioning structure |
|
12280 |
----------------------------------------- |
|
12281 |
|
|
12282 |
The Texinfo export back-end uses a pre-defined scheme to convert Org |
|
12283 |
headlines to an equivalent Texinfo structuring commands. A scheme like |
|
12284 |
this maps top-level headlines to numbered chapters tagged as ‘@chapter’ |
|
12285 |
and lower-level headlines to unnumbered chapters tagged as |
|
12286 |
‘@unnumbered’. To override such mappings to introduce ‘@part’ or other |
|
12287 |
Texinfo structuring commands, define a new class in |
|
12288 |
‘org-texinfo-classes’. Activate the new class with the |
|
12289 |
‘#+TEXINFO_CLASS’ keyword. When no new class is defined and activated, |
|
12290 |
the Texinfo export back-end defaults to the ‘org-texinfo-default-class’. |
|
12291 |
|
|
12292 |
If an Org headline’s level has no associated Texinfo structuring |
|
12293 |
command, or is below a certain threshold (*note Export settings::), then |
|
12294 |
the Texinfo export back-end makes it into a list item. |
|
12295 |
|
|
12296 |
The Texinfo export back-end makes any headline with a non-‘nil’ |
|
12297 |
‘:APPENDIX:’ property into an appendix. This happens independent of the |
|
12298 |
Org headline level or the ‘#+TEXINFO_CLASS’. |
|
12299 |
|
|
12300 |
The Texinfo export back-end creates a menu entry after the Org |
|
12301 |
headline for each regular sectioning structure. To override this with a |
|
12302 |
shorter menu entry, use the ‘:ALT_TITLE:’ property (*note Table of |
|
12303 |
contents::). Texinfo menu entries also have an option for a longer |
|
12304 |
‘:DESCRIPTION:’ property. Here’s an example that uses both to override |
|
12305 |
the default menu entry: |
|
12306 |
|
|
12307 |
* Controlling Screen Display |
|
12308 |
:PROPERTIES: |
|
12309 |
:ALT_TITLE: Display |
|
12310 |
:DESCRIPTION: Controlling Screen Display |
|
12311 |
:END: |
|
12312 |
|
|
12313 |
The text before the first headline belongs to the ‘Top’ node, i.e., |
|
12314 |
the node in which a reader enters an Info manual. As such, it is |
|
12315 |
expected not to appear in printed output generated from the ‘.texi’ |
|
12316 |
file. *note (texinfo)The Top Node::, for more information. |
|
12317 |
|
|
12318 |
|
|
12319 |
File: org, Node: Indices, Next: Quoting Texinfo code, Prev: Headings and sectioning structure, Up: Texinfo export |
|
12320 |
|
|
12321 |
12.14.7 Indices |
|
12322 |
--------------- |
|
12323 |
|
|
12324 |
The Texinfo export back-end recognizes these indexing keywords if used |
|
12325 |
in the Org file: ‘#+CINDEX’, ‘#+FINDEX’, ‘#+KINDEX’, ‘#+PINDEX’, |
|
12326 |
‘#+TINDEX’, and ‘#+VINDEX’. Write their value as verbatim Texinfo code; |
|
12327 |
in particular, ‘{’, ‘}’ and ‘@’ characters need to be escaped with ‘@’ |
|
12328 |
if they not belong to a Texinfo command. |
|
12329 |
|
|
12330 |
#+CINDEX: Defining indexing entries |
|
12331 |
|
|
12332 |
For the back-end to generate an index entry for a headline, set the |
|
12333 |
‘:INDEX:’ property to ‘cp’ or ‘vr’. These abbreviations come from |
|
12334 |
Texinfo that stand for concept index and variable index. The Texinfo |
|
12335 |
manual has abbreviations for all other kinds of indexes. The back-end |
|
12336 |
exports the headline as an unnumbered chapter or section command, and |
|
12337 |
then inserts the index after its contents. |
|
12338 |
|
|
12339 |
* Concept Index |
|
12340 |
:PROPERTIES: |
|
12341 |
:INDEX: cp |
|
12342 |
:END: |
|
12343 |
|
|
12344 |
|
|
12345 |
File: org, Node: Quoting Texinfo code, Next: Plain lists in Texinfo export, Prev: Indices, Up: Texinfo export |
|
12346 |
|
|
12347 |
12.14.8 Quoting Texinfo code |
|
12348 |
---------------------------- |
|
12349 |
|
|
12350 |
Use any of the following three methods to insert or escape raw Texinfo |
|
12351 |
code: |
|
12352 |
|
|
12353 |
Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU. |
|
12354 |
|
|
12355 |
#+TEXINFO: @need800 |
|
12356 |
This paragraph is preceded by... |
|
12357 |
|
|
12358 |
#+BEGIN_EXPORT texinfo |
|
12359 |
@auindex Johnson, Mark |
|
12360 |
@auindex Lakoff, George |
|
12361 |
#+END_EXPORT |
|
12362 |
|
|
12363 |
|
|
12364 |
File: org, Node: Plain lists in Texinfo export, Next: Tables in Texinfo export, Prev: Quoting Texinfo code, Up: Texinfo export |
|
12365 |
|
|
12366 |
12.14.9 Plain lists in Texinfo export |
|
12367 |
------------------------------------- |
|
12368 |
|
|
12369 |
The Texinfo export back-end by default converts description lists in the |
|
12370 |
Org file using the default command ‘@table’, which results in a table |
|
12371 |
with two columns. To change this behavior, specify ‘:table-type’ with |
|
12372 |
‘ftable’ or ‘vtable’ attributes. For more information, *note |
|
12373 |
(texinfo)Two-column Tables::. |
|
12374 |
|
|
12375 |
The Texinfo export back-end by default also applies a text highlight |
|
12376 |
based on the defaults stored in ‘org-texinfo-table-default-markup’. To |
|
12377 |
override the default highlight command, specify another one with the |
|
12378 |
‘:indic’ attribute. |
|
12379 |
|
|
12380 |
Org syntax is limited to one entry per list item. Nevertheless, the |
|
12381 |
Texinfo export back-end can split that entry according to any text |
|
12382 |
provided through the ‘:sep’ attribute. Each part then becomes a new |
|
12383 |
entry in the first column of the table. |
|
12384 |
|
|
12385 |
The following example illustrates all the attributes above: |
|
12386 |
|
|
12387 |
#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis |
|
12388 |
- foo, bar :: This is the common text for variables foo and bar. |
|
12389 |
|
|
12390 |
becomes |
|
12391 |
|
|
12392 |
@vtable @asis |
|
12393 |
@item foo |
|
12394 |
@itemx bar |
|
12395 |
This is the common text for variables foo and bar. |
|
12396 |
@end table |
|
12397 |
|
|
12398 |
|
|
12399 |
File: org, Node: Tables in Texinfo export, Next: Images in Texinfo export, Prev: Plain lists in Texinfo export, Up: Texinfo export |
|
12400 |
|
|
12401 |
12.14.10 Tables in Texinfo export |
|
12402 |
--------------------------------- |
|
12403 |
|
|
12404 |
When exporting tables, the Texinfo export back-end uses the widest cell |
|
12405 |
width in each column. To override this and instead specify as fractions |
|
12406 |
of line length, use the ‘:columns’ attribute. See example below. |
|
12407 |
|
|
12408 |
#+ATTR_TEXINFO: :columns .5 .5 |
|
12409 |
| a cell | another cell | |
|
12410 |
|
|
12411 |
|
|
12412 |
File: org, Node: Images in Texinfo export, Next: Special blocks in Texinfo export, Prev: Tables in Texinfo export, Up: Texinfo export |
|
12413 |
|
|
12414 |
12.14.11 Images in Texinfo export |
|
12415 |
--------------------------------- |
|
12416 |
|
|
12417 |
Insert a file link to the image in the Org file, and the Texinfo export |
|
12418 |
back-end inserts the image. These links must have the usual supported |
|
12419 |
image extensions and no descriptions. To scale the image, use ‘:width’ |
|
12420 |
and ‘:height’ attributes. For alternate text, use ‘:alt’ and specify |
|
12421 |
the text using Texinfo code, as shown in the example: |
|
12422 |
|
|
12423 |
#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text} |
|
12424 |
[[ridt.pdf]] |
|
12425 |
|
|
12426 |
|
|
12427 |
File: org, Node: Special blocks in Texinfo export, Next: A Texinfo example, Prev: Images in Texinfo export, Up: Texinfo export |
|
12428 |
|
|
12429 |
12.14.12 Special blocks |
|
12430 |
----------------------- |
|
12431 |
|
|
12432 |
The Texinfo export back-end converts special blocks to commands with the |
|
12433 |
same name. It also adds any ‘:options’ attributes to the end of the |
|
12434 |
command, as shown in this example: |
|
12435 |
|
|
12436 |
#+ATTR_TEXINFO: :options org-org-export-to-org ... |
|
12437 |
#+begin_defun |
|
12438 |
A somewhat obsessive function. |
|
12439 |
#+end_defun |
|
12440 |
|
|
12441 |
becomes |
|
12442 |
|
|
12443 |
@defun org-org-export-to-org ... |
|
12444 |
A somewhat obsessive function. |
|
12445 |
@end defun |
|
12446 |
|
|
12447 |
|
|
12448 |
File: org, Node: A Texinfo example, Prev: Special blocks in Texinfo export, Up: Texinfo export |
|
12449 |
|
|
12450 |
12.14.13 A Texinfo example |
|
12451 |
-------------------------- |
|
12452 |
|
|
12453 |
Here is a more detailed example Org file. See *note (texinfo)GNU Sample |
|
12454 |
Texts:: for an equivalent example using Texinfo code. |
|
12455 |
|
|
12456 |
#+TITLE: GNU Sample {{{version}}} |
|
12457 |
#+SUBTITLE: for version {{{version}}}, {{{updated}}} |
|
12458 |
#+AUTHOR: A.U. Thor |
|
12459 |
#+EMAIL: bug-sample@gnu.org |
|
12460 |
|
|
12461 |
#+OPTIONS: ':t toc:t author:t email:t |
|
12462 |
#+LANGUAGE: en |
|
12463 |
|
|
12464 |
#+MACRO: version 2.0 |
|
12465 |
#+MACRO: updated last updated 4 March 2014 |
|
12466 |
|
|
12467 |
#+TEXINFO_FILENAME: sample.info |
|
12468 |
#+TEXINFO_HEADER: @syncodeindex pg cp |
|
12469 |
|
|
12470 |
#+TEXINFO_DIR_CATEGORY: Texinfo documentation system |
|
12471 |
#+TEXINFO_DIR_TITLE: sample: (sample) |
|
12472 |
#+TEXINFO_DIR_DESC: Invoking sample |
|
12473 |
|
|
12474 |
#+TEXINFO_PRINTED_TITLE: GNU Sample |
|
12475 |
|
|
12476 |
This manual is for GNU Sample (version {{{version}}}, |
|
12477 |
{{{updated}}}). |
|
12478 |
|
|
12479 |
* Copying |
|
12480 |
:PROPERTIES: |
|
12481 |
:COPYING: t |
|
12482 |
:END: |
|
12483 |
|
|
12484 |
This manual is for GNU Sample (version {{{version}}}, |
|
12485 |
{{{updated}}}), which is an example in the Texinfo documentation. |
|
12486 |
|
|
12487 |
Copyright \copy 2018 Free Software Foundation, Inc. |
|
12488 |
|
|
12489 |
#+BEGIN_QUOTE |
|
12490 |
Permission is granted to copy, distribute and/or modify this |
|
12491 |
document under the terms of the GNU Free Documentation License, |
|
12492 |
Version 1.3 or any later version published by the Free Software |
|
12493 |
Foundation; with no Invariant Sections, with no Front-Cover Texts, |
|
12494 |
and with no Back-Cover Texts. A copy of the license is included in |
|
12495 |
the section entitled "GNU Free Documentation License". |
|
12496 |
#+END_QUOTE |
|
12497 |
|
|
12498 |
* Invoking sample |
|
12499 |
|
|
12500 |
#+PINDEX: sample |
|
12501 |
#+CINDEX: invoking @command{sample} |
|
12502 |
|
|
12503 |
This is a sample manual. There is no sample program to invoke, but |
|
12504 |
if there were, you could see its basic usage and command line |
|
12505 |
options here. |
|
12506 |
|
|
12507 |
* GNU Free Documentation License |
|
12508 |
:PROPERTIES: |
|
12509 |
:APPENDIX: t |
|
12510 |
:END: |
|
12511 |
|
|
12512 |
#+TEXINFO: @include fdl.texi |
|
12513 |
|
|
12514 |
* Index |
|
12515 |
:PROPERTIES: |
|
12516 |
:INDEX: cp |
|
12517 |
:END: |
|
12518 |
|
|
12519 |
|
|
12520 |
File: org, Node: iCalendar export, Next: Other built-in back-ends, Prev: Texinfo export, Up: Exporting |
|
12521 |
|
|
12522 |
12.15 iCalendar export |
|
12523 |
====================== |
|
12524 |
|
|
12525 |
A large part of Org mode’s inter-operability success is its ability to |
|
12526 |
easily export to or import from external applications. The iCalendar |
|
12527 |
export back-end takes calendar data from Org files and exports to the |
|
12528 |
standard iCalendar format. |
|
12529 |
|
|
12530 |
The iCalendar export back-end can also incorporate TODO entries based |
|
12531 |
on the configuration of the ‘org-icalendar-include-todo’ variable. The |
|
12532 |
back-end exports plain timestamps as VEVENT, TODO items as VTODO, and |
|
12533 |
also create events from deadlines that are in non-TODO items. The |
|
12534 |
back-end uses the deadlines and scheduling dates in Org TODO items for |
|
12535 |
setting the start and due dates for the iCalendar TODO entry. Consult |
|
12536 |
the ‘org-icalendar-use-deadline’ and ‘org-icalendar-use-scheduled’ |
|
12537 |
variables for more details. |
|
12538 |
|
|
12539 |
For tags on the headline, the iCalendar export back-end makes them |
|
12540 |
into iCalendar categories. To tweak the inheritance of tags and TODO |
|
12541 |
states, configure the variable ‘org-icalendar-categories’. To assign |
|
12542 |
clock alarms based on time, configure the ‘org-icalendar-alarm-time’ |
|
12543 |
variable. |
|
12544 |
|
|
12545 |
The iCalendar format standard requires globally unique |
|
12546 |
identifier—UID—for each entry. The iCalendar export back-end creates |
|
12547 |
UIDs during export. To save a copy of the UID in the Org file set the |
|
12548 |
variable ‘org-icalendar-store-UID’. The back-end looks for the ‘:ID:’ |
|
12549 |
property of the entry for re-using the same UID for subsequent exports. |
|
12550 |
|
|
12551 |
Since a single Org entry can result in multiple iCalendar entries—as |
|
12552 |
timestamp, deadline, scheduled item, or TODO item—Org adds prefixes to |
|
12553 |
the UID, depending on which part of the Org entry triggered the creation |
|
12554 |
of the iCalendar entry. Prefixing ensures UIDs remains unique, yet |
|
12555 |
enable synchronization programs trace the connections. |
|
12556 |
|
|
12557 |
‘C-c C-e c f (org-icalendar-export-to-ics)’ |
|
12558 |
Create iCalendar entries from the current Org buffer and store them |
|
12559 |
in the same directory, using a file extension ‘.ics’. |
|
12560 |
‘C-c C-e c a (org-icalendar-export-agenda-files)’ |
|
12561 |
Create iCalendar entries from Org files in ‘org-agenda-files’ and |
|
12562 |
store in a separate iCalendar file for each Org file. |
|
12563 |
‘C-c C-e c c (org-icalendar-combine-agenda-files)’ |
|
12564 |
Create a combined iCalendar file from Org files in |
|
12565 |
‘org-agenda-files’ and write it to |
|
12566 |
‘org-icalendar-combined-agenda-file’ file name. |
|
12567 |
|
|
12568 |
The iCalendar export back-end includes ‘SUMMARY’, ‘DESCRIPTION’, |
|
12569 |
‘LOCATION’ and ‘TIMEZONE’ properties from the Org entries when |
|
12570 |
exporting. To force the back-end to inherit the ‘LOCATION’ and |
|
12571 |
‘TIMEZONE’ properties, configure the ‘org-use-property-inheritance’ |
|
12572 |
variable. |
|
12573 |
|
|
12574 |
When Org entries do not have ‘SUMMARY’, ‘DESCRIPTION’ and ‘LOCATION’ |
|
12575 |
properties, the iCalendar export back-end derives the summary from the |
|
12576 |
headline, and derives the description from the body of the Org item. |
|
12577 |
The ‘org-icalendar-include-body’ variable limits the maximum number of |
|
12578 |
characters of the content are turned into its description. |
|
12579 |
|
|
12580 |
The ‘TIMEZONE’ property can be used to specify a per-entry time zone, |
|
12581 |
and will be applied to any entry with timestamp information. Time zones |
|
12582 |
should be specified as per the IANA time zone database format, e.g. |
|
12583 |
“Asia/Almaty”. Alternately, the property value can be “UTC”, to force |
|
12584 |
UTC time for this entry only. |
|
12585 |
|
|
12586 |
Exporting to iCalendar format depends in large part on the |
|
12587 |
capabilities of the destination application. Some are more lenient than |
|
12588 |
others. Consult the Org mode FAQ for advice on specific applications. |
|
12589 |
|
|
12590 |
|
|
12591 |
File: org, Node: Other built-in back-ends, Next: Advanced configuration, Prev: iCalendar export, Up: Exporting |
|
12592 |
|
|
12593 |
12.16 Other built-in back-ends |
|
12594 |
============================== |
|
12595 |
|
|
12596 |
Other export back-ends included with Org are: |
|
12597 |
|
|
12598 |
• ‘ox-man.el’: export to a man page. |
|
12599 |
|
|
12600 |
To activate such back-ends, either customize ‘org-export-backends’ or |
|
12601 |
load directly with ‘(require 'ox-man)’. On successful load, the |
|
12602 |
back-end adds new keys in the export dispatcher (*note The export |
|
12603 |
dispatcher::). |
|
12604 |
|
|
12605 |
Follow the comment section of such files, for example, ‘ox-man.el’, |
|
12606 |
for usage and configuration details. |
|
12607 |
|
|
12608 |
|
|
12609 |
File: org, Node: Advanced configuration, Next: Export in foreign buffers, Prev: Other built-in back-ends, Up: Exporting |
|
12610 |
|
|
12611 |
12.17 Advanced configuration |
|
12612 |
============================ |
|
12613 |
|
|
12614 |
Hooks |
|
12615 |
----- |
|
12616 |
|
|
12617 |
The export process executes two hooks before the actual exporting |
|
12618 |
begins. The first hook, ‘org-export-before-processing-hook’, runs |
|
12619 |
before any expansions of macros, Babel code, and include keywords in the |
|
12620 |
buffer. The second hook, ‘org-export-before-parsing-hook’, runs before |
|
12621 |
the buffer is parsed. Both hooks are specified as functions, see |
|
12622 |
example below. Their main use is for heavy duty structural |
|
12623 |
modifications of the Org content. For example, removing every headline |
|
12624 |
in the buffer during export: |
|
12625 |
|
|
12626 |
(defun my-headline-removal (backend) |
|
12627 |
"Remove all headlines in the current buffer. |
|
12628 |
BACKEND is the export back-end being used, as a symbol." |
|
12629 |
(org-map-entries |
|
12630 |
(lambda () (delete-region (point) (progn (forward-line) (point)))))) |
|
12631 |
|
|
12632 |
(add-hook 'org-export-before-parsing-hook 'my-headline-removal) |
|
12633 |
|
|
12634 |
Note that the hook function must have a mandatory argument that is a |
|
12635 |
symbol for the back-end. |
|
12636 |
|
|
12637 |
Filters |
|
12638 |
------- |
|
12639 |
|
|
12640 |
The Org export process relies on filters to process specific parts of |
|
12641 |
conversion process. Filters are just lists of functions to be applied |
|
12642 |
to certain parts for a given back-end. The output from the first |
|
12643 |
function in the filter is passed on to the next function in the filter. |
|
12644 |
The final output is the output from the final function in the filter. |
|
12645 |
|
|
12646 |
The Org export process has many filter sets applicable to different |
|
12647 |
types of objects, plain text, parse trees, export options, and final |
|
12648 |
output formats. The filters are named after the element type or object |
|
12649 |
type: ‘org-export-filter-TYPE-functions’, where ‘TYPE’ is the type |
|
12650 |
targeted by the filter. Valid types are: |
|
12651 |
|
|
12652 |
body bold babel-call |
|
12653 |
center-block clock code |
|
12654 |
diary-sexp drawer dynamic-block |
|
12655 |
entity example-block export-block |
|
12656 |
export-snippet final-output fixed-width |
|
12657 |
footnote-definition footnote-reference headline |
|
12658 |
horizontal-rule inline-babel-call inline-src-block |
|
12659 |
inlinetask italic item |
|
12660 |
keyword latex-environment latex-fragment |
|
12661 |
line-break link node-property |
|
12662 |
options paragraph parse-tree |
|
12663 |
plain-list plain-text planning |
|
12664 |
property-drawer quote-block radio-target |
|
12665 |
section special-block src-block |
|
12666 |
statistics-cookie strike-through subscript |
|
12667 |
superscript table table-cell |
|
12668 |
table-row target timestamp |
|
12669 |
underline verbatim verse-block |
|
12670 |
|
|
12671 |
Here is an example filter that replaces non-breaking spaces ‘~’ in |
|
12672 |
the Org buffer with ‘_’ for the LaTeX back-end. |
|
12673 |
|
|
12674 |
(defun my-latex-filter-nobreaks (text backend info) |
|
12675 |
"Ensure \"_\" are properly handled in LaTeX export." |
|
12676 |
(when (org-export-derived-backend-p backend 'latex) |
|
12677 |
(replace-regexp-in-string "_" "~" text))) |
|
12678 |
|
|
12679 |
(add-to-list 'org-export-filter-plain-text-functions |
|
12680 |
'my-latex-filter-nobreaks) |
|
12681 |
|
|
12682 |
A filter requires three arguments: the code to be transformed, the |
|
12683 |
name of the back-end, and some optional information about the export |
|
12684 |
process. The third argument can be safely ignored. Note the use of |
|
12685 |
‘org-export-derived-backend-p’ predicate that tests for ‘latex’ back-end |
|
12686 |
or any other back-end, such as ‘beamer’, derived from ‘latex’. |
|
12687 |
|
|
12688 |
Defining filters for individual files |
|
12689 |
------------------------------------- |
|
12690 |
|
|
12691 |
The Org export can filter not just for back-ends, but also for specific |
|
12692 |
files through the ‘#+BIND’ keyword. Here is an example with two |
|
12693 |
filters; one removes brackets from time stamps, and the other removes |
|
12694 |
strike-through text. The filter functions are defined in a ‘src’ code |
|
12695 |
block in the same Org file, which is a handy location for debugging. |
|
12696 |
|
|
12697 |
#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp) |
|
12698 |
#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through) |
|
12699 |
#+begin_src emacs-lisp :exports results :results none |
|
12700 |
(defun tmp-f-timestamp (s backend info) |
|
12701 |
(replace-regexp-in-string "&[lg]t;\\|[][]" "" s)) |
|
12702 |
(defun tmp-f-strike-through (s backend info) "") |
|
12703 |
#+end_src |
|
12704 |
|
|
12705 |
Extending an existing back-end |
|
12706 |
------------------------------ |
|
12707 |
|
|
12708 |
Some parts of the conversion process can be extended for certain |
|
12709 |
elements so as to introduce a new or revised translation. That is how |
|
12710 |
the HTML export back-end was extended to handle Markdown format. The |
|
12711 |
extensions work seamlessly so any aspect of filtering not done by the |
|
12712 |
extended back-end is handled by the original back-end. Of all the |
|
12713 |
export customization in Org, extending is very powerful as it operates |
|
12714 |
at the parser level. |
|
12715 |
|
|
12716 |
For this example, make the ‘ascii’ back-end display the language used |
|
12717 |
in a source code block. Also make it display only when some attribute |
|
12718 |
is non-‘nil’, like the following: |
|
12719 |
|
|
12720 |
#+ATTR_ASCII: :language t |
|
12721 |
|
|
12722 |
Then extend ‘ascii’ back-end with a custom ‘my-ascii’ back-end. |
|
12723 |
|
|
12724 |
(defun my-ascii-src-block (src-block contents info) |
|
12725 |
"Transcode a SRC-BLOCK element from Org to ASCII. |
|
12726 |
CONTENTS is nil. INFO is a plist used as a communication |
|
12727 |
channel." |
|
12728 |
(if (not (org-export-read-attribute :attr_ascii src-block :language)) |
|
12729 |
(org-export-with-backend 'ascii src-block contents info) |
|
12730 |
(concat |
|
12731 |
(format ",--[ %s ]--\n%s`----" |
|
12732 |
(org-element-property :language src-block) |
|
12733 |
(replace-regexp-in-string |
|
12734 |
"^" "| " |
|
12735 |
(org-element-normalize-string |
|
12736 |
(org-export-format-code-default src-block info))))))) |
|
12737 |
|
|
12738 |
(org-export-define-derived-backend 'my-ascii 'ascii |
|
12739 |
:translate-alist '((src-block . my-ascii-src-block))) |
|
12740 |
|
|
12741 |
The ‘my-ascii-src-block’ function looks at the attribute above the |
|
12742 |
current element. If not true, hands over to ‘ascii’ back-end. If true, |
|
12743 |
which it is in this example, it creates a box around the code and leaves |
|
12744 |
room for the inserting a string for language. The last form creates the |
|
12745 |
new back-end that springs to action only when translating ‘src-block’ |
|
12746 |
type elements. |
|
12747 |
|
|
12748 |
To use the newly defined back-end, call the following from an Org |
|
12749 |
buffer: |
|
12750 |
|
|
12751 |
(org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*") |
|
12752 |
|
|
12753 |
Further steps to consider would be an interactive function, |
|
12754 |
self-installing an item in the export dispatcher menu, and other |
|
12755 |
user-friendly improvements. |
|
12756 |
|
|
12757 |
|
|
12758 |
File: org, Node: Export in foreign buffers, Prev: Advanced configuration, Up: Exporting |
|
12759 |
|
|
12760 |
12.18 Export in foreign buffers |
|
12761 |
=============================== |
|
12762 |
|
|
12763 |
The export back-ends in Org often include commands to convert selected |
|
12764 |
regions. A convenient feature of this in-place conversion is that the |
|
12765 |
exported output replaces the original source. Here are such functions: |
|
12766 |
|
|
12767 |
‘org-html-convert-region-to-html’ |
|
12768 |
Convert the selected region into HTML. |
|
12769 |
‘org-latex-convert-region-to-latex’ |
|
12770 |
Convert the selected region into LaTeX. |
|
12771 |
‘org-texinfo-convert-region-to-texinfo’ |
|
12772 |
Convert the selected region into ‘Texinfo’. |
|
12773 |
‘org-md-convert-region-to-md’ |
|
12774 |
Convert the selected region into ‘MarkDown’. |
|
12775 |
|
|
12776 |
In-place conversions are particularly handy for quick conversion of |
|
12777 |
tables and lists in foreign buffers. For example, turn on the minor |
|
12778 |
mode ‘M-x orgstruct-mode’ in an HTML buffer, then use the convenient Org |
|
12779 |
keyboard commands to create a list, select it, and covert it to HTML |
|
12780 |
with ‘M-x org-html-convert-region-to-html <RET>’. |
|
12781 |
|
|
12782 |
|
|
12783 |
File: org, Node: Publishing, Next: Working with source code, Prev: Exporting, Up: Top |
|
12784 |
|
|
12785 |
13 Publishing |
|
12786 |
************* |
|
12787 |
|
|
12788 |
Org includes a publishing management system that allows you to configure |
|
12789 |
automatic HTML conversion of _projects_ composed of interlinked org |
|
12790 |
files. You can also configure Org to automatically upload your exported |
|
12791 |
HTML pages and related attachments, such as images and source code |
|
12792 |
files, to a web server. |
|
12793 |
|
|
12794 |
You can also use Org to convert files into PDF, or even combine HTML |
|
12795 |
and PDF conversion so that files are available in both formats on the |
|
12796 |
server. |
|
12797 |
|
|
12798 |
Publishing has been contributed to Org by David O’Toole. |
|
12799 |
|
|
12800 |
* Menu: |
|
12801 |
|
|
12802 |
* Configuration:: Defining projects |
|
12803 |
* Uploading files:: How to get files up on the server |
|
12804 |
* Sample configuration:: Example projects |
|
12805 |
* Triggering publication:: Publication commands |
|
12806 |
|
|
12807 |
|
|
12808 |
File: org, Node: Configuration, Next: Uploading files, Up: Publishing |
|
12809 |
|
|
12810 |
13.1 Configuration |
|
12811 |
================== |
|
12812 |
|
|
12813 |
Publishing needs significant configuration to specify files, destination |
|
12814 |
and many other properties of a project. |
|
12815 |
|
|
12816 |
* Menu: |
|
12817 |
|
|
12818 |
* Project alist:: The central configuration variable |
|
12819 |
* Sources and destinations:: From here to there |
|
12820 |
* Selecting files:: What files are part of the project? |
|
12821 |
* Publishing action:: Setting the function doing the publishing |
|
12822 |
* Publishing options:: Tweaking HTML/LaTeX export |
|
12823 |
* Publishing links:: Which links keep working after publishing? |
|
12824 |
* Sitemap:: Generating a list of all pages |
|
12825 |
* Generating an index:: An index that reaches across pages |
|
12826 |
|
|
12827 |
|
|
12828 |
File: org, Node: Project alist, Next: Sources and destinations, Up: Configuration |
|
12829 |
|
|
12830 |
13.1.1 The variable ‘org-publish-project-alist’ |
|
12831 |
----------------------------------------------- |
|
12832 |
|
|
12833 |
Publishing is configured almost entirely through setting the value of |
|
12834 |
one variable, called ‘org-publish-project-alist’. Each element of the |
|
12835 |
list configures one project, and may be in one of the two following |
|
12836 |
forms: |
|
12837 |
|
|
12838 |
("project-name" :property value :property value ...) |
|
12839 |
i.e., a well-formed property list with alternating keys and values |
|
12840 |
or |
|
12841 |
("project-name" :components ("project-name" "project-name" ...)) |
|
12842 |
|
|
12843 |
|
|
12844 |
In both cases, projects are configured by specifying property values. |
|
12845 |
A project defines the set of files that will be published, as well as |
|
12846 |
the publishing configuration to use when publishing those files. When a |
|
12847 |
project takes the second form listed above, the individual members of |
|
12848 |
the ‘:components’ property are taken to be sub-projects, which group |
|
12849 |
together files requiring different publishing options. When you publish |
|
12850 |
such a “meta-project”, all the components will also be published, in the |
|
12851 |
sequence given. |
|
12852 |
|
|
12853 |
|
|
12854 |
File: org, Node: Sources and destinations, Next: Selecting files, Prev: Project alist, Up: Configuration |
|
12855 |
|
|
12856 |
13.1.2 Sources and destinations for files |
|
12857 |
----------------------------------------- |
|
12858 |
|
|
12859 |
Most properties are optional, but some should always be set. In |
|
12860 |
particular, Org needs to know where to look for source files, and where |
|
12861 |
to put published files. |
|
12862 |
|
|
12863 |
‘:base-directory’ Directory containing publishing source files |
|
12864 |
‘:publishing-directory’Directory where output files will be published. |
|
12865 |
You can directly publish to a web server using a |
|
12866 |
file name syntax appropriate for the Emacs |
|
12867 |
‘tramp’ package. Or you can publish to a local |
|
12868 |
directory and use external tools to upload your |
|
12869 |
website (*note Uploading files::). |
|
12870 |
‘:preparation-function’Function or list of functions to be called |
|
12871 |
before starting the publishing process, for |
|
12872 |
example, to run ‘make’ for updating files to be |
|
12873 |
published. Each preparation function is called |
|
12874 |
with a single argument, the project property |
|
12875 |
list. |
|
12876 |
‘:completion-function’ Function or list of functions called after |
|
12877 |
finishing the publishing process, for example, |
|
12878 |
to change permissions of the resulting files. |
|
12879 |
Each completion function is called with a single |
|
12880 |
argument, the project property list. |
|
12881 |
|
|
12882 |
|
|
12883 |
File: org, Node: Selecting files, Next: Publishing action, Prev: Sources and destinations, Up: Configuration |
|
12884 |
|
|
12885 |
13.1.3 Selecting files |
|
12886 |
---------------------- |
|
12887 |
|
|
12888 |
By default, all files with extension ‘.org’ in the base directory are |
|
12889 |
considered part of the project. This can be modified by setting the |
|
12890 |
properties |
|
12891 |
‘:base-extension’ Extension (without the dot!) of source files. This |
|
12892 |
actually is a regular expression. Set this to the |
|
12893 |
symbol ‘any’ if you want to get all files in |
|
12894 |
‘:base-directory’, even without extension. |
|
12895 |
|
|
12896 |
‘:exclude’ Regular expression to match file names that should |
|
12897 |
not be published, even though they have been |
|
12898 |
selected on the basis of their extension. |
|
12899 |
|
|
12900 |
‘:include’ List of files to be included regardless of |
|
12901 |
‘:base-extension’ and ‘:exclude’. |
|
12902 |
|
|
12903 |
‘:recursive’ non-‘nil’ means, check base-directory recursively |
|
12904 |
for files to publish. |
|
12905 |
|
|
12906 |
|
|
12907 |
File: org, Node: Publishing action, Next: Publishing options, Prev: Selecting files, Up: Configuration |
|
12908 |
|
|
12909 |
13.1.4 Publishing action |
|
12910 |
------------------------ |
|
12911 |
|
|
12912 |
Publishing means that a file is copied to the destination directory and |
|
12913 |
possibly transformed in the process. The default transformation is to |
|
12914 |
export Org files as HTML files, and this is done by the function |
|
12915 |
‘org-html-publish-to-html’, which calls the HTML exporter (*note HTML |
|
12916 |
export::). But you also can publish your content as PDF files using |
|
12917 |
‘org-latex-publish-to-pdf’ or as ‘ascii’, ‘Texinfo’, etc., using the |
|
12918 |
corresponding functions. |
|
12919 |
|
|
12920 |
If you want to publish the Org file as an ‘.org’ file but with the |
|
12921 |
archived, commented and tag-excluded trees removed, use the function |
|
12922 |
‘org-org-publish-to-org’. This will produce ‘file.org’ and put it in |
|
12923 |
the publishing directory. If you want a htmlized version of this file, |
|
12924 |
set the parameter ‘:htmlized-source’ to ‘t’, it will produce |
|
12925 |
‘file.org.html’ in the publishing directory(1). |
|
12926 |
|
|
12927 |
Other files like images only need to be copied to the publishing |
|
12928 |
destination. For this you can use ‘org-publish-attachment’. For |
|
12929 |
non-org files, you always need to specify the publishing function: |
|
12930 |
|
|
12931 |
‘:publishing-function’ Function executing the publication of a file. |
|
12932 |
This may also be a list of functions, which will |
|
12933 |
all be called in turn. |
|
12934 |
‘:htmlized-source’ non-‘nil’ means, publish htmlized source. |
|
12935 |
|
|
12936 |
The function must accept three arguments: a property list containing |
|
12937 |
at least a ‘:publishing-directory’ property, the name of the file to be |
|
12938 |
published and the path to the publishing directory of the output file. |
|
12939 |
It should take the specified file, make the necessary transformation (if |
|
12940 |
any) and place the result into the destination folder. |
|
12941 |
|
|
12942 |
---------- Footnotes ---------- |
|
12943 |
|
|
12944 |
(1) If the publishing directory is the same than the source |
|
12945 |
directory, ‘file.org’ will be exported as ‘file.org.org’, so probably |
|
12946 |
don’t want to do this. |
|
12947 |
|
|
12948 |
|
|
12949 |
File: org, Node: Publishing options, Next: Publishing links, Prev: Publishing action, Up: Configuration |
|
12950 |
|
|
12951 |
13.1.5 Options for the exporters |
|
12952 |
-------------------------------- |
|
12953 |
|
|
12954 |
The property list can be used to set export options during the |
|
12955 |
publishing process. In most cases, these properties correspond to user |
|
12956 |
variables in Org. While some properties are available for all export |
|
12957 |
back-ends, most of them are back-end specific. The following sections |
|
12958 |
list properties along with the variable they belong to. See the |
|
12959 |
documentation string of these options for details. |
|
12960 |
|
|
12961 |
When a property is given a value in ‘org-publish-project-alist’, its |
|
12962 |
setting overrides the value of the corresponding user variable (if any) |
|
12963 |
during publishing. Options set within a file (*note Export settings::), |
|
12964 |
however, override everything. |
|
12965 |
|
|
12966 |
Generic properties |
|
12967 |
.................. |
|
12968 |
|
|
12969 |
‘:archived-trees’ ‘org-export-with-archived-trees’ |
|
12970 |
‘:exclude-tags’ ‘org-export-exclude-tags’ |
|
12971 |
‘:headline-levels’ ‘org-export-headline-levels’ |
|
12972 |
‘:language’ ‘org-export-default-language’ |
|
12973 |
‘:preserve-breaks’ ‘org-export-preserve-breaks’ |
|
12974 |
‘:section-numbers’ ‘org-export-with-section-numbers’ |
|
12975 |
‘:select-tags’ ‘org-export-select-tags’ |
|
12976 |
‘:with-author’ ‘org-export-with-author’ |
|
12977 |
‘:with-broken-links’ ‘org-export-with-broken-links’ |
|
12978 |
‘:with-clocks’ ‘org-export-with-clocks’ |
|
12979 |
‘:with-creator’ ‘org-export-with-creator’ |
|
12980 |
‘:with-date’ ‘org-export-with-date’ |
|
12981 |
‘:with-drawers’ ‘org-export-with-drawers’ |
|
12982 |
‘:with-email’ ‘org-export-with-email’ |
|
12983 |
‘:with-emphasize’ ‘org-export-with-emphasize’ |
|
12984 |
‘:with-fixed-width’ ‘org-export-with-fixed-width’ |
|
12985 |
‘:with-footnotes’ ‘org-export-with-footnotes’ |
|
12986 |
‘:with-latex’ ‘org-export-with-latex’ |
|
12987 |
‘:with-planning’ ‘org-export-with-planning’ |
|
12988 |
‘:with-priority’ ‘org-export-with-priority’ |
|
12989 |
‘:with-properties’ ‘org-export-with-properties’ |
|
12990 |
‘:with-special-strings’ ‘org-export-with-special-strings’ |
|
12991 |
‘:with-sub-superscript’ ‘org-export-with-sub-superscripts’ |
|
12992 |
‘:with-tables’ ‘org-export-with-tables’ |
|
12993 |
‘:with-tags’ ‘org-export-with-tags’ |
|
12994 |
‘:with-tasks’ ‘org-export-with-tasks’ |
|
12995 |
‘:with-timestamps’ ‘org-export-with-timestamps’ |
|
12996 |
‘:with-title’ ‘org-export-with-title’ |
|
12997 |
‘:with-toc’ ‘org-export-with-toc’ |
|
12998 |
‘:with-todo-keywords’ ‘org-export-with-todo-keywords’ |
|
12999 |
|
|
13000 |
ASCII specific properties |
|
13001 |
......................... |
|
13002 |
|
|
13003 |
‘:ascii-bullets’ ‘org-ascii-bullets’ |
|
13004 |
‘:ascii-caption-above’ ‘org-ascii-caption-above’ |
|
13005 |
‘:ascii-charset’ ‘org-ascii-charset’ |
|
13006 |
‘:ascii-global-margin’ ‘org-ascii-global-margin’ |
|
13007 |
‘:ascii-format-drawer-function’ ‘org-ascii-format-drawer-function’ |
|
13008 |
‘:ascii-format-inlinetask-function’ ‘org-ascii-format-inlinetask-function’ |
|
13009 |
‘:ascii-headline-spacing’ ‘org-ascii-headline-spacing’ |
|
13010 |
‘:ascii-indented-line-width’ ‘org-ascii-indented-line-width’ |
|
13011 |
‘:ascii-inlinetask-width’ ‘org-ascii-inlinetask-width’ |
|
13012 |
‘:ascii-inner-margin’ ‘org-ascii-inner-margin’ |
|
13013 |
‘:ascii-links-to-notes’ ‘org-ascii-links-to-notes’ |
|
13014 |
‘:ascii-list-margin’ ‘org-ascii-list-margin’ |
|
13015 |
‘:ascii-paragraph-spacing’ ‘org-ascii-paragraph-spacing’ |
|
13016 |
‘:ascii-quote-margin’ ‘org-ascii-quote-margin’ |
|
13017 |
‘:ascii-table-keep-all-vertical-lines’ ‘org-ascii-table-keep-all-vertical-lines’ |
|
13018 |
‘:ascii-table-use-ascii-art’ ‘org-ascii-table-use-ascii-art’ |
|
13019 |
‘:ascii-table-widen-columns’ ‘org-ascii-table-widen-columns’ |
|
13020 |
‘:ascii-text-width’ ‘org-ascii-text-width’ |
|
13021 |
‘:ascii-underline’ ‘org-ascii-underline’ |
|
13022 |
‘:ascii-verbatim-format’ ‘org-ascii-verbatim-format’ |
|
13023 |
|
|
13024 |
Beamer specific properties |
|
13025 |
.......................... |
|
13026 |
|
|
13027 |
‘:beamer-theme’ ‘org-beamer-theme’ |
|
13028 |
‘:beamer-column-view-format’ ‘org-beamer-column-view-format’ |
|
13029 |
‘:beamer-environments-extra’ ‘org-beamer-environments-extra’ |
|
13030 |
‘:beamer-frame-default-options’ ‘org-beamer-frame-default-options’ |
|
13031 |
‘:beamer-outline-frame-options’ ‘org-beamer-outline-frame-options’ |
|
13032 |
‘:beamer-outline-frame-title’ ‘org-beamer-outline-frame-title’ |
|
13033 |
‘:beamer-subtitle-format’ ‘org-beamer-subtitle-format’ |
|
13034 |
|
|
13035 |
HTML specific properties |
|
13036 |
........................ |
|
13037 |
|
|
13038 |
‘:html-allow-name-attribute-in-anchors’ ‘org-html-allow-name-attribute-in-anchors’ |
|
13039 |
‘:html-checkbox-type’ ‘org-html-checkbox-type’ |
|
13040 |
‘:html-container’ ‘org-html-container-element’ |
|
13041 |
‘:html-divs’ ‘org-html-divs’ |
|
13042 |
‘:html-doctype’ ‘org-html-doctype’ |
|
13043 |
‘:html-extension’ ‘org-html-extension’ |
|
13044 |
‘:html-footnote-format’ ‘org-html-footnote-format’ |
|
13045 |
‘:html-footnote-separator’ ‘org-html-footnote-separator’ |
|
13046 |
‘:html-footnotes-section’ ‘org-html-footnotes-section’ |
|
13047 |
‘:html-format-drawer-function’ ‘org-html-format-drawer-function’ |
|
13048 |
‘:html-format-headline-function’ ‘org-html-format-headline-function’ |
|
13049 |
‘:html-format-inlinetask-function’ ‘org-html-format-inlinetask-function’ |
|
13050 |
‘:html-head-extra’ ‘org-html-head-extra’ |
|
13051 |
‘:html-head-include-default-style’ ‘org-html-head-include-default-style’ |
|
13052 |
‘:html-head-include-scripts’ ‘org-html-head-include-scripts’ |
|
13053 |
‘:html-head’ ‘org-html-head’ |
|
13054 |
‘:html-home/up-format’ ‘org-html-home/up-format’ |
|
13055 |
‘:html-html5-fancy’ ‘org-html-html5-fancy’ |
|
13056 |
‘:html-indent’ ‘org-html-indent’ |
|
13057 |
‘:html-infojs-options’ ‘org-html-infojs-options’ |
|
13058 |
‘:html-infojs-template’ ‘org-html-infojs-template’ |
|
13059 |
‘:html-inline-image-rules’ ‘org-html-inline-image-rules’ |
|
13060 |
‘:html-inline-images’ ‘org-html-inline-images’ |
|
13061 |
‘:html-link-home’ ‘org-html-link-home’ |
|
13062 |
‘:html-link-org-files-as-html’ ‘org-html-link-org-files-as-html’ |
|
13063 |
‘:html-link-up’ ‘org-html-link-up’ |
|
13064 |
‘:html-link-use-abs-url’ ‘org-html-link-use-abs-url’ |
|
13065 |
‘:html-mathjax-options’ ‘org-html-mathjax-options’ |
|
13066 |
‘:html-mathjax-template’ ‘org-html-mathjax-template’ |
|
13067 |
‘:html-metadata-timestamp-format’ ‘org-html-metadata-timestamp-format’ |
|
13068 |
‘:html-postamble-format’ ‘org-html-postamble-format’ |
|
13069 |
‘:html-postamble’ ‘org-html-postamble’ |
|
13070 |
‘:html-preamble-format’ ‘org-html-preamble-format’ |
|
13071 |
‘:html-preamble’ ‘org-html-preamble’ |
|
13072 |
‘:html-table-align-individual-fields’ ‘org-html-table-align-individual-fields’ |
|
13073 |
‘:html-table-attributes’ ‘org-html-table-default-attributes’ |
|
13074 |
‘:html-table-caption-above’ ‘org-html-table-caption-above’ |
|
13075 |
‘:html-table-data-tags’ ‘org-html-table-data-tags’ |
|
13076 |
‘:html-table-header-tags’ ‘org-html-table-header-tags’ |
|
13077 |
‘:html-table-row-tags’ ‘org-html-table-row-tags’ |
|
13078 |
‘:html-table-use-header-tags-for-first-column’ ‘org-html-table-use-header-tags-for-first-column’ |
|
13079 |
‘:html-tag-class-prefix’ ‘org-html-tag-class-prefix’ |
|
13080 |
‘:html-text-markup-alist’ ‘org-html-text-markup-alist’ |
|
13081 |
‘:html-todo-kwd-class-prefix’ ‘org-html-todo-kwd-class-prefix’ |
|
13082 |
‘:html-toplevel-hlevel’ ‘org-html-toplevel-hlevel’ |
|
13083 |
‘:html-use-infojs’ ‘org-html-use-infojs’ |
|
13084 |
‘:html-validation-link’ ‘org-html-validation-link’ |
|
13085 |
‘:html-viewport’ ‘org-html-viewport’ |
|
13086 |
‘:html-xml-declaration’ ‘org-html-xml-declaration’ |
|
13087 |
|
|
13088 |
LaTeX specific properties |
|
13089 |
......................... |
|
13090 |
|
|
13091 |
‘:latex-active-timestamp-format’ ‘org-latex-active-timestamp-format’ |
|
13092 |
‘:latex-caption-above’ ‘org-latex-caption-above’ |
|
13093 |
‘:latex-classes’ ‘org-latex-classes’ |
|
13094 |
‘:latex-class’ ‘org-latex-default-class’ |
|
13095 |
‘:latex-compiler’ ‘org-latex-compiler’ |
|
13096 |
‘:latex-default-figure-position’ ‘org-latex-default-figure-position’ |
|
13097 |
‘:latex-default-table-environment’ ‘org-latex-default-table-environment’ |
|
13098 |
‘:latex-default-table-mode’ ‘org-latex-default-table-mode’ |
|
13099 |
‘:latex-diary-timestamp-format’ ‘org-latex-diary-timestamp-format’ |
|
13100 |
‘:latex-footnote-defined-format’ ‘org-latex-footnote-defined-format’ |
|
13101 |
‘:latex-footnote-separator’ ‘org-latex-footnote-separator’ |
|
13102 |
‘:latex-format-drawer-function’ ‘org-latex-format-drawer-function’ |
|
13103 |
‘:latex-format-headline-function’ ‘org-latex-format-headline-function’ |
|
13104 |
‘:latex-format-inlinetask-function’ ‘org-latex-format-inlinetask-function’ |
|
13105 |
‘:latex-hyperref-template’ ‘org-latex-hyperref-template’ |
|
13106 |
‘:latex-image-default-height’ ‘org-latex-image-default-height’ |
|
13107 |
‘:latex-image-default-option’ ‘org-latex-image-default-option’ |
|
13108 |
‘:latex-image-default-width’ ‘org-latex-image-default-width’ |
|
13109 |
‘:latex-images-centered’ ‘org-latex-images-centered’ |
|
13110 |
‘:latex-inactive-timestamp-format’ ‘org-latex-inactive-timestamp-format’ |
|
13111 |
‘:latex-inline-image-rules’ ‘org-latex-inline-image-rules’ |
|
13112 |
‘:latex-link-with-unknown-path-format’ ‘org-latex-link-with-unknown-path-format’ |
|
13113 |
‘:latex-listings-langs’ ‘org-latex-listings-langs’ |
|
13114 |
‘:latex-listings-options’ ‘org-latex-listings-options’ |
|
13115 |
‘:latex-listings’ ‘org-latex-listings’ |
|
13116 |
‘:latex-minted-langs’ ‘org-latex-minted-langs’ |
|
13117 |
‘:latex-minted-options’ ‘org-latex-minted-options’ |
|
13118 |
‘:latex-prefer-user-labels’ ‘org-latex-prefer-user-labels’ |
|
13119 |
‘:latex-subtitle-format’ ‘org-latex-subtitle-format’ |
|
13120 |
‘:latex-subtitle-separate’ ‘org-latex-subtitle-separate’ |
|
13121 |
‘:latex-table-scientific-notation’ ‘org-latex-table-scientific-notation’ |
|
13122 |
‘:latex-tables-booktabs’ ‘org-latex-tables-booktabs’ |
|
13123 |
‘:latex-tables-centered’ ‘org-latex-tables-centered’ |
|
13124 |
‘:latex-text-markup-alist’ ‘org-latex-text-markup-alist’ |
|
13125 |
‘:latex-title-command’ ‘org-latex-title-command’ |
|
13126 |
‘:latex-toc-command’ ‘org-latex-toc-command’ |
|
13127 |
|
|
13128 |
Markdown specific properties |
|
13129 |
............................ |
|
13130 |
|
|
13131 |
‘:md-footnote-format’ ‘org-md-footnote-format’ |
|
13132 |
‘:md-footnotes-section’ ‘org-md-footnotes-section’ |
|
13133 |
‘:md-headline-style’ ‘org-md-headline-style’ |
|
13134 |
|
|
13135 |
ODT specific properties |
|
13136 |
....................... |
|
13137 |
|
|
13138 |
‘:odt-content-template-file’ ‘org-odt-content-template-file’ |
|
13139 |
‘:odt-display-outline-level’ ‘org-odt-display-outline-level’ |
|
13140 |
‘:odt-fontify-srcblocks’ ‘org-odt-fontify-srcblocks’ |
|
13141 |
‘:odt-format-drawer-function’ ‘org-odt-format-drawer-function’ |
|
13142 |
‘:odt-format-headline-function’ ‘org-odt-format-headline-function’ |
|
13143 |
‘:odt-format-inlinetask-function’ ‘org-odt-format-inlinetask-function’ |
|
13144 |
‘:odt-inline-formula-rules’ ‘org-odt-inline-formula-rules’ |
|
13145 |
‘:odt-inline-image-rules’ ‘org-odt-inline-image-rules’ |
|
13146 |
‘:odt-pixels-per-inch’ ‘org-odt-pixels-per-inch’ |
|
13147 |
‘:odt-styles-file’ ‘org-odt-styles-file’ |
|
13148 |
‘:odt-table-styles’ ‘org-odt-table-styles’ |
|
13149 |
‘:odt-use-date-fields’ ‘org-odt-use-date-fields’ |
|
13150 |
|
|
13151 |
Texinfo specific properties |
|
13152 |
........................... |
|
13153 |
|
|
13154 |
‘:texinfo-active-timestamp-format’ ‘org-texinfo-active-timestamp-format’ |
|
13155 |
‘:texinfo-classes’ ‘org-texinfo-classes’ |
|
13156 |
‘:texinfo-class’ ‘org-texinfo-default-class’ |
|
13157 |
‘:texinfo-table-default-markup’ ‘org-texinfo-table-default-markup’ |
|
13158 |
‘:texinfo-diary-timestamp-format’ ‘org-texinfo-diary-timestamp-format’ |
|
13159 |
‘:texinfo-filename’ ‘org-texinfo-filename’ |
|
13160 |
‘:texinfo-format-drawer-function’ ‘org-texinfo-format-drawer-function’ |
|
13161 |
‘:texinfo-format-headline-function’ ‘org-texinfo-format-headline-function’ |
|
13162 |
‘:texinfo-format-inlinetask-function’ ‘org-texinfo-format-inlinetask-function’ |
|
13163 |
‘:texinfo-inactive-timestamp-format’ ‘org-texinfo-inactive-timestamp-format’ |
|
13164 |
‘:texinfo-link-with-unknown-path-format’ ‘org-texinfo-link-with-unknown-path-format’ |
|
13165 |
‘:texinfo-node-description-column’ ‘org-texinfo-node-description-column’ |
|
13166 |
‘:texinfo-table-scientific-notation’ ‘org-texinfo-table-scientific-notation’ |
|
13167 |
‘:texinfo-tables-verbatim’ ‘org-texinfo-tables-verbatim’ |
|
13168 |
‘:texinfo-text-markup-alist’ ‘org-texinfo-text-markup-alist’ |
|
13169 |
|
|
13170 |
|
|
13171 |
File: org, Node: Publishing links, Next: Sitemap, Prev: Publishing options, Up: Configuration |
|
13172 |
|
|
13173 |
13.1.6 Links between published files |
|
13174 |
------------------------------------ |
|
13175 |
|
|
13176 |
To create a link from one Org file to another, you would use something |
|
13177 |
like ‘[[file:foo.org][The foo]]’ or simply ‘file:foo.org’ (*note |
|
13178 |
External links::). When published, this link becomes a link to |
|
13179 |
‘foo.html’. You can thus interlink the pages of your “org web” project |
|
13180 |
and the links will work as expected when you publish them to HTML. If |
|
13181 |
you also publish the Org source file and want to link to it, use an |
|
13182 |
‘http:’ link instead of a ‘file:’ link, because ‘file:’ links are |
|
13183 |
converted to link to the corresponding ‘html’ file. |
|
13184 |
|
|
13185 |
You may also link to related files, such as images. Provided you are |
|
13186 |
careful with relative file names, and provided you have also configured |
|
13187 |
Org to upload the related files, these links will work too. See *note |
|
13188 |
Complex example::, for an example of this usage. |
|
13189 |
|
|
13190 |
Eventually, links between published documents can contain some search |
|
13191 |
options (*note Search options::), which will be resolved to the |
|
13192 |
appropriate location in the linked file. For example, once published to |
|
13193 |
HTML, the following links all point to a dedicated anchor in ‘foo.html’. |
|
13194 |
|
|
13195 |
[[file:foo.org::*heading]] |
|
13196 |
[[file:foo.org::#custom-id]] |
|
13197 |
[[file:foo.org::target]] |
|
13198 |
|
|
13199 |
|
|
13200 |
File: org, Node: Sitemap, Next: Generating an index, Prev: Publishing links, Up: Configuration |
|
13201 |
|
|
13202 |
13.1.7 Generating a sitemap |
|
13203 |
--------------------------- |
|
13204 |
|
|
13205 |
The following properties may be used to control publishing of a map of |
|
13206 |
files for a given project. |
|
13207 |
|
|
13208 |
‘:auto-sitemap’ When non-‘nil’, publish a sitemap during |
|
13209 |
‘org-publish-current-project’ or |
|
13210 |
‘org-publish-all’. |
|
13211 |
|
|
13212 |
‘:sitemap-filename’ Filename for output of sitemap. Defaults to |
|
13213 |
‘sitemap.org’ (which becomes ‘sitemap.html’). |
|
13214 |
|
|
13215 |
‘:sitemap-title’ Title of sitemap page. Defaults to name of |
|
13216 |
file. |
|
13217 |
|
|
13218 |
‘:sitemap-format-entry’ With this option one can tell how a site-map |
|
13219 |
entry is formatted in the site-map. It is a |
|
13220 |
function called with three arguments: the |
|
13221 |
file or directory name relative to base |
|
13222 |
directory of the project, the site-map style |
|
13223 |
and the current project. It is expected to |
|
13224 |
return a string. Default value turns file |
|
13225 |
names into links and use document titles as |
|
13226 |
descriptions. For specific formatting needs, |
|
13227 |
one can use ‘org-publish-find-date’, |
|
13228 |
‘org-publish-find-title’ and |
|
13229 |
‘org-publish-find-property’, to retrieve |
|
13230 |
additional information about published |
|
13231 |
documents. |
|
13232 |
|
|
13233 |
‘:sitemap-function’ Plug-in function to use for generation of the |
|
13234 |
sitemap. It is called with two arguments: |
|
13235 |
the title of the site-map and a |
|
13236 |
representation of the files and directories |
|
13237 |
involved in the project as a radio list |
|
13238 |
(*note Radio lists::). The latter can |
|
13239 |
further be transformed using |
|
13240 |
‘org-list-to-generic’, ‘org-list-to-subtree’ |
|
13241 |
and alike. Default value generates a plain |
|
13242 |
list of links to all files in the project. |
|
13243 |
|
|
13244 |
‘:sitemap-sort-folders’ Where folders should appear in the sitemap. |
|
13245 |
Set this to ‘first’ (default) or ‘last’ to |
|
13246 |
display folders first or last, respectively. |
|
13247 |
When set to ‘ignore’, folders are ignored |
|
13248 |
altogether. Any other value will mix files |
|
13249 |
and folders. This variable has no effect |
|
13250 |
when site-map style is ‘tree’. |
|
13251 |
|
|
13252 |
‘:sitemap-sort-files’ How the files are sorted in the site map. |
|
13253 |
Set this to ‘alphabetically’ (default), |
|
13254 |
‘chronologically’ or ‘anti-chronologically’. |
|
13255 |
‘chronologically’ sorts the files with older |
|
13256 |
date first while ‘anti-chronologically’ sorts |
|
13257 |
the files with newer date first. |
|
13258 |
‘alphabetically’ sorts the files |
|
13259 |
alphabetically. The date of a file is |
|
13260 |
retrieved with ‘org-publish-find-date’. |
|
13261 |
|
|
13262 |
‘:sitemap-ignore-case’ Should sorting be case-sensitive? Default |
|
13263 |
‘nil’. |
|
13264 |
|
|
13265 |
‘:sitemap-date-format’ Format string for the ‘format-time-string’ |
|
13266 |
function that tells how a sitemap entry’s |
|
13267 |
date is to be formatted. This property |
|
13268 |
bypasses ‘org-publish-sitemap-date-format’ |
|
13269 |
which defaults to ‘%Y-%m-%d’. |
|
13270 |
|
|
13271 |
|
|
13272 |
|
|
13273 |
File: org, Node: Generating an index, Prev: Sitemap, Up: Configuration |
|
13274 |
|
|
13275 |
13.1.8 Generating an index |
|
13276 |
-------------------------- |
|
13277 |
|
|
13278 |
Org mode can generate an index across the files of a publishing project. |
|
13279 |
|
|
13280 |
‘:makeindex’ When non-‘nil’, generate in index in the file |
|
13281 |
‘theindex.org’ and publish it as ‘theindex.html’. |
|
13282 |
|
|
13283 |
The file will be created when first publishing a project with the |
|
13284 |
‘:makeindex’ set. The file only contains a statement ‘#+INCLUDE: |
|
13285 |
"theindex.inc"’. You can then build around this include statement by |
|
13286 |
adding a title, style information, etc. |
|
13287 |
|
|
13288 |
Index entries are specified with ‘#+INDEX’ keyword. An entry that |
|
13289 |
contains an exclamation mark will create a sub item. |
|
13290 |
|
|
13291 |
* Curriculum Vitae |
|
13292 |
#+INDEX: CV |
|
13293 |
#+INDEX: Application!CV |
|
13294 |
|
|
13295 |
|
|
13296 |
File: org, Node: Uploading files, Next: Sample configuration, Prev: Configuration, Up: Publishing |
|
13297 |
|
|
13298 |
13.2 Uploading files |
|
13299 |
==================== |
|
13300 |
|
|
13301 |
For those people already utilizing third party sync tools such as |
|
13302 |
‘rsync’ or ‘unison’, it might be preferable not to use the built in |
|
13303 |
remote publishing facilities of Org mode which rely heavily on Tramp. |
|
13304 |
Tramp, while very useful and powerful, tends not to be so efficient for |
|
13305 |
multiple file transfer and has been known to cause problems under heavy |
|
13306 |
usage. |
|
13307 |
|
|
13308 |
Specialized synchronization utilities offer several advantages. In |
|
13309 |
addition to timestamp comparison, they also do content and |
|
13310 |
permissions/attribute checks. For this reason you might prefer to |
|
13311 |
publish your web to a local directory (possibly even in place with your |
|
13312 |
Org files) and then use ‘unison’ or ‘rsync’ to do the synchronization |
|
13313 |
with the remote host. |
|
13314 |
|
|
13315 |
Since Unison (for example) can be configured as to which files to |
|
13316 |
transfer to a certain remote destination, it can greatly simplify the |
|
13317 |
project publishing definition. Simply keep all files in the correct |
|
13318 |
location, process your Org files with ‘org-publish’ and let the |
|
13319 |
synchronization tool do the rest. You do not need, in this scenario, to |
|
13320 |
include attachments such as ‘jpg’, ‘css’ or ‘gif’ files in the project |
|
13321 |
definition since the 3rd party tool syncs them. |
|
13322 |
|
|
13323 |
Publishing to a local directory is also much faster than to a remote |
|
13324 |
one, so that you can afford more easily to republish entire projects. |
|
13325 |
If you set ‘org-publish-use-timestamps-flag’ to ‘nil’, you gain the main |
|
13326 |
benefit of re-including any changed external files such as source |
|
13327 |
example files you might include with ‘#+INCLUDE:’. The timestamp |
|
13328 |
mechanism in Org is not smart enough to detect if included files have |
|
13329 |
been modified. |
|
13330 |
|
|
13331 |
|
|
13332 |
File: org, Node: Sample configuration, Next: Triggering publication, Prev: Uploading files, Up: Publishing |
|
13333 |
|
|
13334 |
13.3 Sample configuration |
|
13335 |
========================= |
|
13336 |
|
|
13337 |
Below we provide two example configurations. The first one is a simple |
|
13338 |
project publishing only a set of Org files. The second example is more |
|
13339 |
complex, with a multi-component project. |
|
13340 |
|
|
13341 |
* Menu: |
|
13342 |
|
|
13343 |
* Simple example:: One-component publishing |
|
13344 |
* Complex example:: A multi-component publishing example |
|
13345 |
|
|
13346 |
|
|
13347 |
File: org, Node: Simple example, Next: Complex example, Up: Sample configuration |
|
13348 |
|
|
13349 |
13.3.1 Example: simple publishing configuration |
|
13350 |
----------------------------------------------- |
|
13351 |
|
|
13352 |
This example publishes a set of Org files to the ‘public_html’ directory |
|
13353 |
on the local machine. |
|
13354 |
|
|
13355 |
(setq org-publish-project-alist |
|
13356 |
'(("org" |
|
13357 |
:base-directory "~/org/" |
|
13358 |
:publishing-directory "~/public_html" |
|
13359 |
:publishing-function org-html-publish-to-html |
|
13360 |
:section-numbers nil |
|
13361 |
:with-toc nil |
|
13362 |
:html-head "<link rel=\"stylesheet\" |
|
13363 |
href=\"../other/mystyle.css\" |
|
13364 |
type=\"text/css\"/>"))) |
|
13365 |
|
|
13366 |
|
|
13367 |
File: org, Node: Complex example, Prev: Simple example, Up: Sample configuration |
|
13368 |
|
|
13369 |
13.3.2 Example: complex publishing configuration |
|
13370 |
------------------------------------------------ |
|
13371 |
|
|
13372 |
This more complicated example publishes an entire website, including Org |
|
13373 |
files converted to HTML, image files, Emacs Lisp source code, and style |
|
13374 |
sheets. The publishing directory is remote and private files are |
|
13375 |
excluded. |
|
13376 |
|
|
13377 |
To ensure that links are preserved, care should be taken to replicate |
|
13378 |
your directory structure on the web server, and to use relative file |
|
13379 |
paths. For example, if your Org files are kept in ‘~/org’ and your |
|
13380 |
publishable images in ‘~/images’, you would link to an image with |
|
13381 |
file:../images/myimage.png |
|
13382 |
On the web server, the relative path to the image should be the same. |
|
13383 |
You can accomplish this by setting up an "images" folder in the right |
|
13384 |
place on the web server, and publishing images to it. |
|
13385 |
|
|
13386 |
(setq org-publish-project-alist |
|
13387 |
'(("orgfiles" |
|
13388 |
:base-directory "~/org/" |
|
13389 |
:base-extension "org" |
|
13390 |
:publishing-directory "/ssh:user@host:~/html/notebook/" |
|
13391 |
:publishing-function org-html-publish-to-html |
|
13392 |
:exclude "PrivatePage.org" ;; regexp |
|
13393 |
:headline-levels 3 |
|
13394 |
:section-numbers nil |
|
13395 |
:with-toc nil |
|
13396 |
:html-head "<link rel=\"stylesheet\" |
|
13397 |
href=\"../other/mystyle.css\" type=\"text/css\"/>" |
|
13398 |
:html-preamble t) |
|
13399 |
|
|
13400 |
("images" |
|
13401 |
:base-directory "~/images/" |
|
13402 |
:base-extension "jpg\\|gif\\|png" |
|
13403 |
:publishing-directory "/ssh:user@host:~/html/images/" |
|
13404 |
:publishing-function org-publish-attachment) |
|
13405 |
|
|
13406 |
("other" |
|
13407 |
:base-directory "~/other/" |
|
13408 |
:base-extension "css\\|el" |
|
13409 |
:publishing-directory "/ssh:user@host:~/html/other/" |
|
13410 |
:publishing-function org-publish-attachment) |
|
13411 |
("website" :components ("orgfiles" "images" "other")))) |
|
13412 |
|
|
13413 |
|
|
13414 |
File: org, Node: Triggering publication, Prev: Sample configuration, Up: Publishing |
|
13415 |
|
|
13416 |
13.4 Triggering publication |
|
13417 |
=========================== |
|
13418 |
|
|
13419 |
Once properly configured, Org can publish with the following commands: |
|
13420 |
|
|
13421 |
‘C-c C-e P x (org-publish)’ |
|
13422 |
Prompt for a specific project and publish all files that belong to |
|
13423 |
it. |
|
13424 |
‘C-c C-e P p (org-publish-current-project)’ |
|
13425 |
Publish the project containing the current file. |
|
13426 |
‘C-c C-e P f (org-publish-current-file)’ |
|
13427 |
Publish only the current file. |
|
13428 |
‘C-c C-e P a (org-publish-all)’ |
|
13429 |
Publish every project. |
|
13430 |
|
|
13431 |
Org uses timestamps to track when a file has changed. The above |
|
13432 |
functions normally only publish changed files. You can override this |
|
13433 |
and force publishing of all files by giving a prefix argument to any of |
|
13434 |
the commands above, or by customizing the variable |
|
13435 |
‘org-publish-use-timestamps-flag’. This may be necessary in particular |
|
13436 |
if files include other files via ‘#+SETUPFILE:’ or ‘#+INCLUDE:’. |
|
13437 |
|
|
13438 |
|
|
13439 |
File: org, Node: Working with source code, Next: Miscellaneous, Prev: Publishing, Up: Top |
|
13440 |
|
|
13441 |
14 Working with source code |
|
13442 |
*************************** |
|
13443 |
|
|
13444 |
Source code here refers to any code typed in Org mode documents. Org |
|
13445 |
can manage source code in any Org file once such code is tagged with |
|
13446 |
begin and end markers. Working with source code begins with tagging |
|
13447 |
source code blocks. Tagged ‘src’ code blocks are not restricted to the |
|
13448 |
preamble or the end of an Org document; they can go anywhere—with a few |
|
13449 |
exceptions, such as not inside comments and fixed width areas. Here’s a |
|
13450 |
sample ‘src’ code block in emacs-lisp: |
|
13451 |
|
|
13452 |
#+BEGIN_SRC emacs-lisp |
|
13453 |
(defun org-xor (a b) |
|
13454 |
"Exclusive or." |
|
13455 |
(if a (not b) b)) |
|
13456 |
#+END_SRC |
|
13457 |
|
|
13458 |
Org can take the code in the block between the ‘#+BEGIN_SRC’ and |
|
13459 |
‘#+END_SRC’ tags, and format, compile, execute, and show the results. |
|
13460 |
Org can simplify many housekeeping tasks essential to modern code |
|
13461 |
maintenance. That’s why these blocks in Org mode literature are |
|
13462 |
sometimes referred to as ‘live code’ blocks (as compared to the static |
|
13463 |
text and documentation around it). Users can control how ‘live’ they |
|
13464 |
want each block by tweaking the headers for compiling, execution, |
|
13465 |
extraction. |
|
13466 |
|
|
13467 |
Org’s ‘src’ code block type is one of many block types, such as |
|
13468 |
quote, export, verse, latex, example, and verbatim. This section |
|
13469 |
pertains to ‘src’ code blocks between ‘#+BEGIN_SRC’ and ‘#+END_SRC’ |
|
13470 |
|
|
13471 |
For editing ‘src’ code blocks, Org provides native Emacs major-modes. |
|
13472 |
That leverages the latest Emacs features for that source code language |
|
13473 |
mode. |
|
13474 |
|
|
13475 |
For exporting, Org can then extract ‘src’ code blocks into compilable |
|
13476 |
source files (in a conversion process known as “tangling” in literate |
|
13477 |
programming terminology). |
|
13478 |
|
|
13479 |
For publishing, Org’s back-ends can handle the ‘src’ code blocks and |
|
13480 |
the text for output to a variety of formats with native syntax |
|
13481 |
highlighting. |
|
13482 |
|
|
13483 |
For executing the source code in the ‘src’ code blocks, Org provides |
|
13484 |
facilities that glue the tasks of compiling, collecting the results of |
|
13485 |
the execution, and inserting them back to the Org file. Besides text |
|
13486 |
output, results may include links to other data types that Emacs can |
|
13487 |
handle: audio, video, and graphics. |
|
13488 |
|
|
13489 |
An important feature of Org’s execution of the ‘src’ code blocks is |
|
13490 |
passing variables, functions, and results between ‘src’ blocks. Such |
|
13491 |
interoperability uses a common syntax even if these ‘src’ blocks are in |
|
13492 |
different source code languages. The integration extends to linking the |
|
13493 |
debugger’s error messages to the line in the ‘src’ code block in the Org |
|
13494 |
file. That should partly explain why this functionality by the original |
|
13495 |
contributors, Eric Schulte and Dan Davison, was called ‘Org Babel’. |
|
13496 |
|
|
13497 |
In literate programming, the main appeal is code and documentation |
|
13498 |
co-existing in one file. Org mode takes this several steps further. |
|
13499 |
First by enabling execution, and then by inserting results of that |
|
13500 |
execution back into the Org file. Along the way, Org provides extensive |
|
13501 |
formatting features, including handling tables. Org handles multiple |
|
13502 |
source code languages in one file, and provides a common syntax for |
|
13503 |
passing variables, functions, and results between ‘src’ code blocks. |
|
13504 |
|
|
13505 |
Org mode fulfills the promise of easy verification and maintenance of |
|
13506 |
publishing reproducible research by keeping all these in the same file: |
|
13507 |
text, data, code, configuration settings of the execution environment, |
|
13508 |
the results of the execution, and associated narratives, claims, |
|
13509 |
references, and internal and external links. |
|
13510 |
|
|
13511 |
Details of Org’s facilities for working with source code are shown |
|
13512 |
next. |
|
13513 |
|
|
13514 |
* Menu: |
|
13515 |
|
|
13516 |
* Structure of code blocks:: Code block syntax described |
|
13517 |
* Editing source code:: Language major-mode editing |
|
13518 |
* Exporting code blocks:: Export contents and/or results |
|
13519 |
* Extracting source code:: Create pure source code files |
|
13520 |
* Evaluating code blocks:: Place results of evaluation in the Org mode buffer |
|
13521 |
* Library of Babel:: Use and contribute to a library of useful code blocks |
|
13522 |
* Languages:: List of supported code block languages |
|
13523 |
* Header arguments:: Configure code block functionality |
|
13524 |
* Results of evaluation:: How evaluation results are handled |
|
13525 |
* Noweb reference syntax:: Literate programming in Org mode |
|
13526 |
* Key bindings and useful functions:: Work quickly with code blocks |
|
13527 |
* Batch execution:: Call functions from the command line |
|
13528 |
|
|
13529 |
|
|
13530 |
File: org, Node: Structure of code blocks, Next: Editing source code, Up: Working with source code |
|
13531 |
|
|
13532 |
14.1 Structure of code blocks |
|
13533 |
============================= |
|
13534 |
|
|
13535 |
Org offers two ways to structure source code in Org documents: in a |
|
13536 |
‘src’ block, and directly inline. Both specifications are shown below. |
|
13537 |
|
|
13538 |
A ‘src’ block conforms to this structure: |
|
13539 |
|
|
13540 |
#+NAME: <name> |
|
13541 |
#+BEGIN_SRC <language> <switches> <header arguments> |
|
13542 |
<body> |
|
13543 |
#+END_SRC |
|
13544 |
|
|
13545 |
Org mode’s templates system (*note Easy templates::) speeds up |
|
13546 |
creating ‘src’ code blocks with just three keystrokes. Do not be |
|
13547 |
put-off by having to remember the source block syntax. Org also works |
|
13548 |
with other completion systems in Emacs, some of which predate Org and |
|
13549 |
have custom domain-specific languages for defining templates. Regular |
|
13550 |
use of templates reduces errors, increases accuracy, and maintains |
|
13551 |
consistency. |
|
13552 |
|
|
13553 |
An inline code block conforms to this structure: |
|
13554 |
|
|
13555 |
src_<language>{<body>} |
|
13556 |
|
|
13557 |
or |
|
13558 |
|
|
13559 |
src_<language>[<header arguments>]{<body>} |
|
13560 |
|
|
13561 |
‘#+NAME: <name>’ |
|
13562 |
Optional. Names the ‘src’ block so it can be called, like a |
|
13563 |
function, from other ‘src’ blocks or inline blocks to evaluate or |
|
13564 |
to capture the results. Code from other blocks, other files, and |
|
13565 |
from table formulas (*note The spreadsheet::) can use the name to |
|
13566 |
reference a ‘src’ block. This naming serves the same purpose as |
|
13567 |
naming Org tables. Org mode requires unique names. For duplicate |
|
13568 |
names, Org mode’s behavior is undefined. |
|
13569 |
‘#+BEGIN_SRC’ |
|
13570 |
‘#+END_SRC’ |
|
13571 |
Mandatory. They mark the start and end of a block that Org |
|
13572 |
requires. The ‘#+BEGIN_SRC’ line takes additional arguments, as |
|
13573 |
described next. |
|
13574 |
‘<language>’ |
|
13575 |
Mandatory for live code blocks. It is the identifier of the source |
|
13576 |
code language in the block. *Note Languages::, for identifiers of |
|
13577 |
supported languages. |
|
13578 |
‘<switches>’ |
|
13579 |
Optional. Switches provide finer control of the code execution, |
|
13580 |
export, and format (see the discussion of switches in *note Literal |
|
13581 |
examples::) |
|
13582 |
‘<header arguments>’ |
|
13583 |
Optional. Heading arguments control many aspects of evaluation, |
|
13584 |
export and tangling of code blocks (*note Header arguments::). |
|
13585 |
Using Org’s properties feature, header arguments can be selectively |
|
13586 |
applied to the entire buffer or specific sub-trees of the Org |
|
13587 |
document. |
|
13588 |
‘source code, header arguments’ |
|
13589 |
‘<body>’ |
|
13590 |
Source code in the dialect of the specified language identifier. |
|
13591 |
|
|
13592 |
|
|
13593 |
File: org, Node: Editing source code, Next: Exporting code blocks, Prev: Structure of code blocks, Up: Working with source code |
|
13594 |
|
|
13595 |
14.2 Editing source code |
|
13596 |
======================== |
|
13597 |
|
|
13598 |
‘C-c '’ for editing the current code block. It opens a new major-mode |
|
13599 |
edit buffer containing the body of the ‘src’ code block, ready for any |
|
13600 |
edits. ‘C-c '’ again to close the buffer and return to the Org buffer. |
|
13601 |
|
|
13602 |
‘C-x C-s’ saves the buffer and updates the contents of the Org |
|
13603 |
buffer. |
|
13604 |
|
|
13605 |
Set ‘org-edit-src-auto-save-idle-delay’ to save the base buffer after |
|
13606 |
a certain idle delay time. |
|
13607 |
|
|
13608 |
Set ‘org-edit-src-turn-on-auto-save’ to auto-save this buffer into a |
|
13609 |
separate file using ‘auto-save-mode’. |
|
13610 |
|
|
13611 |
‘C-c '’ to close the major-mode buffer and return back to the Org |
|
13612 |
buffer. |
|
13613 |
|
|
13614 |
While editing the source code in the major-mode, the ‘org-src-mode’ |
|
13615 |
minor mode remains active. It provides these customization variables as |
|
13616 |
described below. For even more variables, look in the customization |
|
13617 |
group ‘org-edit-structure’. |
|
13618 |
|
|
13619 |
‘org-src-lang-modes’ |
|
13620 |
If an Emacs major-mode named ‘<lang>-mode’ exists, where ‘<lang>’ |
|
13621 |
is the language identifier from code block’s header line, then the |
|
13622 |
edit buffer uses that major-mode. Use this variable to arbitrarily |
|
13623 |
map language identifiers to major modes. |
|
13624 |
‘org-src-window-setup’ |
|
13625 |
For specifying Emacs window arrangement when the new edit buffer is |
|
13626 |
created. |
|
13627 |
‘org-src-preserve-indentation’ |
|
13628 |
Default is ‘nil’. Source code is indented. This indentation |
|
13629 |
applies during export or tangling, and depending on the context, |
|
13630 |
may alter leading spaces and tabs. When non-‘nil’, source code is |
|
13631 |
aligned with the leftmost column. No lines are modified during |
|
13632 |
export or tangling, which is very useful for white-space sensitive |
|
13633 |
languages, such as Python. |
|
13634 |
‘org-src-ask-before-returning-to-edit-buffer’ |
|
13635 |
When ‘nil’, Org returns to the edit buffer without further prompts. |
|
13636 |
The default prompts for a confirmation. |
|
13637 |
|
|
13638 |
Set ‘org-src-fontify-natively’ to non-‘nil’ to turn on native code |
|
13639 |
fontification in the _Org_ buffer. Fontification of ‘src’ code blocks |
|
13640 |
can give visual separation of text and code on the display page. To |
|
13641 |
further customize the appearance of ‘org-block’ for specific languages, |
|
13642 |
customize ‘org-src-block-faces’. The following example shades the |
|
13643 |
background of regular blocks, and colors source blocks only for Python |
|
13644 |
and Emacs-Lisp languages. |
|
13645 |
(require 'color) |
|
13646 |
(set-face-attribute 'org-block nil :background |
|
13647 |
(color-darken-name |
|
13648 |
(face-attribute 'default :background) 3)) |
|
13649 |
|
|
13650 |
(setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF")) |
|
13651 |
("python" (:background "#E5FFB8")))) |
|
13652 |
|
|
13653 |
|
|
13654 |
File: org, Node: Exporting code blocks, Next: Extracting source code, Prev: Editing source code, Up: Working with source code |
|
13655 |
|
|
13656 |
14.3 Exporting code blocks |
|
13657 |
========================== |
|
13658 |
|
|
13659 |
Org can flexibly export just the _code_ from the code blocks, just the |
|
13660 |
_results_ of evaluation of the code block, _both_ the code and the |
|
13661 |
results of the code block evaluation, or _none_. Org defaults to |
|
13662 |
exporting _code_ for most languages. For some languages, such as |
|
13663 |
‘ditaa’, Org defaults to _results_. To export just the body of code |
|
13664 |
blocks, *note Literal examples::. To selectively export sub-trees of an |
|
13665 |
Org document, *note Exporting::. |
|
13666 |
|
|
13667 |
The ‘:exports’ header arguments control exporting code blocks only |
|
13668 |
and not inline code: |
|
13669 |
|
|
13670 |
Header arguments: |
|
13671 |
................. |
|
13672 |
|
|
13673 |
‘:exports code’ |
|
13674 |
This is the default for most languages where the body of the code |
|
13675 |
block is exported. See *note Literal examples:: for more. |
|
13676 |
‘:exports results’ |
|
13677 |
On export, Org includes only the results and not the code block. |
|
13678 |
After each evaluation, Org inserts the results after the end of |
|
13679 |
code block in the Org buffer. By default, Org replaces any |
|
13680 |
previous results. Org can also append results. |
|
13681 |
‘:exports both’ |
|
13682 |
Org exports both the code block and the results. |
|
13683 |
‘:exports none’ |
|
13684 |
Org does not export the code block nor the results. |
|
13685 |
|
|
13686 |
To stop Org from evaluating code blocks to speed exports, use the |
|
13687 |
header argument ‘:eval never-export’ (*note eval::). To stop Org from |
|
13688 |
evaluating code blocks for greater security, set the |
|
13689 |
‘org-export-use-babel’ variable to ‘nil’, but understand that header |
|
13690 |
arguments will have no effect. |
|
13691 |
|
|
13692 |
Turning off evaluation comes in handy when batch processing. For |
|
13693 |
example, markup languages for wikis, which have a high risk of untrusted |
|
13694 |
code. Stopping code block evaluation also stops evaluation of all |
|
13695 |
header arguments of the code block. This may not be desirable in some |
|
13696 |
circumstances. So during export, to allow evaluation of just the header |
|
13697 |
arguments but not any code evaluation in the source block, set ‘:eval |
|
13698 |
never-export’ (*note eval::). |
|
13699 |
|
|
13700 |
Org never evaluates code blocks in commented sub-trees when exporting |
|
13701 |
(*note Comment lines::). On the other hand, Org does evaluate code |
|
13702 |
blocks in sub-trees excluded from export (*note Export settings::). |
|
13703 |
|
|
13704 |
|
|
13705 |
File: org, Node: Extracting source code, Next: Evaluating code blocks, Prev: Exporting code blocks, Up: Working with source code |
|
13706 |
|
|
13707 |
14.4 Extracting source code |
|
13708 |
=========================== |
|
13709 |
|
|
13710 |
Extracting source code from code blocks is a basic task in literate |
|
13711 |
programming. Org has features to make this easy. In literate |
|
13712 |
programming parlance, documents on creation are _woven_ with code and |
|
13713 |
documentation, and on export, the code is _tangled_ for execution by a |
|
13714 |
computer. Org facilitates weaving and tangling for producing, |
|
13715 |
maintaining, sharing, and exporting literate programming documents. Org |
|
13716 |
provides extensive customization options for extracting source code. |
|
13717 |
|
|
13718 |
When Org tangles ‘src’ code blocks, it expands, merges, and |
|
13719 |
transforms them. Then Org recomposes them into one or more separate |
|
13720 |
files, as configured through the options. During this _tangling_ |
|
13721 |
process, Org expands variables in the source code, and resolves any |
|
13722 |
Noweb style references (*note Noweb reference syntax::). |
|
13723 |
|
|
13724 |
Header arguments |
|
13725 |
................ |
|
13726 |
|
|
13727 |
‘:tangle no’ |
|
13728 |
By default, Org does not tangle the ‘src’ code block on export. |
|
13729 |
‘:tangle yes’ |
|
13730 |
Org extracts the contents of the code block for the tangled output. |
|
13731 |
By default, the output file name is the same as the Org file but |
|
13732 |
with a file extension derived from the language identifier of the |
|
13733 |
‘src’ code block. |
|
13734 |
‘:tangle filename’ |
|
13735 |
Override the default file name with this one for the tangled |
|
13736 |
output. |
|
13737 |
|
|
13738 |
Functions |
|
13739 |
......... |
|
13740 |
|
|
13741 |
‘org-babel-tangle’ |
|
13742 |
Tangle the current file. Bound to ‘C-c C-v t’. |
|
13743 |
|
|
13744 |
With prefix argument only tangle the current ‘src’ code block. |
|
13745 |
‘org-babel-tangle-file’ |
|
13746 |
Choose a file to tangle. Bound to ‘C-c C-v f’. |
|
13747 |
|
|
13748 |
Hooks |
|
13749 |
..... |
|
13750 |
|
|
13751 |
‘org-babel-post-tangle-hook’ |
|
13752 |
This hook runs from within code tangled by ‘org-babel-tangle’, |
|
13753 |
making it suitable for post-processing, compilation, and evaluation |
|
13754 |
of code in the tangled files. |
|
13755 |
|
|
13756 |
Jumping between code and Org |
|
13757 |
............................ |
|
13758 |
|
|
13759 |
Debuggers normally link errors and messages back to the source code. |
|
13760 |
But for tangled files, we want to link back to the Org file, not to the |
|
13761 |
tangled source file. To make this extra jump, Org uses |
|
13762 |
‘org-babel-tangle-jump-to-org’ function with two additional source code |
|
13763 |
block header arguments: One, set ‘padline’ (*note padline::) to true |
|
13764 |
(the default setting). Two, set ‘comments’ (*note comments::) to |
|
13765 |
‘link’, which makes Org insert links to the Org file. |
|
13766 |
|
|
13767 |
|
|
13768 |
File: org, Node: Evaluating code blocks, Next: Library of Babel, Prev: Extracting source code, Up: Working with source code |
|
13769 |
|
|
13770 |
14.5 Evaluating code blocks |
|
13771 |
=========================== |
|
13772 |
|
|
13773 |
A note about security: With code evaluation comes the risk of harm. Org |
|
13774 |
safeguards by prompting for user’s permission before executing any code |
|
13775 |
in the source block. To customize this safeguard (or disable it) see |
|
13776 |
*note Code evaluation security::. |
|
13777 |
|
|
13778 |
Org captures the results of the ‘src’ code block evaluation and |
|
13779 |
inserts them in the Org file, right after the ‘src’ code block. The |
|
13780 |
insertion point is after a newline and the ‘#+RESULTS’ label. Org |
|
13781 |
creates the ‘#+RESULTS’ label if one is not already there. |
|
13782 |
|
|
13783 |
By default, Org enables only ‘emacs-lisp’ ‘src’ code blocks for |
|
13784 |
execution. See *note Languages:: for identifiers to enable other |
|
13785 |
languages. |
|
13786 |
|
|
13787 |
Org provides many ways to execute ‘src’ code blocks. ‘C-c C-c’ or |
|
13788 |
‘C-c C-v e’ with the point on a ‘src’ code block(1) calls the |
|
13789 |
‘org-babel-execute-src-block’ function, which executes the code in the |
|
13790 |
block, collects the results, and inserts them in the buffer. |
|
13791 |
|
|
13792 |
By calling a named code block(2) from an Org mode buffer or a table. |
|
13793 |
Org can call the named ‘src’ code blocks from the current Org mode |
|
13794 |
buffer or from the “Library of Babel” (*note Library of Babel::). |
|
13795 |
Whether inline syntax or the ‘#+CALL:’ syntax is used, the result is |
|
13796 |
wrapped based on the variable ‘org-babel-inline-result-wrap’, which by |
|
13797 |
default is set to ‘"=%s="’ to produce verbatim text suitable for markup. |
|
13798 |
|
|
13799 |
The syntax for ‘#+CALL:’ is |
|
13800 |
|
|
13801 |
#+CALL: <name>(<arguments>) |
|
13802 |
#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments> |
|
13803 |
|
|
13804 |
The syntax for inline named code block is |
|
13805 |
|
|
13806 |
... call_<name>(<arguments>) ... |
|
13807 |
... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ... |
|
13808 |
|
|
13809 |
‘<name>’ |
|
13810 |
This is the name of the code block to be evaluated (*note Structure |
|
13811 |
of code blocks::). |
|
13812 |
‘<arguments>’ |
|
13813 |
Org passes arguments to the code block using standard function call |
|
13814 |
syntax. For example, a ‘#+CALL:’ line that passes ‘4’ to a code |
|
13815 |
block named ‘double’, which declares the header argument ‘:var |
|
13816 |
n=2’, would be written as ‘#+CALL: double(n=4)’. Note how this |
|
13817 |
function call syntax is different from the header argument syntax. |
|
13818 |
‘<inside header arguments>’ |
|
13819 |
Org passes inside header arguments to the named ‘src’ code block |
|
13820 |
using the header argument syntax. Inside header arguments apply to |
|
13821 |
code block evaluation. For example, ‘[:results output]’ collects |
|
13822 |
results printed to ‘STDOUT’ during code execution of that block. |
|
13823 |
Note how this header argument syntax is different from the function |
|
13824 |
call syntax. |
|
13825 |
‘<end header arguments>’ |
|
13826 |
End header arguments affect the results returned by the code block. |
|
13827 |
For example, ‘:results html’ wraps the results in a ‘BEGIN_EXPORT |
|
13828 |
html’ block before inserting the results in the Org buffer. |
|
13829 |
|
|
13830 |
For more examples of header arguments for ‘#+CALL:’ lines, *note |
|
13831 |
Arguments in function calls::. |
|
13832 |
|
|
13833 |
---------- Footnotes ---------- |
|
13834 |
|
|
13835 |
(1) The option ‘org-babel-no-eval-on-ctrl-c-ctrl-c’ can be used to |
|
13836 |
remove code evaluation from the ‘C-c C-c’ key binding. |
|
13837 |
|
|
13838 |
(2) Actually, the constructs call_<name>() and src_<lang>{} are not |
|
13839 |
evaluated when they appear in a keyword line (i.e. lines starting with |
|
13840 |
‘#+KEYWORD:’, *note In-buffer settings::). |
|
13841 |
|
|
13842 |
|
|
13843 |
File: org, Node: Library of Babel, Next: Languages, Prev: Evaluating code blocks, Up: Working with source code |
|
13844 |
|
|
13845 |
14.6 Library of Babel |
|
13846 |
===================== |
|
13847 |
|
|
13848 |
The “Library of Babel” is a collection of code blocks. Like a function |
|
13849 |
library, these code blocks can be called from other Org files. A |
|
13850 |
collection of useful code blocks is available on Worg |
|
13851 |
(https://orgmode.org/worg/library-of-babel.html). For remote code block |
|
13852 |
evaluation syntax, *note Evaluating code blocks::. |
|
13853 |
|
|
13854 |
For any user to add code to the library, first save the code in |
|
13855 |
regular ‘src’ code blocks of an Org file, and then load the Org file |
|
13856 |
with ‘org-babel-lob-ingest’, which is bound to ‘C-c C-v i’. |
|
13857 |
|
|
13858 |
|
|
13859 |
File: org, Node: Languages, Next: Header arguments, Prev: Library of Babel, Up: Working with source code |
|
13860 |
|
|
13861 |
14.7 Languages |
|
13862 |
============== |
|
13863 |
|
|
13864 |
Org supports the following languages for the ‘src’ code blocks: |
|
13865 |
|
|
13866 |
Language Identifier Language Identifier |
|
13867 |
---------------------------------------------------------------------------- |
|
13868 |
Asymptote asymptote Awk awk |
|
13869 |
C C C++ C++ |
|
13870 |
Clojure clojure CSS css |
|
13871 |
D d ditaa ditaa |
|
13872 |
Graphviz dot Emacs Calc calc |
|
13873 |
Emacs Lisp emacs-lisp Fortran fortran |
|
13874 |
gnuplot gnuplot Haskell haskell |
|
13875 |
Java java Javascript js |
|
13876 |
LaTeX latex Ledger ledger |
|
13877 |
Lisp lisp Lilypond lilypond |
|
13878 |
Lua lua MATLAB matlab |
|
13879 |
Mscgen mscgen Objective Caml ocaml |
|
13880 |
Octave octave Org mode org |
|
13881 |
Oz oz Perl perl |
|
13882 |
Plantuml plantuml Processing.js processing |
|
13883 |
Python python R R |
|
13884 |
Ruby ruby Sass sass |
|
13885 |
Scheme scheme GNU Screen screen |
|
13886 |
Sed sed shell sh |
|
13887 |
SQL sql SQLite sqlite |
|
13888 |
Vala vala |
|
13889 |
|
|
13890 |
Additional documentation for some languages are at |
|
13891 |
<https://orgmode.org/worg/org-contrib/babel/languages.html>. |
|
13892 |
|
|
13893 |
By default, only ‘emacs-lisp’ is enabled for evaluation. To enable |
|
13894 |
or disable other languages, customize the ‘org-babel-load-languages’ |
|
13895 |
variable either through the Emacs customization interface, or by adding |
|
13896 |
code to the init file as shown next: |
|
13897 |
|
|
13898 |
In this example, evaluation is disabled for ‘emacs-lisp’, and enabled |
|
13899 |
for ‘R’. |
|
13900 |
|
|
13901 |
(org-babel-do-load-languages |
|
13902 |
'org-babel-load-languages |
|
13903 |
'((emacs-lisp . nil) |
|
13904 |
(R . t))) |
|
13905 |
|
|
13906 |
Note that this is not the only way to enable a language. Org also |
|
13907 |
enables languages when loaded with ‘require’ statement. For example, |
|
13908 |
the following enables execution of ‘clojure’ code blocks: |
|
13909 |
|
|
13910 |
(require 'ob-clojure) |
|
13911 |
|
|
13912 |
|
|
13913 |
File: org, Node: Header arguments, Next: Results of evaluation, Prev: Languages, Up: Working with source code |
|
13914 |
|
|
13915 |
14.8 Header arguments |
|
13916 |
===================== |
|
13917 |
|
|
13918 |
Details of configuring header arguments are shown here. |
|
13919 |
|
|
13920 |
* Menu: |
|
13921 |
|
|
13922 |
* Using header arguments:: Different ways to set header arguments |
|
13923 |
* Specific header arguments:: List of header arguments |
|
13924 |
|
|
13925 |
|
|
13926 |
File: org, Node: Using header arguments, Next: Specific header arguments, Up: Header arguments |
|
13927 |
|
|
13928 |
14.8.1 Using header arguments |
|
13929 |
----------------------------- |
|
13930 |
|
|
13931 |
Since header arguments can be set in several ways, Org prioritizes them |
|
13932 |
in case of overlaps or conflicts by giving local settings a higher |
|
13933 |
priority. Header values in function calls, for example, override header |
|
13934 |
values from global defaults. |
|
13935 |
* Menu: |
|
13936 |
|
|
13937 |
* System-wide header arguments:: Set globally, language-specific |
|
13938 |
* Language-specific header arguments:: Set in the Org file’s headers |
|
13939 |
* Header arguments in Org mode properties:: Set in the Org file |
|
13940 |
* Language-specific mode properties:: |
|
13941 |
* Code block specific header arguments:: The most commonly used method |
|
13942 |
* Arguments in function calls:: The most specific level, takes highest priority |
|
13943 |
|
|
13944 |
|
|
13945 |
File: org, Node: System-wide header arguments, Next: Language-specific header arguments, Up: Using header arguments |
|
13946 |
|
|
13947 |
System-wide header arguments |
|
13948 |
............................ |
|
13949 |
|
|
13950 |
System-wide values of header arguments can be specified by adapting the |
|
13951 |
‘org-babel-default-header-args’ variable: |
|
13952 |
|
|
13953 |
:session => "none" |
|
13954 |
:results => "replace" |
|
13955 |
:exports => "code" |
|
13956 |
:cache => "no" |
|
13957 |
:noweb => "no" |
|
13958 |
|
|
13959 |
This example sets ‘:noweb’ header arguments to ‘yes’, which makes Org |
|
13960 |
expand ‘:noweb’ references by default. |
|
13961 |
|
|
13962 |
(setq org-babel-default-header-args |
|
13963 |
(cons '(:noweb . "yes") |
|
13964 |
(assq-delete-all :noweb org-babel-default-header-args))) |
|
13965 |
|
|
13966 |
|
|
13967 |
File: org, Node: Language-specific header arguments, Next: Header arguments in Org mode properties, Prev: System-wide header arguments, Up: Using header arguments |
|
13968 |
|
|
13969 |
Language-specific header arguments |
|
13970 |
.................................. |
|
13971 |
|
|
13972 |
Each language can have separate default header arguments by customizing |
|
13973 |
the variable ‘org-babel-default-header-args:<lang>’, where ‘<lang>’ is |
|
13974 |
the name of the language. For details, see the language-specific online |
|
13975 |
documentation at <https://orgmode.org/worg/org-contrib/babel/>. |
|
13976 |
|
|
13977 |
|
|
13978 |
File: org, Node: Header arguments in Org mode properties, Next: Language-specific mode properties, Prev: Language-specific header arguments, Up: Using header arguments |
|
13979 |
|
|
13980 |
Header arguments in Org mode properties |
|
13981 |
....................................... |
|
13982 |
|
|
13983 |
For header arguments applicable to the buffer, use ‘#+PROPERTY:’ lines |
|
13984 |
anywhere in the Org mode file (*note Property syntax::). |
|
13985 |
|
|
13986 |
The following example sets only for ‘R’ code blocks to ‘session’, |
|
13987 |
making all the ‘R’ code blocks execute in the same session. Setting |
|
13988 |
‘results’ to ‘silent’ ignores the results of executions for all blocks, |
|
13989 |
not just ‘R’ code blocks; no results inserted for any block. |
|
13990 |
|
|
13991 |
#+PROPERTY: header-args:R :session *R* |
|
13992 |
#+PROPERTY: header-args :results silent |
|
13993 |
|
|
13994 |
Header arguments set through Org’s property drawers (*note Property |
|
13995 |
syntax::) apply at the sub-tree level on down. Since these property |
|
13996 |
drawers can appear anywhere in the file hierarchy, Org uses outermost |
|
13997 |
call or source block to resolve the values. Org ignores |
|
13998 |
‘org-use-property-inheritance’ setting. |
|
13999 |
|
|
14000 |
In this example, ‘:cache’ defaults to ‘yes’ for all code blocks in |
|
14001 |
the sub-tree starting with ‘sample header’. |
|
14002 |
|
|
14003 |
* sample header |
|
14004 |
:PROPERTIES: |
|
14005 |
:header-args: :cache yes |
|
14006 |
:END: |
|
14007 |
|
|
14008 |
Properties defined through ‘org-set-property’ function, bound to ‘C-c |
|
14009 |
C-x p’, apply to all active languages. They override properties set in |
|
14010 |
‘org-babel-default-header-args’. |
|
14011 |
|
|
14012 |
|
|
14013 |
File: org, Node: Language-specific mode properties, Next: Code block specific header arguments, Prev: Header arguments in Org mode properties, Up: Using header arguments |
|
14014 |
|
|
14015 |
Language-specific mode properties |
|
14016 |
................................. |
|
14017 |
|
|
14018 |
Language-specific header arguments are also read from properties |
|
14019 |
‘header-args:<lang>’ where ‘<lang>’ is the language identifier. For |
|
14020 |
example, |
|
14021 |
|
|
14022 |
* Heading |
|
14023 |
:PROPERTIES: |
|
14024 |
:header-args:clojure: :session *clojure-1* |
|
14025 |
:header-args:R: :session *R* |
|
14026 |
:END: |
|
14027 |
** Subheading |
|
14028 |
:PROPERTIES: |
|
14029 |
:header-args:clojure: :session *clojure-2* |
|
14030 |
:END: |
|
14031 |
|
|
14032 |
would force separate sessions for clojure blocks in Heading and |
|
14033 |
Subheading, but use the same session for all ‘R’ blocks. Blocks in |
|
14034 |
Subheading inherit settings from Heading. |
|
14035 |
|
|
14036 |
|
|
14037 |
File: org, Node: Code block specific header arguments, Next: Arguments in function calls, Prev: Language-specific mode properties, Up: Using header arguments |
|
14038 |
|
|
14039 |
Code block specific header arguments |
|
14040 |
.................................... |
|
14041 |
|
|
14042 |
Header arguments are most commonly set at the ‘src’ code block level, on |
|
14043 |
the ‘#+BEGIN_SRC’ line. Arguments set at this level take precedence |
|
14044 |
over those set in the ‘org-babel-default-header-args’ variable, and also |
|
14045 |
those set as header properties. |
|
14046 |
|
|
14047 |
In the following example, setting ‘results’ to ‘silent’ makes it |
|
14048 |
ignore results of the code execution. Setting ‘:exports’ to ‘code’ |
|
14049 |
exports only the body of the ‘src’ code block to HTML or LaTeX.: |
|
14050 |
|
|
14051 |
#+NAME: factorial |
|
14052 |
#+BEGIN_SRC haskell :results silent :exports code :var n=0 |
|
14053 |
fac 0 = 1 |
|
14054 |
fac n = n * fac (n-1) |
|
14055 |
#+END_SRC |
|
14056 |
|
|
14057 |
The same header arguments in an inline ‘src’ code block: |
|
14058 |
|
|
14059 |
src_haskell[:exports both]{fac 5} |
|
14060 |
|
|
14061 |
Code block header arguments can span multiple lines using ‘#+HEADER:’ |
|
14062 |
on each line. Note that Org currently accepts the plural spelling of |
|
14063 |
‘#+HEADER:’ only as a convenience for backward-compatibility. It may be |
|
14064 |
removed at some point. |
|
14065 |
|
|
14066 |
Multi-line header arguments on an unnamed ‘src’ code block: |
|
14067 |
|
|
14068 |
#+HEADER: :var data1=1 |
|
14069 |
#+BEGIN_SRC emacs-lisp :var data2=2 |
|
14070 |
(message "data1:%S, data2:%S" data1 data2) |
|
14071 |
#+END_SRC |
|
14072 |
|
|
14073 |
#+RESULTS: |
|
14074 |
: data1:1, data2:2 |
|
14075 |
|
|
14076 |
Multi-line header arguments on a named ‘src’ code block: |
|
14077 |
|
|
14078 |
#+NAME: named-block |
|
14079 |
#+HEADER: :var data=2 |
|
14080 |
#+BEGIN_SRC emacs-lisp |
|
14081 |
(message "data:%S" data) |
|
14082 |
#+END_SRC |
|
14083 |
|
|
14084 |
#+RESULTS: named-block |
|
14085 |
: data:2 |
|
14086 |
|
|
14087 |
|
|
14088 |
File: org, Node: Arguments in function calls, Prev: Code block specific header arguments, Up: Using header arguments |
|
14089 |
|
|
14090 |
Arguments in function calls |
|
14091 |
........................... |
|
14092 |
|
|
14093 |
Header arguments in function calls are the most specific and override |
|
14094 |
all other settings in case of an overlap. They get the highest |
|
14095 |
priority. Two ‘#+CALL:’ examples are shown below. For the complete |
|
14096 |
syntax of ‘#+CALL:’ lines, see *note Evaluating code blocks::. |
|
14097 |
|
|
14098 |
In this example, ‘:exports results’ header argument is applied to the |
|
14099 |
evaluation of the ‘#+CALL:’ line. |
|
14100 |
|
|
14101 |
#+CALL: factorial(n=5) :exports results |
|
14102 |
|
|
14103 |
In this example, ‘:session special’ header argument is applied to the |
|
14104 |
evaluation of ‘factorial’ code block. |
|
14105 |
|
|
14106 |
#+CALL: factorial[:session special](n=5) |
|
14107 |
|
|
14108 |
|
|
14109 |
File: org, Node: Specific header arguments, Prev: Using header arguments, Up: Header arguments |
|
14110 |
|
|
14111 |
14.8.2 Specific header arguments |
|
14112 |
-------------------------------- |
|
14113 |
|
|
14114 |
Org comes with many header arguments common to all languages. New |
|
14115 |
header arguments are added for specific languages as they become |
|
14116 |
available for use in ‘src’ code blocks. A header argument is specified |
|
14117 |
with an initial colon followed by the argument’s name in lowercase. |
|
14118 |
Common header arguments are: |
|
14119 |
|
|
14120 |
* Menu: |
|
14121 |
|
|
14122 |
* var:: Pass arguments to ‘src’ code blocks |
|
14123 |
* results:: Specify results type; how to collect |
|
14124 |
* file:: Specify a path for output file |
|
14125 |
* file-desc:: Specify a description for file results |
|
14126 |
* file-ext:: Specify an extension for file output |
|
14127 |
* output-dir:: Specify a directory for output file |
|
14128 |
* dir:: Specify the default directory for code block execution |
|
14129 |
* exports:: Specify exporting code, results, both, none |
|
14130 |
* tangle:: Toggle tangling; or specify file name |
|
14131 |
* mkdirp:: Toggle for parent directory creation for target files during tangling |
|
14132 |
* comments:: Toggle insertion of comments in tangled code files |
|
14133 |
* padline:: Control insertion of padding lines in tangled code files |
|
14134 |
* no-expand:: Turn off variable assignment and noweb expansion during tangling |
|
14135 |
* session:: Preserve the state of code evaluation |
|
14136 |
* noweb:: Toggle expansion of noweb references |
|
14137 |
* noweb-ref:: Specify block’s noweb reference resolution target |
|
14138 |
* noweb-sep:: String to separate noweb references |
|
14139 |
* cache:: Avoid re-evaluating unchanged code blocks |
|
14140 |
* sep:: Delimiter for writing tabular results outside Org |
|
14141 |
* hlines:: Handle horizontal lines in tables |
|
14142 |
* colnames:: Handle column names in tables |
|
14143 |
* rownames:: Handle row names in tables |
|
14144 |
* shebang:: Make tangled files executable |
|
14145 |
* tangle-mode:: Set permission of tangled files |
|
14146 |
* eval:: Limit evaluation of specific code blocks |
|
14147 |
* wrap:: Mark source block evaluation results |
|
14148 |
* post:: Post processing of results of code block evaluation |
|
14149 |
* prologue:: Text to prepend to body of code block |
|
14150 |
* epilogue:: Text to append to body of code block |
|
14151 |
|
|
14152 |
For language-specific header arguments, see *note Languages::. |
|
14153 |
|
|
14154 |
|
|
14155 |
File: org, Node: var, Next: results, Up: Specific header arguments |
|
14156 |
|
|
14157 |
14.8.2.1 ‘:var’ |
|
14158 |
............... |
|
14159 |
|
|
14160 |
Use ‘:var’ for passing arguments to ‘src’ code blocks. The specifics of |
|
14161 |
variables in ‘src’ code blocks vary by the source language and are |
|
14162 |
covered in the language-specific documentation. The syntax for ‘:var’, |
|
14163 |
however, is the same for all languages. This includes declaring a |
|
14164 |
variable, and assigning a default value. |
|
14165 |
|
|
14166 |
Arguments can take values as literals, or as references, or even as |
|
14167 |
Emacs Lisp code (*note Emacs Lisp evaluation of variables: var.). |
|
14168 |
References are names from the Org file from the lines ‘#+NAME:’ or |
|
14169 |
‘#+RESULTS:’. References can also refer to tables, lists, |
|
14170 |
‘#+BEGIN_EXAMPLE’ blocks, other types of ‘src’ code blocks, or the |
|
14171 |
results of execution of ‘src’ code blocks. |
|
14172 |
|
|
14173 |
For better performance, Org can cache results of evaluations. But |
|
14174 |
caching comes with severe limitations (*note cache::). |
|
14175 |
|
|
14176 |
Argument values are indexed like arrays (*note Indexable variable |
|
14177 |
values: var.). |
|
14178 |
|
|
14179 |
The following syntax is used to pass arguments to ‘src’ code blocks |
|
14180 |
using the ‘:var’ header argument. |
|
14181 |
|
|
14182 |
:var name=assign |
|
14183 |
|
|
14184 |
The ‘assign’ is a literal value, such as a string ‘"string"’, a |
|
14185 |
number ‘9’, a reference to a table, a list, a literal example, another |
|
14186 |
code block (with or without arguments), or the results from evaluating a |
|
14187 |
code block. |
|
14188 |
|
|
14189 |
Here are examples of passing values by reference: |
|
14190 |
|
|
14191 |
“table” |
|
14192 |
an Org mode table named with either a ‘#+NAME:’ line |
|
14193 |
|
|
14194 |
#+NAME: example-table |
|
14195 |
| 1 | |
|
14196 |
| 2 | |
|
14197 |
| 3 | |
|
14198 |
| 4 | |
|
14199 |
|
|
14200 |
#+NAME: table-length |
|
14201 |
#+BEGIN_SRC emacs-lisp :var table=example-table |
|
14202 |
(length table) |
|
14203 |
#+END_SRC |
|
14204 |
|
|
14205 |
#+RESULTS: table-length |
|
14206 |
: 4 |
|
14207 |
|
|
14208 |
“list” |
|
14209 |
a simple list named with a ‘#+NAME:’ line. Note that only the top |
|
14210 |
level list items are passed along. Nested list items are ignored. |
|
14211 |
|
|
14212 |
#+NAME: example-list |
|
14213 |
- simple |
|
14214 |
- not |
|
14215 |
- nested |
|
14216 |
- list |
|
14217 |
|
|
14218 |
#+BEGIN_SRC emacs-lisp :var x=example-list |
|
14219 |
(print x) |
|
14220 |
#+END_SRC |
|
14221 |
|
|
14222 |
#+RESULTS: |
|
14223 |
| simple | list | |
|
14224 |
|
|
14225 |
“code block without arguments” |
|
14226 |
a code block name (from the example above), as assigned by |
|
14227 |
‘#+NAME:’, optionally followed by parentheses |
|
14228 |
|
|
14229 |
#+BEGIN_SRC emacs-lisp :var length=table-length() |
|
14230 |
(* 2 length) |
|
14231 |
#+END_SRC |
|
14232 |
|
|
14233 |
#+RESULTS: |
|
14234 |
: 8 |
|
14235 |
|
|
14236 |
“code block with arguments” |
|
14237 |
a ‘src’ code block name, as assigned by ‘#+NAME:’, followed by |
|
14238 |
parentheses and optional arguments passed within the parentheses |
|
14239 |
following the ‘src’ code block name using standard function call |
|
14240 |
syntax |
|
14241 |
|
|
14242 |
#+NAME: double |
|
14243 |
#+BEGIN_SRC emacs-lisp :var input=8 |
|
14244 |
(* 2 input) |
|
14245 |
#+END_SRC |
|
14246 |
|
|
14247 |
#+RESULTS: double |
|
14248 |
: 16 |
|
14249 |
|
|
14250 |
#+NAME: squared |
|
14251 |
#+BEGIN_SRC emacs-lisp :var input=double(input=2) |
|
14252 |
(* input input) |
|
14253 |
#+END_SRC |
|
14254 |
|
|
14255 |
#+RESULTS: squared |
|
14256 |
: 4 |
|
14257 |
|
|
14258 |
“literal example” |
|
14259 |
a literal example block named with a ‘#+NAME:’ line |
|
14260 |
|
|
14261 |
#+NAME: literal-example |
|
14262 |
#+BEGIN_EXAMPLE |
|
14263 |
A literal example |
|
14264 |
on two lines |
|
14265 |
#+END_EXAMPLE |
|
14266 |
|
|
14267 |
#+NAME: read-literal-example |
|
14268 |
#+BEGIN_SRC emacs-lisp :var x=literal-example |
|
14269 |
(concatenate 'string x " for you.") |
|
14270 |
#+END_SRC |
|
14271 |
|
|
14272 |
#+RESULTS: read-literal-example |
|
14273 |
: A literal example |
|
14274 |
: on two lines for you. |
|
14275 |
|
|
14276 |
|
|
14277 |
Indexable variable values |
|
14278 |
......................... |
|
14279 |
|
|
14280 |
Indexing variable values enables referencing portions of a variable. |
|
14281 |
Indexes are 0 based with negative values counting backwards from the |
|
14282 |
end. If an index is separated by ‘,’s then each subsequent section will |
|
14283 |
index as the next dimension. Note that this indexing occurs _before_ |
|
14284 |
other table-related header arguments are applied, such as ‘:hlines’, |
|
14285 |
‘:colnames’ and ‘:rownames’. The following example assigns the last |
|
14286 |
cell of the first row the table ‘example-table’ to the variable ‘data’: |
|
14287 |
|
|
14288 |
#+NAME: example-table |
|
14289 |
| 1 | a | |
|
14290 |
| 2 | b | |
|
14291 |
| 3 | c | |
|
14292 |
| 4 | d | |
|
14293 |
|
|
14294 |
#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1] |
|
14295 |
data |
|
14296 |
#+END_SRC |
|
14297 |
|
|
14298 |
#+RESULTS: |
|
14299 |
: a |
|
14300 |
|
|
14301 |
Ranges of variable values can be referenced using two integers |
|
14302 |
separated by a ‘:’, in which case the entire inclusive range is |
|
14303 |
referenced. For example the following assigns the middle three rows of |
|
14304 |
‘example-table’ to ‘data’. |
|
14305 |
|
|
14306 |
#+NAME: example-table |
|
14307 |
| 1 | a | |
|
14308 |
| 2 | b | |
|
14309 |
| 3 | c | |
|
14310 |
| 4 | d | |
|
14311 |
| 5 | 3 | |
|
14312 |
|
|
14313 |
#+BEGIN_SRC emacs-lisp :var data=example-table[1:3] |
|
14314 |
data |
|
14315 |
#+END_SRC |
|
14316 |
|
|
14317 |
#+RESULTS: |
|
14318 |
| 2 | b | |
|
14319 |
| 3 | c | |
|
14320 |
| 4 | d | |
|
14321 |
|
|
14322 |
To pick the entire range, use an empty index, or the single character |
|
14323 |
‘*’. ‘0:-1’ does the same thing. Example below shows how to reference |
|
14324 |
the first column only. |
|
14325 |
|
|
14326 |
#+NAME: example-table |
|
14327 |
| 1 | a | |
|
14328 |
| 2 | b | |
|
14329 |
| 3 | c | |
|
14330 |
| 4 | d | |
|
14331 |
|
|
14332 |
#+BEGIN_SRC emacs-lisp :var data=example-table[,0] |
|
14333 |
data |
|
14334 |
#+END_SRC |
|
14335 |
|
|
14336 |
#+RESULTS: |
|
14337 |
| 1 | 2 | 3 | 4 | |
|
14338 |
|
|
14339 |
Index referencing can be used for tables and code blocks. Index |
|
14340 |
referencing can handle any number of dimensions. Commas delimit |
|
14341 |
multiple dimensions, as shown below. |
|
14342 |
|
|
14343 |
#+NAME: 3D |
|
14344 |
#+BEGIN_SRC emacs-lisp |
|
14345 |
'(((1 2 3) (4 5 6) (7 8 9)) |
|
14346 |
((10 11 12) (13 14 15) (16 17 18)) |
|
14347 |
((19 20 21) (22 23 24) (25 26 27))) |
|
14348 |
#+END_SRC |
|
14349 |
|
|
14350 |
#+BEGIN_SRC emacs-lisp :var data=3D[1,,1] |
|
14351 |
data |
|
14352 |
#+END_SRC |
|
14353 |
|
|
14354 |
#+RESULTS: |
|
14355 |
| 11 | 14 | 17 | |
|
14356 |
|
|
14357 |
Emacs Lisp evaluation of variables |
|
14358 |
.................................. |
|
14359 |
|
|
14360 |
Emacs lisp code can set the values for variables. To differentiate a |
|
14361 |
value from lisp code, Org interprets any value starting with ‘(’, ‘[’, |
|
14362 |
‘'’ or ‘`’ as Emacs Lisp code. The result of evaluating that code is |
|
14363 |
then assigned to the value of that variable. The following example |
|
14364 |
shows how to reliably query and pass file name of the Org mode buffer to |
|
14365 |
a code block using headers. We need reliability here because the file’s |
|
14366 |
name could change once the code in the block starts executing. |
|
14367 |
|
|
14368 |
#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both |
|
14369 |
wc -w $filename |
|
14370 |
#+END_SRC |
|
14371 |
|
|
14372 |
Note that values read from tables and lists will not be mistakenly |
|
14373 |
evaluated as Emacs Lisp code, as illustrated in the following example. |
|
14374 |
|
|
14375 |
#+NAME: table |
|
14376 |
| (a b c) | |
|
14377 |
|
|
14378 |
#+HEADER: :var data=table[0,0] |
|
14379 |
#+BEGIN_SRC perl |
|
14380 |
$data |
|
14381 |
#+END_SRC |
|
14382 |
|
|
14383 |
#+RESULTS: |
|
14384 |
: (a b c) |
|
14385 |
|
|
14386 |
|
|
14387 |
File: org, Node: results, Next: file, Prev: var, Up: Specific header arguments |
|
14388 |
|
|
14389 |
14.8.2.2 ‘:results’ |
|
14390 |
................... |
|
14391 |
|
|
14392 |
There are four classes of ‘:results’ header arguments. Each ‘src’ code |
|
14393 |
block can take only one option per class. |
|
14394 |
|
|
14395 |
• collection for how the results should be collected from the ‘src’ |
|
14396 |
code block |
|
14397 |
• type for which type of result the code block will return; affects |
|
14398 |
how Org processes and inserts results in the Org buffer |
|
14399 |
• format for the result; affects how Org processes and inserts |
|
14400 |
results in the Org buffer |
|
14401 |
• handling for processing results after evaluation of the ‘src’ code |
|
14402 |
block |
|
14403 |
|
|
14404 |
Collection |
|
14405 |
.......... |
|
14406 |
|
|
14407 |
Collection options specify the results. Choose one of the options; they |
|
14408 |
are mutually exclusive. |
|
14409 |
|
|
14410 |
• ‘value’ Default. Functional mode. Result is the value returned by |
|
14411 |
the last statement in the ‘src’ code block. Languages like Python |
|
14412 |
may require an explicit ‘return’ statement in the ‘src’ code block. |
|
14413 |
Usage example: ‘:results value’. |
|
14414 |
• ‘output’ Scripting mode. Result is collected from STDOUT during |
|
14415 |
execution of the code in the ‘src’ code block. Usage example: |
|
14416 |
‘:results output’. |
|
14417 |
|
|
14418 |
Type |
|
14419 |
.... |
|
14420 |
|
|
14421 |
Type tells what result types to expect from the execution of the code |
|
14422 |
block. Choose one of the options; they are mutually exclusive. The |
|
14423 |
default behavior is to automatically determine the result type. |
|
14424 |
|
|
14425 |
• ‘table’, ‘vector’ Interpret the results as an Org table. If the |
|
14426 |
result is a single value, create a table with one row and one |
|
14427 |
column. Usage example: ‘:results value table’. |
|
14428 |
• ‘list’ Interpret the results as an Org list. If the result is a |
|
14429 |
single value, create a list of one element. |
|
14430 |
• ‘scalar’, ‘verbatim’ Interpret literally and insert as quoted text. |
|
14431 |
Do not create a table. Usage example: ‘:results value verbatim’. |
|
14432 |
• ‘file’ Interpret as path to a file. Inserts a link to the file. |
|
14433 |
Usage example: ‘:results value file’. |
|
14434 |
|
|
14435 |
Format |
|
14436 |
...... |
|
14437 |
|
|
14438 |
Format pertains to the type of the result returned by the ‘src’ code |
|
14439 |
block. Choose one of the options; they are mutually exclusive. The |
|
14440 |
default follows from the type specified above. |
|
14441 |
|
|
14442 |
• ‘raw’ Interpreted as raw Org mode. Inserted directly into the |
|
14443 |
buffer. Aligned if it is a table. Usage example: ‘:results value |
|
14444 |
raw’. |
|
14445 |
• ‘org’ Results enclosed in a ‘BEGIN_SRC org’ block. For |
|
14446 |
comma-escape, either <TAB> in the block, or export the file. Usage |
|
14447 |
example: ‘:results value org’. |
|
14448 |
• ‘html’ Results enclosed in a ‘BEGIN_EXPORT html’ block. Usage |
|
14449 |
example: ‘:results value html’. |
|
14450 |
• ‘latex’ Results enclosed in a ‘BEGIN_EXPORT latex’ block. Usage |
|
14451 |
example: ‘:results value latex’. |
|
14452 |
• ‘code’ Result enclosed in a ‘src’ code block. Useful for parsing. |
|
14453 |
Usage example: ‘:results value code’. |
|
14454 |
• ‘pp’ Result converted to pretty-print source code. Enclosed in a |
|
14455 |
‘src’ code block. Languages supported: Emacs Lisp, Python, and |
|
14456 |
Ruby. Usage example: ‘:results value pp’. |
|
14457 |
• ‘drawer’ Result wrapped in a RESULTS drawer. Useful for containing |
|
14458 |
‘raw’ or ‘org’ results for later scripting and automated |
|
14459 |
processing. Usage example: ‘:results value drawer’. |
|
14460 |
|
|
14461 |
Handling |
|
14462 |
........ |
|
14463 |
|
|
14464 |
Handling options after collecting the results. |
|
14465 |
|
|
14466 |
• ‘silent’ Do not insert results in the Org mode buffer, but echo |
|
14467 |
them in the minibuffer. Usage example: ‘:results output silent’. |
|
14468 |
• ‘replace’ Default. Insert results in the Org buffer. Remove |
|
14469 |
previous results. Usage example: ‘:results output replace’. |
|
14470 |
• ‘append’ Append results to the Org buffer. Latest results are at |
|
14471 |
the bottom. Does not remove previous results. Usage example: |
|
14472 |
‘:results output append’. |
|
14473 |
• ‘prepend’ Prepend results to the Org buffer. Latest results are at |
|
14474 |
the top. Does not remove previous results. Usage example: |
|
14475 |
‘:results output prepend’. |
|
14476 |
|
|
14477 |
|
|
14478 |
File: org, Node: file, Next: file-desc, Prev: results, Up: Specific header arguments |
|
14479 |
|
|
14480 |
14.8.2.3 ‘:file’ |
|
14481 |
................ |
|
14482 |
|
|
14483 |
An external ‘:file’ that saves the results of execution of the code |
|
14484 |
block. The ‘:file’ is either a file name or two strings, where the |
|
14485 |
first is the file name and the second is the description. A link to the |
|
14486 |
file is inserted. It uses an Org mode style ‘[[file:]]’ link (*note |
|
14487 |
Link format::). Some languages, such as ‘R’, ‘dot’, ‘ditaa’, and |
|
14488 |
‘gnuplot’, automatically wrap the source code in additional boilerplate |
|
14489 |
code. Such code wrapping helps recreate the output, especially graphics |
|
14490 |
output, by executing just the ‘:file’ contents. |
|
14491 |
|
|
14492 |
|
|
14493 |
File: org, Node: file-desc, Next: file-ext, Prev: file, Up: Specific header arguments |
|
14494 |
|
|
14495 |
14.8.2.4 ‘:file-desc’ |
|
14496 |
..................... |
|
14497 |
|
|
14498 |
A description of the results file. Org uses this description for the |
|
14499 |
link (see *note Link format::) it inserts in the Org file. If the |
|
14500 |
‘:file-desc’ has no value, Org will use file name for both the “link” |
|
14501 |
and the “description” portion of the Org mode link. |
|
14502 |
|
|
14503 |
|
|
14504 |
File: org, Node: file-ext, Next: output-dir, Prev: file-desc, Up: Specific header arguments |
|
14505 |
|
|
14506 |
14.8.2.5 ‘:file-ext’ |
|
14507 |
.................... |
|
14508 |
|
|
14509 |
File name extension for the output file. Org generates the file’s |
|
14510 |
complete name, and extension by combining ‘:file-ext’, ‘#+NAME:’ of the |
|
14511 |
source block, and the *note output-dir:: header argument. To override |
|
14512 |
this auto generated file name, use the ‘:file’ header argument. |
|
14513 |
|
|
14514 |
|
|
14515 |
File: org, Node: output-dir, Next: dir, Prev: file-ext, Up: Specific header arguments |
|
14516 |
|
|
14517 |
14.8.2.6 ‘:output-dir’ |
|
14518 |
...................... |
|
14519 |
|
|
14520 |
Specifies the ‘:output-dir’ for the results file. Org accepts an |
|
14521 |
absolute path (beginning with ‘/’) or a relative directory (without |
|
14522 |
‘/’). The value can be combined with ‘#+NAME:’ of the source block and |
|
14523 |
*note file:: or *note file-ext:: header arguments. |
|
14524 |
|
|
14525 |
|
|
14526 |
File: org, Node: dir, Next: exports, Prev: output-dir, Up: Specific header arguments |
|
14527 |
|
|
14528 |
14.8.2.7 ‘:dir’ and remote execution |
|
14529 |
.................................... |
|
14530 |
|
|
14531 |
While the ‘:file’ header argument can be used to specify the path to the |
|
14532 |
output file, ‘:dir’ specifies the default directory during ‘src’ code |
|
14533 |
block execution. If it is absent, then the directory associated with |
|
14534 |
the current buffer is used. In other words, supplying ‘:dir path’ |
|
14535 |
temporarily has the same effect as changing the current directory with |
|
14536 |
‘M-x cd path <RET>’, and then not supplying ‘:dir’. Under the surface, |
|
14537 |
‘:dir’ simply sets the value of the Emacs variable ‘default-directory’. |
|
14538 |
|
|
14539 |
When using ‘:dir’, relative paths (for example, ‘:file myfile.jpg’ or |
|
14540 |
‘:file results/myfile.jpg’) become relative to the default directory. |
|
14541 |
|
|
14542 |
For example, to save the plot file in the ‘Work’ folder of the home |
|
14543 |
directory (notice tilde is expanded): |
|
14544 |
|
|
14545 |
#+BEGIN_SRC R :file myplot.png :dir ~/Work |
|
14546 |
matplot(matrix(rnorm(100), 10), type="l") |
|
14547 |
#+END_SRC |
|
14548 |
|
|
14549 |
Remote execution |
|
14550 |
................ |
|
14551 |
|
|
14552 |
To evaluate the ‘src’ code block on a remote machine, supply a remote s |
|
14553 |
directory name using ‘Tramp’ syntax. For example: |
|
14554 |
|
|
14555 |
#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu: |
|
14556 |
plot(1:10, main=system("hostname", intern=TRUE)) |
|
14557 |
#+END_SRC |
|
14558 |
|
|
14559 |
Org first captures the text results as usual for insertion in the Org |
|
14560 |
file. Then Org also inserts a link to the remote file, thanks to Emacs |
|
14561 |
‘Tramp’. Org constructs the remote path to the file name from ‘:dir’ |
|
14562 |
and ‘default-directory’, as illustrated here: |
|
14563 |
|
|
14564 |
[[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]] |
|
14565 |
|
|
14566 |
Some more warnings |
|
14567 |
.................. |
|
14568 |
|
|
14569 |
• When ‘:dir’ is used with ‘:session’, Org sets the starting |
|
14570 |
directory for a new session. But Org will not alter the directory |
|
14571 |
of an already existing session. |
|
14572 |
• Do not use ‘:dir’ with ‘:exports results’ or with ‘:exports both’ |
|
14573 |
to avoid Org inserting incorrect links to remote files. That is |
|
14574 |
because Org does not expand ‘default directory’ to avoid some |
|
14575 |
underlying portability issues. |
|
14576 |
|
|
14577 |
|
|
14578 |
File: org, Node: exports, Next: tangle, Prev: dir, Up: Specific header arguments |
|
14579 |
|
|
14580 |
14.8.2.8 ‘:exports’ |
|
14581 |
................... |
|
14582 |
|
|
14583 |
The ‘:exports’ header argument is to specify if that part of the Org |
|
14584 |
file is exported to, say, HTML or LaTeX formats. Note that ‘:exports’ |
|
14585 |
affects only ‘src’ code blocks and not inline code. |
|
14586 |
|
|
14587 |
• ‘code’ The default. The body of code is included into the exported |
|
14588 |
file. Example: ‘:exports code’. |
|
14589 |
• ‘results’ The results of evaluation of the code is included in the |
|
14590 |
exported file. Example: ‘:exports results’. |
|
14591 |
• ‘both’ Both the code and results of evaluation are included in the |
|
14592 |
exported file. Example: ‘:exports both’. |
|
14593 |
• ‘none’ Neither the code nor the results of evaluation is included |
|
14594 |
in the exported file. Whether the code is evaluated at all depends |
|
14595 |
on other options. Example: ‘:exports none’. |
|
14596 |
|
|
14597 |
|
|
14598 |
File: org, Node: tangle, Next: mkdirp, Prev: exports, Up: Specific header arguments |
|
14599 |
|
|
14600 |
14.8.2.9 ‘:tangle’ |
|
14601 |
.................. |
|
14602 |
|
|
14603 |
The ‘:tangle’ header argument specifies if the ‘src’ code block is |
|
14604 |
exported to source file(s). |
|
14605 |
|
|
14606 |
• ‘tangle’ Export the ‘src’ code block to source file. The file name |
|
14607 |
for the source file is derived from the name of the Org file, and |
|
14608 |
the file extension is derived from the source code language |
|
14609 |
identifier. Example: ‘:tangle yes’. |
|
14610 |
• ‘no’ The default. Do not extract the code a source code file. |
|
14611 |
Example: ‘:tangle no’. |
|
14612 |
• other Export the ‘src’ code block to source file whose file name is |
|
14613 |
derived from any string passed to the ‘:tangle’ header argument. |
|
14614 |
Org derives the file name as being relative to the directory of the |
|
14615 |
Org file’s location. Example: ‘:tangle path’. |
|
14616 |
|
|
14617 |
|
|
14618 |
File: org, Node: mkdirp, Next: comments, Prev: tangle, Up: Specific header arguments |
|
14619 |
|
|
14620 |
14.8.2.10 ‘:mkdirp’ |
|
14621 |
................... |
|
14622 |
|
|
14623 |
The ‘:mkdirp’ header argument creates parent directories for tangled |
|
14624 |
files if the directory does not exist. ‘yes’ enables directory creation |
|
14625 |
and ‘no’ inhibits directory creation. |
|
14626 |
|
|
14627 |
|
|
14628 |
File: org, Node: comments, Next: padline, Prev: mkdirp, Up: Specific header arguments |
|
14629 |
|
|
14630 |
14.8.2.11 ‘:comments’ |
|
14631 |
..................... |
|
14632 |
|
|
14633 |
Controls inserting comments into tangled files. These are above and |
|
14634 |
beyond whatever comments may already exist in the ‘src’ code block. |
|
14635 |
|
|
14636 |
• ‘no’ The default. Do not insert any extra comments during |
|
14637 |
tangling. |
|
14638 |
• ‘link’ Wrap the ‘src’ code block in comments. Include links |
|
14639 |
pointing back to the place in the Org file from where the code was |
|
14640 |
tangled. |
|
14641 |
• ‘yes’ Kept for backward compatibility; same as “link”. |
|
14642 |
• ‘org’ Nearest headline text from Org file is inserted as comment. |
|
14643 |
The exact text that is inserted is picked from the leading context |
|
14644 |
of the source block. |
|
14645 |
• ‘both’ Includes both “link” and “org” comment options. |
|
14646 |
• ‘noweb’ Includes “link” comment option, expands noweb references, |
|
14647 |
and wraps them in link comments inside the body of the ‘src’ code |
|
14648 |
block. |
|
14649 |
|
|
14650 |
|
|
14651 |
File: org, Node: padline, Next: no-expand, Prev: comments, Up: Specific header arguments |
|
14652 |
|
|
14653 |
14.8.2.12 ‘:padline’ |
|
14654 |
.................... |
|
14655 |
|
|
14656 |
Control insertion of newlines to pad ‘src’ code blocks in the tangled |
|
14657 |
file. |
|
14658 |
• ‘yes’ Default. Insert a newline before and after each ‘src’ code |
|
14659 |
block in the tangled file. |
|
14660 |
• ‘no’ Do not insert newlines to pad the tangled ‘src’ code blocks. |
|
14661 |
|
|
14662 |
|
|
14663 |
File: org, Node: no-expand, Next: session, Prev: padline, Up: Specific header arguments |
|
14664 |
|
|
14665 |
14.8.2.13 ‘:no-expand’ |
|
14666 |
...................... |
|
14667 |
|
|
14668 |
By default Org expands ‘src’ code blocks during tangling. The |
|
14669 |
‘:no-expand’ header argument turns off such expansions. Note that one |
|
14670 |
side-effect of expansion by ‘org-babel-expand-src-block’ also assigns |
|
14671 |
values to ‘:var’ (*note var::) variables. Expansions also replace Noweb |
|
14672 |
references with their targets (*note Noweb reference syntax::). Some of |
|
14673 |
these expansions may cause premature assignment, hence this option. |
|
14674 |
This option makes a difference only for tangling. It has no effect when |
|
14675 |
exporting since ‘src’ code blocks for execution have to be expanded |
|
14676 |
anyway. |
|
14677 |
|
|
14678 |
|
|
14679 |
File: org, Node: session, Next: noweb, Prev: no-expand, Up: Specific header arguments |
|
14680 |
|
|
14681 |
14.8.2.14 ‘:session’ |
|
14682 |
.................... |
|
14683 |
|
|
14684 |
The ‘:session’ header argument is for running multiple source code |
|
14685 |
blocks under one session. Org runs ‘src’ code blocks with the same |
|
14686 |
session name in the same interpreter process. |
|
14687 |
|
|
14688 |
• ‘none’ Default. Each ‘src’ code block gets a new interpreter |
|
14689 |
process to execute. The process terminates once the block is |
|
14690 |
evaluated. |
|
14691 |
• ‘other’ Any string besides ‘none’ turns that string into the name |
|
14692 |
of that session. For example, ‘:session mysession’ names it |
|
14693 |
‘mysession’. If ‘:session’ has no argument, then the session name |
|
14694 |
is derived from the source language identifier. Subsequent blocks |
|
14695 |
with the same source code language use the same session. Depending |
|
14696 |
on the language, state variables, code from other blocks, and the |
|
14697 |
overall interpreted environment may be shared. Some interpreted |
|
14698 |
languages support concurrent sessions when subsequent source code |
|
14699 |
language blocks change session names. |
|
14700 |
|
|
14701 |
|
|
14702 |
File: org, Node: noweb, Next: noweb-ref, Prev: session, Up: Specific header arguments |
|
14703 |
|
|
14704 |
14.8.2.15 ‘:noweb’ |
|
14705 |
.................. |
|
14706 |
|
|
14707 |
The ‘:noweb’ header argument controls expansion of Noweb syntax |
|
14708 |
references (*note Noweb reference syntax::). Expansions occur when |
|
14709 |
source code blocks are evaluated, tangled, or exported. |
|
14710 |
|
|
14711 |
• ‘no’ Default. No expansion of Noweb syntax references in the body |
|
14712 |
of the code when evaluating, tangling, or exporting. |
|
14713 |
• ‘yes’ Expansion of Noweb syntax references in the body of the ‘src’ |
|
14714 |
code block when evaluating, tangling, or exporting. |
|
14715 |
• ‘tangle’ Expansion of Noweb syntax references in the body of the |
|
14716 |
‘src’ code block when tangling. No expansion when evaluating or |
|
14717 |
exporting. |
|
14718 |
• ‘no-export’ Expansion of Noweb syntax references in the body of the |
|
14719 |
‘src’ code block when evaluating or tangling. No expansion when |
|
14720 |
exporting. |
|
14721 |
• ‘strip-export’ Expansion of Noweb syntax references in the body of |
|
14722 |
the ‘src’ code block when expanding prior to evaluating or |
|
14723 |
tangling. Removes Noweb syntax references when exporting. |
|
14724 |
• ‘eval’ Expansion of Noweb syntax references in the body of the |
|
14725 |
‘src’ code block only before evaluating. |
|
14726 |
|
|
14727 |
Noweb prefix lines |
|
14728 |
.................. |
|
14729 |
|
|
14730 |
Noweb insertions now honor prefix characters that appear before the |
|
14731 |
Noweb syntax reference. |
|
14732 |
|
|
14733 |
This behavior is illustrated in the following example. Because the |
|
14734 |
‘<<example>>’ noweb reference appears behind the SQL comment syntax, |
|
14735 |
each line of the expanded noweb reference will be commented. |
|
14736 |
|
|
14737 |
With: |
|
14738 |
|
|
14739 |
#+NAME: example |
|
14740 |
#+BEGIN_SRC text |
|
14741 |
this is the |
|
14742 |
multi-line body of example |
|
14743 |
#+END_SRC |
|
14744 |
|
|
14745 |
this ‘src’ code block: |
|
14746 |
|
|
14747 |
#+BEGIN_SRC sql :noweb yes |
|
14748 |
-- <<example>> |
|
14749 |
#+END_SRC |
|
14750 |
|
|
14751 |
expands to: |
|
14752 |
|
|
14753 |
-- this is the |
|
14754 |
-- multi-line body of example |
|
14755 |
|
|
14756 |
Since this change will not affect noweb replacement text without |
|
14757 |
newlines in them, inline noweb references are acceptable. |
|
14758 |
|
|
14759 |
This feature can also be used for management of indentation in |
|
14760 |
exported code snippets. |
|
14761 |
|
|
14762 |
With: |
|
14763 |
|
|
14764 |
#+NAME: if-true |
|
14765 |
#+BEGIN_SRC python :exports none |
|
14766 |
print('Do things when True') |
|
14767 |
#+END_SRC |
|
14768 |
|
|
14769 |
#+NAME: if-false |
|
14770 |
#+BEGIN_SRC python :exports none |
|
14771 |
print('Do things when False') |
|
14772 |
#+END_SRC |
|
14773 |
|
|
14774 |
this ‘src’ code block: |
|
14775 |
|
|
14776 |
#+BEGIN_SRC python :noweb yes :results output |
|
14777 |
if True: |
|
14778 |
<<if-true>> |
|
14779 |
else: |
|
14780 |
<<if-false>> |
|
14781 |
#+END_SRC |
|
14782 |
|
|
14783 |
expands to: |
|
14784 |
|
|
14785 |
if True: |
|
14786 |
print('Do things when True') |
|
14787 |
else: |
|
14788 |
print('Do things when False') |
|
14789 |
|
|
14790 |
and evaluates to: |
|
14791 |
|
|
14792 |
Do things when True |
|
14793 |
|
|
14794 |
|
|
14795 |
File: org, Node: noweb-ref, Next: noweb-sep, Prev: noweb, Up: Specific header arguments |
|
14796 |
|
|
14797 |
14.8.2.16 ‘:noweb-ref’ |
|
14798 |
...................... |
|
14799 |
|
|
14800 |
When expanding Noweb style references, Org concatenates ‘src’ code |
|
14801 |
blocks by matching the reference name to either the code block name or |
|
14802 |
the ‘:noweb-ref’ header argument. |
|
14803 |
|
|
14804 |
For simple concatenation, set this ‘:noweb-ref’ header argument at |
|
14805 |
the sub-tree or file level. In the example Org file shown next, the |
|
14806 |
body of the source code in each block is extracted for concatenation to |
|
14807 |
a pure code file when tangled. |
|
14808 |
|
|
14809 |
#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh |
|
14810 |
<<fullest-disk>> |
|
14811 |
#+END_SRC |
|
14812 |
* the mount point of the fullest disk |
|
14813 |
:PROPERTIES: |
|
14814 |
:header-args: :noweb-ref fullest-disk |
|
14815 |
:END: |
|
14816 |
|
|
14817 |
** query all mounted disks |
|
14818 |
#+BEGIN_SRC sh |
|
14819 |
df \ |
|
14820 |
#+END_SRC |
|
14821 |
|
|
14822 |
** strip the header row |
|
14823 |
#+BEGIN_SRC sh |
|
14824 |
|sed '1d' \ |
|
14825 |
#+END_SRC |
|
14826 |
|
|
14827 |
** output mount point of fullest disk |
|
14828 |
#+BEGIN_SRC sh |
|
14829 |
|awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}' |
|
14830 |
#+END_SRC |
|
14831 |
|
|
14832 |
|
|
14833 |
File: org, Node: noweb-sep, Next: cache, Prev: noweb-ref, Up: Specific header arguments |
|
14834 |
|
|
14835 |
14.8.2.17 ‘:noweb-sep’ |
|
14836 |
...................... |
|
14837 |
|
|
14838 |
By default a newline separates each noweb reference concatenation. To |
|
14839 |
change this newline separator, edit the ‘:noweb-sep’ (*note noweb-sep::) |
|
14840 |
header argument. |
|
14841 |
|
|
14842 |
|
|
14843 |
File: org, Node: cache, Next: sep, Prev: noweb-sep, Up: Specific header arguments |
|
14844 |
|
|
14845 |
14.8.2.18 ‘:cache’ |
|
14846 |
.................. |
|
14847 |
|
|
14848 |
The ‘:cache’ header argument is for caching results of evaluating code |
|
14849 |
blocks. Caching results can avoid re-evaluating ‘src’ code blocks that |
|
14850 |
have not changed since the previous run. To benefit from the cache and |
|
14851 |
avoid redundant evaluations, the source block must have a result already |
|
14852 |
present in the buffer, and neither the header arguments (including the |
|
14853 |
value of ‘:var’ references) nor the text of the block itself has changed |
|
14854 |
since the result was last computed. This feature greatly helps avoid |
|
14855 |
long-running calculations. For some edge cases, however, the cached |
|
14856 |
results may not be reliable. |
|
14857 |
|
|
14858 |
The caching feature is best for when ‘src’ blocks are pure functions, |
|
14859 |
that is functions that return the same value for the same input |
|
14860 |
arguments (*note var::), and that do not have side effects, and do not |
|
14861 |
rely on external variables other than the input arguments. Functions |
|
14862 |
that depend on a timer, file system objects, and random number |
|
14863 |
generators are clearly unsuitable for caching. |
|
14864 |
|
|
14865 |
A note of warning: when ‘:cache’ is used for a ‘:session’, caching |
|
14866 |
may cause unexpected results. |
|
14867 |
|
|
14868 |
When the caching mechanism tests for any source code changes, it will |
|
14869 |
not expand Noweb style references (*note Noweb reference syntax::). For |
|
14870 |
reasons why, see <http://thread.gmane.org/gmane.emacs.orgmode/79046>. |
|
14871 |
|
|
14872 |
The ‘:cache’ header argument can have one of two values: ‘yes’ or |
|
14873 |
‘no’. |
|
14874 |
|
|
14875 |
• ‘no’ Default. No caching of results; ‘src’ code block evaluated |
|
14876 |
every time. |
|
14877 |
• ‘yes’ Whether to run the code or return the cached results is |
|
14878 |
determined by comparing the SHA1 hash value of the combined ‘src’ |
|
14879 |
code block and arguments passed to it. This hash value is packed |
|
14880 |
on the ‘#+RESULTS:’ line from previous evaluation. When hash |
|
14881 |
values match, Org does not evaluate the ‘src’ code block. When |
|
14882 |
hash values mismatch, Org evaluates the ‘src’ code block, inserts |
|
14883 |
the results, recalculates the hash value, and updates ‘#+RESULTS:’ |
|
14884 |
line. |
|
14885 |
|
|
14886 |
In this example, both functions are cached. But ‘caller’ runs only |
|
14887 |
if the result from ‘random’ has changed since the last run. |
|
14888 |
|
|
14889 |
#+NAME: random |
|
14890 |
#+BEGIN_SRC R :cache yes |
|
14891 |
runif(1) |
|
14892 |
#+END_SRC |
|
14893 |
|
|
14894 |
#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random |
|
14895 |
0.4659510825295 |
|
14896 |
|
|
14897 |
#+NAME: caller |
|
14898 |
#+BEGIN_SRC emacs-lisp :var x=random :cache yes |
|
14899 |
x |
|
14900 |
#+END_SRC |
|
14901 |
|
|
14902 |
#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller |
|
14903 |
0.254227238707244 |
|
14904 |
|
|
14905 |
|
|
14906 |
File: org, Node: sep, Next: hlines, Prev: cache, Up: Specific header arguments |
|
14907 |
|
|
14908 |
14.8.2.19 ‘:sep’ |
|
14909 |
................ |
|
14910 |
|
|
14911 |
The ‘:sep’ header argument is the delimiter for saving results as tables |
|
14912 |
to files (*note file::) external to Org mode. Org defaults to tab |
|
14913 |
delimited output. The function, ‘org-open-at-point’, which is bound to |
|
14914 |
‘C-c C-o’, also uses ‘:sep’ for opening tabular results. |
|
14915 |
|
|
14916 |
|
|
14917 |
File: org, Node: hlines, Next: colnames, Prev: sep, Up: Specific header arguments |
|
14918 |
|
|
14919 |
14.8.2.20 ‘:hlines’ |
|
14920 |
................... |
|
14921 |
|
|
14922 |
In-between each table row or below the table headings, sometimes results |
|
14923 |
have horizontal lines, which are also known as hlines. The ‘:hlines’ |
|
14924 |
argument with the value ‘yes’ accepts such lines. The default is ‘no’. |
|
14925 |
|
|
14926 |
• ‘no’ Strips horizontal lines from the input table. For most code, |
|
14927 |
this is desirable, or else those ‘hline’ symbols raise unbound |
|
14928 |
variable errors. |
|
14929 |
|
|
14930 |
The default is ‘:hlines no’. The example shows hlines removed from |
|
14931 |
the input table. |
|
14932 |
|
|
14933 |
#+NAME: many-cols |
|
14934 |
| a | b | c | |
|
14935 |
|---+---+---| |
|
14936 |
| d | e | f | |
|
14937 |
|---+---+---| |
|
14938 |
| g | h | i | |
|
14939 |
|
|
14940 |
#+NAME: echo-table |
|
14941 |
#+BEGIN_SRC python :var tab=many-cols |
|
14942 |
return tab |
|
14943 |
#+END_SRC |
|
14944 |
|
|
14945 |
#+RESULTS: echo-table |
|
14946 |
| a | b | c | |
|
14947 |
| d | e | f | |
|
14948 |
| g | h | i | |
|
14949 |
|
|
14950 |
• ‘yes’ For ‘:hlines yes’, the example shows hlines unchanged. |
|
14951 |
|
|
14952 |
#+NAME: many-cols |
|
14953 |
| a | b | c | |
|
14954 |
|---+---+---| |
|
14955 |
| d | e | f | |
|
14956 |
|---+---+---| |
|
14957 |
| g | h | i | |
|
14958 |
|
|
14959 |
#+NAME: echo-table |
|
14960 |
#+BEGIN_SRC python :var tab=many-cols :hlines yes |
|
14961 |
return tab |
|
14962 |
#+END_SRC |
|
14963 |
|
|
14964 |
#+RESULTS: echo-table |
|
14965 |
| a | b | c | |
|
14966 |
|---+---+---| |
|
14967 |
| d | e | f | |
|
14968 |
|---+---+---| |
|
14969 |
| g | h | i | |
|
14970 |
|
|
14971 |
|
|
14972 |
File: org, Node: colnames, Next: rownames, Prev: hlines, Up: Specific header arguments |
|
14973 |
|
|
14974 |
14.8.2.21 ‘:colnames’ |
|
14975 |
..................... |
|
14976 |
|
|
14977 |
The ‘:colnames’ header argument accepts ‘yes’, ‘no’, or ‘nil’ values. |
|
14978 |
The default value is ‘nil’, which is unassigned. But this header |
|
14979 |
argument behaves differently depending on the source code language. |
|
14980 |
|
|
14981 |
• ‘nil’ If an input table has column names (because the second row is |
|
14982 |
an hline), then Org removes the column names, processes the table, |
|
14983 |
puts back the column names, and then writes the table to the |
|
14984 |
results block. |
|
14985 |
|
|
14986 |
#+NAME: less-cols |
|
14987 |
| a | |
|
14988 |
|---| |
|
14989 |
| b | |
|
14990 |
| c | |
|
14991 |
|
|
14992 |
#+NAME: echo-table-again |
|
14993 |
#+BEGIN_SRC python :var tab=less-cols |
|
14994 |
return [[val + '*' for val in row] for row in tab] |
|
14995 |
#+END_SRC |
|
14996 |
|
|
14997 |
#+RESULTS: echo-table-again |
|
14998 |
| a | |
|
14999 |
|----| |
|
15000 |
| b* | |
|
15001 |
| c* | |
|
15002 |
|
|
15003 |
Note that column names have to accounted for when using variable |
|
15004 |
indexing (*note Indexable variable values: var.) because column |
|
15005 |
names are not removed for indexing. |
|
15006 |
|
|
15007 |
• ‘no’ Do not pre-process column names. |
|
15008 |
|
|
15009 |
• ‘yes’ For an input table that has no hlines, process it like the |
|
15010 |
‘nil’ value. That is, Org removes the column names, processes the |
|
15011 |
table, puts back the column names, and then writes the table to the |
|
15012 |
results block. |
|
15013 |
|
|
15014 |
|
|
15015 |
File: org, Node: rownames, Next: shebang, Prev: colnames, Up: Specific header arguments |
|
15016 |
|
|
15017 |
14.8.2.22 ‘:rownames’ |
|
15018 |
..................... |
|
15019 |
|
|
15020 |
The ‘:rownames’ header argument can take on values ‘yes’ or ‘no’ values. |
|
15021 |
The default is ‘no’. Note that ‘emacs-lisp’ code blocks ignore |
|
15022 |
‘:rownames’ header argument because of the ease of table-handling in |
|
15023 |
Emacs. |
|
15024 |
|
|
15025 |
• ‘no’ Org will not pre-process row names. |
|
15026 |
|
|
15027 |
• ‘yes’ If an input table has row names, then Org removes the row |
|
15028 |
names, processes the table, puts back the row names, and then |
|
15029 |
writes the table to the results block. |
|
15030 |
|
|
15031 |
#+NAME: with-rownames |
|
15032 |
| one | 1 | 2 | 3 | 4 | 5 | |
|
15033 |
| two | 6 | 7 | 8 | 9 | 10 | |
|
15034 |
|
|
15035 |
#+NAME: echo-table-once-again |
|
15036 |
#+BEGIN_SRC python :var tab=with-rownames :rownames yes |
|
15037 |
return [[val + 10 for val in row] for row in tab] |
|
15038 |
#+END_SRC |
|
15039 |
|
|
15040 |
#+RESULTS: echo-table-once-again |
|
15041 |
| one | 11 | 12 | 13 | 14 | 15 | |
|
15042 |
| two | 16 | 17 | 18 | 19 | 20 | |
|
15043 |
|
|
15044 |
Note that row names have to accounted for when using variable |
|
15045 |
indexing (*note Indexable variable values: var.) because row names |
|
15046 |
are not removed for indexing. |
|
15047 |
|
|
15048 |
|
|
15049 |
File: org, Node: shebang, Next: tangle-mode, Prev: rownames, Up: Specific header arguments |
|
15050 |
|
|
15051 |
14.8.2.23 ‘:shebang’ |
|
15052 |
.................... |
|
15053 |
|
|
15054 |
This header argument can turn results into executable script files. By |
|
15055 |
setting the ‘:shebang’ header argument to a string value (for example, |
|
15056 |
‘:shebang "#!/bin/bash"’), Org inserts that string as the first line of |
|
15057 |
the tangled file that the ‘src’ code block is extracted to. Org then |
|
15058 |
turns on the tangled file’s executable permission. |
|
15059 |
|
|
15060 |
|
|
15061 |
File: org, Node: tangle-mode, Next: eval, Prev: shebang, Up: Specific header arguments |
|
15062 |
|
|
15063 |
14.8.2.24 ‘:tangle-mode’ |
|
15064 |
........................ |
|
15065 |
|
|
15066 |
The ‘tangle-mode’ header argument specifies what permissions to set for |
|
15067 |
tangled files by ‘set-file-modes’. For example, to make read-only |
|
15068 |
tangled file, use ‘:tangle-mode (identity #o444)’. To make it |
|
15069 |
executable, use ‘:tangle-mode (identity #o755)’. |
|
15070 |
|
|
15071 |
On ‘src’ code blocks with ‘shebang’ (*note shebang::) header |
|
15072 |
argument, Org will automatically set the tangled file to executable |
|
15073 |
permissions. But this can be overridden with custom permissions using |
|
15074 |
‘tangle-mode’ header argument. |
|
15075 |
|
|
15076 |
When multiple ‘src’ code blocks tangle to a single file with |
|
15077 |
different and conflicting ‘tangle-mode’ header arguments, Org’s behavior |
|
15078 |
is undefined. |
|
15079 |
|
|
15080 |
|
|
15081 |
File: org, Node: eval, Next: wrap, Prev: tangle-mode, Up: Specific header arguments |
|
15082 |
|
|
15083 |
14.8.2.25 ‘:eval’ |
|
15084 |
................. |
|
15085 |
|
|
15086 |
The ‘:eval’ header argument can limit evaluation of specific code |
|
15087 |
blocks. It is useful for protection against evaluating untrusted ‘src’ |
|
15088 |
code blocks by prompting for a confirmation. This protection is |
|
15089 |
independent of the ‘org-confirm-babel-evaluate’ setting. |
|
15090 |
|
|
15091 |
‘never or no’ |
|
15092 |
Org will never evaluate this ‘src’ code block. |
|
15093 |
‘query’ |
|
15094 |
Org prompts the user for permission to evaluate this ‘src’ code |
|
15095 |
block. |
|
15096 |
‘never-export or no-export’ |
|
15097 |
Org will not evaluate this ‘src’ code block when exporting, yet the |
|
15098 |
user can evaluate this source block interactively. |
|
15099 |
‘query-export’ |
|
15100 |
Org prompts the user for permission to export this ‘src’ code |
|
15101 |
block. |
|
15102 |
|
|
15103 |
If ‘:eval’ header argument is not set for a source block, then Org |
|
15104 |
determines whether to evaluate from the ‘org-confirm-babel-evaluate’ |
|
15105 |
variable (*note Code evaluation security::). |
|
15106 |
|
|
15107 |
|
|
15108 |
File: org, Node: wrap, Next: post, Prev: eval, Up: Specific header arguments |
|
15109 |
|
|
15110 |
14.8.2.26 ‘:wrap’ |
|
15111 |
................. |
|
15112 |
|
|
15113 |
The ‘:wrap’ header argument marks the results block by appending strings |
|
15114 |
to ‘#+BEGIN_’ and ‘#+END_’. If no string is specified, Org wraps the |
|
15115 |
results in a ‘#+BEGIN/END_RESULTS’ block. |
|
15116 |
|
|
15117 |
|
|
15118 |
File: org, Node: post, Next: prologue, Prev: wrap, Up: Specific header arguments |
|
15119 |
|
|
15120 |
14.8.2.27 ‘:post’ |
|
15121 |
................. |
|
15122 |
|
|
15123 |
The ‘:post’ header argument is for post-processing results from ‘src’ |
|
15124 |
block evaluation. When ‘:post’ has any value, Org binds the results to |
|
15125 |
‘*this*’ variable for easy passing to *note var:: header argument |
|
15126 |
specifications. That makes results available to other ‘src’ code |
|
15127 |
blocks, or for even direct Emacs Lisp code execution. |
|
15128 |
|
|
15129 |
The following two examples illustrate ‘:post’ header argument in |
|
15130 |
action. The first one shows how to attach ‘#+ATTR_LATEX:’ line using |
|
15131 |
‘:post’. |
|
15132 |
|
|
15133 |
#+name: attr_wrap |
|
15134 |
#+begin_src sh :var data="" :var width="\\textwidth" :results output |
|
15135 |
echo "#+ATTR_LATEX: :width $width" |
|
15136 |
echo "$data" |
|
15137 |
#+end_src |
|
15138 |
|
|
15139 |
#+header: :file /tmp/it.png |
|
15140 |
#+begin_src dot :post attr_wrap(width="5cm", data=*this*) :results drawer |
|
15141 |
digraph{ |
|
15142 |
a -> b; |
|
15143 |
b -> c; |
|
15144 |
c -> a; |
|
15145 |
} |
|
15146 |
#+end_src |
|
15147 |
|
|
15148 |
#+RESULTS: |
|
15149 |
:RESULTS: |
|
15150 |
#+ATTR_LATEX :width 5cm |
|
15151 |
[[file:/tmp/it.png]] |
|
15152 |
:END: |
|
15153 |
|
|
15154 |
The second example shows use of ‘:colnames’ in ‘:post’ to pass data |
|
15155 |
between ‘src’ code blocks. |
|
15156 |
|
|
15157 |
#+name: round-tbl |
|
15158 |
#+begin_src emacs-lisp :var tbl="" fmt="%.3f" |
|
15159 |
(mapcar (lambda (row) |
|
15160 |
(mapcar (lambda (cell) |
|
15161 |
(if (numberp cell) |
|
15162 |
(format fmt cell) |
|
15163 |
cell)) |
|
15164 |
row)) |
|
15165 |
tbl) |
|
15166 |
#+end_src |
|
15167 |
|
|
15168 |
#+begin_src R :colnames yes :post round-tbl[:colnames yes](*this*) |
|
15169 |
set.seed(42) |
|
15170 |
data.frame(foo=rnorm(1)) |
|
15171 |
#+end_src |
|
15172 |
|
|
15173 |
#+RESULTS: |
|
15174 |
| foo | |
|
15175 |
|-------| |
|
15176 |
| 1.371 | |
|
15177 |
|
|
15178 |
|
|
15179 |
File: org, Node: prologue, Next: epilogue, Prev: post, Up: Specific header arguments |
|
15180 |
|
|
15181 |
14.8.2.28 ‘:prologue’ |
|
15182 |
..................... |
|
15183 |
|
|
15184 |
The ‘prologue’ header argument is for appending to the top of the code |
|
15185 |
block for execution. For example, a clear or reset code at the start of |
|
15186 |
new execution of a ‘src’ code block. A ‘reset’ for ‘gnuplot’: |
|
15187 |
‘:prologue "reset"’. See also *note epilogue::. |
|
15188 |
|
|
15189 |
(add-to-list 'org-babel-default-header-args:gnuplot |
|
15190 |
'((:prologue . "reset"))) |
|
15191 |
|
|
15192 |
|
|
15193 |
File: org, Node: epilogue, Prev: prologue, Up: Specific header arguments |
|
15194 |
|
|
15195 |
14.8.2.29 ‘:epilogue’ |
|
15196 |
..................... |
|
15197 |
|
|
15198 |
The value of the ‘epilogue’ header argument is for appending to the end |
|
15199 |
of the code block for execution. See also *note prologue::. |
|
15200 |
|
|
15201 |
|
|
15202 |
File: org, Node: Results of evaluation, Next: Noweb reference syntax, Prev: Header arguments, Up: Working with source code |
|
15203 |
|
|
15204 |
14.9 Results of evaluation |
|
15205 |
========================== |
|
15206 |
|
|
15207 |
How Org handles results of a code block execution depends on many header |
|
15208 |
arguments working together. Here is only a summary of these. For an |
|
15209 |
enumeration of all the header arguments that affect results, see *note |
|
15210 |
results::. |
|
15211 |
|
|
15212 |
The primary determinant is the execution context. Is it in a |
|
15213 |
‘:session’ or not? Orthogonal to that is if the expected result is a |
|
15214 |
‘:results value’ or ‘:results output’, which is a concatenation of |
|
15215 |
output from start to finish of the ‘src’ code block’s evaluation. |
|
15216 |
|
|
15217 |
Non-session Session |
|
15218 |
‘:results value’ value of last value of last expression |
|
15219 |
expression |
|
15220 |
‘:results output’ contents of STDOUT concatenation of interpreter |
|
15221 |
output |
|
15222 |
|
|
15223 |
For ‘:session’ and non-session, the ‘:results value’ turns the |
|
15224 |
results into an Org mode table format. Single values are wrapped in a |
|
15225 |
one dimensional vector. Rows and columns of a table are wrapped in a |
|
15226 |
two-dimensional vector. |
|
15227 |
|
|
15228 |
14.9.1 Non-session |
|
15229 |
------------------ |
|
15230 |
|
|
15231 |
14.9.1.1 ‘:results value’ |
|
15232 |
......................... |
|
15233 |
|
|
15234 |
Default. Org gets the value by wrapping the code in a function |
|
15235 |
definition in the language of the ‘src’ block. That is why when using |
|
15236 |
‘:results value’, code should execute like a function and return a |
|
15237 |
value. For languages like Python, an explicit ‘return’ statement is |
|
15238 |
mandatory when using ‘:results value’. |
|
15239 |
|
|
15240 |
This is one of four evaluation contexts where Org automatically wraps |
|
15241 |
the code in a function definition. |
|
15242 |
|
|
15243 |
14.9.1.2 ‘:results output’ |
|
15244 |
.......................... |
|
15245 |
|
|
15246 |
For ‘:results output’, the code is passed to an external process running |
|
15247 |
the interpreter. Org returns the contents of the standard output stream |
|
15248 |
as as text results. |
|
15249 |
|
|
15250 |
14.9.2 Session |
|
15251 |
-------------- |
|
15252 |
|
|
15253 |
14.9.2.1 ‘:results value’ |
|
15254 |
......................... |
|
15255 |
|
|
15256 |
For ‘:results value’ from a ‘:session’, Org passes the code to an |
|
15257 |
interpreter running as an interactive Emacs inferior process. So only |
|
15258 |
languages that provide interactive evaluation can have session support. |
|
15259 |
Not all languages provide this support, such as ‘C’ and ‘ditaa’. Even |
|
15260 |
those that do support, such as ‘Python’ and ‘Haskell’, they impose |
|
15261 |
limitations on allowable language constructs that can run interactively. |
|
15262 |
Org inherits those limitations for those ‘src’ code blocks running in a |
|
15263 |
‘:session’. |
|
15264 |
|
|
15265 |
Org gets the value from the source code interpreter’s last statement |
|
15266 |
output. Org has to use language-specific methods to obtain the value. |
|
15267 |
For example, from the variable ‘_’ in ‘Python’ and ‘Ruby’, and the value |
|
15268 |
of ‘.Last.value’ in ‘R’). |
|
15269 |
|
|
15270 |
14.9.2.2 ‘:results output’ |
|
15271 |
.......................... |
|
15272 |
|
|
15273 |
For ‘:results output’, Org passes the code to the interpreter running as |
|
15274 |
an interactive Emacs inferior process. Org concatenates whatever text |
|
15275 |
output emitted by the interpreter to return the collection as a result. |
|
15276 |
Note that this collection is not the same as collected from ‘STDOUT’ of |
|
15277 |
a non-interactive interpreter running as an external process. Compare |
|
15278 |
for example these two blocks: |
|
15279 |
|
|
15280 |
#+BEGIN_SRC python :results output |
|
15281 |
print "hello" |
|
15282 |
2 |
|
15283 |
print "bye" |
|
15284 |
#+END_SRC |
|
15285 |
|
|
15286 |
#+RESULTS: |
|
15287 |
: hello |
|
15288 |
: bye |
|
15289 |
|
|
15290 |
In the above non-session mode, the “2” is not printed; so does not |
|
15291 |
appear in results. |
|
15292 |
|
|
15293 |
#+BEGIN_SRC python :results output :session |
|
15294 |
print "hello" |
|
15295 |
2 |
|
15296 |
print "bye" |
|
15297 |
#+END_SRC |
|
15298 |
|
|
15299 |
#+RESULTS: |
|
15300 |
: hello |
|
15301 |
: 2 |
|
15302 |
: bye |
|
15303 |
|
|
15304 |
In the above ‘:session’ mode, the interactive interpreter receives |
|
15305 |
and prints “2”. Results show that. |
|
15306 |
|
|
15307 |
|
|
15308 |
File: org, Node: Noweb reference syntax, Next: Key bindings and useful functions, Prev: Results of evaluation, Up: Working with source code |
|
15309 |
|
|
15310 |
14.10 Noweb reference syntax |
|
15311 |
============================ |
|
15312 |
|
|
15313 |
Org supports named blocks in Noweb style syntax. For Noweb literate |
|
15314 |
programming details, see <http://www.cs.tufts.edu/~nr/noweb/>). |
|
15315 |
|
|
15316 |
<<code-block-name>> |
|
15317 |
|
|
15318 |
For the header argument ‘:noweb yes’, Org expands Noweb style |
|
15319 |
references in the ‘src’ code block before evaluation. |
|
15320 |
|
|
15321 |
For the header argument ‘:noweb no’, Org does not expand Noweb style |
|
15322 |
references in the ‘src’ code block before evaluation. |
|
15323 |
|
|
15324 |
The default is ‘:noweb no’. Org defaults to ‘:noweb no’ so as not to |
|
15325 |
cause errors in languages where Noweb syntax is ambiguous. Change Org’s |
|
15326 |
default to ‘:noweb yes’ for languages where there is no risk of |
|
15327 |
confusion. |
|
15328 |
|
|
15329 |
Org offers a more flexible way to resolve Noweb style references |
|
15330 |
(*note noweb-ref::). |
|
15331 |
|
|
15332 |
Org can include the _results_ of a code block rather than its body. |
|
15333 |
To that effect, append parentheses, possibly including arguments, to the |
|
15334 |
code block name, as show below. |
|
15335 |
|
|
15336 |
<<code-block-name(optional arguments)>> |
|
15337 |
|
|
15338 |
Note that when using the above approach to a code block’s results, |
|
15339 |
the code block name set by ‘#+NAME’ keyword is required; the reference |
|
15340 |
set by ‘:noweb-ref’ will not work. |
|
15341 |
|
|
15342 |
Here is an example that demonstrates how the exported content changes |
|
15343 |
when Noweb style references are used with parentheses versus without. |
|
15344 |
|
|
15345 |
With: |
|
15346 |
|
|
15347 |
#+NAME: some-code |
|
15348 |
#+BEGIN_SRC python :var num=0 :results output :exports none |
|
15349 |
print(num*10) |
|
15350 |
#+END_SRC |
|
15351 |
|
|
15352 |
this code block: |
|
15353 |
|
|
15354 |
#+BEGIN_SRC text :noweb yes |
|
15355 |
<<some-code>> |
|
15356 |
#+END_SRC |
|
15357 |
|
|
15358 |
expands to: |
|
15359 |
|
|
15360 |
print(num*10) |
|
15361 |
|
|
15362 |
Below, a similar Noweb style reference is used, but with parentheses, |
|
15363 |
while setting a variable ‘num’ to 10: |
|
15364 |
|
|
15365 |
#+BEGIN_SRC text :noweb yes |
|
15366 |
<<some-code(num=10)>> |
|
15367 |
#+END_SRC |
|
15368 |
|
|
15369 |
Note that now the expansion contains the _results_ of the code block |
|
15370 |
‘some-code’, not the code block itself: |
|
15371 |
|
|
15372 |
100 |
|
15373 |
|
|
15374 |
For faster tangling of large Org mode files, set |
|
15375 |
‘org-babel-use-quick-and-dirty-noweb-expansion’ variable to ‘t’. The |
|
15376 |
speedup comes at the expense of not correctly resolving inherited values |
|
15377 |
of the ‘:noweb-ref’ header argument. |
|
15378 |
|
|
15379 |
|
|
15380 |
File: org, Node: Key bindings and useful functions, Next: Batch execution, Prev: Noweb reference syntax, Up: Working with source code |
|
15381 |
|
|
15382 |
14.11 Key bindings and useful functions |
|
15383 |
======================================= |
|
15384 |
|
|
15385 |
Many common Org mode key sequences are re-bound depending on the |
|
15386 |
context. |
|
15387 |
|
|
15388 |
Active key bindings in code blocks: |
|
15389 |
|
|
15390 |
‘C-c C-c’ ‘org-babel-execute-src-block’ |
|
15391 |
‘C-c C-o’ ‘org-babel-open-src-block-result’ |
|
15392 |
‘M-<UP>’ ‘org-babel-load-in-session’ |
|
15393 |
‘M-<DOWN>’ ‘org-babel-switch-to-session’ |
|
15394 |
|
|
15395 |
Active key bindings in Org mode buffer: |
|
15396 |
|
|
15397 |
‘C-c C-v p’ or ‘C-c C-v C-p’ ‘org-babel-previous-src-block’ |
|
15398 |
‘C-c C-v n’ or ‘C-c C-v C-n’ ‘org-babel-next-src-block’ |
|
15399 |
‘C-c C-v e’ or ‘C-c C-v C-e’ ‘org-babel-execute-maybe’ |
|
15400 |
‘C-c C-v o’ or ‘C-c C-v C-o’ ‘org-babel-open-src-block-result’ |
|
15401 |
‘C-c C-v v’ or ‘C-c C-v C-v’ ‘org-babel-expand-src-block’ |
|
15402 |
‘C-c C-v u’ or ‘C-c C-v C-u’ ‘org-babel-goto-src-block-head’ |
|
15403 |
‘C-c C-v g’ or ‘C-c C-v C-g’ ‘org-babel-goto-named-src-block’ |
|
15404 |
‘C-c C-v r’ or ‘C-c C-v C-r’ ‘org-babel-goto-named-result’ |
|
15405 |
‘C-c C-v b’ or ‘C-c C-v C-b’ ‘org-babel-execute-buffer’ |
|
15406 |
‘C-c C-v s’ or ‘C-c C-v C-s’ ‘org-babel-execute-subtree’ |
|
15407 |
‘C-c C-v d’ or ‘C-c C-v C-d’ ‘org-babel-demarcate-block’ |
|
15408 |
‘C-c C-v t’ or ‘C-c C-v C-t’ ‘org-babel-tangle’ |
|
15409 |
‘C-c C-v f’ or ‘C-c C-v C-f’ ‘org-babel-tangle-file’ |
|
15410 |
‘C-c C-v c’ or ‘C-c C-v C-c’ ‘org-babel-check-src-block’ |
|
15411 |
‘C-c C-v j’ or ‘C-c C-v C-j’ ‘org-babel-insert-header-arg’ |
|
15412 |
‘C-c C-v l’ or ‘C-c C-v C-l’ ‘org-babel-load-in-session’ |
|
15413 |
‘C-c C-v i’ or ‘C-c C-v C-i’ ‘org-babel-lob-ingest’ |
|
15414 |
‘C-c C-v I’ or ‘C-c C-v C-I’ ‘org-babel-view-src-block-info’ |
|
15415 |
‘C-c C-v z’ or ‘C-c C-v C-z’ ‘org-babel-switch-to-session-with-code’ |
|
15416 |
‘C-c C-v a’ or ‘C-c C-v C-a’ ‘org-babel-sha1-hash’ |
|
15417 |
‘C-c C-v h’ or ‘C-c C-v C-h’ ‘org-babel-describe-bindings’ |
|
15418 |
‘C-c C-v x’ or ‘C-c C-v C-x’ ‘org-babel-do-key-sequence-in-edit-buffer’ |
|
15419 |
|
|
15420 |
|
|
15421 |
File: org, Node: Batch execution, Prev: Key bindings and useful functions, Up: Working with source code |
|
15422 |
|
|
15423 |
14.12 Batch execution |
|
15424 |
===================== |
|
15425 |
|
|
15426 |
Org mode features, including working with source code facilities can be |
|
15427 |
invoked from the command line. This enables building shell scripts for |
|
15428 |
batch processing, running automated system tasks, and expanding Org |
|
15429 |
mode’s usefulness. |
|
15430 |
|
|
15431 |
The sample script shows batch processing of multiple files using |
|
15432 |
‘org-babel-tangle’. |
|
15433 |
|
|
15434 |
#!/bin/sh |
|
15435 |
# tangle files with org-mode |
|
15436 |
# |
|
15437 |
emacs -Q --batch --eval " |
|
15438 |
(progn |
|
15439 |
(require 'ob-tangle) |
|
15440 |
(dolist (file command-line-args-left) |
|
15441 |
(with-current-buffer (find-file-noselect file) |
|
15442 |
(org-babel-tangle)))) |
|
15443 |
" "$@" |
|
15444 |
|
|
15445 |
|
|
15446 |
File: org, Node: Miscellaneous, Next: Hacking, Prev: Working with source code, Up: Top |
|
15447 |
|
|
15448 |
15 Miscellaneous |
|
15449 |
**************** |
|
15450 |
|
|
15451 |
* Menu: |
|
15452 |
|
|
15453 |
* Completion:: M-<TAB> guesses completions |
|
15454 |
* Easy templates:: Quick insertion of structural elements |
|
15455 |
* Speed keys:: Electric commands at the beginning of a headline |
|
15456 |
* Code evaluation security:: Org mode files evaluate inline code |
|
15457 |
* Customization:: Adapting Org to changing tastes |
|
15458 |
* In-buffer settings:: Overview of the ‘#+KEYWORDS’ |
|
15459 |
* The very busy C-c C-c key:: When in doubt, press C-c C-c |
|
15460 |
* Clean view:: Getting rid of leading stars in the outline |
|
15461 |
* TTY keys:: Using Org on a tty |
|
15462 |
* Interaction:: With other Emacs packages |
|
15463 |
* org-crypt:: Encrypting Org files |
|
15464 |
|
|
15465 |
|
|
15466 |
File: org, Node: Completion, Next: Easy templates, Up: Miscellaneous |
|
15467 |
|
|
15468 |
15.1 Completion |
|
15469 |
=============== |
|
15470 |
|
|
15471 |
Org has in-buffer completions. Unlike minibuffer completions, which are |
|
15472 |
useful for quick command interactions, Org’s in-buffer completions are |
|
15473 |
more suitable for content creation in Org documents. Type one or more |
|
15474 |
letters and invoke the hot key to complete the text in-place. Depending |
|
15475 |
on the context and the keys, Org will offer different types of |
|
15476 |
completions. No minibuffer is involved. Such mode-specific hot keys |
|
15477 |
have become an integral part of Emacs and Org provides several |
|
15478 |
shortcuts. |
|
15479 |
|
|
15480 |
‘M-<TAB>’ |
|
15481 |
Complete word at point |
|
15482 |
• At the beginning of a headline, complete TODO keywords. |
|
15483 |
• After ‘\’, complete TeX symbols supported by the exporter. |
|
15484 |
• After ‘*’, complete headlines in the current buffer so that |
|
15485 |
they can be used in search links like ‘[[*find this |
|
15486 |
headline]]’. |
|
15487 |
• After ‘:’ in a headline, complete tags. The list of tags is |
|
15488 |
taken from the variable ‘org-tag-alist’ (possibly set through |
|
15489 |
the ‘#+TAGS’ in-buffer option, *note Setting tags::), or it is |
|
15490 |
created dynamically from all tags used in the current buffer. |
|
15491 |
• After ‘:’ and not in a headline, complete property keys. The |
|
15492 |
list of keys is constructed dynamically from all keys used in |
|
15493 |
the current buffer. |
|
15494 |
• After ‘[’, complete link abbreviations (*note Link |
|
15495 |
abbreviations::). |
|
15496 |
• After ‘#+’, complete the special keywords like ‘TYP_TODO’ or |
|
15497 |
file-specific ‘OPTIONS’. After option keyword is complete, |
|
15498 |
pressing ‘M-<TAB>’ again will insert example settings for that |
|
15499 |
option. |
|
15500 |
• After ‘#+STARTUP:’, complete startup keywords. |
|
15501 |
• When the point is anywhere else, complete dictionary words |
|
15502 |
using Ispell. |
|
15503 |
If your desktop intercepts the combo ‘M-<TAB>’ to switch windows, |
|
15504 |
use ‘C-M-i’ or ‘<ESC> <TAB>’ as an alternative or customize your |
|
15505 |
environment. |
|
15506 |
|
|
15507 |
|
|
15508 |
File: org, Node: Easy templates, Next: Speed keys, Prev: Completion, Up: Miscellaneous |
|
15509 |
|
|
15510 |
15.2 Easy templates |
|
15511 |
=================== |
|
15512 |
|
|
15513 |
With just a few keystrokes, Org’s easy templates inserts empty pairs of |
|
15514 |
structural elements, such as ‘#+BEGIN_SRC’ and ‘#+END_SRC’. Easy |
|
15515 |
templates use an expansion mechanism, which is native to Org, in a |
|
15516 |
process similar to ‘yasnippet’ and other Emacs template expansion |
|
15517 |
packages. |
|
15518 |
|
|
15519 |
‘<’ ‘s’ ‘<TAB>’ expands to a ‘src’ code block. |
|
15520 |
|
|
15521 |
‘<’ ‘l’ ‘<TAB>’ expands to: |
|
15522 |
|
|
15523 |
#+BEGIN_EXPORT latex |
|
15524 |
|
|
15525 |
#+END_EXPORT |
|
15526 |
|
|
15527 |
Org comes with these pre-defined easy templates: |
|
15528 |
|
|
15529 |
‘s’ ‘#+BEGIN_SRC ... #+END_SRC’ |
|
15530 |
‘e’ ‘#+BEGIN_EXAMPLE ... #+END_EXAMPLE’ |
|
15531 |
‘q’ ‘#+BEGIN_QUOTE ... #+END_QUOTE’ |
|
15532 |
‘v’ ‘#+BEGIN_VERSE ... #+END_VERSE’ |
|
15533 |
‘c’ ‘#+BEGIN_CENTER ... #+END_CENTER’ |
|
15534 |
‘C’ ‘#+BEGIN_COMMENT ... #+END_COMMENT’ |
|
15535 |
‘l’ ‘#+BEGIN_EXPORT latex ... #+END_EXPORT’ |
|
15536 |
‘L’ ‘#+LATEX:’ |
|
15537 |
‘h’ ‘#+BEGIN_EXPORT html ... #+END_EXPORT’ |
|
15538 |
‘H’ ‘#+HTML:’ |
|
15539 |
‘a’ ‘#+BEGIN_EXPORT ascii ... #+END_EXPORT’ |
|
15540 |
‘A’ ‘#+ASCII:’ |
|
15541 |
‘i’ ‘#+INDEX:’ line |
|
15542 |
‘I’ ‘#+INCLUDE:’ line |
|
15543 |
|
|
15544 |
More templates can added by customizing the variable |
|
15545 |
‘org-structure-template-alist’, whose docstring has additional details. |
|
15546 |
|
|
15547 |
|
|
15548 |
File: org, Node: Speed keys, Next: Code evaluation security, Prev: Easy templates, Up: Miscellaneous |
|
15549 |
|
|
15550 |
15.3 Speed keys |
|
15551 |
=============== |
|
15552 |
|
|
15553 |
Single keystrokes can execute custom commands in an Org file when the |
|
15554 |
cursor is on a headline. Without the extra burden of a meta or modifier |
|
15555 |
key, Speed Keys can speed navigation or execute custom commands. |
|
15556 |
Besides faster navigation, Speed Keys may come in handy on small mobile |
|
15557 |
devices that do not have full keyboards. Speed Keys may also work on |
|
15558 |
TTY devices known for their problems when entering Emacs keychords. |
|
15559 |
|
|
15560 |
By default, Org has Speed Keys disabled. To activate Speed Keys, set |
|
15561 |
the variable ‘org-use-speed-commands’ to a non-‘nil’ value. To trigger |
|
15562 |
a Speed Key, the cursor must be at the beginning of an Org headline, |
|
15563 |
before any of the stars. |
|
15564 |
|
|
15565 |
Org comes with a pre-defined list of Speed Keys. To add or modify |
|
15566 |
Speed Keys, customize the variable, ‘org-speed-commands-user’. For more |
|
15567 |
details, see the variable’s docstring. With Speed Keys activated, ‘M-x |
|
15568 |
org-speed-command-help’, or ‘?’ when cursor is at the beginning of an |
|
15569 |
Org headline, shows currently active Speed Keys, including the |
|
15570 |
user-defined ones. |
|
15571 |
|
|
15572 |
|
|
15573 |
File: org, Node: Code evaluation security, Next: Customization, Prev: Speed keys, Up: Miscellaneous |
|
15574 |
|
|
15575 |
15.4 Code evaluation and security issues |
|
15576 |
======================================== |
|
15577 |
|
|
15578 |
Unlike plain text, running code comes with risk. Each ‘src’ code block, |
|
15579 |
in terms of risk, is equivalent to an executable file. Org therefore |
|
15580 |
puts a few confirmation prompts by default. This is to alert the casual |
|
15581 |
user from accidentally running untrusted code. |
|
15582 |
|
|
15583 |
For users who do not run code blocks or write code regularly, Org’s |
|
15584 |
default settings should suffice. However, some users may want to tweak |
|
15585 |
the prompts for fewer interruptions. To weigh the risks of automatic |
|
15586 |
execution of code blocks, here are some details about code evaluation. |
|
15587 |
|
|
15588 |
Org evaluates code in the following circumstances: |
|
15589 |
|
|
15590 |
Source code blocks |
|
15591 |
Org evaluates ‘src’ code blocks in an Org file during export. Org |
|
15592 |
also evaluates a ‘src’ code block with the ‘C-c C-c’ key chord. |
|
15593 |
Users exporting or running code blocks must load files only from |
|
15594 |
trusted sources. Be wary of customizing variables that remove or |
|
15595 |
alter default security measures. |
|
15596 |
|
|
15597 |
-- User Option: org-confirm-babel-evaluate |
|
15598 |
When ‘t’, Org prompts the user for confirmation before |
|
15599 |
executing each code block. When ‘nil’, Org executes code |
|
15600 |
blocks without prompting the user for confirmation. When this |
|
15601 |
option is set to a custom function, Org invokes the function |
|
15602 |
with these two arguments: the source code language and the |
|
15603 |
body of the code block. The custom function must return |
|
15604 |
either a ‘t’ or ‘nil’, which determines if the user is |
|
15605 |
prompted. Each source code language can be handled separately |
|
15606 |
through this function argument. |
|
15607 |
|
|
15608 |
For example, this function enables execution of ‘ditaa’ code |
|
15609 |
+blocks without prompting: |
|
15610 |
|
|
15611 |
(defun my-org-confirm-babel-evaluate (lang body) |
|
15612 |
(not (string= lang "ditaa"))) ; don't ask for ditaa |
|
15613 |
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) |
|
15614 |
|
|
15615 |
Following ‘shell’ and ‘elisp’ links |
|
15616 |
Org has two link types that can also directly evaluate code (*note |
|
15617 |
External links::). Because such code is not visible, these links |
|
15618 |
have a potential risk. Org therefore prompts the user when it |
|
15619 |
encounters such links. The customization variables are: |
|
15620 |
|
|
15621 |
-- User Option: org-confirm-shell-link-function |
|
15622 |
Function that prompts the user before executing a shell link. |
|
15623 |
-- User Option: org-confirm-elisp-link-function |
|
15624 |
Function that prompts the user before executing an Emacs Lisp |
|
15625 |
link. |
|
15626 |
|
|
15627 |
Formulas in tables |
|
15628 |
Org executes formulas in tables (*note The spreadsheet::) either |
|
15629 |
through the _calc_ or the _Emacs Lisp_ interpreters. |
|
15630 |
|
|
15631 |
|
|
15632 |
File: org, Node: Customization, Next: In-buffer settings, Prev: Code evaluation security, Up: Miscellaneous |
|
15633 |
|
|
15634 |
15.5 Customization |
|
15635 |
================== |
|
15636 |
|
|
15637 |
Org has more than 500 variables for customization. They can be accessed |
|
15638 |
through the usual ‘M-x org-customize <RET>’ command. Or through the Org |
|
15639 |
menu, ‘Org->Customization->Browse Org Group’. Org also has per-file |
|
15640 |
settings for some variables (*note In-buffer settings::). |
|
15641 |
|
|
15642 |
|
|
15643 |
File: org, Node: In-buffer settings, Next: The very busy C-c C-c key, Prev: Customization, Up: Miscellaneous |
|
15644 |
|
|
15645 |
15.6 Summary of in-buffer settings |
|
15646 |
================================== |
|
15647 |
|
|
15648 |
In-buffer settings start with ‘#+’, followed by a keyword, a colon, and |
|
15649 |
then a word for each setting. Org accepts multiple settings on the same |
|
15650 |
line. Org also accepts multiple lines for a keyword. This manual |
|
15651 |
describes these settings throughout. A summary follows here. |
|
15652 |
|
|
15653 |
‘C-c C-c’ activates any changes to the in-buffer settings. Closing |
|
15654 |
and reopening the Org file in Emacs also activates the changes. |
|
15655 |
|
|
15656 |
‘#+ARCHIVE: %s_done::’ |
|
15657 |
Sets the archive location of the agenda file. This location |
|
15658 |
applies to the lines until the next ‘#+ARCHIVE’ line, if any, in |
|
15659 |
the Org file. The first archive location in the Org file also |
|
15660 |
applies to any entries before it. The corresponding variable is |
|
15661 |
‘org-archive-location’. |
|
15662 |
‘#+CATEGORY:’ |
|
15663 |
Sets the category of the agenda file, which applies to the entire |
|
15664 |
document. |
|
15665 |
‘#+COLUMNS: %25ITEM ...’ |
|
15666 |
Sets the default format for columns view. Org uses this format for |
|
15667 |
column views where there is no ‘COLUMNS’ property. |
|
15668 |
‘#+CONSTANTS: name1=value1 ...’ |
|
15669 |
Set file-local values for constants that table formulas can use. |
|
15670 |
This line sets the local variable |
|
15671 |
‘org-table-formula-constants-local’. The global version of this |
|
15672 |
variable is ‘org-table-formula-constants’. |
|
15673 |
‘#+FILETAGS: :tag1:tag2:tag3:’ |
|
15674 |
Set tags that all entries in the file will inherit from here, |
|
15675 |
including the top-level entries. |
|
15676 |
‘#+LINK: linkword replace’ |
|
15677 |
Each line specifies one abbreviation for one link. Use multiple |
|
15678 |
‘#+LINK:’ lines for more, *note Link abbreviations::. The |
|
15679 |
corresponding variable is ‘org-link-abbrev-alist’. |
|
15680 |
‘#+PRIORITIES: highest lowest default’ |
|
15681 |
This line sets the limits and the default for the priorities. All |
|
15682 |
three must be either letters A–Z or numbers 0–9. The highest |
|
15683 |
priority must have a lower ASCII number than the lowest priority. |
|
15684 |
‘#+PROPERTY: Property_Name Value’ |
|
15685 |
This line sets a default inheritance value for entries in the |
|
15686 |
current buffer, most useful for specifying the allowed values of a |
|
15687 |
property. |
|
15688 |
‘#+SETUPFILE: file or URL’ |
|
15689 |
The setup file or a URL pointing to such file is for additional |
|
15690 |
in-buffer settings. Org loads this file and parses it for any |
|
15691 |
settings in it only when Org opens the main file. If URL is |
|
15692 |
specified, the contents are downloaded and stored in a temporary |
|
15693 |
file cache. ‘C-c C-c’ on the settings line will parse and load the |
|
15694 |
file, and also reset the temporary file cache. Org also parses and |
|
15695 |
loads the document during normal exporting process. Org parses the |
|
15696 |
contents of this document as if it was included in the buffer. It |
|
15697 |
can be another Org file. To visit the file (not a URL), ‘C-c '’ |
|
15698 |
while the cursor is on the line with the file name. |
|
15699 |
‘#+STARTUP:’ |
|
15700 |
Startup options Org uses when first visiting a file. |
|
15701 |
|
|
15702 |
The first set of options deals with the initial visibility of the |
|
15703 |
outline tree. The corresponding variable for global default |
|
15704 |
settings is ‘org-startup-folded’ with a default value of ‘t’, which |
|
15705 |
is the same as ‘overview’. |
|
15706 |
|
|
15707 |
overview top-level headlines only |
|
15708 |
content all headlines |
|
15709 |
showall no folding of any entries |
|
15710 |
showeverything show even drawer contents |
|
15711 |
|
|
15712 |
Dynamic virtual indentation is controlled by the variable |
|
15713 |
‘org-startup-indented’ |
|
15714 |
indent start with ‘org-indent-mode’ turned on |
|
15715 |
noindent start with ‘org-indent-mode’ turned off |
|
15716 |
|
|
15717 |
Aligns tables consistently upon visiting a file; useful for |
|
15718 |
restoring narrowed table columns. The corresponding variable is |
|
15719 |
‘org-startup-align-all-tables’ with ‘nil’ as default value. |
|
15720 |
|
|
15721 |
align align all tables |
|
15722 |
noalign don’t align tables on startup |
|
15723 |
|
|
15724 |
Whether Org should automatically display inline images. The |
|
15725 |
corresponding variable is ‘org-startup-with-inline-images’, with a |
|
15726 |
default value ‘nil’ to avoid delays when visiting a file. |
|
15727 |
inlineimages show inline images |
|
15728 |
noinlineimages don’t show inline images on startup |
|
15729 |
|
|
15730 |
Whether Org should automatically convert LaTeX fragments to images. |
|
15731 |
The variable ‘org-startup-with-latex-preview’, which controls this |
|
15732 |
setting, is set to ‘nil’ by default to avoid startup delays. |
|
15733 |
latexpreview preview LaTeX fragments |
|
15734 |
nolatexpreview don’t preview LaTeX fragments |
|
15735 |
|
|
15736 |
Logging the closing and reopening of TODO items and clock intervals |
|
15737 |
can be configured using these options (see variables |
|
15738 |
‘org-log-done’, ‘org-log-note-clock-out’ and ‘org-log-repeat’) |
|
15739 |
logdone record a timestamp when an item is marked DONE |
|
15740 |
lognotedone record timestamp and a note when DONE |
|
15741 |
nologdone don’t record when items are marked DONE |
|
15742 |
logrepeat record a time when reinstating a repeating item |
|
15743 |
lognoterepeat record a note when reinstating a repeating item |
|
15744 |
nologrepeat do not record when reinstating repeating item |
|
15745 |
lognoteclock-out record a note when clocking out |
|
15746 |
nolognoteclock-out don’t record a note when clocking out |
|
15747 |
logreschedule record a timestamp when scheduling time changes |
|
15748 |
lognotereschedule record a note when scheduling time changes |
|
15749 |
nologreschedule do not record when a scheduling date changes |
|
15750 |
logredeadline record a timestamp when deadline changes |
|
15751 |
lognoteredeadline record a note when deadline changes |
|
15752 |
nologredeadline do not record when a deadline date changes |
|
15753 |
logrefile record a timestamp when refiling |
|
15754 |
lognoterefile record a note when refiling |
|
15755 |
nologrefile do not record when refiling |
|
15756 |
logdrawer store log into drawer |
|
15757 |
nologdrawer store log outside of drawer |
|
15758 |
logstatesreversed reverse the order of states notes |
|
15759 |
nologstatesreversed do not reverse the order of states notes |
|
15760 |
|
|
15761 |
These options hide leading stars in outline headings, and indent |
|
15762 |
outlines. The corresponding variables are ‘org-hide-leading-stars’ |
|
15763 |
and ‘org-odd-levels-only’, both with a default setting of ‘nil’ |
|
15764 |
(meaning ‘showstars’ and ‘oddeven’). |
|
15765 |
hidestars hide all stars on the headline except one. |
|
15766 |
showstars show all stars on the headline |
|
15767 |
indent virtual indents according to the outline level |
|
15768 |
noindent no virtual indents |
|
15769 |
odd show odd outline levels only (1,3,...) |
|
15770 |
oddeven show all outline levels |
|
15771 |
|
|
15772 |
To turn on custom format overlays over timestamps (variables |
|
15773 |
‘org-put-time-stamp-overlays’ and |
|
15774 |
‘org-time-stamp-overlay-formats’), use |
|
15775 |
customtime overlay custom time format |
|
15776 |
|
|
15777 |
The following options influence the table spreadsheet (variable |
|
15778 |
‘constants-unit-system’). |
|
15779 |
constcgs ‘constants.el’ should use the c-g-s unit system |
|
15780 |
constSI ‘constants.el’ should use the SI unit system |
|
15781 |
|
|
15782 |
For footnote settings, use the following keywords. The |
|
15783 |
corresponding variables are ‘org-footnote-define-inline’, |
|
15784 |
‘org-footnote-auto-label’, and ‘org-footnote-auto-adjust’. |
|
15785 |
fninline define footnotes inline |
|
15786 |
fnnoinline define footnotes in separate section |
|
15787 |
fnlocal define footnotes near first reference, but not inline |
|
15788 |
fnprompt prompt for footnote labels |
|
15789 |
fnauto create ‘[fn:1]’-like labels automatically (default) |
|
15790 |
fnconfirm offer automatic label for editing or confirmation |
|
15791 |
fnplain create ‘[1]’-like labels automatically |
|
15792 |
fnadjust automatically renumber and sort footnotes |
|
15793 |
nofnadjust do not renumber and sort automatically |
|
15794 |
|
|
15795 |
To hide blocks on startup, use these keywords. The corresponding |
|
15796 |
variable is ‘org-hide-block-startup’. |
|
15797 |
hideblocks Hide all begin/end blocks on startup |
|
15798 |
nohideblocks Do not hide blocks on startup |
|
15799 |
|
|
15800 |
The display of entities as UTF-8 characters is governed by the |
|
15801 |
variable ‘org-pretty-entities’ and the keywords |
|
15802 |
entitiespretty Show entities as UTF-8 characters where possible |
|
15803 |
entitiesplain Leave entities plain |
|
15804 |
|
|
15805 |
‘#+TAGS: TAG1(c1) TAG2(c2)’ |
|
15806 |
These lines specify valid tags for this file. Org accepts multiple |
|
15807 |
tags lines. Tags could correspond to the _fast tag selection_ |
|
15808 |
keys. The corresponding variable is ‘org-tag-alist’. |
|
15809 |
‘#+TBLFM:’ |
|
15810 |
This line is for formulas for the table directly above. A table |
|
15811 |
can have multiple ‘#+TBLFM:’ lines. On table recalculation, Org |
|
15812 |
applies only the first ‘#+TBLFM:’ line. For details see *note |
|
15813 |
Using multiple #+TBLFM lines:: in *note Editing and debugging |
|
15814 |
formulas::. |
|
15815 |
‘#+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+DATE:,’ |
|
15816 |
‘#+OPTIONS:, #+BIND:,’ |
|
15817 |
‘#+SELECT_TAGS:, #+EXCLUDE_TAGS:’ |
|
15818 |
These lines provide settings for exporting files. For more details |
|
15819 |
see *note Export settings::. |
|
15820 |
‘#+TODO: #+SEQ_TODO: #+TYP_TODO:’ |
|
15821 |
These lines set the TODO keywords and their significance to the |
|
15822 |
current file. The corresponding variable is ‘org-todo-keywords’. |
|
15823 |
|
|
15824 |
|
|
15825 |
File: org, Node: The very busy C-c C-c key, Next: Clean view, Prev: In-buffer settings, Up: Miscellaneous |
|
15826 |
|
|
15827 |
15.7 The very busy C-c C-c key |
|
15828 |
============================== |
|
15829 |
|
|
15830 |
The ‘C-c C-c’ key in Org serves many purposes depending on the context. |
|
15831 |
It is probably the most over-worked, multi-purpose key combination in |
|
15832 |
Org. Its uses are well-documented through out this manual, but here is |
|
15833 |
a consolidated list for easy reference. |
|
15834 |
|
|
15835 |
− If any highlights shown in the buffer from the creation of a sparse |
|
15836 |
tree, or from clock display, remove such highlights. |
|
15837 |
− If the cursor is in one of the special ‘#+KEYWORD’ lines, scan the |
|
15838 |
buffer for these lines and update the information. Also reset the |
|
15839 |
Org file cache used to temporary store the contents of URLs used as |
|
15840 |
values for keywords like ‘#+SETUPFILE’. |
|
15841 |
− If the cursor is inside a table, realign the table. The table |
|
15842 |
realigns even if automatic table editor is turned off. |
|
15843 |
− If the cursor is on a ‘#+TBLFM’ line, re-apply the formulas to the |
|
15844 |
entire table. |
|
15845 |
− If the current buffer is a capture buffer, close the note and file |
|
15846 |
it. With a prefix argument, also jump to the target location after |
|
15847 |
saving the note. |
|
15848 |
− If the cursor is on a ‘<<<target>>>’, update radio targets and |
|
15849 |
corresponding links in this buffer. |
|
15850 |
− If the cursor is on a property line or at the start or end of a |
|
15851 |
property drawer, offer property commands. |
|
15852 |
− If the cursor is at a footnote reference, go to the corresponding |
|
15853 |
definition, and _vice versa_. |
|
15854 |
− If the cursor is on a statistics cookie, update it. |
|
15855 |
− If the cursor is in a plain list item with a checkbox, toggle the |
|
15856 |
status of the checkbox. |
|
15857 |
− If the cursor is on a numbered item in a plain list, renumber the |
|
15858 |
ordered list. |
|
15859 |
− If the cursor is on the ‘#+BEGIN’ line of a dynamic block, the |
|
15860 |
block is updated. |
|
15861 |
− If the cursor is at a timestamp, fix the day name in the timestamp. |
|
15862 |
|
|
15863 |
|
|
15864 |
File: org, Node: Clean view, Next: TTY keys, Prev: The very busy C-c C-c key, Up: Miscellaneous |
|
15865 |
|
|
15866 |
15.8 A cleaner outline view |
|
15867 |
=========================== |
|
15868 |
|
|
15869 |
Org’s default outline with stars and no indents can become too cluttered |
|
15870 |
for short documents. For _book-like_ long documents, the effect is not |
|
15871 |
as noticeable. Org provides an alternate stars and indentation scheme, |
|
15872 |
as shown on the right in the following table. It uses only one star and |
|
15873 |
indents text to line with the heading: |
|
15874 |
|
|
15875 |
* Top level headline | * Top level headline |
|
15876 |
** Second level | * Second level |
|
15877 |
*** 3rd level | * 3rd level |
|
15878 |
some text | some text |
|
15879 |
*** 3rd level | * 3rd level |
|
15880 |
more text | more text |
|
15881 |
* Another top level headline | * Another top level headline |
|
15882 |
|
|
15883 |
|
|
15884 |
To turn this mode on, use the minor mode, ‘org-indent-mode’. Text |
|
15885 |
lines that are not headlines are prefixed with spaces to vertically |
|
15886 |
align with the headline text(1). |
|
15887 |
|
|
15888 |
To make more horizontal space, the headlines are shifted by two |
|
15889 |
stars. This can be configured by the ‘org-indent-indentation-per-level’ |
|
15890 |
variable. Only one star on each headline is visible, the rest are |
|
15891 |
masked with the same font color as the background. This font face can |
|
15892 |
be configured with the ‘org-hide’ variable. |
|
15893 |
|
|
15894 |
Note that turning on ‘org-indent-mode’ sets ‘org-hide-leading-stars’ |
|
15895 |
to ‘t’ and ‘org-adapt-indentation’ to ‘nil’; ‘2.’ below shows how this |
|
15896 |
works. |
|
15897 |
|
|
15898 |
To globally turn on ‘org-indent-mode’ for all files, customize the |
|
15899 |
variable ‘org-startup-indented’. |
|
15900 |
|
|
15901 |
To turn on indenting for individual files, use ‘#+STARTUP’ option as |
|
15902 |
follows: |
|
15903 |
|
|
15904 |
#+STARTUP: indent |
|
15905 |
|
|
15906 |
Indent on startup makes Org use hard spaces to align text with |
|
15907 |
headings as shown in examples below. |
|
15908 |
|
|
15909 |
1. _Indentation of text below headlines_ |
|
15910 |
Indent text to align with the headline. |
|
15911 |
|
|
15912 |
*** 3rd level |
|
15913 |
more text, now indented |
|
15914 |
|
|
15915 |
Org adapts indentations with paragraph filling, line wrapping, and |
|
15916 |
structure editing(2). |
|
15917 |
|
|
15918 |
2. _Hiding leading stars_ |
|
15919 |
Org can make leading stars invisible. For global preference, |
|
15920 |
configure the variable ‘org-hide-leading-stars’. For per-file |
|
15921 |
preference, use these file ‘#+STARTUP’ options: |
|
15922 |
|
|
15923 |
#+STARTUP: hidestars |
|
15924 |
#+STARTUP: showstars |
|
15925 |
|
|
15926 |
With stars hidden, the tree is shown as: |
|
15927 |
|
|
15928 |
* Top level headline |
|
15929 |
* Second level |
|
15930 |
* 3rd level |
|
15931 |
... |
|
15932 |
|
|
15933 |
Because Org makes the font color same as the background color to |
|
15934 |
hide to stars, sometimes ‘org-hide’ face may need tweaking to get |
|
15935 |
the effect right. For some black and white combinations, ‘grey90’ |
|
15936 |
on a white background might mask the stars better. |
|
15937 |
|
|
15938 |
3. Using stars for only odd levels, 1, 3, 5, ..., can also clean up |
|
15939 |
the clutter. This removes two stars from each level(3). For Org |
|
15940 |
to properly handle this cleaner structure during edits and exports, |
|
15941 |
configure the variable ‘org-odd-levels-only’. To set this |
|
15942 |
per-file, use either one of the following lines: |
|
15943 |
|
|
15944 |
#+STARTUP: odd |
|
15945 |
#+STARTUP: oddeven |
|
15946 |
|
|
15947 |
To switch between single and double stars layouts, use ‘M-x |
|
15948 |
org-convert-to-odd-levels <RET>’ and ‘M-x |
|
15949 |
org-convert-to-oddeven-levels <RET>’. |
|
15950 |
|
|
15951 |
---------- Footnotes ---------- |
|
15952 |
|
|
15953 |
(1) The ‘org-indent-mode’ also sets the ‘wrap-prefix’ correctly for |
|
15954 |
indenting and wrapping long lines of headlines or text. This minor mode |
|
15955 |
handles ‘visual-line-mode’ and directly applied settings through |
|
15956 |
‘word-wrap’. |
|
15957 |
|
|
15958 |
(2) Also see the variable ‘org-adapt-indentation’. |
|
15959 |
|
|
15960 |
(3) Because ‘LEVEL=2’ has 3 stars, ‘LEVEL=3’ has 4 stars, and so on |
|
15961 |
|
|
15962 |
|
|
15963 |
File: org, Node: TTY keys, Next: Interaction, Prev: Clean view, Up: Miscellaneous |
|
15964 |
|
|
15965 |
15.9 Using Org on a tty |
|
15966 |
======================= |
|
15967 |
|
|
15968 |
Org provides alternative key bindings for TTY and modern mobile devices |
|
15969 |
that cannot handle cursor keys and complex modifier key chords. Some of |
|
15970 |
these workarounds may be more cumbersome than necessary. Users should |
|
15971 |
look into customizing these further based on their usage needs. For |
|
15972 |
example, the normal ‘S-<cursor>’ for editing timestamp might be better |
|
15973 |
with ‘C-c .’ chord. |
|
15974 |
|
|
15975 |
Default Alternative Speed Alternative |
|
15976 |
1 key 2 |
|
15977 |
‘S-<TAB>’ ‘C-u <TAB>’ ‘C’ |
|
15978 |
‘M-<LEFT>’ ‘C-c C-x l’ ‘l’ ‘<Esc> |
|
15979 |
<LEFT>’ |
|
15980 |
‘M-S-<LEFT>’‘C-c C-x L’ ‘L’ |
|
15981 |
‘M-<RIGHT>’ ‘C-c C-x r’ ‘r’ ‘<Esc> |
|
15982 |
<RIGHT>’ |
|
15983 |
‘M-S-<RIGHT>’‘C-c C-x R’ ‘R’ |
|
15984 |
‘M-<UP>’ ‘C-c C-x u’ ‘ ’ ‘<Esc> <UP>’ |
|
15985 |
‘M-S-<UP>’ ‘C-c C-x U’ ‘U’ |
|
15986 |
‘M-<DOWN>’ ‘C-c C-x d’ ‘ ’ ‘<Esc> |
|
15987 |
<DOWN>’ |
|
15988 |
‘M-S-<DOWN>’‘C-c C-x D’ ‘D’ |
|
15989 |
‘S-<RET>’ ‘C-c C-x c’ ‘ ’ |
|
15990 |
‘M-<RET>’ ‘C-c C-x m’ ‘ ’ ‘<Esc> |
|
15991 |
<RET>’ |
|
15992 |
‘M-S-<RET>’ ‘C-c C-x M’ ‘ ’ |
|
15993 |
‘S-<LEFT>’ ‘C-c <LEFT>’ ‘ ’ |
|
15994 |
‘S-<RIGHT>’ ‘C-c ‘ ’ |
|
15995 |
<RIGHT>’ |
|
15996 |
‘S-<UP>’ ‘C-c <UP>’ ‘ ’ |
|
15997 |
‘S-<DOWN>’ ‘C-c <DOWN>’ ‘ ’ |
|
15998 |
‘C-S-<LEFT>’‘C-c C-x ‘ ’ |
|
15999 |
<LEFT>’ |
|
16000 |
‘C-S-<RIGHT>’‘C-c C-x ‘ ’ |
|
16001 |
<RIGHT>’ |
|
16002 |
|
|
16003 |
|
|
16004 |
File: org, Node: Interaction, Next: org-crypt, Prev: TTY keys, Up: Miscellaneous |
|
16005 |
|
|
16006 |
15.10 Interaction with other packages |
|
16007 |
===================================== |
|
16008 |
|
|
16009 |
Org’s compatibility and the level of interaction with other Emacs |
|
16010 |
packages are documented here. |
|
16011 |
|
|
16012 |
* Menu: |
|
16013 |
|
|
16014 |
* Cooperation:: Packages Org cooperates with |
|
16015 |
* Conflicts:: Packages that lead to conflicts |
|
16016 |
|
|
16017 |
|
|
16018 |
File: org, Node: Cooperation, Next: Conflicts, Up: Interaction |
|
16019 |
|
|
16020 |
15.10.1 Packages that Org cooperates with |
|
16021 |
----------------------------------------- |
|
16022 |
|
|
16023 |
‘calc.el’ by Dave Gillespie |
|
16024 |
Org uses the Calc package for tables to implement spreadsheet |
|
16025 |
functionality (*note The spreadsheet::). Org also uses Calc for |
|
16026 |
embedded calculations. *Note Embedded Mode: (calc)Embedded Mode. |
|
16027 |
‘constants.el’ by Carsten Dominik |
|
16028 |
Org can use names for constants in formulas in tables. Org can |
|
16029 |
also use calculation suffixes for units, such as ‘M’ for ‘Mega’. |
|
16030 |
For a standard collection of such constants, install the |
|
16031 |
‘constants’ package. Install version 2.0 of this package, |
|
16032 |
available at <https://staff.fnwi.uva.nl/c.dominik/Tools/>. Org |
|
16033 |
checks if the function ‘constants-get’ has been autoloaded. |
|
16034 |
Installation instructions are in the file, ‘constants.el’. |
|
16035 |
‘cdlatex.el’ by Carsten Dominik |
|
16036 |
Org mode can use CDLaTeX package to efficiently enter LaTeX |
|
16037 |
fragments into Org files (*note CDLaTeX mode::). |
|
16038 |
‘imenu.el’ by Ake Stenhoff and Lars Lindberg |
|
16039 |
Imenu creates dynamic menus based on an index of items in a file. |
|
16040 |
Org mode supports Imenu menus. Enable it with a mode hook as |
|
16041 |
follows: |
|
16042 |
(add-hook 'org-mode-hook |
|
16043 |
(lambda () (imenu-add-to-menubar "Imenu"))) |
|
16044 |
By default the Imenu index is two levels deep. Change the index |
|
16045 |
depth using thes variable, ‘org-imenu-depth’. |
|
16046 |
‘speedbar.el’ by Eric M. Ludlam |
|
16047 |
Speedbar package creates a special Emacs frame for displaying files |
|
16048 |
and index items in files. Org mode supports Speedbar; users can |
|
16049 |
drill into Org files directly from the Speedbar. The ‘<’ in the |
|
16050 |
Speedbar frame tweaks the agenda commands to that file or to a |
|
16051 |
subtree. |
|
16052 |
‘table.el’ by Takaaki Ota |
|
16053 |
|
|
16054 |
Complex ASCII tables with automatic line wrapping, column- and |
|
16055 |
row-spanning, and alignment can be created using the Emacs table |
|
16056 |
package by Takaaki Ota. Org mode recognizes such tables and export |
|
16057 |
them properly. ‘C-c '’ to edit these tables in a special buffer, |
|
16058 |
much like Org’s ‘src’ code blocks. Because of interference with |
|
16059 |
other Org mode functionality, Takaaki Ota tables cannot be edited |
|
16060 |
directly in the Org buffer. |
|
16061 |
‘C-c ' (org-edit-special)’ |
|
16062 |
Edit a ‘table.el’ table. Works when the cursor is in a |
|
16063 |
table.el table. |
|
16064 |
‘C-c ~ (org-table-create-with-table.el)’ |
|
16065 |
Insert a ‘table.el’ table. If there is already a table at |
|
16066 |
point, this command converts it between the ‘table.el’ format |
|
16067 |
and the Org mode format. See the documentation string of the |
|
16068 |
command ‘org-convert-table’ for details. |
|
16069 |
|
|
16070 |
|
|
16071 |
File: org, Node: Conflicts, Prev: Cooperation, Up: Interaction |
|
16072 |
|
|
16073 |
15.10.2 Packages that conflict with Org mode |
|
16074 |
-------------------------------------------- |
|
16075 |
|
|
16076 |
In Emacs, ‘shift-selection-mode’ combines cursor motions with shift |
|
16077 |
key to enlarge regions. Emacs sets this mode by default. This |
|
16078 |
conflicts with Org’s use of ‘S-<cursor>’ commands to change |
|
16079 |
timestamps, TODO keywords, priorities, and item bullet types, etc. |
|
16080 |
Since ‘S-<cursor>’ commands outside of specific contexts don’t do |
|
16081 |
anything, Org offers the variable ‘org-support-shift-select’ for |
|
16082 |
customization. Org mode accommodates shift selection by (i) making |
|
16083 |
it available outside of the special contexts where special commands |
|
16084 |
apply, and (ii) extending an existing active region even if the |
|
16085 |
cursor moves across a special context. |
|
16086 |
|
|
16087 |
‘CUA.el’ by Kim. F. Storm |
|
16088 |
Org key bindings conflict with ‘S-<cursor>’ keys used by CUA mode. |
|
16089 |
For Org to relinquish these bindings to CUA mode, configure the |
|
16090 |
variable ‘org-replace-disputed-keys’. When set, Org moves the |
|
16091 |
following key bindings in Org files, and in the agenda buffer (but |
|
16092 |
not during date selection). |
|
16093 |
|
|
16094 |
S-<UP> ⇒ M-p S-<DOWN> ⇒ M-n |
|
16095 |
S-<LEFT> ⇒ M-- S-<RIGHT> ⇒ M-+ |
|
16096 |
C-S-<LEFT> ⇒ M-S-- C-S-<RIGHT> ⇒ M-S-+ |
|
16097 |
|
|
16098 |
Yes, these are unfortunately more difficult to remember. To define |
|
16099 |
a different replacement keys, look at the variable |
|
16100 |
‘org-disputed-keys’. |
|
16101 |
|
|
16102 |
‘ecomplete.el’ by Lars Magne Ingebrigtsen <larsi@gnus.org> |
|
16103 |
|
|
16104 |
Ecomplete provides “electric” address completion in address header |
|
16105 |
lines in message buffers. Sadly Orgtbl mode cuts ecompletes power |
|
16106 |
supply: No completion happens when Orgtbl mode is enabled in |
|
16107 |
message buffers while entering text in address header lines. If |
|
16108 |
one wants to use ecomplete one should _not_ follow the advice to |
|
16109 |
automagically turn on Orgtbl mode in message buffers (see *note |
|
16110 |
Orgtbl mode::), but instead—after filling in the message |
|
16111 |
headers—turn on Orgtbl mode manually when needed in the messages |
|
16112 |
body. |
|
16113 |
|
|
16114 |
‘filladapt.el’ by Kyle Jones |
|
16115 |
|
|
16116 |
Org mode tries to do the right thing when filling paragraphs, list |
|
16117 |
items and other elements. Many users reported problems using both |
|
16118 |
‘filladapt.el’ and Org mode, so a safe thing to do is to disable |
|
16119 |
filladapt like this: |
|
16120 |
|
|
16121 |
(add-hook 'org-mode-hook 'turn-off-filladapt-mode) |
|
16122 |
|
|
16123 |
‘yasnippet.el’ |
|
16124 |
The way Org mode binds the <TAB> key (binding to ‘[tab]’ instead of |
|
16125 |
‘"\t"’) overrules YASnippet’s access to this key. The following |
|
16126 |
code fixed this problem: |
|
16127 |
|
|
16128 |
(add-hook 'org-mode-hook |
|
16129 |
(lambda () |
|
16130 |
(setq-local yas/trigger-key [tab]) |
|
16131 |
(define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) |
|
16132 |
|
|
16133 |
The latest version of yasnippet doesn’t play well with Org mode. |
|
16134 |
If the above code does not fix the conflict, first define the |
|
16135 |
following function: |
|
16136 |
|
|
16137 |
(defun yas/org-very-safe-expand () |
|
16138 |
(let ((yas/fallback-behavior 'return-nil)) (yas/expand))) |
|
16139 |
|
|
16140 |
Then tell Org mode to use that function: |
|
16141 |
|
|
16142 |
(add-hook 'org-mode-hook |
|
16143 |
(lambda () |
|
16144 |
(make-variable-buffer-local 'yas/trigger-key) |
|
16145 |
(setq yas/trigger-key [tab]) |
|
16146 |
(add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand) |
|
16147 |
(define-key yas/keymap [tab] 'yas/next-field))) |
|
16148 |
|
|
16149 |
‘windmove.el’ by Hovav Shacham |
|
16150 |
This package also uses the ‘S-<cursor>’ keys, so everything written |
|
16151 |
in the paragraph above about CUA mode also applies here. If you |
|
16152 |
want make the windmove function active in locations where Org mode |
|
16153 |
does not have special functionality on ‘S-<cursor>’, add this to |
|
16154 |
your configuration: |
|
16155 |
|
|
16156 |
;; Make windmove work in org-mode: |
|
16157 |
(add-hook 'org-shiftup-final-hook 'windmove-up) |
|
16158 |
(add-hook 'org-shiftleft-final-hook 'windmove-left) |
|
16159 |
(add-hook 'org-shiftdown-final-hook 'windmove-down) |
|
16160 |
(add-hook 'org-shiftright-final-hook 'windmove-right) |
|
16161 |
|
|
16162 |
‘viper.el’ by Michael Kifer |
|
16163 |
Viper uses ‘C-c /’ and therefore makes this key not access the |
|
16164 |
corresponding Org mode command ‘org-sparse-tree’. You need to find |
|
16165 |
another key for this command, or override the key in |
|
16166 |
‘viper-vi-global-user-map’ with |
|
16167 |
|
|
16168 |
(define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree) |
|
16169 |
|
|
16170 |
|
|
16171 |
File: org, Node: org-crypt, Prev: Interaction, Up: Miscellaneous |
|
16172 |
|
|
16173 |
15.11 org-crypt.el |
|
16174 |
================== |
|
16175 |
|
|
16176 |
Org crypt encrypts the text of an Org entry, but not the headline, or |
|
16177 |
properties. Org crypt uses the Emacs EasyPG library to encrypt and |
|
16178 |
decrypt. |
|
16179 |
|
|
16180 |
Any text below a headline that has a ‘:crypt:’ tag will be |
|
16181 |
automatically be encrypted when the file is saved. To use a different |
|
16182 |
tag, customize the ‘org-crypt-tag-matcher’ variable. |
|
16183 |
|
|
16184 |
Suggested Org crypt settings in Emacs init file: |
|
16185 |
|
|
16186 |
(require 'org-crypt) |
|
16187 |
(org-crypt-use-before-save-magic) |
|
16188 |
(setq org-tags-exclude-from-inheritance (quote ("crypt"))) |
|
16189 |
|
|
16190 |
(setq org-crypt-key nil) |
|
16191 |
;; GPG key to use for encryption |
|
16192 |
;; Either the Key ID or set to nil to use symmetric encryption. |
|
16193 |
|
|
16194 |
(setq auto-save-default nil) |
|
16195 |
;; Auto-saving does not cooperate with org-crypt.el: so you need |
|
16196 |
;; to turn it off if you plan to use org-crypt.el quite often. |
|
16197 |
;; Otherwise, you'll get an (annoying) message each time you |
|
16198 |
;; start Org. |
|
16199 |
|
|
16200 |
;; To turn it off only locally, you can insert this: |
|
16201 |
;; |
|
16202 |
;; # -*- buffer-auto-save-file-name: nil; -*- |
|
16203 |
|
|
16204 |
Excluding the crypt tag from inheritance prevents encrypting |
|
16205 |
previously encrypted text. |
|
16206 |
|
|
16207 |
|
|
16208 |
File: org, Node: Hacking, Next: MobileOrg, Prev: Miscellaneous, Up: Top |
|
16209 |
|
|
16210 |
Appendix A Hacking |
|
16211 |
****************** |
|
16212 |
|
|
16213 |
This appendix covers some areas where users can extend the functionality |
|
16214 |
of Org. |
|
16215 |
|
|
16216 |
* Menu: |
|
16217 |
|
|
16218 |
* Hooks:: How to reach into Org’s internals |
|
16219 |
* Add-on packages:: Available extensions |
|
16220 |
* Adding hyperlink types:: New custom link types |
|
16221 |
* Adding export back-ends:: How to write new export back-ends |
|
16222 |
* Context-sensitive commands:: How to add functionality to such commands |
|
16223 |
* Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs |
|
16224 |
* Dynamic blocks:: Automatically filled blocks |
|
16225 |
* Special agenda views:: Customized views |
|
16226 |
* Speeding up your agendas:: Tips on how to speed up your agendas |
|
16227 |
* Extracting agenda information:: Post-processing of agenda information |
|
16228 |
* Using the property API:: Writing programs that use entry properties |
|
16229 |
* Using the mapping API:: Mapping over all or selected entries |
|
16230 |
|
|
16231 |
|
|
16232 |
File: org, Node: Hooks, Next: Add-on packages, Up: Hacking |
|
16233 |
|
|
16234 |
A.1 Hooks |
|
16235 |
========= |
|
16236 |
|
|
16237 |
Org has a large number of hook variables for adding functionality. This |
|
16238 |
appendix illustrates using a few. A complete list of hooks with |
|
16239 |
documentation is maintained by the Worg project at |
|
16240 |
<https://orgmode.org/worg/doc.html#hooks>. |
|
16241 |
|
|
16242 |
|
|
16243 |
File: org, Node: Add-on packages, Next: Adding hyperlink types, Prev: Hooks, Up: Hacking |
|
16244 |
|
|
16245 |
A.2 Add-on packages |
|
16246 |
=================== |
|
16247 |
|
|
16248 |
Various authors wrote a large number of add-on packages for Org. |
|
16249 |
|
|
16250 |
These packages are not part of Emacs, but they are distributed as |
|
16251 |
contributed packages with the separate release available at |
|
16252 |
<https://orgmode.org>. See the ‘contrib/README’ file in the source code |
|
16253 |
directory for a list of contributed files. Worg page with more |
|
16254 |
information is at: <https://orgmode.org/worg/org-contrib/>. |
|
16255 |
|
|
16256 |
|
|
16257 |
File: org, Node: Adding hyperlink types, Next: Adding export back-ends, Prev: Add-on packages, Up: Hacking |
|
16258 |
|
|
16259 |
A.3 Adding hyperlink types |
|
16260 |
========================== |
|
16261 |
|
|
16262 |
Org has many built-in hyperlink types (*note Hyperlinks::), and an |
|
16263 |
interface for adding new link types. The example file, ‘org-man.el’, |
|
16264 |
shows the process of adding Org links to Unix man pages, which look like |
|
16265 |
this: ‘[[man:printf][The printf manpage]]’: |
|
16266 |
|
|
16267 |
;;; org-man.el - Support for links to manpages in Org |
|
16268 |
|
|
16269 |
(require 'org) |
|
16270 |
|
|
16271 |
(org-add-link-type "man" 'org-man-open) |
|
16272 |
(add-hook 'org-store-link-functions 'org-man-store-link) |
|
16273 |
|
|
16274 |
(defcustom org-man-command 'man |
|
16275 |
"The Emacs command to be used to display a man page." |
|
16276 |
:group 'org-link |
|
16277 |
:type '(choice (const man) (const woman))) |
|
16278 |
|
|
16279 |
(defun org-man-open (path) |
|
16280 |
"Visit the manpage on PATH. |
|
16281 |
PATH should be a topic that can be thrown at the man command." |
|
16282 |
(funcall org-man-command path)) |
|
16283 |
|
|
16284 |
(defun org-man-store-link () |
|
16285 |
"Store a link to a manpage." |
|
16286 |
(when (memq major-mode '(Man-mode woman-mode)) |
|
16287 |
;; This is a man page, we do make this link |
|
16288 |
(let* ((page (org-man-get-page-name)) |
|
16289 |
(link (concat "man:" page)) |
|
16290 |
(description (format "Manpage for %s" page))) |
|
16291 |
(org-store-link-props |
|
16292 |
:type "man" |
|
16293 |
:link link |
|
16294 |
:description description)))) |
|
16295 |
|
|
16296 |
(defun org-man-get-page-name () |
|
16297 |
"Extract the page name from the buffer name." |
|
16298 |
;; This works for both `Man-mode' and `woman-mode'. |
|
16299 |
(if (string-match " \\(\\S-+\\)\\*" (buffer-name)) |
|
16300 |
(match-string 1 (buffer-name)) |
|
16301 |
(error "Cannot create link to this man page"))) |
|
16302 |
|
|
16303 |
(provide 'org-man) |
|
16304 |
|
|
16305 |
;;; org-man.el ends here |
|
16306 |
|
|
16307 |
To activate links to man pages in Org, enter this in the init file: |
|
16308 |
|
|
16309 |
(require 'org-man) |
|
16310 |
|
|
16311 |
A review of ‘org-man.el’: |
|
16312 |
1. First, ‘(require 'org)’ ensures ‘org.el’ is loaded. |
|
16313 |
2. The ‘org-add-link-type’ defines a new link type with ‘man’ prefix. |
|
16314 |
The call contains the function to call that follows the link type. |
|
16315 |
3. The next line adds a function to ‘org-store-link-functions’ that |
|
16316 |
records a useful link with the command ‘C-c l’ in a buffer |
|
16317 |
displaying a man page. |
|
16318 |
|
|
16319 |
The rest of the file defines necessary variables and functions. |
|
16320 |
First is the customization variable ‘org-man-command’. It has two |
|
16321 |
options, ‘man’ and ‘woman’. Next is a function whose argument is the |
|
16322 |
link path, which for man pages is the topic of the man command. To |
|
16323 |
follow the link, the function calls the ‘org-man-command’ to display the |
|
16324 |
man page. |
|
16325 |
|
|
16326 |
‘C-c l’ constructs and stores the link. |
|
16327 |
|
|
16328 |
‘C-c l’ calls the function ‘org-man-store-link’, which first checks |
|
16329 |
if the ‘major-mode’ is appropriate. If check fails, the function |
|
16330 |
returns ‘nil’. Otherwise the function makes a link string by combining |
|
16331 |
the ‘man:’ prefix with the man topic. The function then calls |
|
16332 |
‘org-store-link-props’ with ‘:type’ and ‘:link’ properties. A |
|
16333 |
‘:description’ property is an optional string that is displayed when the |
|
16334 |
function inserts the link in the Org buffer. |
|
16335 |
|
|
16336 |
‘C-c C-l’ inserts the stored link. |
|
16337 |
|
|
16338 |
To define new link types, define a function that implements |
|
16339 |
completion support with ‘C-c C-l’. This function should not accept any |
|
16340 |
arguments but return the appropriate prefix and complete link string. |
|
16341 |
|
|
16342 |
|
|
16343 |
File: org, Node: Adding export back-ends, Next: Context-sensitive commands, Prev: Adding hyperlink types, Up: Hacking |
|
16344 |
|
|
16345 |
A.4 Adding export back-ends |
|
16346 |
=========================== |
|
16347 |
|
|
16348 |
Org’s export engine makes it easy for writing new back-ends. The |
|
16349 |
framework on which the engine was built makes it easy to derive new |
|
16350 |
back-ends from existing ones. |
|
16351 |
|
|
16352 |
The two main entry points to the export engine are: |
|
16353 |
‘org-export-define-backend’ and ‘org-export-define-derived-backend’. To |
|
16354 |
grok these functions, see ‘ox-latex.el’ for an example of defining a new |
|
16355 |
back-end from scratch, and ‘ox-beamer.el’ for an example of deriving |
|
16356 |
from an existing engine. |
|
16357 |
|
|
16358 |
For creating a new back-end from scratch, first set its name as a |
|
16359 |
symbol in an alist consisting of elements and export functions. To make |
|
16360 |
the back-end visible to the export dispatcher, set ‘:menu-entry’ |
|
16361 |
keyword. For export options specific to this back-end, set the |
|
16362 |
‘:options-alist’. |
|
16363 |
|
|
16364 |
For creating a new back-end from an existing one, set |
|
16365 |
‘:translate-alist’ to an alist of export functions. This alist replaces |
|
16366 |
the parent back-end functions. |
|
16367 |
|
|
16368 |
For complete documentation, see the Org Export Reference on Worg |
|
16369 |
(https://orgmode.org/worg/dev/org-export-reference.html). |
|
16370 |
|
|
16371 |
|
|
16372 |
File: org, Node: Context-sensitive commands, Next: Tables in arbitrary syntax, Prev: Adding export back-ends, Up: Hacking |
|
16373 |
|
|
16374 |
A.5 Context-sensitive commands |
|
16375 |
============================== |
|
16376 |
|
|
16377 |
Org has facilities for building context sensitive commands. Authors of |
|
16378 |
Org add-ons can tap into this functionality. |
|
16379 |
|
|
16380 |
Some Org commands change depending on the context. The most |
|
16381 |
important example of this behavior is the ‘C-c C-c’ (*note The very busy |
|
16382 |
C-c C-c key::). Other examples are ‘M-cursor’ and ‘M-S-cursor’. |
|
16383 |
|
|
16384 |
These context sensitive commands work by providing a function that |
|
16385 |
detects special context for that add-on and executes functionality |
|
16386 |
appropriate for that context. |
|
16387 |
|
|
16388 |
|
|
16389 |
File: org, Node: Tables in arbitrary syntax, Next: Dynamic blocks, Prev: Context-sensitive commands, Up: Hacking |
|
16390 |
|
|
16391 |
A.6 Tables and lists in arbitrary syntax |
|
16392 |
======================================== |
|
16393 |
|
|
16394 |
Because of Org’s success in handling tables with Orgtbl, a frequently |
|
16395 |
asked feature is to Org’s usability functions to other table formats |
|
16396 |
native to other modem’s, such as LaTeX. This would be hard to do in a |
|
16397 |
general way without complicated customization nightmares. Moreover, |
|
16398 |
that would take Org away from its simplicity roots that Orgtbl has |
|
16399 |
proven. There is, however, an alternate approach to accomplishing the |
|
16400 |
same. |
|
16401 |
|
|
16402 |
This approach involves implementing a custom _translate_ function |
|
16403 |
that operates on a native Org _source table_ to produce a table in |
|
16404 |
another format. This strategy would keep the excellently working Orgtbl |
|
16405 |
simple and isolate complications, if any, confined to the translate |
|
16406 |
function. To add more alien table formats, we just add more translate |
|
16407 |
functions. Also the burden of developing custom translate functions for |
|
16408 |
new table formats will be in the hands of those who know those formats |
|
16409 |
best. |
|
16410 |
|
|
16411 |
For an example of how this strategy works, see Orgstruct mode. In |
|
16412 |
that mode, Bastien added the ability to use Org’s facilities to edit and |
|
16413 |
re-structure lists. He did by turning ‘orgstruct-mode’ on, and then |
|
16414 |
exporting the list locally to another format, such as HTML, LaTeX or |
|
16415 |
Texinfo. |
|
16416 |
|
|
16417 |
* Menu: |
|
16418 |
|
|
16419 |
* Radio tables:: Sending and receiving radio tables |
|
16420 |
* A LaTeX example:: Step by step, almost a tutorial |
|
16421 |
* Translator functions:: Copy and modify |
|
16422 |
* Radio lists:: Sending and receiving lists |
|
16423 |
|
|
16424 |
|
|
16425 |
File: org, Node: Radio tables, Next: A LaTeX example, Up: Tables in arbitrary syntax |
|
16426 |
|
|
16427 |
A.6.1 Radio tables |
|
16428 |
------------------ |
|
16429 |
|
|
16430 |
Radio tables are target locations for translated tables that are not |
|
16431 |
near their source. Org finds the target location and inserts the |
|
16432 |
translated table. |
|
16433 |
|
|
16434 |
The key to finding the target location are the magic words ‘BEGIN/END |
|
16435 |
RECEIVE ORGTBL’. They have to appear as comments in the current mode. |
|
16436 |
If the mode is C, then: |
|
16437 |
|
|
16438 |
/* BEGIN RECEIVE ORGTBL table_name */ |
|
16439 |
/* END RECEIVE ORGTBL table_name */ |
|
16440 |
|
|
16441 |
At the location of source, Org needs a special line to direct Orgtbl to |
|
16442 |
translate and to find the target for inserting the translated table. |
|
16443 |
For example: |
|
16444 |
#+ORGTBL: SEND table_name translation_function arguments... |
|
16445 |
|
|
16446 |
‘table_name’ is the table’s reference name, which is also used in the |
|
16447 |
receiver lines, and the ‘translation_function’ is the Lisp function that |
|
16448 |
translates. This line, in addition, may also contain alternating key |
|
16449 |
and value arguments at the end. The translation function gets these |
|
16450 |
values as a property list. A few standard parameters are already |
|
16451 |
recognized and acted upon before the translation function is called: |
|
16452 |
|
|
16453 |
‘:skip N’ |
|
16454 |
Skip the first N lines of the table. Hlines do count; include them |
|
16455 |
if they are to be skipped. |
|
16456 |
|
|
16457 |
‘:skipcols (n1 n2 ...)’ |
|
16458 |
List of columns to be skipped. First Org automatically discards |
|
16459 |
columns with calculation marks and then sends the table to the |
|
16460 |
translator function, which then skips columns as specified in |
|
16461 |
‘skipcols’. |
|
16462 |
|
|
16463 |
To keep the source table intact in the buffer without being disturbed |
|
16464 |
when the source file is compiled or otherwise being worked on, use one |
|
16465 |
of these strategies: |
|
16466 |
|
|
16467 |
• Place the table in a block comment. For example, in C mode you |
|
16468 |
could wrap the table between ‘/*’ and ‘*/’ lines. |
|
16469 |
• Put the table after an ‘END’ statement. For example ‘\bye’ in TeX |
|
16470 |
and ‘\end{document}’ in LaTeX. |
|
16471 |
• Comment and uncomment each line of the table during edits. The |
|
16472 |
‘M-x orgtbl-toggle-comment <RET>’ command makes toggling easy. |
|
16473 |
|
|
16474 |
|
|
16475 |
File: org, Node: A LaTeX example, Next: Translator functions, Prev: Radio tables, Up: Tables in arbitrary syntax |
|
16476 |
|
|
16477 |
A.6.2 A LaTeX example of radio tables |
|
16478 |
------------------------------------- |
|
16479 |
|
|
16480 |
To wrap a source table in LaTeX, use the ‘comment’ environment provided |
|
16481 |
by ‘comment.sty’. To activate it, put ‘\usepackage{comment}’ in the |
|
16482 |
document header. Orgtbl mode inserts a radio table skeleton(1) with the |
|
16483 |
command ‘M-x orgtbl-insert-radio-table <RET>’, which prompts for a table |
|
16484 |
name. For example, if ‘salesfigures’ is the name, the template inserts: |
|
16485 |
|
|
16486 |
% BEGIN RECEIVE ORGTBL salesfigures |
|
16487 |
% END RECEIVE ORGTBL salesfigures |
|
16488 |
\begin{comment} |
|
16489 |
#+ORGTBL: SEND salesfigures orgtbl-to-latex |
|
16490 |
| | | |
|
16491 |
\end{comment} |
|
16492 |
|
|
16493 |
The line ‘#+ORGTBL: SEND’ tells Orgtbl mode to use the function |
|
16494 |
‘orgtbl-to-latex’ to convert the table to LaTeX format, then insert the |
|
16495 |
table at the target (receive) location named ‘salesfigures’. Now the |
|
16496 |
table is ready for data entry. It can even use spreadsheet features(2): |
|
16497 |
|
|
16498 |
% BEGIN RECEIVE ORGTBL salesfigures |
|
16499 |
% END RECEIVE ORGTBL salesfigures |
|
16500 |
\begin{comment} |
|
16501 |
#+ORGTBL: SEND salesfigures orgtbl-to-latex |
|
16502 |
| Month | Days | Nr sold | per day | |
|
16503 |
|-------+------+---------+---------| |
|
16504 |
| Jan | 23 | 55 | 2.4 | |
|
16505 |
| Feb | 21 | 16 | 0.8 | |
|
16506 |
| March | 22 | 278 | 12.6 | |
|
16507 |
#+TBLFM: $4=$3/$2;%.1f |
|
16508 |
% $ (optional extra dollar to keep font-lock happy, see footnote) |
|
16509 |
\end{comment} |
|
16510 |
|
|
16511 |
After editing, ‘C-c C-c’ inserts translated table at the target |
|
16512 |
location, between the two marker lines. |
|
16513 |
|
|
16514 |
For hand-made custom tables, note that the translator needs to skip |
|
16515 |
the first two lines of the source table. Also the command has to |
|
16516 |
_splice_ out the target table without the header and footer. |
|
16517 |
|
|
16518 |
\begin{tabular}{lrrr} |
|
16519 |
Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\ |
|
16520 |
% BEGIN RECEIVE ORGTBL salesfigures |
|
16521 |
% END RECEIVE ORGTBL salesfigures |
|
16522 |
\end{tabular} |
|
16523 |
% |
|
16524 |
\begin{comment} |
|
16525 |
#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2 |
|
16526 |
| Month | Days | Nr sold | per day | |
|
16527 |
|-------+------+---------+---------| |
|
16528 |
| Jan | 23 | 55 | 2.4 | |
|
16529 |
| Feb | 21 | 16 | 0.8 | |
|
16530 |
| March | 22 | 278 | 12.6 | |
|
16531 |
#+TBLFM: $4=$3/$2;%.1f |
|
16532 |
\end{comment} |
|
16533 |
|
|
16534 |
The LaTeX translator function ‘orgtbl-to-latex’ is already part of |
|
16535 |
Orgtbl mode and uses ‘tabular’ environment by default to typeset the |
|
16536 |
table and mark the horizontal lines with ‘\hline’. For additional |
|
16537 |
parameters to control output, *note Translator functions::: |
|
16538 |
|
|
16539 |
‘:splice nil/t’ |
|
16540 |
When non-‘nil’, returns only table body lines; not wrapped in |
|
16541 |
tabular environment. Default is ‘nil’. |
|
16542 |
|
|
16543 |
‘:fmt fmt’ |
|
16544 |
Format to warp each field. It should contain ‘%s’ for the original |
|
16545 |
field value. For example, to wrap each field value in dollar |
|
16546 |
symbol, you could use ‘:fmt "$%s$"’. Format can also wrap a |
|
16547 |
property list with column numbers and formats, for example ‘:fmt (2 |
|
16548 |
"$%s$" 4 "%s\\%%")’. In place of a string, a function of one |
|
16549 |
argument can be used; the function must return a formatted string. |
|
16550 |
|
|
16551 |
‘:efmt efmt’ |
|
16552 |
Format numbers as exponentials. The spec should have ‘%s’ twice |
|
16553 |
for inserting mantissa and exponent, for example |
|
16554 |
‘"%s\\times10^{%s}"’. This may also be a property list with column |
|
16555 |
numbers and formats, for example ‘:efmt (2 "$%s\\times10^{%s}$" 4 |
|
16556 |
"$%s\\cdot10^{%s}$")’. After ‘efmt’ has been applied to a value, |
|
16557 |
‘fmt’ will also be applied. Functions with two arguments can be |
|
16558 |
supplied instead of strings. By default, no special formatting is |
|
16559 |
applied. |
|
16560 |
|
|
16561 |
---------- Footnotes ---------- |
|
16562 |
|
|
16563 |
(1) By default this works only for LaTeX, HTML, and Texinfo. |
|
16564 |
Configure the variable ‘orgtbl-radio-table-templates’ to install |
|
16565 |
templates for other export formats. |
|
16566 |
|
|
16567 |
(2) If the ‘#+TBLFM’ line contains an odd number of dollar |
|
16568 |
characters, this may cause problems with font-lock in LaTeX mode. As |
|
16569 |
shown in the example you can fix this by adding an extra line inside the |
|
16570 |
‘comment’ environment that is used to balance the dollar expressions. |
|
16571 |
If you are using AUCTeX with the font-latex library, a much better |
|
16572 |
solution is to add the ‘comment’ environment to the variable |
|
16573 |
‘LaTeX-verbatim-environments’. |
|
16574 |
|
|
16575 |
|
|
16576 |
File: org, Node: Translator functions, Next: Radio lists, Prev: A LaTeX example, Up: Tables in arbitrary syntax |
|
16577 |
|
|
16578 |
A.6.3 Translator functions |
|
16579 |
-------------------------- |
|
16580 |
|
|
16581 |
Orgtbl mode has built-in translator functions: ‘orgtbl-to-csv’ |
|
16582 |
(comma-separated values), ‘orgtbl-to-tsv’ (TAB-separated values), |
|
16583 |
‘orgtbl-to-latex’, ‘orgtbl-to-html’, ‘orgtbl-to-texinfo’, |
|
16584 |
‘orgtbl-to-unicode’ and ‘orgtbl-to-orgtbl’. They use the generic |
|
16585 |
translator, ‘orgtbl-to-generic’, which delegates translations to various |
|
16586 |
export back-ends. |
|
16587 |
|
|
16588 |
Properties passed to the function through the ‘ORGTBL SEND’ line take |
|
16589 |
precedence over properties defined inside the function. For example, |
|
16590 |
this overrides the default LaTeX line endings, ‘\\’, with ‘\\[2mm]’: |
|
16591 |
|
|
16592 |
#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]" |
|
16593 |
|
|
16594 |
For a new language translator, define a converter function. It can |
|
16595 |
be a generic function, such as shown in this example. It marks a |
|
16596 |
beginning and ending of a table with ‘!BTBL!’ and ‘!ETBL!’; a beginning |
|
16597 |
and ending of lines with ‘!BL!’ and ‘!EL!’; and uses a TAB for a field |
|
16598 |
separator: |
|
16599 |
|
|
16600 |
(defun orgtbl-to-language (table params) |
|
16601 |
"Convert the orgtbl-mode TABLE to language." |
|
16602 |
(orgtbl-to-generic |
|
16603 |
table |
|
16604 |
(org-combine-plists |
|
16605 |
'(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t") |
|
16606 |
params))) |
|
16607 |
|
|
16608 |
The documentation for the ‘orgtbl-to-generic’ function shows a complete |
|
16609 |
list of parameters, each of which can be passed through to |
|
16610 |
‘orgtbl-to-latex’, ‘orgtbl-to-texinfo’, and any other function using |
|
16611 |
that generic function. |
|
16612 |
|
|
16613 |
For complicated translations the generic translator function could be |
|
16614 |
replaced by a custom translator function. Such a custom function must |
|
16615 |
take two arguments and return a single string containing the formatted |
|
16616 |
table. The first argument is the table whose lines are a list of fields |
|
16617 |
or the symbol ‘hline’. The second argument is the property list |
|
16618 |
consisting of parameters specified in the ‘#+ORGTBL: SEND’ line. Please |
|
16619 |
share your translator functions by posting them to the Org users mailing |
|
16620 |
list, <emacs-orgmode@gnu.org>. |
|
16621 |
|
|
16622 |
|
|
16623 |
File: org, Node: Radio lists, Prev: Translator functions, Up: Tables in arbitrary syntax |
|
16624 |
|
|
16625 |
A.6.4 Radio lists |
|
16626 |
----------------- |
|
16627 |
|
|
16628 |
Call the ‘org-list-insert-radio-list’ function to insert a radio list |
|
16629 |
template in HTML, LaTeX, and Texinfo mode documents. Sending and |
|
16630 |
receiving radio lists works is the same as for radio tables (*note Radio |
|
16631 |
tables::) except for these differences: |
|
16632 |
|
|
16633 |
− Orgstruct mode must be active. |
|
16634 |
− Use ‘ORGLST’ keyword instead of ‘ORGTBL’. |
|
16635 |
− ‘C-c C-c’ works only on the first list item. |
|
16636 |
|
|
16637 |
Built-in translators functions are: ‘org-list-to-latex’, |
|
16638 |
‘org-list-to-html’ and ‘org-list-to-texinfo’. They use the |
|
16639 |
‘org-list-to-generic’ translator function. See its documentation for |
|
16640 |
parameters for accurate customizations of lists. Here is a LaTeX |
|
16641 |
example: |
|
16642 |
|
|
16643 |
% BEGIN RECEIVE ORGLST to-buy |
|
16644 |
% END RECEIVE ORGLST to-buy |
|
16645 |
\begin{comment} |
|
16646 |
#+ORGLST: SEND to-buy org-list-to-latex |
|
16647 |
- a new house |
|
16648 |
- a new computer |
|
16649 |
+ a new keyboard |
|
16650 |
+ a new mouse |
|
16651 |
- a new life |
|
16652 |
\end{comment} |
|
16653 |
|
|
16654 |
‘C-c C-c’ on ‘a new house’ inserts the translated LaTeX list |
|
16655 |
in-between the BEGIN and END marker lines. |
|
16656 |
|
|
16657 |
|
|
16658 |
File: org, Node: Dynamic blocks, Next: Special agenda views, Prev: Tables in arbitrary syntax, Up: Hacking |
|
16659 |
|
|
16660 |
A.7 Dynamic blocks |
|
16661 |
================== |
|
16662 |
|
|
16663 |
Org supports _dynamic blocks_ in Org documents. They are inserted with |
|
16664 |
begin and end markers like any other ‘src’ code block, but the contents |
|
16665 |
are updated automatically by a user function. For example, ‘C-c C-x |
|
16666 |
C-r’ inserts a dynamic table that updates the work time (*note Clocking |
|
16667 |
work time::). |
|
16668 |
|
|
16669 |
Dynamic blocks can have names and function parameters. The syntax is |
|
16670 |
similar to ‘src’ code block specifications: |
|
16671 |
|
|
16672 |
#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ... |
|
16673 |
|
|
16674 |
#+END: |
|
16675 |
|
|
16676 |
These command update dynamic blocks: |
|
16677 |
|
|
16678 |
‘C-c C-x C-u (org-dblock-update)’ |
|
16679 |
Update dynamic block at point. |
|
16680 |
‘C-u C-c C-x C-u’ |
|
16681 |
Update all dynamic blocks in the current file. |
|
16682 |
|
|
16683 |
Before updating a dynamic block, Org removes content between the |
|
16684 |
BEGIN and END markers. Org then reads the parameters on the BEGIN line |
|
16685 |
for passing to the writer function. If the function expects to access |
|
16686 |
the removed content, then Org expects an extra parameter, ‘:content’, on |
|
16687 |
the BEGIN line. |
|
16688 |
|
|
16689 |
To syntax for calling a writer function with a named block, ‘myblock’ |
|
16690 |
is: ‘org-dblock-write:myblock’. Parameters come from the BEGIN line. |
|
16691 |
|
|
16692 |
The following is an example of a dynamic block and a block writer |
|
16693 |
function that updates the time when the function was last run: |
|
16694 |
|
|
16695 |
#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M" |
|
16696 |
|
|
16697 |
#+END: |
|
16698 |
|
|
16699 |
The dynamic block’s writer function: |
|
16700 |
|
|
16701 |
(defun org-dblock-write:block-update-time (params) |
|
16702 |
(let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) |
|
16703 |
(insert "Last block update at: " |
|
16704 |
(format-time-string fmt)))) |
|
16705 |
|
|
16706 |
To keep dynamic blocks up-to-date in an Org file, use the function, |
|
16707 |
‘org-update-all-dblocks’ in hook, such as ‘before-save-hook’. The |
|
16708 |
‘org-update-all-dblocks’ function does not run if the file is not in Org |
|
16709 |
mode. |
|
16710 |
|
|
16711 |
Dynamic blocks, like any other block, can be narrowed with |
|
16712 |
‘org-narrow-to-block’. |
|
16713 |
|
|
16714 |
|
|
16715 |
File: org, Node: Special agenda views, Next: Speeding up your agendas, Prev: Dynamic blocks, Up: Hacking |
|
16716 |
|
|
16717 |
A.8 Special agenda views |
|
16718 |
======================== |
|
16719 |
|
|
16720 |
Org provides a special hook to further limit items in agenda views: |
|
16721 |
‘agenda’, ‘agenda*’(1), ‘todo’, ‘alltodo’, ‘tags’, ‘tags-todo’, |
|
16722 |
‘tags-tree’. Specify a custom function that tests inclusion of every |
|
16723 |
matched item in the view. This function can also skip as much as is |
|
16724 |
needed. |
|
16725 |
|
|
16726 |
For a global condition applicable to agenda views, use the |
|
16727 |
‘org-agenda-skip-function-global’ variable. Org uses a global condition |
|
16728 |
with ‘org-agenda-skip-function’ for custom searching. |
|
16729 |
|
|
16730 |
This example defines a function for a custom view showing TODO items |
|
16731 |
with WAITING status. Manually this is a multi step search process, but |
|
16732 |
with a custom view, this can be automated as follows: |
|
16733 |
|
|
16734 |
The custom function searches the subtree for the WAITING tag and |
|
16735 |
returns ‘nil’ on match. Otherwise it gives the location from where the |
|
16736 |
search continues. |
|
16737 |
|
|
16738 |
(defun my-skip-unless-waiting () |
|
16739 |
"Skip trees that are not waiting" |
|
16740 |
(let ((subtree-end (save-excursion (org-end-of-subtree t)))) |
|
16741 |
(if (re-search-forward ":waiting:" subtree-end t) |
|
16742 |
nil ; tag found, do not skip |
|
16743 |
subtree-end))) ; tag not found, continue after end of subtree |
|
16744 |
|
|
16745 |
To use this custom function in a custom agenda command: |
|
16746 |
|
|
16747 |
(org-add-agenda-custom-command |
|
16748 |
'("b" todo "PROJECT" |
|
16749 |
((org-agenda-skip-function 'my-skip-unless-waiting) |
|
16750 |
(org-agenda-overriding-header "Projects waiting for something: ")))) |
|
16751 |
|
|
16752 |
Note that this also binds ‘org-agenda-overriding-header’ to a more |
|
16753 |
meaningful string suitable for the agenda view. |
|
16754 |
|
|
16755 |
Search for entries with a limit set on levels for the custom search. |
|
16756 |
This is a general approach to creating custom searches in Org. To |
|
16757 |
include all levels, use ‘LEVEL>0’(2). Then to selectively pick the |
|
16758 |
matched entries, use ‘org-agenda-skip-function’, which also accepts Lisp |
|
16759 |
forms, such as ‘org-agenda-skip-entry-if’ and |
|
16760 |
‘org-agenda-skip-subtree-if’. For example: |
|
16761 |
|
|
16762 |
‘(org-agenda-skip-entry-if 'scheduled)’ |
|
16763 |
Skip current entry if it has been scheduled. |
|
16764 |
‘(org-agenda-skip-entry-if 'notscheduled)’ |
|
16765 |
Skip current entry if it has not been scheduled. |
|
16766 |
‘(org-agenda-skip-entry-if 'deadline)’ |
|
16767 |
Skip current entry if it has a deadline. |
|
16768 |
‘(org-agenda-skip-entry-if 'scheduled 'deadline)’ |
|
16769 |
Skip current entry if it has a deadline, or if it is scheduled. |
|
16770 |
‘(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))’ |
|
16771 |
Skip current entry if the TODO keyword is TODO or WAITING. |
|
16772 |
‘(org-agenda-skip-entry-if 'todo 'done)’ |
|
16773 |
Skip current entry if the TODO keyword marks a DONE state. |
|
16774 |
‘(org-agenda-skip-entry-if 'timestamp)’ |
|
16775 |
Skip current entry if it has any timestamp, may also be deadline or |
|
16776 |
scheduled. |
|
16777 |
‘(org-agenda-skip-entry-if 'regexp "regular expression")’ |
|
16778 |
Skip current entry if the regular expression matches in the entry. |
|
16779 |
‘(org-agenda-skip-entry-if 'notregexp "regular expression")’ |
|
16780 |
Skip current entry unless the regular expression matches. |
|
16781 |
‘(org-agenda-skip-subtree-if 'regexp "regular expression")’ |
|
16782 |
Same as above, but check and skip the entire subtree. |
|
16783 |
|
|
16784 |
The following is an example of a search for ‘WAITING’ without the |
|
16785 |
special function: |
|
16786 |
|
|
16787 |
(org-add-agenda-custom-command |
|
16788 |
'("b" todo "PROJECT" |
|
16789 |
((org-agenda-skip-function '(org-agenda-skip-subtree-if |
|
16790 |
'regexp ":waiting:")) |
|
16791 |
(org-agenda-overriding-header "Projects waiting for something: ")))) |
|
16792 |
|
|
16793 |
---------- Footnotes ---------- |
|
16794 |
|
|
16795 |
(1) The ‘agenda*’ view is the same as ‘agenda’ except that it only |
|
16796 |
considers _appointments_, i.e., scheduled and deadline items that have a |
|
16797 |
time specification ‘[h]h:mm’ in their time-stamps. |
|
16798 |
|
|
16799 |
(2) Note that, for ‘org-odd-levels-only’, a level number corresponds |
|
16800 |
to order in the hierarchy, not to the number of stars. |
|
16801 |
|
|
16802 |
|
|
16803 |
File: org, Node: Speeding up your agendas, Next: Extracting agenda information, Prev: Special agenda views, Up: Hacking |
|
16804 |
|
|
16805 |
A.9 Speeding up your agendas |
|
16806 |
============================ |
|
16807 |
|
|
16808 |
Some agenda commands slow down when the Org files grow in size or |
|
16809 |
number. Here are tips to speed up: |
|
16810 |
|
|
16811 |
1. Reduce the number of Org agenda files to avoid slowdowns due to |
|
16812 |
hard drive accesses. |
|
16813 |
2. Reduce the number of ‘DONE’ and archived headlines so agenda |
|
16814 |
operations that skip over these can finish faster. |
|
16815 |
3. Do not dim blocked tasks: |
|
16816 |
(setq org-agenda-dim-blocked-tasks nil) |
|
16817 |
4. Stop preparing agenda buffers on startup: |
|
16818 |
(setq org-agenda-inhibit-startup nil) |
|
16819 |
5. Disable tag inheritance for agendas: |
|
16820 |
(setq org-agenda-use-tag-inheritance nil) |
|
16821 |
|
|
16822 |
These options can be applied to selected agenda views. For more |
|
16823 |
details about generation of agenda views, see the docstrings for the |
|
16824 |
relevant variables, and this dedicated Worg page |
|
16825 |
(https://orgmode.org/worg/agenda-optimization.html) for agenda |
|
16826 |
optimization. |
|
16827 |
|
|
16828 |
|
|
16829 |
File: org, Node: Extracting agenda information, Next: Using the property API, Prev: Speeding up your agendas, Up: Hacking |
|
16830 |
|
|
16831 |
A.10 Extracting agenda information |
|
16832 |
================================== |
|
16833 |
|
|
16834 |
Org provides commands to access agendas through Emacs batch mode. |
|
16835 |
Through this command-line interface, agendas are automated for further |
|
16836 |
processing or printing. |
|
16837 |
|
|
16838 |
‘org-batch-agenda’ creates an agenda view in ASCII and outputs to |
|
16839 |
STDOUT. This command takes one string parameter. When string length=1, |
|
16840 |
Org uses it as a key to ‘org-agenda-custom-commands’. These are the |
|
16841 |
same ones available through ‘C-c a’. |
|
16842 |
|
|
16843 |
This example command line directly prints the TODO list to the |
|
16844 |
printer: |
|
16845 |
|
|
16846 |
emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr |
|
16847 |
|
|
16848 |
When the string parameter length is two or more characters, Org |
|
16849 |
matches it with tags/TODO strings. For example, this example command |
|
16850 |
line prints items tagged with ‘shop’, but excludes items tagged with |
|
16851 |
‘NewYork’: |
|
16852 |
|
|
16853 |
emacs -batch -l ~/.emacs \ |
|
16854 |
-eval '(org-batch-agenda "+shop-NewYork")' | lpr |
|
16855 |
|
|
16856 |
An example showing on-the-fly parameter modifications: |
|
16857 |
|
|
16858 |
emacs -batch -l ~/.emacs \ |
|
16859 |
-eval '(org-batch-agenda "a" \ |
|
16860 |
org-agenda-span (quote month) \ |
|
16861 |
org-agenda-include-diary nil \ |
|
16862 |
org-agenda-files (quote ("~/org/project.org")))' \ |
|
16863 |
| lpr |
|
16864 |
|
|
16865 |
which will produce an agenda for the next 30 days from just the |
|
16866 |
‘~/org/projects.org’ file. |
|
16867 |
|
|
16868 |
For structured processing of agenda output, use |
|
16869 |
‘org-batch-agenda-csv’ with the following fields: |
|
16870 |
|
|
16871 |
category The category of the item |
|
16872 |
head The headline, without TODO keyword, TAGS and PRIORITY |
|
16873 |
type The type of the agenda entry, can be |
|
16874 |
todo selected in TODO match |
|
16875 |
tagsmatch selected in tags match |
|
16876 |
diary imported from diary |
|
16877 |
deadline a deadline |
|
16878 |
scheduled scheduled |
|
16879 |
timestamp appointment, selected by timestamp |
|
16880 |
closed entry was closed on date |
|
16881 |
upcoming-deadline warning about nearing deadline |
|
16882 |
past-scheduled forwarded scheduled item |
|
16883 |
block entry has date block including date |
|
16884 |
todo The TODO keyword, if any |
|
16885 |
tags All tags including inherited ones, separated by colons |
|
16886 |
date The relevant date, like 2007-2-14 |
|
16887 |
time The time, like 15:00-16:50 |
|
16888 |
extra String with extra planning info |
|
16889 |
priority-l The priority letter if any was given |
|
16890 |
priority-n The computed numerical priority |
|
16891 |
|
|
16892 |
If the selection of the agenda item was based on a timestamp, including |
|
16893 |
those items with ‘DEADLINE’ and ‘SCHEDULED’ keywords, then Org includes |
|
16894 |
date and time in the output. |
|
16895 |
|
|
16896 |
If the selection of the agenda item was based on a timestamp (or |
|
16897 |
deadline/scheduled), then Org includes date and time in the output. |
|
16898 |
|
|
16899 |
Here is an example of a post-processing script in Perl. It takes the |
|
16900 |
CSV output from Emacs and prints with a checkbox: |
|
16901 |
|
|
16902 |
#!/usr/bin/perl |
|
16903 |
|
|
16904 |
# define the Emacs command to run |
|
16905 |
$cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'"; |
|
16906 |
|
|
16907 |
# run it and capture the output |
|
16908 |
$agenda = qx{$cmd 2>/dev/null}; |
|
16909 |
|
|
16910 |
# loop over all lines |
|
16911 |
foreach $line (split(/\n/,$agenda)) { |
|
16912 |
# get the individual values |
|
16913 |
($category,$head,$type,$todo,$tags,$date,$time,$extra, |
|
16914 |
$priority_l,$priority_n) = split(/,/,$line); |
|
16915 |
# process and print |
|
16916 |
print "[ ] $head\n"; |
|
16917 |
} |
|
16918 |
|
|
16919 |
|
|
16920 |
File: org, Node: Using the property API, Next: Using the mapping API, Prev: Extracting agenda information, Up: Hacking |
|
16921 |
|
|
16922 |
A.11 Using the property API |
|
16923 |
=========================== |
|
16924 |
|
|
16925 |
Functions for working with properties. |
|
16926 |
|
|
16927 |
-- Function: org-entry-properties &optional pom which |
|
16928 |
Get all properties of the entry at point-or-marker POM. |
|
16929 |
This includes the TODO keyword, the tags, time strings for |
|
16930 |
deadline, scheduled, and clocking, and any additional properties |
|
16931 |
defined in the entry. The return value is an alist. Keys may |
|
16932 |
occur multiple times if the property key was used several times. |
|
16933 |
POM may also be ‘nil’, in which case the current entry is used. If |
|
16934 |
WHICH is ‘nil’ or ‘all’, get all properties. If WHICH is ‘special’ |
|
16935 |
or ‘standard’, only get that subclass. |
|
16936 |
|
|
16937 |
-- Function: org-entry-get pom property &optional inherit |
|
16938 |
Get value of ‘PROPERTY’ for entry at point-or-marker ‘POM’. By |
|
16939 |
default, this only looks at properties defined locally in the |
|
16940 |
entry. If ‘INHERIT’ is non-‘nil’ and the entry does not have the |
|
16941 |
property, then also check higher levels of the hierarchy. If |
|
16942 |
‘INHERIT’ is the symbol ‘selective’, use inheritance if and only if |
|
16943 |
the setting of ‘org-use-property-inheritance’ selects ‘PROPERTY’ |
|
16944 |
for inheritance. |
|
16945 |
|
|
16946 |
-- Function: org-entry-delete pom property |
|
16947 |
Delete the property ‘PROPERTY’ from entry at point-or-marker POM. |
|
16948 |
|
|
16949 |
-- Function: org-entry-put pom property value |
|
16950 |
Set ‘PROPERTY’ to ‘VALUE’ for entry at point-or-marker POM. |
|
16951 |
|
|
16952 |
-- Function: org-buffer-property-keys &optional include-specials |
|
16953 |
Get all property keys in the current buffer. |
|
16954 |
|
|
16955 |
-- Function: org-insert-property-drawer |
|
16956 |
Insert a property drawer for the current entry. |
|
16957 |
|
|
16958 |
-- Function: org-entry-put-multivalued-property pom property &rest |
|
16959 |
values |
|
16960 |
Set ‘PROPERTY’ at point-or-marker ‘POM’ to ‘VALUES’. ‘VALUES’ |
|
16961 |
should be a list of strings. They will be concatenated, with |
|
16962 |
spaces as separators. |
|
16963 |
|
|
16964 |
-- Function: org-entry-get-multivalued-property pom property |
|
16965 |
Treat the value of the property ‘PROPERTY’ as a |
|
16966 |
whitespace-separated list of values and return the values as a list |
|
16967 |
of strings. |
|
16968 |
|
|
16969 |
-- Function: org-entry-add-to-multivalued-property pom property value |
|
16970 |
Treat the value of the property ‘PROPERTY’ as a |
|
16971 |
whitespace-separated list of values and make sure that ‘VALUE’ is |
|
16972 |
in this list. |
|
16973 |
|
|
16974 |
-- Function: org-entry-remove-from-multivalued-property pom property |
|
16975 |
value |
|
16976 |
Treat the value of the property ‘PROPERTY’ as a |
|
16977 |
whitespace-separated list of values and make sure that ‘VALUE’ is |
|
16978 |
_not_ in this list. |
|
16979 |
|
|
16980 |
-- Function: org-entry-member-in-multivalued-property pom property |
|
16981 |
value |
|
16982 |
Treat the value of the property ‘PROPERTY’ as a |
|
16983 |
whitespace-separated list of values and check if ‘VALUE’ is in this |
|
16984 |
list. |
|
16985 |
|
|
16986 |
-- User Option: org-property-allowed-value-functions |
|
16987 |
Hook for functions supplying allowed values for a specific |
|
16988 |
property. The functions must take a single argument, the name of |
|
16989 |
the property, and return a flat list of allowed values. If ‘:ETC’ |
|
16990 |
is one of the values, use the values as completion help, but allow |
|
16991 |
also other values to be entered. The functions must return ‘nil’ |
|
16992 |
if they are not responsible for this property. |
|
16993 |
|
|
16994 |
|
|
16995 |
File: org, Node: Using the mapping API, Prev: Using the property API, Up: Hacking |
|
16996 |
|
|
16997 |
A.12 Using the mapping API |
|
16998 |
========================== |
|
16999 |
|
|
17000 |
Org has sophisticated mapping capabilities for finding entries. Org |
|
17001 |
uses this functionality internally for generating agenda views. Org |
|
17002 |
also exposes an API for executing arbitrary functions for each selected |
|
17003 |
entry. The API’s main entry point is: |
|
17004 |
|
|
17005 |
-- Function: org-map-entries func &optional match scope &rest skip |
|
17006 |
Call ‘FUNC’ at each headline selected by ‘MATCH’ in ‘SCOPE’. |
|
17007 |
|
|
17008 |
‘FUNC’ is a function or a Lisp form. With the cursor positioned at |
|
17009 |
the beginning of the headline, call the function without arguments. |
|
17010 |
Org returns an alist of return values of calls to the function. |
|
17011 |
|
|
17012 |
To avoid preserving point, Org wraps the call to ‘FUNC’ in |
|
17013 |
save-excursion form. After evaluation, Org moves the cursor to the |
|
17014 |
end of the line that was just processed. Search continues from |
|
17015 |
that point forward. This may not always work as expected under |
|
17016 |
some conditions, such as if the current sub-tree was removed by a |
|
17017 |
previous archiving operation. In such rare circumstances, Org |
|
17018 |
skips the next entry entirely when it should not. To stop Org from |
|
17019 |
such skips, make ‘FUNC’ set the variable ‘org-map-continue-from’ to |
|
17020 |
a specific buffer position. |
|
17021 |
|
|
17022 |
‘MATCH’ is a tags/property/TODO match. Org iterates only matched |
|
17023 |
headlines. Org iterates over all headlines when ‘MATCH’ is ‘nil’ |
|
17024 |
or ‘t’. |
|
17025 |
|
|
17026 |
‘SCOPE’ determines the scope of this command. It can be any of: |
|
17027 |
|
|
17028 |
nil the current buffer, respecting the restriction if any |
|
17029 |
tree the subtree started with the entry at point |
|
17030 |
region The entries within the active region, if any |
|
17031 |
file the current buffer, without restriction |
|
17032 |
file-with-archives |
|
17033 |
the current buffer, and any archives associated with it |
|
17034 |
agenda all agenda files |
|
17035 |
agenda-with-archives |
|
17036 |
all agenda files with any archive files associated with them |
|
17037 |
(file1 file2 ...) |
|
17038 |
if this is a list, all files in the list will be scanned |
|
17039 |
The remaining args are treated as settings for the scanner’s |
|
17040 |
skipping facilities. Valid args are: |
|
17041 |
|
|
17042 |
archive skip trees with the archive tag |
|
17043 |
comment skip trees with the COMMENT keyword |
|
17044 |
function or Lisp form |
|
17045 |
will be used as value for ‘org-agenda-skip-function’, |
|
17046 |
so whenever the function returns t, FUNC |
|
17047 |
will not be called for that entry and search will |
|
17048 |
continue from the point where the function leaves it |
|
17049 |
|
|
17050 |
The mapping routine can call any arbitrary function, even functions |
|
17051 |
that change meta data or query the property API (*note Using the |
|
17052 |
property API::). Here are some handy functions: |
|
17053 |
|
|
17054 |
-- Function: org-todo &optional arg |
|
17055 |
Change the TODO state of the entry. See the docstring of the |
|
17056 |
functions for the many possible values for the argument ‘ARG’. |
|
17057 |
|
|
17058 |
-- Function: org-priority &optional action |
|
17059 |
Change the priority of the entry. See the docstring of this |
|
17060 |
function for the possible values for ‘ACTION’. |
|
17061 |
|
|
17062 |
-- Function: org-toggle-tag tag &optional onoff |
|
17063 |
Toggle the tag ‘TAG’ in the current entry. Setting ‘ONOFF’ to |
|
17064 |
either ‘on’ or ‘off’ will not toggle tag, but ensure that it is |
|
17065 |
either on or off. |
|
17066 |
|
|
17067 |
-- Function: org-promote |
|
17068 |
Promote the current entry. |
|
17069 |
|
|
17070 |
-- Function: org-demote |
|
17071 |
Demote the current entry. |
|
17072 |
|
|
17073 |
This example turns all entries tagged with ‘TOMORROW’ into TODO |
|
17074 |
entries with keyword ‘UPCOMING’. Org ignores entries in comment trees |
|
17075 |
and archive trees. |
|
17076 |
|
|
17077 |
(org-map-entries |
|
17078 |
'(org-todo "UPCOMING") |
|
17079 |
"+TOMORROW" 'file 'archive 'comment) |
|
17080 |
|
|
17081 |
The following example counts the number of entries with TODO keyword |
|
17082 |
‘WAITING’, in all agenda files. |
|
17083 |
|
|
17084 |
(length (org-map-entries t "/+WAITING" 'agenda)) |
|
17085 |
|
|
17086 |
|
|
17087 |
File: org, Node: MobileOrg, Next: History and acknowledgments, Prev: Hacking, Up: Top |
|
17088 |
|
|
17089 |
Appendix B MobileOrg |
|
17090 |
******************** |
|
17091 |
|
|
17092 |
MobileOrg is a companion mobile app that runs on iOS and Android |
|
17093 |
devices. MobileOrg enables offline-views and capture support for an Org |
|
17094 |
mode system that is rooted on a “real” computer. MobileOrg can record |
|
17095 |
changes to existing entries. |
|
17096 |
|
|
17097 |
The iOS implementation (https://github.com/MobileOrg/) for the |
|
17098 |
_iPhone/iPod Touch/iPad_ series of devices, was started by Richard |
|
17099 |
Moreland and is now in the hands Sean Escriva. Android users should |
|
17100 |
check out MobileOrg Android |
|
17101 |
(http://wiki.github.com/matburt/mobileorg-android/) by Matt Jones. |
|
17102 |
Though the two implementations are not identical, they offer similar |
|
17103 |
features. |
|
17104 |
|
|
17105 |
This appendix describes Org’s support for agenda view formats |
|
17106 |
compatible with MobileOrg. It also describes synchronizing changes, |
|
17107 |
such as to notes, between MobileOrg and the computer. |
|
17108 |
|
|
17109 |
To change tags and TODO states in MobileOrg, first customize the |
|
17110 |
variables ‘org-todo-keywords’ and ‘org-tag-alist’. These should cover |
|
17111 |
all the important tags and TODO keywords, even if Org files use only |
|
17112 |
some of them. Though MobileOrg has in-buffer settings, it understands |
|
17113 |
TODO states _sets_ (*note Per-file keywords::) and _mutually exclusive_ |
|
17114 |
tags (*note Setting tags::) only for those set in these variables. |
|
17115 |
|
|
17116 |
* Menu: |
|
17117 |
|
|
17118 |
* Setting up the staging area:: For the mobile device |
|
17119 |
* Pushing to MobileOrg:: Uploading Org files and agendas |
|
17120 |
* Pulling from MobileOrg:: Integrating captured and flagged items |
|
17121 |
|
|
17122 |
|
|
17123 |
File: org, Node: Setting up the staging area, Next: Pushing to MobileOrg, Up: MobileOrg |
|
17124 |
|
|
17125 |
B.1 Setting up the staging area |
|
17126 |
=============================== |
|
17127 |
|
|
17128 |
MobileOrg needs access to a file directory on a server to interact with |
|
17129 |
Emacs. With a public server, consider encrypting the files. MobileOrg |
|
17130 |
version 1.5 supports encryption for the iPhone. Org also requires |
|
17131 |
‘openssl’ installed on the local computer. To turn on encryption, set |
|
17132 |
the same password in MobileOrg and in Emacs. Set the password in the |
|
17133 |
variable ‘org-mobile-use-encryption’(1). Note that even after MobileOrg |
|
17134 |
encrypts the file contents, the file names will remain visible on the |
|
17135 |
file systems of the local computer, the server, and the mobile device. |
|
17136 |
|
|
17137 |
For a server to host files, consider options like Dropbox.com |
|
17138 |
(http://dropbox.com) account(2). On first connection, MobileOrg creates |
|
17139 |
a directory ‘MobileOrg/’ on Dropbox. Pass its location to Emacs through |
|
17140 |
an init file variable as follows: |
|
17141 |
|
|
17142 |
(setq org-mobile-directory "~/Dropbox/MobileOrg") |
|
17143 |
|
|
17144 |
Org copies files to the above directory for MobileOrg. Org also uses |
|
17145 |
the same directory for sharing notes between Org and MobileOrg. |
|
17146 |
|
|
17147 |
---------- Footnotes ---------- |
|
17148 |
|
|
17149 |
(1) If Emacs is configured for safe storing of passwords, then |
|
17150 |
configure the variable, ‘org-mobile-encryption-password’; please read |
|
17151 |
the docstring of that variable. |
|
17152 |
|
|
17153 |
(2) An alternative is to use webdav server. MobileOrg documentation |
|
17154 |
has details of webdav server configuration. Additional help is at FAQ |
|
17155 |
entry (https://orgmode.org/worg/org-faq.html#mobileorg_webdav). |
|
17156 |
|
|
17157 |
|
|
17158 |
File: org, Node: Pushing to MobileOrg, Next: Pulling from MobileOrg, Prev: Setting up the staging area, Up: MobileOrg |
|
17159 |
|
|
17160 |
B.2 Pushing to MobileOrg |
|
17161 |
======================== |
|
17162 |
|
|
17163 |
Org pushes files listed in ‘org-mobile-files’ to ‘org-mobile-directory’. |
|
17164 |
Files include agenda files (as listed in ‘org-agenda-files’). Customize |
|
17165 |
‘org-mobile-files’ to add other files. File names will be staged with |
|
17166 |
paths relative to ‘org-directory’, so all files should be inside this |
|
17167 |
directory(1). |
|
17168 |
|
|
17169 |
Push creates a special Org file ‘agendas.org’ with custom agenda |
|
17170 |
views defined by the user(2). |
|
17171 |
|
|
17172 |
Org writes the file ‘index.org’, containing links to other files. |
|
17173 |
MobileOrg reads this file first from the server to determine what other |
|
17174 |
files to download for agendas. For faster downloads, MobileOrg will |
|
17175 |
read only those files whose checksums(3) have changed. |
|
17176 |
|
|
17177 |
---------- Footnotes ---------- |
|
17178 |
|
|
17179 |
(1) Symbolic links in ‘org-directory’ should have the same name as |
|
17180 |
their targets. |
|
17181 |
|
|
17182 |
(2) While creating the agendas, Org mode will force ID properties on |
|
17183 |
all referenced entries, so that these entries can be uniquely identified |
|
17184 |
if MobileOrg flags them for further action. To avoid setting properties |
|
17185 |
configure the variable ‘org-mobile-force-id-on-agenda-items’ to ‘nil’. |
|
17186 |
Org mode will then rely on outline paths, assuming they are unique. |
|
17187 |
|
|
17188 |
(3) Checksums are stored automatically in the file ‘checksums.dat’. |
|
17189 |
|
|
17190 |
|
|
17191 |
File: org, Node: Pulling from MobileOrg, Prev: Pushing to MobileOrg, Up: MobileOrg |
|
17192 |
|
|
17193 |
B.3 Pulling from MobileOrg |
|
17194 |
========================== |
|
17195 |
|
|
17196 |
When MobileOrg synchronizes with the server, it pulls the Org files for |
|
17197 |
viewing. It then appends to the file ‘mobileorg.org’ on the server the |
|
17198 |
captured entries, pointers to flagged and changed entries. Org |
|
17199 |
integrates its data in an inbox file format. |
|
17200 |
|
|
17201 |
1. Org moves all entries found in ‘mobileorg.org’(1) and appends them |
|
17202 |
to the file pointed to by the variable ‘org-mobile-inbox-for-pull’. |
|
17203 |
Each captured entry and each editing event is a top-level entry in |
|
17204 |
the inbox file. |
|
17205 |
2. After moving the entries, Org attempts changes to MobileOrg. Some |
|
17206 |
changes are applied directly and without user interaction. |
|
17207 |
Examples include changes to tags, TODO state, headline and body |
|
17208 |
text. Entries for further action are tagged as ‘:FLAGGED:’. Org |
|
17209 |
marks entries with problems with an error message in the inbox. |
|
17210 |
They have to be resolved manually. |
|
17211 |
3. Org generates an agenda view for flagged entries for user |
|
17212 |
intervention to clean up. For notes stored in flagged entries, |
|
17213 |
MobileOrg displays them in the echo area when the cursor is on the |
|
17214 |
corresponding agenda item. |
|
17215 |
|
|
17216 |
‘?’ |
|
17217 |
Pressing ‘?’ displays the entire flagged note in another |
|
17218 |
window. Org also pushes it to the kill ring. To store |
|
17219 |
flagged note as a normal note, use ‘? z C-y C-c C-c’. |
|
17220 |
Pressing ‘?’ twice does these things: first it removes the |
|
17221 |
‘:FLAGGED:’ tag; second, it removes the flagged note from the |
|
17222 |
property drawer; third, it signals that manual editing of the |
|
17223 |
flagged entry is now finished. |
|
17224 |
|
|
17225 |
‘C-c a ?’ returns to the agenda view to finish processing flagged |
|
17226 |
entries. Note that these entries may not be the most recent since |
|
17227 |
MobileOrg searches files that were last pulled. To get an updated |
|
17228 |
agenda view with changes since the last pull, pull again. |
|
17229 |
|
|
17230 |
---------- Footnotes ---------- |
|
17231 |
|
|
17232 |
(1) ‘mobileorg.org’ will be empty after this operation. |
|
17233 |
|
|
17234 |
|
|
17235 |
File: org, Node: History and acknowledgments, Next: GNU Free Documentation License, Prev: MobileOrg, Up: Top |
|
17236 |
|
|
17237 |
Appendix C History and acknowledgments |
|
17238 |
************************************** |
|
17239 |
|
|
17240 |
C.1 From Carsten |
|
17241 |
================ |
|
17242 |
|
|
17243 |
Org was born in 2003, out of frustration over the user interface of the |
|
17244 |
Emacs Outline mode. I was trying to organize my notes and projects, and |
|
17245 |
using Emacs seemed to be the natural way to go. However, having to |
|
17246 |
remember eleven different commands with two or three keys per command, |
|
17247 |
only to hide and show parts of the outline tree, that seemed entirely |
|
17248 |
unacceptable. Also, when using outlines to take notes, I constantly |
|
17249 |
wanted to restructure the tree, organizing it paralleling my thoughts |
|
17250 |
and plans. _Visibility cycling_ and _structure editing_ were originally |
|
17251 |
implemented in the package ‘outline-magic.el’, but quickly moved to the |
|
17252 |
more general ‘org.el’. As this environment became comfortable for |
|
17253 |
project planning, the next step was adding _TODO entries_, basic |
|
17254 |
_timestamps_, and _table support_. These areas highlighted the two main |
|
17255 |
goals that Org still has today: to be a new, outline-based, plain text |
|
17256 |
mode with innovative and intuitive editing features, and to incorporate |
|
17257 |
project planning functionality directly into a notes file. |
|
17258 |
|
|
17259 |
Since the first release, literally thousands of emails to me or to |
|
17260 |
<emacs-orgmode@gnu.org> have provided a constant stream of bug reports, |
|
17261 |
feedback, new ideas, and sometimes patches and add-on code. Many thanks |
|
17262 |
to everyone who has helped to improve this package. I am trying to keep |
|
17263 |
here a list of the people who had significant influence in shaping one |
|
17264 |
or more aspects of Org. The list may not be complete, if I have |
|
17265 |
forgotten someone, please accept my apologies and let me know. |
|
17266 |
|
|
17267 |
Before I get to this list, a few special mentions are in order: |
|
17268 |
|
|
17269 |
Bastien Guerry |
|
17270 |
Bastien has written a large number of extensions to Org (most of |
|
17271 |
them integrated into the core by now), including the LaTeX exporter |
|
17272 |
and the plain list parser. His support during the early days was |
|
17273 |
central to the success of this project. Bastien also invented |
|
17274 |
Worg, helped establishing the Web presence of Org, and sponsored |
|
17275 |
hosting costs for the orgmode.org website. Bastien stepped in as |
|
17276 |
maintainer of Org between 2011 and 2013, at a time when I |
|
17277 |
desperately needed a break. |
|
17278 |
Eric Schulte and Dan Davison |
|
17279 |
Eric and Dan are jointly responsible for the Org-babel system, |
|
17280 |
which turns Org into a multi-language environment for evaluating |
|
17281 |
code and doing literate programming and reproducible research. |
|
17282 |
This has become one of Org’s killer features that define what Org |
|
17283 |
is today. |
|
17284 |
John Wiegley |
|
17285 |
John has contributed a number of great ideas and patches directly |
|
17286 |
to Org, including the attachment system (‘org-attach.el’), |
|
17287 |
integration with Apple Mail (‘org-mac-message.el’), hierarchical |
|
17288 |
dependencies of TODO items, habit tracking (‘org-habits.el’), and |
|
17289 |
encryption (‘org-crypt.el’). Also, the capture system is really an |
|
17290 |
extended copy of his great ‘remember.el’. |
|
17291 |
Sebastian Rose |
|
17292 |
Without Sebastian, the HTML/XHTML publishing of Org would be the |
|
17293 |
pitiful work of an ignorant amateur. Sebastian has pushed this |
|
17294 |
part of Org onto a much higher level. He also wrote ‘org-info.js’, |
|
17295 |
a Java script for displaying web pages derived from Org using an |
|
17296 |
Info-like or a folding interface with single-key navigation. |
|
17297 |
|
|
17298 |
See below for the full list of contributions! Again, please let me know |
|
17299 |
what I am missing here! |
|
17300 |
|
|
17301 |
C.2 From Bastien |
|
17302 |
================ |
|
17303 |
|
|
17304 |
I (Bastien) have been maintaining Org between 2011 and 2013. This |
|
17305 |
appendix would not be complete without adding a few more acknowledgments |
|
17306 |
and thanks. |
|
17307 |
|
|
17308 |
I am first grateful to Carsten for his trust while handing me over |
|
17309 |
the maintainership of Org. His unremitting support is what really |
|
17310 |
helped me getting more confident over time, with both the community and |
|
17311 |
the code. |
|
17312 |
|
|
17313 |
When I took over maintainership, I knew I would have to make Org more |
|
17314 |
collaborative than ever, as I would have to rely on people that are more |
|
17315 |
knowledgeable than I am on many parts of the code. Here is a list of |
|
17316 |
the persons I could rely on, they should really be considered |
|
17317 |
co-maintainers, either of the code or the community: |
|
17318 |
|
|
17319 |
Eric Schulte |
|
17320 |
Eric is maintaining the Babel parts of Org. His reactivity here |
|
17321 |
kept me away from worrying about possible bugs here and let me |
|
17322 |
focus on other parts. |
|
17323 |
|
|
17324 |
Nicolas Goaziou |
|
17325 |
Nicolas is maintaining the consistency of the deepest parts of Org. |
|
17326 |
His work on ‘org-element.el’ and ‘ox.el’ has been outstanding, and |
|
17327 |
it opened the doors for many new ideas and features. He rewrote |
|
17328 |
many of the old exporters to use the new export engine, and helped |
|
17329 |
with documenting this major change. More importantly (if that’s |
|
17330 |
possible), he has been more than reliable during all the work done |
|
17331 |
for Org 8.0, and always very reactive on the mailing list. |
|
17332 |
|
|
17333 |
Achim Gratz |
|
17334 |
Achim rewrote the building process of Org, turning some _ad hoc_ |
|
17335 |
tools into a flexible and conceptually clean process. He patiently |
|
17336 |
coped with the many hiccups that such a change can create for |
|
17337 |
users. |
|
17338 |
|
|
17339 |
Nick Dokos |
|
17340 |
The Org mode mailing list would not be such a nice place without |
|
17341 |
Nick, who patiently helped users so many times. It is impossible |
|
17342 |
to overestimate such a great help, and the list would not be so |
|
17343 |
active without him. |
|
17344 |
|
|
17345 |
I received support from so many users that it is clearly impossible |
|
17346 |
to be fair when shortlisting a few of them, but Org’s history would not |
|
17347 |
be complete if the ones above were not mentioned in this manual. |
|
17348 |
|
|
17349 |
C.3 List of contributions |
|
17350 |
========================= |
|
17351 |
|
|
17352 |
• Russel Adams came up with the idea for drawers. |
|
17353 |
• Suvayu Ali has steadily helped on the mailing list, providing |
|
17354 |
useful feedback on many features and several patches. |
|
17355 |
• Luis Anaya wrote ‘ox-man.el’. |
|
17356 |
• Thomas Baumann wrote ‘org-bbdb.el’ and ‘org-mhe.el’. |
|
17357 |
• Michael Brand helped by reporting many bugs and testing many |
|
17358 |
features. He also implemented the distinction between empty fields |
|
17359 |
and 0-value fields in Org’s spreadsheets. |
|
17360 |
• Christophe Bataillon created the great unicorn logo that we use on |
|
17361 |
the Org mode website. |
|
17362 |
• Alex Bochannek provided a patch for rounding timestamps. |
|
17363 |
• Jan Böcker wrote ‘org-docview.el’. |
|
17364 |
• Brad Bozarth showed how to pull RSS feed data into Org mode files. |
|
17365 |
• Tom Breton wrote ‘org-choose.el’. |
|
17366 |
• Charles Cave’s suggestion sparked the implementation of templates |
|
17367 |
for Remember, which are now templates for capture. |
|
17368 |
• Pavel Chalmoviansky influenced the agenda treatment of items with |
|
17369 |
specified time. |
|
17370 |
• Gregory Chernov patched support for Lisp forms into table |
|
17371 |
calculations and improved XEmacs compatibility, in particular by |
|
17372 |
porting ‘nouline.el’ to XEmacs. |
|
17373 |
• Sacha Chua suggested copying some linking code from Planner, and |
|
17374 |
helped make Org popular through her blog. |
|
17375 |
• Toby S. Cubitt contributed to the code for clock formats. |
|
17376 |
• Baoqiu Cui contributed the first DocBook exporter. In Org 8.0, we |
|
17377 |
go a different route: you can now export to Texinfo and export the |
|
17378 |
‘.texi’ file to DocBook using ‘makeinfo’. |
|
17379 |
• Eddward DeVilla proposed and tested checkbox statistics. He also |
|
17380 |
came up with the idea of properties, and that there should be an |
|
17381 |
API for them. |
|
17382 |
• Nick Dokos tracked down several nasty bugs. |
|
17383 |
• Kees Dullemond used to edit projects lists directly in HTML and so |
|
17384 |
inspired some of the early development, including HTML export. He |
|
17385 |
also asked for a way to narrow wide table columns. |
|
17386 |
• Jason Dunsmore has been maintaining the Org-Mode server at |
|
17387 |
Rackspace for several years now. He also sponsored the hosting |
|
17388 |
costs until Rackspace started to host us for free. |
|
17389 |
• Thomas S. Dye contributed documentation on Worg and helped |
|
17390 |
integrating the Org-Babel documentation into the manual. |
|
17391 |
• Christian Egli converted the documentation into Texinfo format, |
|
17392 |
inspired the agenda, patched CSS formatting into the HTML exporter, |
|
17393 |
and wrote ‘org-taskjuggler.el’, which has been rewritten by Nicolas |
|
17394 |
Goaziou as ‘ox-taskjuggler.el’ for Org 8.0. |
|
17395 |
• David Emery provided a patch for custom CSS support in exported |
|
17396 |
HTML agendas. |
|
17397 |
• Sean Escriva took over MobileOrg development on the iPhone |
|
17398 |
platform. |
|
17399 |
• Nic Ferrier contributed mailcap and XOXO support. |
|
17400 |
• Miguel A. Figueroa-Villanueva implemented hierarchical checkboxes. |
|
17401 |
• John Foerch figured out how to make incremental search show context |
|
17402 |
around a match in a hidden outline tree. |
|
17403 |
• Raimar Finken wrote ‘org-git-line.el’. |
|
17404 |
• Mikael Fornius works as a mailing list moderator. |
|
17405 |
• Austin Frank works as a mailing list moderator. |
|
17406 |
• Eric Fraga drove the development of BEAMER export with ideas and |
|
17407 |
testing. |
|
17408 |
• Barry Gidden did proofreading the manual in preparation for the |
|
17409 |
book publication through Network Theory Ltd. |
|
17410 |
• Niels Giesen had the idea to automatically archive DONE trees. |
|
17411 |
• Nicolas Goaziou rewrote much of the plain list code. He also wrote |
|
17412 |
‘org-element.el’ and ‘org-export.el’, which was a huge step forward |
|
17413 |
in implementing a clean framework for Org exporters. |
|
17414 |
• Kai Grossjohann pointed out key-binding conflicts with other |
|
17415 |
packages. |
|
17416 |
• Brian Gough of Network Theory Ltd publishes the Org mode manual as |
|
17417 |
a book. |
|
17418 |
• Bernt Hansen has driven much of the support for auto-repeating |
|
17419 |
tasks, task state change logging, and the clocktable. His clear |
|
17420 |
explanations have been critical when we started to adopt the Git |
|
17421 |
version control system. |
|
17422 |
• Manuel Hermenegildo has contributed various ideas, small fixes and |
|
17423 |
patches. |
|
17424 |
• Phil Jackson wrote ‘org-irc.el’. |
|
17425 |
• Scott Jaderholm proposed footnotes, control over whitespace between |
|
17426 |
folded entries, and column view for properties. |
|
17427 |
• Matt Jones wrote MobileOrg Android. |
|
17428 |
• Tokuya Kameshima wrote ‘org-wl.el’ and ‘org-mew.el’. |
|
17429 |
• Jonathan Leech-Pepin wrote ‘ox-texinfo.el’. |
|
17430 |
• Shidai Liu ("Leo") asked for embedded LaTeX and tested it. He also |
|
17431 |
provided frequent feedback and some patches. |
|
17432 |
• Matt Lundin has proposed last-row references for table formulas and |
|
17433 |
named invisible anchors. He has also worked a lot on the FAQ. |
|
17434 |
• David Maus wrote ‘org-atom.el’, maintains the issues file for Org, |
|
17435 |
and is a prolific contributor on the mailing list with competent |
|
17436 |
replies, small fixes and patches. |
|
17437 |
• Jason F. McBrayer suggested agenda export to CSV format. |
|
17438 |
• Max Mikhanosha came up with the idea of refiling and sticky |
|
17439 |
agendas. |
|
17440 |
• Dmitri Minaev sent a patch to set priority limits on a per-file |
|
17441 |
basis. |
|
17442 |
• Stefan Monnier provided a patch to keep the Emacs-Lisp compiler |
|
17443 |
happy. |
|
17444 |
• Richard Moreland wrote MobileOrg for the iPhone. |
|
17445 |
• Rick Moynihan proposed allowing multiple TODO sequences in a file |
|
17446 |
and being able to quickly restrict the agenda to a subtree. |
|
17447 |
• Todd Neal provided patches for links to Info files and Elisp forms. |
|
17448 |
• Greg Newman refreshed the unicorn logo into its current form. |
|
17449 |
• Tim O’Callaghan suggested in-file links, search options for general |
|
17450 |
file links, and TAGS. |
|
17451 |
• Osamu Okano wrote ‘orgcard2ref.pl’, a Perl program to create a text |
|
17452 |
version of the reference card. |
|
17453 |
• Takeshi Okano translated the manual and David O’Toole’s tutorial |
|
17454 |
into Japanese. |
|
17455 |
• Oliver Oppitz suggested multi-state TODO items. |
|
17456 |
• Scott Otterson sparked the introduction of descriptive text for |
|
17457 |
links, among other things. |
|
17458 |
• Pete Phillips helped during the development of the TAGS feature, |
|
17459 |
and provided frequent feedback. |
|
17460 |
• Francesco Pizzolante provided patches that helped speeding up the |
|
17461 |
agenda generation. |
|
17462 |
• Martin Pohlack provided the code snippet to bundle character |
|
17463 |
insertion into bundles of 20 for undo. |
|
17464 |
• Rackspace.com is hosting our website for free. Thank you |
|
17465 |
Rackspace! |
|
17466 |
• T.V. Raman reported bugs and suggested improvements. |
|
17467 |
• Matthias Rempe (Oelde) provided ideas, Windows support, and quality |
|
17468 |
control. |
|
17469 |
• Paul Rivier provided the basic implementation of named footnotes. |
|
17470 |
He also acted as mailing list moderator for some time. |
|
17471 |
• Kevin Rogers contributed code to access VM files on remote hosts. |
|
17472 |
• Frank Ruell solved the mystery of the ‘keymapp nil’ bug, a conflict |
|
17473 |
with ‘allout.el’. |
|
17474 |
• Jason Riedy generalized the send-receive mechanism for Orgtbl |
|
17475 |
tables with extensive patches. |
|
17476 |
• Philip Rooke created the Org reference card, provided lots of |
|
17477 |
feedback, developed and applied standards to the Org documentation. |
|
17478 |
• Christian Schlauer proposed angular brackets around links, among |
|
17479 |
other things. |
|
17480 |
• Christopher Schmidt reworked ‘orgstruct-mode’ so that users can |
|
17481 |
enjoy folding in non-org buffers by using Org headlines in |
|
17482 |
comments. |
|
17483 |
• Paul Sexton wrote ‘org-ctags.el’. |
|
17484 |
• Linking to VM/BBDB/Gnus was first inspired by Tom Shannon’s |
|
17485 |
‘organizer-mode.el’. |
|
17486 |
• Ilya Shlyakhter proposed the Archive Sibling, line numbering in |
|
17487 |
literal examples, and remote highlighting for referenced code |
|
17488 |
lines. |
|
17489 |
• Stathis Sideris wrote the ‘ditaa.jar’ ASCII to PNG converter that |
|
17490 |
is now packaged into Org’s ‘contrib’ directory. |
|
17491 |
• Daniel Sinder came up with the idea of internal archiving by |
|
17492 |
locking subtrees. |
|
17493 |
• Dale Smith proposed link abbreviations. |
|
17494 |
• James TD Smith has contributed a large number of patches for useful |
|
17495 |
tweaks and features. |
|
17496 |
• Adam Spiers asked for global linking commands, inspired the link |
|
17497 |
extension system, added support for mairix, and proposed the |
|
17498 |
mapping API. |
|
17499 |
• Ulf Stegemann created the table to translate special symbols to |
|
17500 |
HTML, LaTeX, UTF-8, Latin-1 and ASCII. |
|
17501 |
• Andy Stewart contributed code to ‘org-w3m.el’, to copy HTML content |
|
17502 |
with links transformation to Org syntax. |
|
17503 |
• David O’Toole wrote ‘org-publish.el’ and drafted the manual chapter |
|
17504 |
about publishing. |
|
17505 |
• Jambunathan K contributed the ODT exporter and rewrote the HTML |
|
17506 |
exporter. |
|
17507 |
• Sebastien Vauban reported many issues with LaTeX and BEAMER export |
|
17508 |
and enabled source code highlighting in Gnus. |
|
17509 |
• Stefan Vollmar organized a video-recorded talk at the |
|
17510 |
Max-Planck-Institute for Neurology. He also inspired the creation |
|
17511 |
of a concept index for HTML export. |
|
17512 |
• Jürgen Vollmer contributed code generating the table of contents in |
|
17513 |
HTML output. |
|
17514 |
• Samuel Wales has provided important feedback and bug reports. |
|
17515 |
• Chris Wallace provided a patch implementing the ‘QUOTE’ keyword. |
|
17516 |
• David Wainberg suggested archiving, and improvements to the linking |
|
17517 |
system. |
|
17518 |
• Carsten Wimmer suggested some changes and helped fix a bug in |
|
17519 |
linking to Gnus. |
|
17520 |
• Roland Winkler requested additional key bindings to make Org work |
|
17521 |
on a tty. |
|
17522 |
• Piotr Zielinski wrote ‘org-mouse.el’, proposed agenda blocks and |
|
17523 |
contributed various ideas and code snippets. |
|
17524 |
• Marco Wahl wrote ‘org-eww.el’. |
|
17525 |
|
|
17526 |
|
|
17527 |
File: org, Node: GNU Free Documentation License, Next: Main Index, Prev: History and acknowledgments, Up: Top |
|
17528 |
|
|
17529 |
Appendix D GNU Free Documentation License |
|
17530 |
***************************************** |
|
17531 |
|
|
17532 |
Version 1.3, 3 November 2008 |
|
17533 |
|
|
17534 |
Copyright © 2000, 2001, 2002, 2007, 2008, 2013, 2014, 2018 Free Software Foundation, Inc. |
|
17535 |
<http://fsf.org/> |
|
17536 |
|
|
17537 |
Everyone is permitted to copy and distribute verbatim copies |
|
17538 |
of this license document, but changing it is not allowed. |
|
17539 |
|
|
17540 |
0. PREAMBLE |
|
17541 |
|
|
17542 |
The purpose of this License is to make a manual, textbook, or other |
|
17543 |
functional and useful document “free” in the sense of freedom: to |
|
17544 |
assure everyone the effective freedom to copy and redistribute it, |
|
17545 |
with or without modifying it, either commercially or |
|
17546 |
noncommercially. Secondarily, this License preserves for the |
|
17547 |
author and publisher a way to get credit for their work, while not |
|
17548 |
being considered responsible for modifications made by others. |
|
17549 |
|
|
17550 |
This License is a kind of “copyleft”, which means that derivative |
|
17551 |
works of the document must themselves be free in the same sense. |
|
17552 |
It complements the GNU General Public License, which is a copyleft |
|
17553 |
license designed for free software. |
|
17554 |
|
|
17555 |
We have designed this License in order to use it for manuals for |
|
17556 |
free software, because free software needs free documentation: a |
|
17557 |
free program should come with manuals providing the same freedoms |
|
17558 |
that the software does. But this License is not limited to |
|
17559 |
software manuals; it can be used for any textual work, regardless |
|
17560 |
of subject matter or whether it is published as a printed book. We |
|
17561 |
recommend this License principally for works whose purpose is |
|
17562 |
instruction or reference. |
|
17563 |
|
|
17564 |
1. APPLICABILITY AND DEFINITIONS |
|
17565 |
|
|
17566 |
This License applies to any manual or other work, in any medium, |
|
17567 |
that contains a notice placed by the copyright holder saying it can |
|
17568 |
be distributed under the terms of this License. Such a notice |
|
17569 |
grants a world-wide, royalty-free license, unlimited in duration, |
|
17570 |
to use that work under the conditions stated herein. The |
|
17571 |
“Document”, below, refers to any such manual or work. Any member |
|
17572 |
of the public is a licensee, and is addressed as “you”. You accept |
|
17573 |
the license if you copy, modify or distribute the work in a way |
|
17574 |
requiring permission under copyright law. |
|
17575 |
|
|
17576 |
A “Modified Version” of the Document means any work containing the |
|
17577 |
Document or a portion of it, either copied verbatim, or with |
|
17578 |
modifications and/or translated into another language. |
|
17579 |
|
|
17580 |
A “Secondary Section” is a named appendix or a front-matter section |
|
17581 |
of the Document that deals exclusively with the relationship of the |
|
17582 |
publishers or authors of the Document to the Document’s overall |
|
17583 |
subject (or to related matters) and contains nothing that could |
|
17584 |
fall directly within that overall subject. (Thus, if the Document |
|
17585 |
is in part a textbook of mathematics, a Secondary Section may not |
|
17586 |
explain any mathematics.) The relationship could be a matter of |
|
17587 |
historical connection with the subject or with related matters, or |
|
17588 |
of legal, commercial, philosophical, ethical or political position |
|
17589 |
regarding them. |
|
17590 |
|
|
17591 |
The “Invariant Sections” are certain Secondary Sections whose |
|
17592 |
titles are designated, as being those of Invariant Sections, in the |
|
17593 |
notice that says that the Document is released under this License. |
|
17594 |
If a section does not fit the above definition of Secondary then it |
|
17595 |
is not allowed to be designated as Invariant. The Document may |
|
17596 |
contain zero Invariant Sections. If the Document does not identify |
|
17597 |
any Invariant Sections then there are none. |
|
17598 |
|
|
17599 |
The “Cover Texts” are certain short passages of text that are |
|
17600 |
listed, as Front-Cover Texts or Back-Cover Texts, in the notice |
|
17601 |
that says that the Document is released under this License. A |
|
17602 |
Front-Cover Text may be at most 5 words, and a Back-Cover Text may |
|
17603 |
be at most 25 words. |
|
17604 |
|
|
17605 |
A “Transparent” copy of the Document means a machine-readable copy, |
|
17606 |
represented in a format whose specification is available to the |
|
17607 |
general public, that is suitable for revising the document |
|
17608 |
straightforwardly with generic text editors or (for images composed |
|
17609 |
of pixels) generic paint programs or (for drawings) some widely |
|
17610 |
available drawing editor, and that is suitable for input to text |
|
17611 |
formatters or for automatic translation to a variety of formats |
|
17612 |
suitable for input to text formatters. A copy made in an otherwise |
|
17613 |
Transparent file format whose markup, or absence of markup, has |
|
17614 |
been arranged to thwart or discourage subsequent modification by |
|
17615 |
readers is not Transparent. An image format is not Transparent if |
|
17616 |
used for any substantial amount of text. A copy that is not |
|
17617 |
“Transparent” is called “Opaque”. |
|
17618 |
|
|
17619 |
Examples of suitable formats for Transparent copies include plain |
|
17620 |
ASCII without markup, Texinfo input format, LaTeX input format, |
|
17621 |
SGML or XML using a publicly available DTD, and standard-conforming |
|
17622 |
simple HTML, PostScript or PDF designed for human modification. |
|
17623 |
Examples of transparent image formats include PNG, XCF and JPG. |
|
17624 |
Opaque formats include proprietary formats that can be read and |
|
17625 |
edited only by proprietary word processors, SGML or XML for which |
|
17626 |
the DTD and/or processing tools are not generally available, and |
|
17627 |
the machine-generated HTML, PostScript or PDF produced by some word |
|
17628 |
processors for output purposes only. |
|
17629 |
|
|
17630 |
The “Title Page” means, for a printed book, the title page itself, |
|
17631 |
plus such following pages as are needed to hold, legibly, the |
|
17632 |
material this License requires to appear in the title page. For |
|
17633 |
works in formats which do not have any title page as such, “Title |
|
17634 |
Page” means the text near the most prominent appearance of the |
|
17635 |
work’s title, preceding the beginning of the body of the text. |
|
17636 |
|
|
17637 |
The “publisher” means any person or entity that distributes copies |
|
17638 |
of the Document to the public. |
|
17639 |
|
|
17640 |
A section “Entitled XYZ” means a named subunit of the Document |
|
17641 |
whose title either is precisely XYZ or contains XYZ in parentheses |
|
17642 |
following text that translates XYZ in another language. (Here XYZ |
|
17643 |
stands for a specific section name mentioned below, such as |
|
17644 |
“Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) |
|
17645 |
To “Preserve the Title” of such a section when you modify the |
|
17646 |
Document means that it remains a section “Entitled XYZ” according |
|
17647 |
to this definition. |
|
17648 |
|
|
17649 |
The Document may include Warranty Disclaimers next to the notice |
|
17650 |
which states that this License applies to the Document. These |
|
17651 |
Warranty Disclaimers are considered to be included by reference in |
|
17652 |
this License, but only as regards disclaiming warranties: any other |
|
17653 |
implication that these Warranty Disclaimers may have is void and |
|
17654 |
has no effect on the meaning of this License. |
|
17655 |
|
|
17656 |
2. VERBATIM COPYING |
|
17657 |
|
|
17658 |
You may copy and distribute the Document in any medium, either |
|
17659 |
commercially or noncommercially, provided that this License, the |
|
17660 |
copyright notices, and the license notice saying this License |
|
17661 |
applies to the Document are reproduced in all copies, and that you |
|
17662 |
add no other conditions whatsoever to those of this License. You |
|
17663 |
may not use technical measures to obstruct or control the reading |
|
17664 |
or further copying of the copies you make or distribute. However, |
|
17665 |
you may accept compensation in exchange for copies. If you |
|
17666 |
distribute a large enough number of copies you must also follow the |
|
17667 |
conditions in section 3. |
|
17668 |
|
|
17669 |
You may also lend copies, under the same conditions stated above, |
|
17670 |
and you may publicly display copies. |
|
17671 |
|
|
17672 |
3. COPYING IN QUANTITY |
|
17673 |
|
|
17674 |
If you publish printed copies (or copies in media that commonly |
|
17675 |
have printed covers) of the Document, numbering more than 100, and |
|
17676 |
the Document’s license notice requires Cover Texts, you must |
|
17677 |
enclose the copies in covers that carry, clearly and legibly, all |
|
17678 |
these Cover Texts: Front-Cover Texts on the front cover, and |
|
17679 |
Back-Cover Texts on the back cover. Both covers must also clearly |
|
17680 |
and legibly identify you as the publisher of these copies. The |
|
17681 |
front cover must present the full title with all words of the title |
|
17682 |
equally prominent and visible. You may add other material on the |
|
17683 |
covers in addition. Copying with changes limited to the covers, as |
|
17684 |
long as they preserve the title of the Document and satisfy these |
|
17685 |
conditions, can be treated as verbatim copying in other respects. |
|
17686 |
|
|
17687 |
If the required texts for either cover are too voluminous to fit |
|
17688 |
legibly, you should put the first ones listed (as many as fit |
|
17689 |
reasonably) on the actual cover, and continue the rest onto |
|
17690 |
adjacent pages. |
|
17691 |
|
|
17692 |
If you publish or distribute Opaque copies of the Document |
|
17693 |
numbering more than 100, you must either include a machine-readable |
|
17694 |
Transparent copy along with each Opaque copy, or state in or with |
|
17695 |
each Opaque copy a computer-network location from which the general |
|
17696 |
network-using public has access to download using public-standard |
|
17697 |
network protocols a complete Transparent copy of the Document, free |
|
17698 |
of added material. If you use the latter option, you must take |
|
17699 |
reasonably prudent steps, when you begin distribution of Opaque |
|
17700 |
copies in quantity, to ensure that this Transparent copy will |
|
17701 |
remain thus accessible at the stated location until at least one |
|
17702 |
year after the last time you distribute an Opaque copy (directly or |
|
17703 |
through your agents or retailers) of that edition to the public. |
|
17704 |
|
|
17705 |
It is requested, but not required, that you contact the authors of |
|
17706 |
the Document well before redistributing any large number of copies, |
|
17707 |
to give them a chance to provide you with an updated version of the |
|
17708 |
Document. |
|
17709 |
|
|
17710 |
4. MODIFICATIONS |
|
17711 |
|
|
17712 |
You may copy and distribute a Modified Version of the Document |
|
17713 |
under the conditions of sections 2 and 3 above, provided that you |
|
17714 |
release the Modified Version under precisely this License, with the |
|
17715 |
Modified Version filling the role of the Document, thus licensing |
|
17716 |
distribution and modification of the Modified Version to whoever |
|
17717 |
possesses a copy of it. In addition, you must do these things in |
|
17718 |
the Modified Version: |
|
17719 |
|
|
17720 |
A. Use in the Title Page (and on the covers, if any) a title |
|
17721 |
distinct from that of the Document, and from those of previous |
|
17722 |
versions (which should, if there were any, be listed in the |
|
17723 |
History section of the Document). You may use the same title |
|
17724 |
as a previous version if the original publisher of that |
|
17725 |
version gives permission. |
|
17726 |
|
|
17727 |
B. List on the Title Page, as authors, one or more persons or |
|
17728 |
entities responsible for authorship of the modifications in |
|
17729 |
the Modified Version, together with at least five of the |
|
17730 |
principal authors of the Document (all of its principal |
|
17731 |
authors, if it has fewer than five), unless they release you |
|
17732 |
from this requirement. |
|
17733 |
|
|
17734 |
C. State on the Title page the name of the publisher of the |
|
17735 |
Modified Version, as the publisher. |
|
17736 |
|
|
17737 |
D. Preserve all the copyright notices of the Document. |
|
17738 |
|
|
17739 |
E. Add an appropriate copyright notice for your modifications |
|
17740 |
adjacent to the other copyright notices. |
|
17741 |
|
|
17742 |
F. Include, immediately after the copyright notices, a license |
|
17743 |
notice giving the public permission to use the Modified |
|
17744 |
Version under the terms of this License, in the form shown in |
|
17745 |
the Addendum below. |
|
17746 |
|
|
17747 |
G. Preserve in that license notice the full lists of Invariant |
|
17748 |
Sections and required Cover Texts given in the Document’s |
|
17749 |
license notice. |
|
17750 |
|
|
17751 |
H. Include an unaltered copy of this License. |
|
17752 |
|
|
17753 |
I. Preserve the section Entitled “History”, Preserve its Title, |
|
17754 |
and add to it an item stating at least the title, year, new |
|
17755 |
authors, and publisher of the Modified Version as given on the |
|
17756 |
Title Page. If there is no section Entitled “History” in the |
|
17757 |
Document, create one stating the title, year, authors, and |
|
17758 |
publisher of the Document as given on its Title Page, then add |
|
17759 |
an item describing the Modified Version as stated in the |
|
17760 |
previous sentence. |
|
17761 |
|
|
17762 |
J. Preserve the network location, if any, given in the Document |
|
17763 |
for public access to a Transparent copy of the Document, and |
|
17764 |
likewise the network locations given in the Document for |
|
17765 |
previous versions it was based on. These may be placed in the |
|
17766 |
“History” section. You may omit a network location for a work |
|
17767 |
that was published at least four years before the Document |
|
17768 |
itself, or if the original publisher of the version it refers |
|
17769 |
to gives permission. |
|
17770 |
|
|
17771 |
K. For any section Entitled “Acknowledgements” or “Dedications”, |
|
17772 |
Preserve the Title of the section, and preserve in the section |
|
17773 |
all the substance and tone of each of the contributor |
|
17774 |
acknowledgements and/or dedications given therein. |
|
17775 |
|
|
17776 |
L. Preserve all the Invariant Sections of the Document, unaltered |
|
17777 |
in their text and in their titles. Section numbers or the |
|
17778 |
equivalent are not considered part of the section titles. |
|
17779 |
|
|
17780 |
M. Delete any section Entitled “Endorsements”. Such a section |
|
17781 |
may not be included in the Modified Version. |
|
17782 |
|
|
17783 |
N. Do not retitle any existing section to be Entitled |
|
17784 |
“Endorsements” or to conflict in title with any Invariant |
|
17785 |
Section. |
|
17786 |
|
|
17787 |
O. Preserve any Warranty Disclaimers. |
|
17788 |
|
|
17789 |
If the Modified Version includes new front-matter sections or |
|
17790 |
appendices that qualify as Secondary Sections and contain no |
|
17791 |
material copied from the Document, you may at your option designate |
|
17792 |
some or all of these sections as invariant. To do this, add their |
|
17793 |
titles to the list of Invariant Sections in the Modified Version’s |
|
17794 |
license notice. These titles must be distinct from any other |
|
17795 |
section titles. |
|
17796 |
|
|
17797 |
You may add a section Entitled “Endorsements”, provided it contains |
|
17798 |
nothing but endorsements of your Modified Version by various |
|
17799 |
parties—for example, statements of peer review or that the text has |
|
17800 |
been approved by an organization as the authoritative definition of |
|
17801 |
a standard. |
|
17802 |
|
|
17803 |
You may add a passage of up to five words as a Front-Cover Text, |
|
17804 |
and a passage of up to 25 words as a Back-Cover Text, to the end of |
|
17805 |
the list of Cover Texts in the Modified Version. Only one passage |
|
17806 |
of Front-Cover Text and one of Back-Cover Text may be added by (or |
|
17807 |
through arrangements made by) any one entity. If the Document |
|
17808 |
already includes a cover text for the same cover, previously added |
|
17809 |
by you or by arrangement made by the same entity you are acting on |
|
17810 |
behalf of, you may not add another; but you may replace the old |
|
17811 |
one, on explicit permission from the previous publisher that added |
|
17812 |
the old one. |
|
17813 |
|
|
17814 |
The author(s) and publisher(s) of the Document do not by this |
|
17815 |
License give permission to use their names for publicity for or to |
|
17816 |
assert or imply endorsement of any Modified Version. |
|
17817 |
|
|
17818 |
5. COMBINING DOCUMENTS |
|
17819 |
|
|
17820 |
You may combine the Document with other documents released under |
|
17821 |
this License, under the terms defined in section 4 above for |
|
17822 |
modified versions, provided that you include in the combination all |
|
17823 |
of the Invariant Sections of all of the original documents, |
|
17824 |
unmodified, and list them all as Invariant Sections of your |
|
17825 |
combined work in its license notice, and that you preserve all |
|
17826 |
their Warranty Disclaimers. |
|
17827 |
|
|
17828 |
The combined work need only contain one copy of this License, and |
|
17829 |
multiple identical Invariant Sections may be replaced with a single |
|
17830 |
copy. If there are multiple Invariant Sections with the same name |
|
17831 |
but different contents, make the title of each such section unique |
|
17832 |
by adding at the end of it, in parentheses, the name of the |
|
17833 |
original author or publisher of that section if known, or else a |
|
17834 |
unique number. Make the same adjustment to the section titles in |
|
17835 |
the list of Invariant Sections in the license notice of the |
|
17836 |
combined work. |
|
17837 |
|
|
17838 |
In the combination, you must combine any sections Entitled |
|
17839 |
“History” in the various original documents, forming one section |
|
17840 |
Entitled “History”; likewise combine any sections Entitled |
|
17841 |
“Acknowledgements”, and any sections Entitled “Dedications”. You |
|
17842 |
must delete all sections Entitled “Endorsements.” |
|
17843 |
|
|
17844 |
6. COLLECTIONS OF DOCUMENTS |
|
17845 |
|
|
17846 |
You may make a collection consisting of the Document and other |
|
17847 |
documents released under this License, and replace the individual |
|
17848 |
copies of this License in the various documents with a single copy |
|
17849 |
that is included in the collection, provided that you follow the |
|
17850 |
rules of this License for verbatim copying of each of the documents |
|
17851 |
in all other respects. |
|
17852 |
|
|
17853 |
You may extract a single document from such a collection, and |
|
17854 |
distribute it individually under this License, provided you insert |
|
17855 |
a copy of this License into the extracted document, and follow this |
|
17856 |
License in all other respects regarding verbatim copying of that |
|
17857 |
document. |
|
17858 |
|
|
17859 |
7. AGGREGATION WITH INDEPENDENT WORKS |
|
17860 |
|
|
17861 |
A compilation of the Document or its derivatives with other |
|
17862 |
separate and independent documents or works, in or on a volume of a |
|
17863 |
storage or distribution medium, is called an “aggregate” if the |
|
17864 |
copyright resulting from the compilation is not used to limit the |
|
17865 |
legal rights of the compilation’s users beyond what the individual |
|
17866 |
works permit. When the Document is included in an aggregate, this |
|
17867 |
License does not apply to the other works in the aggregate which |
|
17868 |
are not themselves derivative works of the Document. |
|
17869 |
|
|
17870 |
If the Cover Text requirement of section 3 is applicable to these |
|
17871 |
copies of the Document, then if the Document is less than one half |
|
17872 |
of the entire aggregate, the Document’s Cover Texts may be placed |
|
17873 |
on covers that bracket the Document within the aggregate, or the |
|
17874 |
electronic equivalent of covers if the Document is in electronic |
|
17875 |
form. Otherwise they must appear on printed covers that bracket |
|
17876 |
the whole aggregate. |
|
17877 |
|
|
17878 |
8. TRANSLATION |
|
17879 |
|
|
17880 |
Translation is considered a kind of modification, so you may |
|
17881 |
distribute translations of the Document under the terms of section |
|
17882 |
4. Replacing Invariant Sections with translations requires special |
|
17883 |
permission from their copyright holders, but you may include |
|
17884 |
translations of some or all Invariant Sections in addition to the |
|
17885 |
original versions of these Invariant Sections. You may include a |
|
17886 |
translation of this License, and all the license notices in the |
|
17887 |
Document, and any Warranty Disclaimers, provided that you also |
|
17888 |
include the original English version of this License and the |
|
17889 |
original versions of those notices and disclaimers. In case of a |
|
17890 |
disagreement between the translation and the original version of |
|
17891 |
this License or a notice or disclaimer, the original version will |
|
17892 |
prevail. |
|
17893 |
|
|
17894 |
If a section in the Document is Entitled “Acknowledgements”, |
|
17895 |
“Dedications”, or “History”, the requirement (section 4) to |
|
17896 |
Preserve its Title (section 1) will typically require changing the |
|
17897 |
actual title. |
|
17898 |
|
|
17899 |
9. TERMINATION |
|
17900 |
|
|
17901 |
You may not copy, modify, sublicense, or distribute the Document |
|
17902 |
except as expressly provided under this License. Any attempt |
|
17903 |
otherwise to copy, modify, sublicense, or distribute it is void, |
|
17904 |
and will automatically terminate your rights under this License. |
|
17905 |
|
|
17906 |
However, if you cease all violation of this License, then your |
|
17907 |
license from a particular copyright holder is reinstated (a) |
|
17908 |
provisionally, unless and until the copyright holder explicitly and |
|
17909 |
finally terminates your license, and (b) permanently, if the |
|
17910 |
copyright holder fails to notify you of the violation by some |
|
17911 |
reasonable means prior to 60 days after the cessation. |
|
17912 |
|
|
17913 |
Moreover, your license from a particular copyright holder is |
|
17914 |
reinstated permanently if the copyright holder notifies you of the |
|
17915 |
violation by some reasonable means, this is the first time you have |
|
17916 |
received notice of violation of this License (for any work) from |
|
17917 |
that copyright holder, and you cure the violation prior to 30 days |
|
17918 |
after your receipt of the notice. |
|
17919 |
|
|
17920 |
Termination of your rights under this section does not terminate |
|
17921 |
the licenses of parties who have received copies or rights from you |
|
17922 |
under this License. If your rights have been terminated and not |
|
17923 |
permanently reinstated, receipt of a copy of some or all of the |
|
17924 |
same material does not give you any rights to use it. |
|
17925 |
|
|
17926 |
10. FUTURE REVISIONS OF THIS LICENSE |
|
17927 |
|
|
17928 |
The Free Software Foundation may publish new, revised versions of |
|
17929 |
the GNU Free Documentation License from time to time. Such new |
|
17930 |
versions will be similar in spirit to the present version, but may |
|
17931 |
differ in detail to address new problems or concerns. See |
|
17932 |
<http://www.gnu.org/copyleft/>. |
|
17933 |
|
|
17934 |
Each version of the License is given a distinguishing version |
|
17935 |
number. If the Document specifies that a particular numbered |
|
17936 |
version of this License “or any later version” applies to it, you |
|
17937 |
have the option of following the terms and conditions either of |
|
17938 |
that specified version or of any later version that has been |
|
17939 |
published (not as a draft) by the Free Software Foundation. If the |
|
17940 |
Document does not specify a version number of this License, you may |
|
17941 |
choose any version ever published (not as a draft) by the Free |
|
17942 |
Software Foundation. If the Document specifies that a proxy can |
|
17943 |
decide which future versions of this License can be used, that |
|
17944 |
proxy’s public statement of acceptance of a version permanently |
|
17945 |
authorizes you to choose that version for the Document. |
|
17946 |
|
|
17947 |
11. RELICENSING |
|
17948 |
|
|
17949 |
“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any |
|
17950 |
World Wide Web server that publishes copyrightable works and also |
|
17951 |
provides prominent facilities for anybody to edit those works. A |
|
17952 |
public wiki that anybody can edit is an example of such a server. |
|
17953 |
A “Massive Multiauthor Collaboration” (or “MMC”) contained in the |
|
17954 |
site means any set of copyrightable works thus published on the MMC |
|
17955 |
site. |
|
17956 |
|
|
17957 |
“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 |
|
17958 |
license published by Creative Commons Corporation, a not-for-profit |
|
17959 |
corporation with a principal place of business in San Francisco, |
|
17960 |
California, as well as future copyleft versions of that license |
|
17961 |
published by that same organization. |
|
17962 |
|
|
17963 |
“Incorporate” means to publish or republish a Document, in whole or |
|
17964 |
in part, as part of another Document. |
|
17965 |
|
|
17966 |
An MMC is “eligible for relicensing” if it is licensed under this |
|
17967 |
License, and if all works that were first published under this |
|
17968 |
License somewhere other than this MMC, and subsequently |
|
17969 |
incorporated in whole or in part into the MMC, (1) had no cover |
|
17970 |
texts or invariant sections, and (2) were thus incorporated prior |
|
17971 |
to November 1, 2008. |
|
17972 |
|
|
17973 |
The operator of an MMC Site may republish an MMC contained in the |
|
17974 |
site under CC-BY-SA on the same site at any time before August 1, |
|
17975 |
2009, provided the MMC is eligible for relicensing. |
|
17976 |
|
|
17977 |
ADDENDUM: How to use this License for your documents |
|
17978 |
==================================================== |
|
17979 |
|
|
17980 |
To use this License in a document you have written, include a copy of |
|
17981 |
the License in the document and put the following copyright and license |
|
17982 |
notices just after the title page: |
|
17983 |
|
|
17984 |
Copyright (C) YEAR YOUR NAME. |
|
17985 |
Permission is granted to copy, distribute and/or modify this document |
|
17986 |
under the terms of the GNU Free Documentation License, Version 1.3 |
|
17987 |
or any later version published by the Free Software Foundation; |
|
17988 |
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover |
|
17989 |
Texts. A copy of the license is included in the section entitled ``GNU |
|
17990 |
Free Documentation License''. |
|
17991 |
|
|
17992 |
If you have Invariant Sections, Front-Cover Texts and Back-Cover |
|
17993 |
Texts, replace the “with...Texts.” line with this: |
|
17994 |
|
|
17995 |
with the Invariant Sections being LIST THEIR TITLES, with |
|
17996 |
the Front-Cover Texts being LIST, and with the Back-Cover Texts |
|
17997 |
being LIST. |
|
17998 |
|
|
17999 |
If you have Invariant Sections without Cover Texts, or some other |
|
18000 |
combination of the three, merge those two alternatives to suit the |
|
18001 |
situation. |
|
18002 |
|
|
18003 |
If your document contains nontrivial examples of program code, we |
|
18004 |
recommend releasing these examples in parallel under your choice of free |
|
18005 |
software license, such as the GNU General Public License, to permit |
|
18006 |
their use in free software. |
|
18007 |
|
|
18008 |
|
|
18009 |
File: org, Node: Main Index, Next: Key Index, Prev: GNU Free Documentation License, Up: Top |
|
18010 |
|
|
18011 |
Concept index |
|
18012 |
************* |
|
18013 |
|
|
18014 |
|