diff --git a/Makefile b/Makefile index 7bf932f24..bd9a4689a 100644 --- a/Makefile +++ b/Makefile @@ -56,7 +56,7 @@ CP = cp -p ##---------------------------------------------------------------------- # The following variables need to be defined by the maintainer -LISPFILES = org.el org-publish.el org-mouse.el org-install.el +LISPFILES = org.el org-publish.el org-mouse.el org-export-latex.el org-install.el ELCFILES = $(LISPFILES:.el=.elc) DOCFILES = org.texi org.pdf org CARDFILES = orgcard.tex orgcard.pdf orgcard_letter.pdf @@ -67,7 +67,7 @@ HTMLDIR = /home/dominik/public_html/Tools/org .SUFFIXES: .el .elc .texi SHELL = /bin/sh -DISTFILES= README ${LISPFILES} ${DOCFILES} ${CARDFILES} Makefile +DISTFILES= README ${LISPFILES} ${DOCFILES} ${CARDFILES} Makefile dir DISTFILES_xemacs= xemacs/noutline.el xemacs/ps-print-invisible.el xemacs/README all: $(ELCFILES) @@ -148,7 +148,7 @@ ecompile: distfile: @if [ "X$(TAG)" = "X" ]; then echo "*** No tag ***"; exit 1; fi - touch org.texi orgcard.tex +# touch org.texi orgcard.tex make info make doc rm -rf org-$(TAG) org-$(TAG).zip diff --git a/org b/org index 4d1b86833..b99e1aa7f 100644 --- a/org +++ b/org @@ -5,7 +5,7 @@ START-INFO-DIR-ENTRY * Org Mode: (org). Outline-based notes management and organizer END-INFO-DIR-ENTRY - This manual is for Org-mode (version 5.04). + This manual is for Org-mode (version 5.05). Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation @@ -27,7 +27,7 @@ File: org, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) Org Mode Manual *************** -This manual is for Org-mode (version 5.04). +This manual is for Org-mode (version 5.05). Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation @@ -115,6 +115,7 @@ Hyperlinks * Internal links:: Links to other places in the current file * External links:: URL-like links to the world * Handling links:: Creating, inserting and following +* Using links outside Org-mode:: Linking from my C source code? * Link abbreviations:: Shortcuts for writing complex links * Search options:: Linking to a specific location * Custom searches:: When the default search is not enough @@ -166,8 +167,8 @@ Column View Defining Columns -* Scope of column definitions:: -* Column attributes:: +* Scope of column definitions:: Where defined, where valid? +* Column attributes:: Appearance and content of a column Timestamps @@ -183,8 +184,8 @@ Creating timestamps Deadlines and Scheduling -* Inserting deadline/schedule:: -* Repeated tasks:: +* Inserting deadline/schedule:: Planning items +* Repeated tasks:: Items that show up again and again Progress Logging @@ -235,17 +236,23 @@ Exporting * ASCII export:: Exporting to plain ASCII * HTML export:: Exporting to HTML +* LaTeX export:: Exporting to LaTeX * XOXO export:: Exporting to XOXO * iCalendar export:: Exporting in iCalendar format * Text interpretation:: How the exporter looks at the file HTML export -* Export commands:: How to invoke HTML export +* HTML Export commands:: How to invoke LaTeX export * Quoting HTML tags:: Using direct HTML in Org-mode -* Links:: How hyperlinks get transferred to HTML -* Images:: To inline or not to inline? -* CSS support:: Style specifications +* Links:: Transformation of links for HTML +* Images:: How to include images +* CSS support:: Changing the appearence of the output + +LaTeX export + +* LaTeX export commands:: How to invoke LaTeX export +* Quoting LaTeX code:: Incorporating literal LaTeX code Text interpretation by the exporter @@ -295,6 +302,7 @@ Interaction with other packages Extensions, Hooks and Hacking * Extensions:: Existing 3rd-part extensions +* Adding hyperlink types:: New custom link types * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs * Dynamic blocks:: Automatically filled blocks * Special agenda views:: Customized views @@ -530,14 +538,14 @@ File: org, Node: Outlines, Next: Headlines, Prev: Document structure, Up: Do 2.1 Outlines ============ -Org-mode is implemented on top of outline-mode. Outlines allow to -organize a document in a hierarchical structure, which (at least for -me) is the best representation of notes and thoughts. Overview over -this structure is achieved by folding (hiding) large parts of the +Org-mode is implemented on top of outline-mode. Outlines allow a +document to be organized in a hierarchical structure, which (at least +for me) is the best representation of notes and thoughts. An overview +of this structure is achieved by folding (hiding) large parts of the document to show only the general document structure and the parts currently being worked on. Org-mode greatly simplifies the use of -outlines by compressing the entire show/hide functionality into a -single command `org-cycle', which is bound to the key. +outlines by compressing the entire show/hide functionality into a single +command `org-cycle', which is bound to the key.  File: org, Node: Headlines, Next: Visibility cycling, Prev: Outlines, Up: Document structure @@ -566,7 +574,7 @@ that has whitespace followed by a single star as headline starters. will be hidden when the subtree is folded. However, if you leave at least two empty lines, one empty line will remain visible after folding the subtree, in order to structure the collapsed view. See the -variable `org-cycle-separator-lines' for modifying this behavior. +variable `org-cycle-separator-lines' to modify this behavior. ---------- Footnotes ---------- @@ -864,7 +872,7 @@ basic one is `org-occur': body are made visible. In order to provide minimal context, also the full hierarchy of headlines above the match is shown, as well as the headline following the match. Each match is also - highlighted; the highlights disappear when the buffer is changes + highlighted; the highlights disappear when the buffer is changed an editing command, or by pressing `C-c C-c'. When called with a `C-u' prefix argument, previous highlights are kept, so several calls to this command can be stacked. @@ -1076,8 +1084,8 @@ File: org, Node: Built-in table editor, Next: Narrow columns, Prev: Tables, ============================= Org-mode makes it easy to format tables in plain ASCII. Any line with -`|' as the first non-white character is considered part of a table. -`|' is also the column separator. A table might look like this: +`|' as the first non-whitespace character is considered part of a +table. `|' is also the column separator. A table might look like this: | Name | Phone | Age | |-------+-------+-----| @@ -1883,6 +1891,7 @@ links to other files, Usenet articles, emails, and much more. * Internal links:: Links to other places in the current file * External links:: URL-like links to the world * Handling links:: Creating, inserting and following +* Using links outside Org-mode:: Linking from my C source code? * Link abbreviations:: Shortcuts for writing complex links * Search options:: Linking to a specific location * Custom searches:: When the default search is not enough @@ -2032,7 +2041,7 @@ them as links. If spaces must be part of the link (for example in the end of the link, enclose them in angular brackets.  -File: org, Node: Handling links, Next: Link abbreviations, Prev: External links, Up: Hyperlinks +File: org, Node: Handling links, Next: Using links outside Org-mode, Prev: External links, Up: Hyperlinks 4.4 Handling links ================== @@ -2145,9 +2154,23 @@ triple `C-u' prefix to `C-c C-l', or configure the option (2) See the variable `org-display-internal-link-with-indirect-buffer'  -File: org, Node: Link abbreviations, Next: Search options, Prev: Handling links, Up: Hyperlinks +File: org, Node: Using links outside Org-mode, Next: Link abbreviations, Prev: Handling links, Up: Hyperlinks -4.5 Link abbreviations +4.5 Using links outside Org-mode +================================ + +You can insert and follow links that have Org-mode syntax not only in +Org-mode, but in any Emacs buffer. For this, you should create two +global commands, like this (please select suitable global keys +yourself): + + (define-key global-map 'org-insert-link-global "\\C-c L") + (define-key global-map 'org-open-at-point-global "\\C-c o") + + +File: org, Node: Link abbreviations, Next: Search options, Prev: Using links outside Org-mode, Up: Hyperlinks + +4.6 Link abbreviations ====================== Long URLs can be cumbersome to type, and often many similar links are @@ -2188,7 +2211,7 @@ complete link abbreviations.  File: org, Node: Search options, Next: Custom searches, Prev: Link abbreviations, Up: Hyperlinks -4.6 Search options in file links +4.7 Search options in file links ================================ File links can contain additional information to make Emacs jump to a @@ -2238,7 +2261,7 @@ single colon.  File: org, Node: Custom searches, Next: Remember, Prev: Search options, Up: Hyperlinks -4.7 Custom Searches +4.8 Custom Searches =================== The default mechanism for creating search strings and for doing the @@ -2260,7 +2283,7 @@ implementation example. Search for `BibTeX links' in the source file.  File: org, Node: Remember, Prev: Custom searches, Up: Hyperlinks -4.8 Remember +4.9 Remember ============ Another way to create org entries with links to other files is through @@ -2283,7 +2306,7 @@ note should be stored interactively, on the fly.  File: org, Node: Setting up remember, Next: Remember templates, Prev: Remember, Up: Remember -4.8.1 Setting up remember +4.9.1 Setting up remember ------------------------- The following customization will tell remember to use org files as @@ -2298,7 +2321,7 @@ target, and to create annotations compatible with Org-mode links.  File: org, Node: Remember templates, Next: Storing notes, Prev: Setting up remember, Up: Remember -4.8.2 Remember templates +4.9.2 Remember templates ------------------------ In combination with Org-mode, you can use templates to generate @@ -2379,7 +2402,7 @@ be filled with the previous context information.  File: org, Node: Storing notes, Prev: Remember templates, Up: Remember -4.8.3 Storing notes +4.9.3 Storing notes ------------------- When you are finished preparing a note with remember, you have to press @@ -3076,6 +3099,14 @@ disks in a box like this: :Publisher_ALL: "Deutsche Grammophon" Phillips EMI :END: + If you want to set properties that can be inherited by any entry in a +file, use a line like + + #+PROPERTY: NDisks_ALL 1 2 3 4 + + Property values set with the global variable `org-global-properties' +can be inherited by all entries in all Org-mode files. + The following commands help to work with properties: `M-' @@ -3592,6 +3623,10 @@ DEADLINE The editor in charge is [[bbdb:Ford Prefect]] DEADLINE: <2004-02-29 Sun> + You can specify a different lead time for warnings for a specific + deadlines using the following syntax. Here is an example with a + warning period of 5 days `DEADLINE: <2004-02-29 Sun -5d>'. + SCHEDULED You are planning to start working on that task on the given date. The headline will be listed under the given date(1). In addition, @@ -3604,8 +3639,8 @@ SCHEDULED * Menu: -* Inserting deadline/schedule:: -* Repeated tasks:: +* Inserting deadline/schedule:: Planning items +* Repeated tasks:: Items that show up again and again ---------- Footnotes ---------- @@ -4964,14 +4999,14 @@ File: org, Node: LaTeX fragments, Next: Processing LaTeX fragments, Prev: Sub ==================== With symbols, sub- and superscripts, HTML is pretty much at its end when -it comes to representing mathematical formulas(1). More complex -expressions need a dedicated formula processor. To this end, Org-mode -can contain arbitrary LaTeX fragments. It provides commands to preview +it comes to representing mathematical formulas(1). More complex +expressions need a dedicated formula processor. To this end, Org-mode +can contain arbitrary LaTeX fragments. It provides commands to preview the typeset result of these fragments, and upon export to HTML, all fragments will be converted to images and inlined into the HTML -document. For this to work you need to be on a system with a working -LaTeX installation. You also need the `dvipng' program, available at -`http://sourceforge.net/projects/dvipng/'. The LaTeX header that will +document(2). For this to work you need to be on a system with a working +LaTeX installation. You also need the `dvipng' program, available at +`http://sourceforge.net/projects/dvipng/'. The LaTeX header that will be used when processing a fragment can be configured with the variable `org-format-latex-header'. @@ -5006,10 +5041,13 @@ ones you do not wish to have interpreted by the LaTeX converter. ---------- Footnotes ---------- (1) Yes, there is MathML, but that is not yet fully supported by -many browsers, and there is no decent converter for turning LaTeX of -ASCII representations of formulas into MathML. So for the time being, +many browsers, and there is no decent converter for turning LaTeX or +ASCII representations of formulas into MathML. So for the time being, converting formulas into images seems the way to go. + (2) The LaTeX export will not use images for displaying LaTeX +fragments but include these fragments directly into the LaTeX code. +  File: org, Node: Processing LaTeX fragments, Next: CDLaTeX mode, Prev: LaTeX fragments, Up: Embedded LaTeX @@ -5101,11 +5139,12 @@ Org-mode documents can be exported into a variety of other formats. For printing and sharing of notes, ASCII export produces a readable and simple version of an Org-mode file. HTML export allows you to publish a notes file on the web, while the XOXO format provides a solid base for -exchange with a broad range of other applications. To incorporate -entries with associated times like deadlines or appointments into a -desktop calendar program like iCal, Org-mode can also produce extracts -in the iCalendar format. Currently Org-mode only supports export, not -import of these different formats. +exchange with a broad range of other applications. LaTeX export lets +you use Org-mode and its structured editing functions to easily create +LaTeX files. To incorporate entries with associated times like +deadlines or appointments into a desktop calendar program like iCal, +Org-mode can also produce extracts in the iCalendar format. Currently +Org-mode only supports export, not import of these different formats. When exporting, Org-mode uses special conventions to enrich the output produced. *Note Text interpretation::, for more details. @@ -5119,6 +5158,7 @@ output produced. *Note Text interpretation::, for more details. * ASCII export:: Exporting to plain ASCII * HTML export:: Exporting to HTML +* LaTeX export:: Exporting to LaTeX * XOXO export:: Exporting to XOXO * iCalendar export:: Exporting in iCalendar format * Text interpretation:: How the exporter looks at the file @@ -5158,7 +5198,7 @@ the layout relative to the first line. Should there be lines with less indentation than the first, these are left alone.  -File: org, Node: HTML export, Next: XOXO export, Prev: ASCII export, Up: Exporting +File: org, Node: HTML export, Next: LaTeX export, Prev: ASCII export, Up: Exporting 11.2 HTML export ================ @@ -5169,14 +5209,14 @@ but with additional support for tables. * Menu: -* Export commands:: How to invoke HTML export +* HTML Export commands:: How to invoke LaTeX export * Quoting HTML tags:: Using direct HTML in Org-mode -* Links:: How hyperlinks get transferred to HTML -* Images:: To inline or not to inline? -* CSS support:: Style specifications +* Links:: Transformation of links for HTML +* Images:: How to include images +* CSS support:: Changing the appearence of the output  -File: org, Node: Export commands, Next: Quoting HTML tags, Prev: HTML export, Up: HTML export +File: org, Node: HTML Export commands, Next: Quoting HTML tags, Prev: HTML export, Up: HTML export 11.2.1 HTML export commands --------------------------- @@ -5209,6 +5249,10 @@ File: org, Node: Export commands, Next: Quoting HTML tags, Prev: HTML export, org-mode syntax before. This is a global command that can be invoked in any buffer. +`M-x org-replace-region-by-HTML' + Replace the active region (assumed to be in Org-mode syntax) by + HTML code. + In the exported version, the first 3 outline levels will become headlines, defining a general document structure. Additional levels will be exported as itemized lists. If you want that transition to @@ -5220,7 +5264,7 @@ example, creates two levels of headings and does the rest as items.  -File: org, Node: Quoting HTML tags, Next: Links, Prev: Export commands, Up: HTML export +File: org, Node: Quoting HTML tags, Next: Links, Prev: HTML Export commands, Up: HTML export 11.2.2 Quoting HTML tags ------------------------ @@ -5321,9 +5365,79 @@ section in the buffer. should have no `#' at the start of the line.  -File: org, Node: XOXO export, Next: iCalendar export, Prev: HTML export, Up: Exporting +File: org, Node: LaTeX export, Next: XOXO export, Prev: HTML export, Up: Exporting -11.3 XOXO export +11.3 LaTeX export +================= + +Org-mode contains a LaTeX exporter written by Bastien Guerry. + +* Menu: + +* LaTeX export commands:: How to invoke LaTeX export +* Quoting LaTeX code:: Incorporating literal LaTeX code + + +File: org, Node: LaTeX export commands, Next: Quoting LaTeX code, Prev: LaTeX export, Up: LaTeX export + +11.3.1 LaTeX export commands +---------------------------- + +`C-c C-e l' + Export as LaTeX file `myfile.tex'. + +`C-c C-e L' + Export to a temporary buffer, do not create a file. + +`C-c C-e v l' + +`C-c C-e v L' + Export only the visible part of the document. + +`M-x org-export-region-as-latex' + Convert the region to LaTeX under the assumption that it was + org-mode syntax before. This is a global command that can be + invoked in any buffer. + +`M-x org-replace-region-by-latex' + Replace the active region (assumed to be in Org-mode syntax) by + LaTeX code. + + In the exported version, the first 3 outline levels will become +headlines, defining a general document structure. Additional levels +will be exported as description lists. The exporter can ignore them or +convert them to a custom string depending on `org-latex-low-levels'. + + If you want that transition to occur at a different level, specify it +with a prefix argument. For example, + + C-2 C-c C-e l + +creates two levels of headings and does the rest as items. + + +File: org, Node: Quoting LaTeX code, Prev: LaTeX export commands, Up: LaTeX export + +11.3.2 Quoting LaTeX code +------------------------- + +Embedded LaTeX as described in *Note Embedded LaTeX:: will be correctly +inserted into the LaTeX file. Forthermore, you can add special code +that should only be present in LaTeX export with the following +constructs: + + #+LaTeX: Literal LaTeX code for export + +or + + #+BEGIN_LaTeX + All lines between these markers are exported literally + #+END_LaTeX + + +File: org, Node: XOXO export, Next: iCalendar export, Prev: LaTeX export, Up: Exporting + +11.4 XOXO export ================ Org-mode contains an exporter that produces XOXO-style output. @@ -5339,7 +5453,7 @@ does not interpret any additional Org-mode features.  File: org, Node: iCalendar export, Next: Text interpretation, Prev: XOXO export, Up: Exporting -11.4 iCalendar export +11.5 iCalendar export ===================== Some people like to use Org-mode for keeping track of projects, but @@ -5370,7 +5484,7 @@ application you are using. The FAQ covers this issue.  File: org, Node: Text interpretation, Prev: iCalendar export, Up: Exporting -11.5 Text interpretation by the exporter +11.6 Text interpretation by the exporter ======================================== The exporter backends interpret additional structure in the Org-mode @@ -5387,7 +5501,7 @@ file in order to produce better output.  File: org, Node: Comment lines, Next: Initial text, Prev: Text interpretation, Up: Text interpretation -11.5.1 Comment lines +11.6.1 Comment lines -------------------- Lines starting with `#' in column zero are treated as comments and will @@ -5400,7 +5514,7 @@ never be exported. Also entire subtrees starting with the word  File: org, Node: Initial text, Next: Footnotes, Prev: Comment lines, Up: Text interpretation -11.5.2 Text before the first headline +11.6.2 Text before the first headline ------------------------------------- Org-mode normally ignores any text before the first headline when @@ -5436,7 +5550,7 @@ headline when exporting the file, you can use the `#+TEXT' construct:  File: org, Node: Footnotes, Next: Enhancing text, Prev: Initial text, Up: Text interpretation -11.5.3 Footnotes +11.6.3 Footnotes ---------------- Numbers in square brackets are treated as footnotes, so that you can use @@ -5457,13 +5571,13 @@ binding, you could use `org-replace-disputed-keys' and  File: org, Node: Enhancing text, Next: Export options, Prev: Footnotes, Up: Text interpretation -11.5.4 Enhancing text for export +11.6.4 Enhancing text for export -------------------------------- Some of the export backends of Org-mode allow for sophisticated text -formatting, this is true in particular for the HTML backend. Org-mode -has a number of typing conventions that allow to produce a richly -formatted output. +formatting, this is true in particular for the HTML and LaTeX backends. +Org-mode has a number of typing conventions that allow to produce a +richly formatted output. * Plain lists `-', `*' or `+' as bullet, or with `1.' or `2)' as enumerator will be recognized and transformed if the backend @@ -5505,7 +5619,7 @@ should never be used.  File: org, Node: Export options, Prev: Enhancing text, Up: Text interpretation -11.5.5 Export options +11.6.5 Export options --------------------- The exporter recognizes special lines in the buffer which provide @@ -5546,6 +5660,10 @@ you can: author: turn on/off inclusion of author name/email into exported file timestamp: turn on/off inclusion creation time into exported file + These options take effect in both the HTML and LaTeX export, except +for `TeX' and `LaTeX', which are respectively `t' and `nil' for the +LaTeX export. +  File: org, Node: Publishing, Next: Miscellaneous, Prev: Exporting, Up: Top @@ -5557,8 +5675,11 @@ configure automatic HTML conversion of _projects_ composed of interlinked org files. This system is called _org-publish_. You can also configure org-publish to automatically upload your exported HTML pages and related attachments, such as images and source code files, to -a web server. Org-publish turns org-mode into a web-site authoring -tool. +a web server. Org-publish turns org-mode into a web-site authoring tool. + + You can also use Org-publish to convert files into LaTeX, or even +combine HTML and LaTeX conversion so that files are available in both +formats on the server(2). Org-publish has been contributed to Org-mode by David O'Toole. @@ -5574,6 +5695,10 @@ tool. still using Emacs 21, you need you need to download this file separately. + (2) Since LaTeX files on a server are not that helpful, you surely +want to perform further conversion on them - e.g. convert them to `PDF' +format. +  File: org, Node: Configuration, Next: Sample configuration, Prev: Publishing, Up: Publishing @@ -5662,9 +5787,10 @@ Publishing means that a file is copied to the destination directory and possibly transformed in the process. The default transformation is to export Org-mode files as HTML files, and this is done by the function `org-publish-org-to-html' which calls the HTML exporter (*note HTML -export::). Other files like images only need to be copied to the -publishing destination. For non-Org-mode files, you need to specify -the publishing function. +export::). But you also can publish your files in LaTeX by using the +function `org-publish-org-to-latex' instead. Other files like images +only need to be copied to the publishing destination. For non-Org-mode +files, you need to specify the publishing function. `:publishing-function' Function executing the publication of a file. This may also be a list of functions, which will @@ -5681,13 +5807,13 @@ provides one for attachments (files that only need to be copied):  File: org, Node: Publishing options, Next: Publishing links, Prev: Publishing action, Up: Configuration -12.1.5 Options for the HTML exporter ------------------------------------- +12.1.5 Options for the HTML/LaTeX exporters +------------------------------------------- The property list can be used to set many export options for the HTML -exporter. In most cases, these properties correspond to user variables -in Org-mode. The table below lists these properties along with the -variable they belong to. See the documentation string for the +and LaTeX exporters. In most cases, these properties correspond to user +variables in Org-mode. The table below lists these properties along +with the variable they belong to. See the documentation string for the respective variable for details. `:language' `org-export-default-language' @@ -5719,6 +5845,10 @@ respective variable for details. `:author' `user-full-name' `:email' `user-mail-address' + Most of the `org-export-with-*' variables have the same effect in +both HTML and LaTeX exporters, except for `:TeX-macros' and +`:LaTeX-fragments', respectively `nil' and `t' in the LaTeX export. + When a property is given a value in org-publish-project-alist, its setting overrides the value of the corresponding user variable (if any) during publishing. Options set within a file (*note Export options::), @@ -5974,7 +6104,7 @@ file is visited again in a new Emacs session. `#+ARCHIVE: %s_done::' This line sets the archive location for the agenda file. It - applies for all subsequent lines until the next `#+CATEGORY' line, + applies for all subsequent lines until the next `#+ARCHIVE' line, or the end of the file. The first such line also applies to any entries before it. The corresponding variable is `org-archive-location'. @@ -6006,8 +6136,13 @@ file is visited again in a new Emacs session. three must be either letters A-Z or numbers 0-9. The highest priority must have a lower ASCII number that the lowest priority. +`#+PROPERTY: Property_Name Value' + This line sets a default inheritance value for entries in the + current buffer, most useful for specifying the allowed values of a + property. + `#+STARTUP:' - This line sets options to be used at startup of org-mode, when an + This line sets options to be used at startup of Org-mode, when an Org-mode file is being visited. The first set of options deals with the initial visibility of the outline tree. The corresponding variable for global default settings is @@ -6332,7 +6467,7 @@ File: org, Node: Conflicts, Prev: Cooperation, Up: Interaction select and extend the region. If you want to use one of these packages along with Org-mode, configure the variable `org-CUA-compatible'. When set, Org-mode will move the following - keybindings in org-mode files, and in the agenda buffer (but not + keybindings in Org-mode files, and in the agenda buffer (but not during date selection). S-UP -> M-p S-DOWN -> M-n @@ -6349,7 +6484,7 @@ File: org, Node: Conflicts, Prev: Cooperation, Up: Interaction `footnote.el' by Steven L. Baur Org-mode supports the syntax of the footnote package, but only the numerical footnote markers. Also, the default key for footnote - commands, `C-c !' is already used by org-mode. You could use the + commands, `C-c !' is already used by Org-mode. You could use the variable `footnote-prefix' to switch footnotes commands to another key. Or, you could use `org-replace-disputed-keys' and `org-disputed-keys' to change the settings in Org-mode. @@ -6406,13 +6541,14 @@ Org-mode. * Menu: * Extensions:: Existing 3rd-part extensions +* Adding hyperlink types:: New custom link types * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs * Dynamic blocks:: Automatically filled blocks * Special agenda views:: Customized views * Using the property API:: Writing programs that use entry properties  -File: org, Node: Extensions, Next: Tables in arbitrary syntax, Prev: Extensions and Hacking, Up: Extensions and Hacking +File: org, Node: Extensions, Next: Adding hyperlink types, Prev: Extensions and Hacking, Up: Extensions and Hacking A.1 Third-party extensions for Org-mode ======================================= @@ -6454,9 +6590,97 @@ The following extensions for Org-mode have been written by other people: `http://www.cognition.ens.fr/~guerry/u/org2rem.el'.  -File: org, Node: Tables in arbitrary syntax, Next: Dynamic blocks, Prev: Extensions, Up: Extensions and Hacking +File: org, Node: Adding hyperlink types, Next: Tables in arbitrary syntax, Prev: Extensions, Up: Extensions and Hacking -A.2 Tables in arbitrary syntax +A.2 Adding hyperlink types +========================== + +Org-mode has a large number of hyperlink types built-in (*note +Hyperlinks::). If you would like to add new link types, it provides an +interface for doing so. Lets look at an example file `org-man.el' that +will add support for creating links like `[[man:printf][The printf +manpage]]' to show unix manual pages inside emacs: + + ;;; org-man.el - Support for links to manpages in Org-mode + + (require 'org) + + (org-add-link-type "man" 'org-man-open) + (add-hook 'org-store-link-functions 'org-man-store-link) + + (defcustom org-man-command 'man + "The Emacs command to be used to display a man page." + :group 'org-link + :type '(choice (const man) (const woman))) + + (defun org-man-open (path) + "Visit the manpage on PATH. + PATH should be a topic that can be thrown at the man command." + (funcall org-man-command path)) + + (defun org-man-store-link () + "Store a link to a manpage." + (when (memq major-mode '(Man-mode woman-mode)) + ;; This is a man page, we do make this link + (let* ((page (org-man-get-page-name)) + (link (concat "man:" page)) + (description (format "Manpage for %s" page))) + (org-store-link-props + :type "man" + :link link + :description description)))) + + (defun org-man-get-page-name () + "Extract the page name from the buffer name." + ;; This works for both `Man-mode' and `woman-mode'. + (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) + (match-string 1 (buffer-name)) + (error "Cannot create link to this man page"))) + + (provide 'org-man) + + ;;; org-man.el ends here + +You would activate this new link type in `.emacs' with + + (require 'org-man) + +Lets go through the file and see what it does. + 1. It does `(require 'org)' to make sure that `org.el' has been + loaded. + + 2. The next line calls `org-add-link-type' to define a new link type + with prefix `man'. The call also contains the name of a function + that will be called to follow such a link. + + 3. The next line adds a function to `org-store-link-functions', in + order to allow the command `C-c l' to record a useful link in a + buffer displaying a man page. + + The rest of the file defines the necessary variables and functions. +First there is a customization variable that determines which emacs +command should be used to display manpages. There are two options, +`man' and `woman'. Then the function to follow a link is defined. It +gets the link path as an argument - in this case the link path is just +a topic for the manual command. The function calls the value of +`org-man-command' to display the man page. + + Finally the function `org-man-store-link' is defined. When you try +to store a link with `C-c l', also this function will be called to try +to make a link. The function must first decide if it is supposed to +create the link for this buffer type, we do this by checking the value +of the variable `major-mode'. If not, the function must exit and +retunr the value `nil'. If yes, the link is created by getting the +manual tpoic from the buffer name and prefixing it with the string +`man:'. Then it must call the command `org-store-link-props' and set +the `:type' and `:link' properties. Optionally you can also set the +`:description' property to provide a default for the link description +when the link is later inserted into tan Org-mode buffer with `C-c C-l'. + + +File: org, Node: Tables in arbitrary syntax, Next: Dynamic blocks, Prev: Adding hyperlink types, Up: Extensions and Hacking + +A.3 Tables in arbitrary syntax ============================== Since Orgtbl-mode can be used as a minor mode in arbitrary buffers, a @@ -6481,7 +6705,7 @@ very flexible system.  File: org, Node: Radio tables, Next: A LaTeX example, Prev: Tables in arbitrary syntax, Up: Tables in arbitrary syntax -A.2.1 Radio tables +A.3.1 Radio tables ------------------ To define the location of the target table, you first need to create two @@ -6536,7 +6760,7 @@ number of different solutions:  File: org, Node: A LaTeX example, Next: Translator functions, Prev: Radio tables, Up: Tables in arbitrary syntax -A.2.2 A LaTeX example +A.3.2 A LaTeX example --------------------- The best way to wrap the source table in LaTeX is to use the `comment' @@ -6639,7 +6863,7 @@ solution is to add the `comment' environment to the variable  File: org, Node: Translator functions, Prev: A LaTeX example, Up: Tables in arbitrary syntax -A.2.3 Translator functions +A.3.3 Translator functions -------------------------- Orgtbl-mode has several translator functions built-in: @@ -6707,7 +6931,7 @@ during HTML export.  File: org, Node: Dynamic blocks, Next: Special agenda views, Prev: Tables in arbitrary syntax, Up: Extensions and Hacking -A.3 Dynamic blocks +A.4 Dynamic blocks ================== Org-mode documents can contain _dynamic blocks_. These are specially @@ -6759,7 +6983,7 @@ Org-mode.  File: org, Node: Special agenda views, Next: Using the property API, Prev: Dynamic blocks, Up: Extensions and Hacking -A.4 Special Agenda Views +A.5 Special Agenda Views ======================== Org-mode provides a special hook that can be used to narrow down the @@ -6787,33 +7011,53 @@ search should continue from there. nil ; tag found, do not skip subtree-end))) ; tag not found, continue after end of subtree - Furthermore you must write a command that uses `let' to temporarily -put this function into the variable `org-agenda-skip-function', sets -the header string for the agenda buffer, and calls the todo-list -generator while asking for the specific TODO keyword PROJECT. The -function must also accept one argument MATCH, but it can choose to -ignore it(1) (as we do in the example below). Here is the example: + Now you may use this function in an agenda custom command, for +example like this: - (defun my-org-waiting-projects (&optional match) - "Produce a list of projects that contain a WAITING tag. - MATCH is being ignored." - (interactive) - (let ((org-agenda-skip-function 'my-skip-unless-waiting) - (org-agenda-overriding-header "Projects waiting for something: ")) - ;; make the list - (org-todo-list "PROJECT"))) + (org-add-agenda-custom-command + '("b" todo "PROJECT" + ((org-agenda-skip-function 'my-org-waiting-projects) + (org-agenda-overriding-header "Projects waiting for something: ")))) - ---------- Footnotes ---------- + Note that this also binds `org-agenda-overriding-header' to get a +meaningful header in the agenda view. - (1) MATCH must be present in case you want to define a custom -command for producing this special list. Custom commands always supply -the MATCH argument, but it can be empty if you do not specify it while -defining the command(*note Custom agenda views::). + You may also put a Lisp form into `org-agenda-skip-function'. In +particular, you may use the functions `org-agenda-skip-entry-if' and +`org-agenda-skip-subtree-if' in this form, for example: + +`'(org-agenda-skip-entry-if 'scheduled)' + Skip current entry if it has been scheduled. + +`'(org-agenda-skip-entry-if 'notscheduled)' + Skip current entry if it has not been scheduled. + +`'(org-agenda-skip-entry-if 'deadline)' + Skip current entry if it has a deadline. + +`'(org-agenda-skip-entry-if 'scheduled 'deadline)' + Skip current entry if it has a deadline, or if it is scheduled. + +`'(org-agenda-skip-entry 'regexp "regular expression")' + Skip current entry if the regular expression contained in the + variable `org-agenda-skip-regexp' matches in the entry. + +`'(org-agenda-skip-subtree-if 'regexp "regular expression")' + Same as above, but check and skip the entire subtree. + + Therefore we could also have written the search for WAITING projects +like this, even without defining a special function: + + (org-add-agenda-custom-command + '("b" todo "PROJECT" + ((org-agenda-skip-function '(org-agenda-skip-subtree-if + 'regexp ":WAITING:")) + (org-agenda-overriding-header "Projects waiting for something: "))))  File: org, Node: Using the property API, Prev: Special agenda views, Up: Extensions and Hacking -A.5 Using the property API +A.6 Using the property API ========================== Here is a description of the functions that can be used to work with @@ -6918,8 +7162,8 @@ if I have forgotten someone, please accept my apologies and let me know. * Niels Giessen had the idea to automatically archive DONE trees. - * Bastien Guerry provided extensive feedback and some patches, and - translated David O'Toole's tutorial into French. + * Bastien Guerry wrote the LaTeX exporter and has been prolific with + patches, ideas, and bug reports. to Org-mode. * Kai Grossjohann pointed out key-binding conflicts with other packages. @@ -6982,6 +7226,9 @@ if I have forgotten someone, please accept my apologies and let me know. * Dale Smith proposed link abbreviations. + * Adam Spiers asked for global linking commands and inspired the link + extension system. support mairix. + * David O'Toole wrote `org-publish.el' and drafted the manual chapter about publishing. @@ -6999,7 +7246,8 @@ if I have forgotten someone, please accept my apologies and let me know. details. I later looked at John's code, however, and learned from his implementation of (i) links where the link itself is hidden and only a description is shown, and (ii) popping up a calendar to - select a date. + select a date. John has also contributed a number of great ideas + directly to Org-mode. * Carsten Wimmer suggested some changes and helped fix a bug in linking to GNUS. @@ -7024,7 +7272,8 @@ Index (line 6) * action, for publishing: Publishing action. (line 6) * activation: Activation. (line 6) -* active region <1>: Export commands. (line 6) +* active region <1>: HTML Export commands. + (line 6) * active region <2>: ASCII export. (line 9) * active region <3>: Built-in table editor. (line 141) @@ -7043,7 +7292,7 @@ Index * agenda, pipe: Extracting Agenda Information for other programs. (line 6) * agenda, with block views: Block agenda. (line 6) -* align, STARTUP keyword: In-buffer settings. (line 63) +* align, STARTUP keyword: In-buffer settings. (line 68) * allout.el: Conflicts. (line 6) * angular brackets, around links: External links. (line 43) * API, for properties <1>: Using the property API. @@ -7100,9 +7349,9 @@ Index * completion, of TODO keywords: Workflow states. (line 15) * constants, in calculations: References. (line 82) * constants.el: Cooperation. (line 14) -* constcgs, STARTUP keyword: In-buffer settings. (line 88) -* constSI, STARTUP keyword: In-buffer settings. (line 88) -* content, STARTUP keyword: In-buffer settings. (line 56) +* constcgs, STARTUP keyword: In-buffer settings. (line 93) +* constSI, STARTUP keyword: In-buffer settings. (line 93) +* content, STARTUP keyword: In-buffer settings. (line 61) * contents, global visibility state: Visibility cycling. (line 22) * copying, of subtrees: Structure editing. (line 6) * creating timestamps: Creating timestamps. (line 6) @@ -7111,7 +7360,7 @@ Index * custom date/time format: Custom time format. (line 6) * custom search strings: Custom searches. (line 6) * customization: Customization. (line 6) -* customtime, STARTUP keyword: In-buffer settings. (line 85) +* customtime, STARTUP keyword: In-buffer settings. (line 90) * cutting, of subtrees: Structure editing. (line 6) * cycling, of TODO states: TODO basics. (line 13) * cycling, visibility: Visibility cycling. (line 6) @@ -7147,7 +7396,7 @@ Index * emphasized text: Export options. (line 25) * enhancing text: Enhancing text. (line 6) * evaluate time range: Creating timestamps. (line 48) -* even, STARTUP keyword: In-buffer settings. (line 78) +* even, STARTUP keyword: In-buffer settings. (line 83) * exporting: Exporting. (line 6) * exporting agenda views <1>: Exporting Agenda Views. (line 12) @@ -7199,14 +7448,17 @@ Index * grouping columns in tables: Column groups. (line 6) * hand-formatted lists: Enhancing text. (line 11) * headline levels: Export options. (line 25) -* headline levels, for exporting <1>: Export commands. (line 34) +* headline levels, for exporting <1>: LaTeX export commands. + (line 26) +* headline levels, for exporting <2>: HTML Export commands. + (line 38) * headline levels, for exporting: ASCII export. (line 18) * headline navigation: Motion. (line 6) * headline tagging: Tags. (line 6) * headline, promotion and demotion: Structure editing. (line 6) * headlines: Headlines. (line 6) * hide text: Visibility cycling. (line 6) -* hidestars, STARTUP keyword: In-buffer settings. (line 78) +* hidestars, STARTUP keyword: In-buffer settings. (line 83) * hiding leading stars: Clean view. (line 6) * history: History and Acknowledgments. (line 6) @@ -7215,6 +7467,8 @@ Index * HTML, and orgtbl-mode: Translator functions. (line 6) * hyperlinks: Hyperlinks. (line 6) +* hyperlinks, adding new types: Adding hyperlink types. + (line 6) * iCalendar export: iCalendar export. (line 6) * images, inline in HTML: Images. (line 6) * in-buffer settings: In-buffer settings. (line 6) @@ -7233,6 +7487,7 @@ Index * jumping, to headlines: Motion. (line 6) * keybindings, global: Activation. (line 6) * keyword options: Per file keywords. (line 6) +* LaTeX export: LaTeX export. (line 6) * LaTeX fragments <1>: Export options. (line 25) * LaTeX fragments: LaTeX fragments. (line 6) * LaTeX fragments, export: Enhancing text. (line 21) @@ -7260,12 +7515,12 @@ Index * lists, hand-formatted: Enhancing text. (line 11) * lists, ordered: Plain lists. (line 6) * lists, plain: Plain lists. (line 6) -* logdone, STARTUP keyword: In-buffer settings. (line 67) +* logdone, STARTUP keyword: In-buffer settings. (line 72) * logging, of progress: Progress logging. (line 6) -* lognoteclock-out, STARTUP keyword: In-buffer settings. (line 67) -* lognotedone, STARTUP keyword: In-buffer settings. (line 67) -* lognotestate, STARTUP keyword: In-buffer settings. (line 67) -* logrepeat, STARTUP keyword: In-buffer settings. (line 67) +* lognoteclock-out, STARTUP keyword: In-buffer settings. (line 72) +* lognotedone, STARTUP keyword: In-buffer settings. (line 72) +* lognotestate, STARTUP keyword: In-buffer settings. (line 72) +* logrepeat, STARTUP keyword: In-buffer settings. (line 72) * maintainer: Feedback. (line 6) * mark ring: Handling links. (line 81) * marking characters, tables: Advanced features. (line 40) @@ -7286,11 +7541,11 @@ Index * named references: References. (line 82) * names as TODO keywords: TODO types. (line 6) * narrow columns in tables: Narrow columns. (line 6) -* noalign, STARTUP keyword: In-buffer settings. (line 63) -* nologging, STARTUP keyword: In-buffer settings. (line 67) -* nologrepeat, STARTUP keyword: In-buffer settings. (line 67) +* noalign, STARTUP keyword: In-buffer settings. (line 68) +* nologging, STARTUP keyword: In-buffer settings. (line 72) +* nologrepeat, STARTUP keyword: In-buffer settings. (line 72) * occur, command: Sparse trees. (line 6) -* odd, STARTUP keyword: In-buffer settings. (line 78) +* odd, STARTUP keyword: In-buffer settings. (line 83) * option keyword completion: Completion. (line 6) * options, for custom agenda views: Setting Options. (line 6) * options, for customization: Customization. (line 6) @@ -7312,7 +7567,7 @@ Index * outline-mode: Outlines. (line 6) * outlines: Outlines. (line 6) * overview, global visibility state: Visibility cycling. (line 22) -* overview, STARTUP keyword: In-buffer settings. (line 56) +* overview, STARTUP keyword: In-buffer settings. (line 61) * packages, interaction with other: Interaction. (line 6) * pasting, of subtrees: Structure editing. (line 6) * per file keywords: Per file keywords. (line 6) @@ -7347,7 +7602,8 @@ Index * references, named: References. (line 82) * references, to fields: References. (line 15) * references, to ranges: References. (line 60) -* region, active <1>: Export commands. (line 6) +* region, active <1>: HTML Export commands. + (line 6) * region, active <2>: ASCII export. (line 9) * region, active <3>: Built-in table editor. (line 141) @@ -7360,7 +7616,7 @@ Index * richer text: Enhancing text. (line 6) * RMAIL links: External links. (line 6) * SCHEDULED keyword: Deadlines and scheduling. - (line 22) + (line 26) * scheduling: Time stamps. (line 6) * Scripts, for agenda processing: Extracting Agenda Information for other programs. (line 6) @@ -7373,8 +7629,8 @@ Index * show all, command: Visibility cycling. (line 33) * show all, global visibility state: Visibility cycling. (line 22) * show hidden text: Visibility cycling. (line 6) -* showall, STARTUP keyword: In-buffer settings. (line 56) -* showstars, STARTUP keyword: In-buffer settings. (line 78) +* showall, STARTUP keyword: In-buffer settings. (line 61) +* showstars, STARTUP keyword: In-buffer settings. (line 83) * sorting, of agenda items: Sorting of agenda items. (line 6) * sparse tree, for deadlines: Inserting deadline/schedule. @@ -7456,7 +7712,8 @@ Index * TODO list, global: Global TODO list. (line 6) * TODO types: TODO types. (line 6) * TODO workflow: Workflow states. (line 6) -* transient-mark-mode <1>: Export commands. (line 6) +* transient-mark-mode <1>: HTML Export commands. + (line 6) * transient-mark-mode <2>: ASCII export. (line 9) * transient-mark-mode <3>: Built-in table editor. (line 141) @@ -7598,7 +7855,7 @@ Key Index (line 6) * C-c C-c <3>: Processing LaTeX fragments. (line 15) -* C-c C-c <4>: Property syntax. (line 46) +* C-c C-c <4>: Property syntax. (line 54) * C-c C-c <5>: Setting tags. (line 10) * C-c C-c <6>: Checkboxes. (line 37) * C-c C-c <7>: Editing and debugging formulas. @@ -7609,23 +7866,39 @@ Key Index * C-c C-d <1>: Agenda commands. (line 156) * C-c C-d: Inserting deadline/schedule. (line 9) -* C-c C-e: Exporting. (line 19) +* C-c C-e: Exporting. (line 20) * C-c C-e a: ASCII export. (line 9) -* C-c C-e b: Export commands. (line 7) +* C-c C-e b: HTML Export commands. + (line 7) * C-c C-e c: iCalendar export. (line 21) -* C-c C-e H: Export commands. (line 10) -* C-c C-e h: Export commands. (line 6) +* C-c C-e H: HTML Export commands. + (line 10) +* C-c C-e h: HTML Export commands. + (line 6) * C-c C-e I: iCalendar export. (line 16) * C-c C-e i: iCalendar export. (line 14) -* C-c C-e R: Export commands. (line 13) +* C-c C-e L: LaTeX export commands. + (line 7) +* C-c C-e l: LaTeX export commands. + (line 6) +* C-c C-e R: HTML Export commands. + (line 13) * C-c C-e t: Export options. (line 13) * C-c C-e v <1>: XOXO export. (line 11) * C-c C-e v: Sparse trees. (line 41) * C-c C-e v a: ASCII export. (line 13) -* C-c C-e v b: Export commands. (line 18) -* C-c C-e v H: Export commands. (line 18) -* C-c C-e v h: Export commands. (line 18) -* C-c C-e v R: Export commands. (line 18) +* C-c C-e v b: HTML Export commands. + (line 18) +* C-c C-e v H: HTML Export commands. + (line 18) +* C-c C-e v h: HTML Export commands. + (line 18) +* C-c C-e v L: LaTeX export commands. + (line 10) +* C-c C-e v l: LaTeX export commands. + (line 10) +* C-c C-e v R: HTML Export commands. + (line 18) * C-c C-e x: XOXO export. (line 10) * C-c C-f: Motion. (line 12) * C-c C-j: Motion. (line 21) @@ -7738,7 +8011,7 @@ Key Index (line 72) * M-: Structure editing. (line 24) * M- <1>: Completion. (line 10) -* M- <2>: Property syntax. (line 38) +* M- <2>: Property syntax. (line 46) * M- <3>: Setting tags. (line 6) * M- <4>: Per file keywords. (line 23) * M-: Editing and debugging formulas. @@ -7808,7 +8081,7 @@ Key Index (line 42) * S- <3>: Creating timestamps. (line 35) * S- <4>: Using column view. (line 26) -* S- <5>: Property syntax. (line 54) +* S- <5>: Property syntax. (line 62) * S- <6>: Multiple sets in one file. (line 29) * S- <7>: TODO basics. (line 20) @@ -7821,7 +8094,7 @@ Key Index (line 39) * S- <3>: Creating timestamps. (line 35) * S- <4>: Using column view. (line 26) -* S- <5>: Property syntax. (line 54) +* S- <5>: Property syntax. (line 62) * S- <6>: Multiple sets in one file. (line 29) * S- <7>: TODO basics. (line 20) @@ -7853,207 +8126,213 @@ Key Index  Tag Table: Node: Top970 -Node: Introduction12513 -Node: Summary12928 -Node: Installation16080 -Node: Activation17458 -Node: Feedback18709 -Node: Document structure20785 -Node: Outlines21677 -Node: Headlines22337 -Ref: Headlines-Footnote-123345 -Node: Visibility cycling23456 -Ref: Visibility cycling-Footnote-125666 -Ref: Visibility cycling-Footnote-225724 -Ref: Visibility cycling-Footnote-325774 -Node: Motion26044 -Node: Structure editing26998 -Node: Archiving29824 -Node: ARCHIVE tag30382 -Node: Moving subtrees32175 -Node: Sparse trees33486 -Ref: Sparse trees-Footnote-135618 -Ref: Sparse trees-Footnote-235800 -Node: Plain lists35915 -Ref: Plain lists-Footnote-140112 -Ref: Plain lists-Footnote-240470 -Node: Drawers40651 -Node: orgstruct-mode41489 -Node: Tables42389 -Node: Built-in table editor42970 -Node: Narrow columns50209 -Ref: Narrow columns-Footnote-152144 -Node: Column groups52190 -Node: orgtbl-mode53723 -Node: The spreadsheet54526 -Node: References55613 -Ref: References-Footnote-160077 -Node: Formula syntax for Calc60366 -Node: Formula syntax for Lisp62823 -Node: Field formulas64541 -Node: Column formulas65849 -Node: Editing and debugging formulas67448 -Node: Updating the table71601 -Node: Advanced features72636 -Node: Hyperlinks77161 -Node: Link format77934 -Node: Internal links79227 -Ref: Internal links-Footnote-181152 -Node: Radio targets81287 -Node: External links81978 -Node: Handling links84382 -Ref: Handling links-Footnote-189669 -Ref: Handling links-Footnote-289906 -Node: Link abbreviations89980 -Node: Search options91659 -Ref: Search options-Footnote-193439 -Node: Custom searches93520 -Node: Remember94568 -Node: Setting up remember95555 -Node: Remember templates96137 -Ref: Remember templates-Footnote-199583 -Node: Storing notes99681 -Node: TODO items101568 -Node: TODO basics102545 -Node: TODO extensions104309 -Node: Workflow states105128 -Ref: Workflow states-Footnote-1106303 -Node: TODO types106396 -Ref: TODO types-Footnote-1107979 -Node: Multiple sets in one file108061 -Node: Per file keywords109672 -Ref: Per file keywords-Footnote-1110961 -Node: Priorities111162 -Node: Breaking down tasks112772 -Ref: Breaking down tasks-Footnote-1113292 -Node: Checkboxes113388 -Node: Tags116237 -Node: Tag inheritance117009 -Node: Setting tags117946 -Ref: Setting tags-Footnote-1122469 -Ref: Setting tags-Footnote-2122581 -Node: Tag searches122664 -Node: Properties and columns125381 -Node: Property syntax126486 -Node: Special properties128646 -Node: Property searches129562 -Node: Column view130217 -Node: Defining columns131384 -Node: Scope of column definitions131782 -Node: Column attributes132704 -Node: Using column view134952 -Node: Property API136939 -Node: Timestamps137293 -Node: Time stamps137754 -Ref: Time stamps-Footnote-1140182 -Node: Creating timestamps140298 -Node: The date/time prompt142372 -Ref: The date/time prompt-Footnote-1144360 -Node: Custom time format144466 -Node: Deadlines and scheduling146158 -Ref: Deadlines and scheduling-Footnote-1147508 -Node: Inserting deadline/schedule147663 -Node: Repeated tasks148601 -Node: Progress logging150240 -Node: Closing items150895 -Ref: Closing items-Footnote-1151829 -Ref: Closing items-Footnote-2151898 -Node: Tracking TODO state changes151971 -Node: Clocking work time152827 -Ref: Clocking work time-Footnote-1156473 -Ref: Clocking work time-Footnote-2156551 -Node: Agenda views156677 -Node: Agenda files158628 -Ref: Agenda files-Footnote-1159594 -Ref: Agenda files-Footnote-2159743 -Node: Agenda dispatcher159936 -Node: Built-in agenda views161633 -Node: Weekly/Daily agenda162213 -Node: Global TODO list165155 -Node: Matching tags and properties167433 -Node: Timeline168522 -Node: Stuck projects169194 -Node: Presentation and sorting171045 -Node: Categories171836 -Node: Time-of-day specifications172500 -Node: Sorting of agenda items174471 -Node: Agenda commands175753 -Node: Custom agenda views183034 -Node: Storing searches183753 -Node: Block agenda185665 -Node: Setting Options186895 -Node: Exporting Agenda Views189634 -Ref: Exporting Agenda Views-Footnote-1193918 -Ref: Exporting Agenda Views-Footnote-2193975 -Node: Extracting Agenda Information for other programs194161 -Node: Embedded LaTeX198287 -Ref: Embedded LaTeX-Footnote-1199381 -Node: Math symbols199571 -Node: Subscripts and Superscripts200338 -Node: LaTeX fragments201184 -Ref: LaTeX fragments-Footnote-1203420 -Node: Processing LaTeX fragments203682 -Node: CDLaTeX mode204630 -Ref: CDLaTeX mode-Footnote-1207116 -Node: Exporting207264 -Node: ASCII export208578 -Node: HTML export209868 -Node: Export commands210487 -Node: Quoting HTML tags211731 -Node: Links212361 -Node: Images213058 -Ref: Images-Footnote-1213929 -Node: CSS support213990 -Ref: CSS support-Footnote-1215309 -Node: XOXO export215422 -Node: iCalendar export215861 -Node: Text interpretation217080 -Node: Comment lines217671 -Node: Initial text218066 -Node: Footnotes219735 -Node: Enhancing text220550 -Ref: Enhancing text-Footnote-1222409 -Node: Export options222499 -Node: Publishing224621 -Ref: Publishing-Footnote-1225417 -Node: Configuration225561 -Node: Project alist226279 -Node: Sources and destinations227345 -Node: Selecting files228075 -Node: Publishing action228823 -Node: Publishing options230056 -Node: Publishing links232208 -Node: Project page index233721 -Node: Sample configuration234499 -Node: Simple example234991 -Node: Complex example235664 -Node: Triggering publication237740 -Node: Miscellaneous238425 -Node: Completion239059 -Node: Customization240729 -Node: In-buffer settings241312 -Node: The very busy C-c C-c key246651 -Node: Clean view248412 -Node: TTY keys250989 -Node: Interaction252599 -Node: Cooperation252996 -Node: Conflicts255872 -Node: Bugs257875 -Node: Extensions and Hacking259371 -Node: Extensions260042 -Node: Tables in arbitrary syntax261989 -Node: Radio tables263066 -Node: A LaTeX example265569 -Ref: A LaTeX example-Footnote-1269215 -Ref: A LaTeX example-Footnote-2269363 -Node: Translator functions269798 -Ref: Translator functions-Footnote-1272907 -Node: Dynamic blocks272995 -Node: Special agenda views274967 -Ref: Special agenda views-Footnote-1277277 -Node: Using the property API277537 -Node: History and Acknowledgments279018 -Node: Index285402 -Node: Key Index319294 +Node: Introduction12966 +Node: Summary13381 +Node: Installation16533 +Node: Activation17911 +Node: Feedback19162 +Node: Document structure21238 +Node: Outlines22130 +Node: Headlines22795 +Ref: Headlines-Footnote-123799 +Node: Visibility cycling23910 +Ref: Visibility cycling-Footnote-126120 +Ref: Visibility cycling-Footnote-226178 +Ref: Visibility cycling-Footnote-326228 +Node: Motion26498 +Node: Structure editing27452 +Node: Archiving30278 +Node: ARCHIVE tag30836 +Node: Moving subtrees32629 +Node: Sparse trees33940 +Ref: Sparse trees-Footnote-136072 +Ref: Sparse trees-Footnote-236254 +Node: Plain lists36369 +Ref: Plain lists-Footnote-140566 +Ref: Plain lists-Footnote-240924 +Node: Drawers41105 +Node: orgstruct-mode41943 +Node: Tables42843 +Node: Built-in table editor43424 +Node: Narrow columns50669 +Ref: Narrow columns-Footnote-152604 +Node: Column groups52650 +Node: orgtbl-mode54183 +Node: The spreadsheet54986 +Node: References56073 +Ref: References-Footnote-160537 +Node: Formula syntax for Calc60826 +Node: Formula syntax for Lisp63283 +Node: Field formulas65001 +Node: Column formulas66309 +Node: Editing and debugging formulas67908 +Node: Updating the table72061 +Node: Advanced features73096 +Node: Hyperlinks77621 +Node: Link format78459 +Node: Internal links79752 +Ref: Internal links-Footnote-181677 +Node: Radio targets81812 +Node: External links82503 +Node: Handling links84907 +Ref: Handling links-Footnote-190204 +Ref: Handling links-Footnote-290441 +Node: Using links outside Org-mode90515 +Node: Link abbreviations91041 +Node: Search options92734 +Ref: Search options-Footnote-194514 +Node: Custom searches94595 +Node: Remember95643 +Node: Setting up remember96630 +Node: Remember templates97212 +Ref: Remember templates-Footnote-1100658 +Node: Storing notes100756 +Node: TODO items102643 +Node: TODO basics103620 +Node: TODO extensions105384 +Node: Workflow states106203 +Ref: Workflow states-Footnote-1107378 +Node: TODO types107471 +Ref: TODO types-Footnote-1109054 +Node: Multiple sets in one file109136 +Node: Per file keywords110747 +Ref: Per file keywords-Footnote-1112036 +Node: Priorities112237 +Node: Breaking down tasks113847 +Ref: Breaking down tasks-Footnote-1114367 +Node: Checkboxes114463 +Node: Tags117312 +Node: Tag inheritance118084 +Node: Setting tags119021 +Ref: Setting tags-Footnote-1123544 +Ref: Setting tags-Footnote-2123656 +Node: Tag searches123739 +Node: Properties and columns126456 +Node: Property syntax127561 +Node: Special properties129982 +Node: Property searches130898 +Node: Column view131553 +Node: Defining columns132720 +Node: Scope of column definitions133118 +Node: Column attributes134040 +Node: Using column view136288 +Node: Property API138275 +Node: Timestamps138629 +Node: Time stamps139090 +Ref: Time stamps-Footnote-1141518 +Node: Creating timestamps141634 +Node: The date/time prompt143708 +Ref: The date/time prompt-Footnote-1145696 +Node: Custom time format145802 +Node: Deadlines and scheduling147494 +Ref: Deadlines and scheduling-Footnote-1149114 +Node: Inserting deadline/schedule149269 +Node: Repeated tasks150207 +Node: Progress logging151846 +Node: Closing items152501 +Ref: Closing items-Footnote-1153435 +Ref: Closing items-Footnote-2153504 +Node: Tracking TODO state changes153577 +Node: Clocking work time154433 +Ref: Clocking work time-Footnote-1158079 +Ref: Clocking work time-Footnote-2158157 +Node: Agenda views158283 +Node: Agenda files160234 +Ref: Agenda files-Footnote-1161200 +Ref: Agenda files-Footnote-2161349 +Node: Agenda dispatcher161542 +Node: Built-in agenda views163239 +Node: Weekly/Daily agenda163819 +Node: Global TODO list166761 +Node: Matching tags and properties169039 +Node: Timeline170128 +Node: Stuck projects170800 +Node: Presentation and sorting172651 +Node: Categories173442 +Node: Time-of-day specifications174106 +Node: Sorting of agenda items176077 +Node: Agenda commands177359 +Node: Custom agenda views184640 +Node: Storing searches185359 +Node: Block agenda187271 +Node: Setting Options188501 +Node: Exporting Agenda Views191240 +Ref: Exporting Agenda Views-Footnote-1195524 +Ref: Exporting Agenda Views-Footnote-2195581 +Node: Extracting Agenda Information for other programs195767 +Node: Embedded LaTeX199893 +Ref: Embedded LaTeX-Footnote-1200987 +Node: Math symbols201177 +Node: Subscripts and Superscripts201944 +Node: LaTeX fragments202790 +Ref: LaTeX fragments-Footnote-1205023 +Ref: LaTeX fragments-Footnote-2205284 +Node: Processing LaTeX fragments205418 +Node: CDLaTeX mode206366 +Ref: CDLaTeX mode-Footnote-1208852 +Node: Exporting209000 +Node: ASCII export210467 +Node: HTML export211757 +Node: HTML Export commands212383 +Node: Quoting HTML tags213751 +Node: Links214386 +Node: Images215083 +Ref: Images-Footnote-1215954 +Node: CSS support216015 +Ref: CSS support-Footnote-1217334 +Node: LaTeX export217447 +Node: LaTeX export commands217771 +Node: Quoting LaTeX code218933 +Node: XOXO export219438 +Node: iCalendar export219878 +Node: Text interpretation221097 +Node: Comment lines221688 +Node: Initial text222083 +Node: Footnotes223752 +Node: Enhancing text224567 +Ref: Enhancing text-Footnote-1226436 +Node: Export options226526 +Node: Publishing228802 +Ref: Publishing-Footnote-1229763 +Ref: Publishing-Footnote-2229907 +Node: Configuration230058 +Node: Project alist230776 +Node: Sources and destinations231842 +Node: Selecting files232572 +Node: Publishing action233320 +Node: Publishing options234654 +Node: Publishing links237029 +Node: Project page index238542 +Node: Sample configuration239320 +Node: Simple example239812 +Node: Complex example240485 +Node: Triggering publication242561 +Node: Miscellaneous243246 +Node: Completion243880 +Node: Customization245550 +Node: In-buffer settings246133 +Node: The very busy C-c C-c key251660 +Node: Clean view253421 +Node: TTY keys255998 +Node: Interaction257608 +Node: Cooperation258005 +Node: Conflicts260881 +Node: Bugs262884 +Node: Extensions and Hacking264380 +Node: Extensions265105 +Node: Adding hyperlink types267048 +Node: Tables in arbitrary syntax270710 +Node: Radio tables271799 +Node: A LaTeX example274302 +Ref: A LaTeX example-Footnote-1277948 +Ref: A LaTeX example-Footnote-2278096 +Node: Translator functions278531 +Ref: Translator functions-Footnote-1281640 +Node: Dynamic blocks281728 +Node: Special agenda views283700 +Node: Using the property API286878 +Node: History and Acknowledgments288359 +Node: Index294935 +Node: Key Index329427  End Tag Table diff --git a/org-install.el b/org-install.el index e5a7905ac..d4c953a8d 100644 --- a/org-install.el +++ b/org-install.el @@ -4,6 +4,8 @@ (autoload 'org-diary "org" "Diary entries from Org mode.") (autoload 'org-agenda "org" "Multi-file agenda from Org mode." t) (autoload 'org-store-link "org" "Store a link to the current location." t) +(autoload 'org-open-at-point-global "org" "Follow a link like Org-mode does." t) +(autoload 'org-insert-link-global "org" "Insert a link like Org-mode does." t) (autoload 'orgtbl-mode "org" "Org tables as a minor mode." t) (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode.") (autoload 'orgstruct-mode "org" "Org structure as a minor mode." t) @@ -23,6 +25,17 @@ "Export all files in `org-agenda-files' to iCalendar .ics files." t) (autoload 'org-export-icalendar-combine-agenda-files "org" "Export all files in `org-agenda-files' to a single combined iCalendar file." t) + +(autoload 'org-export-as-latex-batch "org-export-latex") +(autoload 'org-export-as-latex-to-buffer "org-export-latex" + "Call `org-exort-as-latex` with output to a temporary buffer" t) +(autoload 'org-replace-region-by-latex "org-export-latex" + "Replace the region from BEG to END with its LaTeX export." t) +(autoload 'org-export-region-as-latex "org-export-latex" + "Convert region from BEG to END in `org-mode' buffer to LaTeX." t) +(autoload 'org-export-as-latex "org-export-latex" + "Export current buffer to a LaTeX file." t) + (autoload 'org-batch-agenda "org") (autoload 'org-batch-agenda-csv "org") (autoload 'org-store-agenda-views "org" "Store agenda views to files" t) @@ -33,4 +46,8 @@ "Publish all files of current project." t) (autoload 'org-publish "org-publish" "Publish a project." t) (autoload 'org-publish-all "org-publish" "Publish all projects." t) + +(autoload 'org-run-like-in-org-mode "Run a command like in Org-mode.") + (provide 'org-install) + diff --git a/org-publish.el b/org-publish.el index 8ec27a443..cdfc673b0 100644 --- a/org-publish.el +++ b/org-publish.el @@ -454,6 +454,27 @@ FILENAME is the filename of the org file to be published." (kill-buffer (current-buffer))))) +(defun org-publish-org-to-latex (plist filename) + "Publish an org file to LaTeX." + (org-publish-org-to "latex" plist filename)) + +(defun org-publish-org-to-html (plist filename) + "Publish an org file to HTML." + (org-publish-org-to "html" plist filename)) + +(defun org-publish-org-to (format plist filename) + "Publish an org file to FORMAT. +PLIST is the property list for the given project. +FILENAME is the filename of the org file to be published." + (require 'org) + (let* ((arg (plist-get plist :headline-levels))) + (progn + (find-file filename) + (funcall (intern (concat "org-export-as-" format)) + arg nil plist) + (kill-buffer (current-buffer))))) + + (defun org-publish-attachment (plist filename) "Publish a file with no transformation of any kind. PLIST is the property list for the given project. diff --git a/org.el b/org.el index 1fc081e0e..629a847d8 100644 --- a/org.el +++ b/org.el @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ -;; Version: 5.04 +;; Version: 5.05 ;; ;; This file is part of GNU Emacs. ;; @@ -83,7 +83,7 @@ ;;; Version -(defconst org-version "5.04" +(defconst org-version "5.05" "The version number of the file org.el.") (defun org-version () (interactive) @@ -491,9 +491,10 @@ the values `folded', `children', or `subtree'." (defcustom org-special-ctrl-a/e nil - "Non-nil means `C-a' and `C-e' behave specially in headlines. + "Non-nil means `C-a' and `C-e' behave specially in headlines and items. When set, `C-a' will bring back the cursor to the beginning of the headline text, i.e. after the stars and after a possible TODO keyword. +In an item, this will be the position after the bullet. When the cursor is already at that position, another `C-a' will bring it to the beginning of the line. `C-e' will jump to the end of the headline, ignoring the presence of tags @@ -698,7 +699,7 @@ line like :group 'org-archive :type 'string) -(defcustom org-archive-mark-done "DONE" +(defcustom org-archive-mark-done t "Non-nil means, mark entries as DONE when they are moved to the archive file. This can be a string to set the keyword to use. When t, Org-mode will use the first keyword in its list that means done." @@ -801,7 +802,7 @@ table, obtained by prompting the user." :type 'string) (defcustom org-table-number-regexp - "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\)$" + "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%:]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$" "Regular expression for recognizing numbers in table columns. If a table column contains mostly numbers, it will be aligned to the right. If not, it will be aligned to the left. @@ -826,7 +827,7 @@ Other options offered by the customize interface are more restrictive." (const :tag "Exponential, Floating point, Integer" "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$") (const :tag "Very General Number-Like, including hex" - "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\)$") + "^\\([<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*\\|\\(0[xX]\\)[0-9a-fA-F]+\\|nan\\)$") (string :tag "Regexp:"))) (defcustom org-table-number-fraction 0.5 @@ -1341,6 +1342,15 @@ You can set this on a per-template basis with the variable (const :tag "Default from remember-data-file" nil) file)) +(defcustom org-remember-store-without-prompt nil + "Non-nil means, `C-c C-c' stores remember note without further promts. +In this case, you need `C-u C-c C-c' to get the prompts for +note file and headline. +When this variable is nil, `C-c C-c' give you the prompts, and +`C-u C-c C-c' trigger the fasttrack." + :group 'org-remember + :type 'boolean) + (defcustom org-remember-default-headline "" "The headline that should be the default location in the notes file. When filing remember notes, the cursor will start at that position. @@ -1551,7 +1561,7 @@ When nil, only the date will be recorded." (state . "State %-12s %t") (clock-out . "")) "Headings for notes added when clocking out or closing TODO items. -The value is an alist, with the car being a sympol indicating the note +The value is an alist, with the car being a symbol indicating the note context, and the cdr is the heading to be used. The heading may also be the empty string. %t in the heading will be replaced by a time stamp. @@ -1567,6 +1577,13 @@ empty string. state) string) (cons (const :tag "Heading when clocking out" clock-out) string))) +(defcustom org-log-states-order-reversed t + "Non-nil means, the latest state change note will be directly after heading. +When nil, the notes will be orderer according to time." + :group 'org-todo + :group 'org-progress + :type 'boolean) + (defcustom org-log-repeat t "Non-nil means, prompt for a note when REPEAT is resetting a TODO entry. When nil, no note will be taken." @@ -1574,6 +1591,13 @@ When nil, no note will be taken." :group 'org-progress :type 'boolean) +(defcustom org-clock-out-when-done t + "When t, the clock will be stopped when the relevant entry is marked DONE. +Nil means, clock will keep running until stopped explicitly with +`C-c C-x C-o', or until the clock is started in a different item." + :group 'org-progress + :type 'boolean) + (defgroup org-priorities nil "Priorities in Org-mode." :tag "Org Priorities" @@ -1792,6 +1816,20 @@ This variable can be set on the per-file basis by inserting a line :group 'org-properties :type 'string) +(defcustom org-global-properties nil + "List of property/value pairs that can be inherited by any entry. +You can set buffer-local values for this by adding lines like + +#+PROPERTY: NAME VALUE" + :group 'org-properties + :type '(repeat + (cons (string :tag "Property") + (string :tag "Value")))) + +(defvar org-local-properties nil + "List of property/value pairs that can be inherited by any entry. +Valid for the current buffer. +This variable is populated from #+PROPERTY lines.") (defgroup org-agenda nil "Options concerning agenda views in Org-mode." @@ -1926,7 +1964,7 @@ match What to search for: - a single keyword for TODO keyword searches - a tags match expression for tags searches - a regular expression for occur searches -options A list of option setttings, similar to that in a let form, so like +options A list of option settings, similar to that in a let form, so like this: ((opt1 val1) (opt2 val2) ...) files A list of files file to write the produced agenda buffer to with the command `org-store-agenda-views'. @@ -2214,6 +2252,13 @@ the entries for specific days." :group 'org-agenda-daily/weekly :type 'boolean) +(defcustom org-agenda-repeating-timestamp-show-all t + "Non-nil means, show all occurences of a repeating stamp in the agenda. +When nil, only one occurence is shown, either today or the +nearest into the future." + :group 'org-agenda-daily/weekly + :type 'boolean) + (defgroup org-agenda-time-grid nil "Options concerning the time grid in the Org-mode Agenda." :tag "Org Agenda Time Grid" @@ -2469,7 +2514,7 @@ This is a property list with the following properties: \"$$\" find math expressions surrounded by $$....$$ \"\\(\" find math expressions surrounded by \\(...\\) \"\\ [\" find math expressions surrounded by \\ [...\\]" - :group 'org-latex + :group 'org-export-latex :type 'plist) (defcustom org-format-latex-header "\\documentclass{article} @@ -2481,7 +2526,7 @@ This is a property list with the following properties: \\usepackage[mathscr]{eucal} \\pagestyle{empty} % do not remove" "The document header used for processing LaTeX fragments." - :group 'org-latex + :group 'org-export-latex :type 'string) (defgroup org-export nil @@ -2499,7 +2544,7 @@ This is a property list with the following properties: This path may be relative to the directory where the Org-mode file lives. The default is to put them into the same directory as the Org-mode file. The variable may also be an alist with export types `:html', `:ascii', -`:ical', or `:xoxo' and the corresponding directories. If a direcoty path +`:ical', or `:xoxo' and the corresponding directories. If a directory path is relative, it is interpreted relative to the directory where the exported Org-mode files lives." :group 'org-export-general @@ -2615,7 +2660,7 @@ headline Only export the headline, but skip the tree below it." "Non-nil means, insert author name and email into the exported file. This option can also be set with the +OPTIONS line, -e.g. \"author:nil\"." +e.g. \"author-info:nil\"." :group 'org-export-general :type 'boolean) @@ -2719,7 +2764,7 @@ Not all export backends support this. This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." :group 'org-export-translation - :group 'org-latex + :group 'org-export-latex :type 'boolean) (defcustom org-export-with-LaTeX-fragments nil @@ -2731,7 +2776,7 @@ display math. This option can also be set with the +OPTIONS line, e.g. \"LaTeX:t\"." :group 'org-export-translation - :group 'org-latex + :group 'org-export-latex :type 'boolean) (defcustom org-export-with-fixed-width t @@ -3434,6 +3479,31 @@ to the part of the headline after the DONE keyword." "Face for items scheduled previously, and not yet done." :group 'org-faces) +(defcustom org-agenda-deadline-faces + '((1.0 . org-warning) + (0.5 . org-upcoming-deadline) + (0.0 . default)) + "Faces for showing deadlines in the agenda. +This is a list of cons cells. The cdr of each cess is a face to be used, +and it can also just be a like like '(:foreground \"yellow\"). +Each car is a fraction of the head-warning time that must have passed for +this the face in the cdr to be used for display. The numbers must be +given in descending order. The head-warning time is normally taken +from `org-deadline-warning-days', but can also be specified in the deadline +timestamp itself, like this: + + DEADLINE: <2007-08-13 Mon -8d> + +You may use d for days, w for weeks, m for months and y for years. Months +and years will only be treated in an approximate fashion (30.4 days for a +month and 365.24 days for a year)." + :group 'org-faces + :group 'org-agenda-daily/weekly + :type '(repeat + (cons + (number :tag "Fraction of head-warning time passed") + (sexp :tag "Face")))) + (defface org-time-grid ;; font-lock-variable-name-face (org-compatible-face '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod")) @@ -3601,9 +3671,10 @@ means to push this value onto the list in the variable.") (let ((re (org-make-options-regexp '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "COLUMNS" "STARTUP" "ARCHIVE" "TAGS" "LINK" "PRIORITIES" - "CONSTANTS"))) + "CONSTANTS" "PROPERTY"))) (splitre "[ \t]+") - kwds key value cat arch tags const links hw dws tail sep kws1 prio) + kwds key value cat arch tags const links hw dws tail sep kws1 prio + props) (save-excursion (save-restriction (widen) @@ -3630,6 +3701,10 @@ means to push this value onto the list in the variable.") links))) ((equal key "PRIORITIES") (setq prio (org-split-string value " +"))) + ((equal key "PROPERTY") + (when (string-match "\\(\\S-+\\)\\s-+\\(.*\\)" value) + (push (cons (match-string 1 value) (match-string 2 value)) + props))) ((equal key "CONSTANTS") (setq const (append const (org-split-string value splitre)))) ((equal key "STARTUP") @@ -3657,6 +3732,7 @@ means to push this value onto the list in the variable.") (org-set-local 'org-highest-priority (nth 0 prio)) (org-set-local 'org-lowest-priority (nth 1 prio)) (org-set-local 'org-default-priority (nth 2 prio))) + (and props (org-set-local 'org-local-properties (nreverse props))) (and arch (org-set-local 'org-archive-location arch)) (and links (setq org-link-abbrev-alist-local (nreverse links))) ;; Process the TODO keywords @@ -4099,6 +4175,7 @@ The following commands are available: (defsubst org-current-line (&optional pos) (save-excursion (and pos (goto-char pos)) + ;; works also in narrowed buffer, because we start at 1, not point-min (+ (if (bolp) 1 0) (count-lines 1 (point))))) (defun org-current-time () @@ -4140,61 +4217,71 @@ that will be added to PLIST. Returns the string that was modified." (require 'font-lock) (defconst org-non-link-chars "]\t\n\r<>") -(defconst org-link-types '("http" "https" "ftp" "mailto" "file" "news" "bbdb" "vm" +(defvar org-link-types '("http" "https" "ftp" "mailto" "file" "news" "bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) -(defconst org-link-re-with-space - (concat - "?") +(defvar org-link-re-with-space nil "Matches a link with spaces, optional angular brackets around it.") - -(defconst org-link-re-with-space2 - (concat - "?") +(defvar org-link-re-with-space2 nil "Matches a link with spaces, optional angular brackets around it.") - -(defconst org-angle-link-re - (concat - "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" - "\\([^" org-non-link-chars " ]" - "[^" org-non-link-chars "]*" - "\\)>") +(defvar org-angle-link-re nil "Matches link with angular brackets, spaces are allowed.") -(defconst org-plain-link-re - (concat - "\\(" (mapconcat 'identity org-link-types "\\|") "\\):" - "\\([^]\t\n\r<>,;() ]+\\)") +(defvar org-plain-link-re nil "Matches plain link, without spaces.") - -(defconst org-bracket-link-regexp - "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" +(defvar org-bracket-link-regexp nil "Matches a link in double brackets.") - -(defconst org-bracket-link-analytic-regexp - (concat - "\\[\\[" - "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" - "\\([^]]+\\)" - "\\]" - "\\(\\[" "\\([^]]+\\)" "\\]\\)?" - "\\]")) -; 1: http: -; 2: http -; 3: path -; 4: [desc] -; 5: desc - -(defconst org-any-link-re - (concat "\\(" org-bracket-link-regexp "\\)\\|\\(" - org-angle-link-re "\\)\\|\\(" - org-plain-link-re "\\)") +(defvar org-bracket-link-analytic-regexp nil + "Regular expression used to analyze links. +Here is what the match groups contain after a match: +1: http: +2: http +3: path +4: [desc] +5: desc") +(defvar org-any-link-re nil "Regular expression matching any link.") +(defun org-make-link-regexps () + "Update the link regular expressions. +This should be called after the variable `org-link-types' has changed." + (setq org-link-re-with-space + (concat + "?") + org-link-re-with-space2 + (concat + "?") + org-angle-link-re + (concat + "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" + "\\([^" org-non-link-chars " ]" + "[^" org-non-link-chars "]*" + "\\)>") + org-plain-link-re + (concat + "\\(" (mapconcat 'identity org-link-types "\\|") "\\):" + "\\([^]\t\n\r<>,;() ]+\\)") + org-bracket-link-regexp + "\\[\\[\\([^][]+\\)\\]\\(\\[\\([^][]+\\)\\]\\)?\\]" + org-bracket-link-analytic-regexp + (concat + "\\[\\[" + "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" + "\\([^]]+\\)" + "\\]" + "\\(\\[" "\\([^]]+\\)" "\\]\\)?" + "\\]") + org-any-link-re + (concat "\\(" org-bracket-link-regexp "\\)\\|\\(" + org-angle-link-re "\\)\\|\\(" + org-plain-link-re "\\)"))) + +(org-make-link-regexps) + (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)>" "Regular expression for fast time stamp matching.") (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [^\r\n>]*?\\)[]>]" @@ -4417,6 +4504,7 @@ We use a macro so that the test can happen at compilation time." (defun org-restart-font-lock () "Restart font-lock-mode, to force refontification." (when (and (boundp 'font-lock-mode) font-lock-mode) + ;; FIXME: Could font-lock-fontify-buffer be enough??? (font-lock-mode -1) (font-lock-mode 1))) @@ -4448,7 +4536,7 @@ between words." "\\)\\>"))) (defun org-activate-tags (limit) - (if (re-search-forward (org-re "[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) + (if (re-search-forward (org-re "^\\*+.*[ \t]\\(:[[:alnum:]_@:]+:\\)[ \r\n]") limit t) (progn (add-text-properties (match-beginning 1) (match-end 1) (list 'mouse-face 'highlight @@ -4714,7 +4802,8 @@ between words." (goto-char eos) (outline-next-heading) (if (org-invisible-p) (org-flag-heading nil)))) - ((>= eol eos) + ((or (>= eol eos) + (not (string-match "\\S-" (buffer-substring eol eos)))) ;; Entire subtree is hidden in one line: open it (org-show-entry) (show-children) @@ -4886,31 +4975,34 @@ Optional argument N means, put the headline into the Nth line of the window." (defvar org-goto-window-configuration nil) (defvar org-goto-marker nil) -(defvar org-goto-map (make-sparse-keymap)) -(let ((cmds '(isearch-forward isearch-backward)) cmd) - (while (setq cmd (pop cmds)) - (substitute-key-definition cmd cmd org-goto-map global-map))) -(org-defkey org-goto-map "\C-m" 'org-goto-ret) -(org-defkey org-goto-map [(left)] 'org-goto-left) -(org-defkey org-goto-map [(right)] 'org-goto-right) -(org-defkey org-goto-map [(?q)] 'org-goto-quit) -(org-defkey org-goto-map [(control ?g)] 'org-goto-quit) -(org-defkey org-goto-map "\C-i" 'org-cycle) -(org-defkey org-goto-map [(tab)] 'org-cycle) -(org-defkey org-goto-map [(down)] 'outline-next-visible-heading) -(org-defkey org-goto-map [(up)] 'outline-previous-visible-heading) -(org-defkey org-goto-map "n" 'outline-next-visible-heading) -(org-defkey org-goto-map "p" 'outline-previous-visible-heading) -(org-defkey org-goto-map "f" 'outline-forward-same-level) -(org-defkey org-goto-map "b" 'outline-backward-same-level) -(org-defkey org-goto-map "u" 'outline-up-heading) -(org-defkey org-goto-map "\C-c\C-n" 'outline-next-visible-heading) -(org-defkey org-goto-map "\C-c\C-p" 'outline-previous-visible-heading) -(org-defkey org-goto-map "\C-c\C-f" 'outline-forward-same-level) -(org-defkey org-goto-map "\C-c\C-b" 'outline-backward-same-level) -(org-defkey org-goto-map "\C-c\C-u" 'outline-up-heading) -(let ((l '(1 2 3 4 5 6 7 8 9 0))) - (while l (org-defkey org-goto-map (int-to-string (pop l)) 'digit-argument))) +(defvar org-goto-map + (let ((map (make-sparse-keymap))) + (let ((cmds '(isearch-forward isearch-backward)) cmd) + (while (setq cmd (pop cmds)) + (substitute-key-definition cmd cmd map global-map))) + (org-defkey map "\C-m" 'org-goto-ret) + (org-defkey map [(left)] 'org-goto-left) + (org-defkey map [(right)] 'org-goto-right) + (org-defkey map [(?q)] 'org-goto-quit) + (org-defkey map [(control ?g)] 'org-goto-quit) + (org-defkey map "\C-i" 'org-cycle) + (org-defkey map [(tab)] 'org-cycle) + (org-defkey map [(down)] 'outline-next-visible-heading) + (org-defkey map [(up)] 'outline-previous-visible-heading) + (org-defkey map "n" 'outline-next-visible-heading) + (org-defkey map "p" 'outline-previous-visible-heading) + (org-defkey map "f" 'outline-forward-same-level) + (org-defkey map "b" 'outline-backward-same-level) + (org-defkey map "u" 'outline-up-heading) + (org-defkey map "\C-c\C-n" 'outline-next-visible-heading) + (org-defkey map "\C-c\C-p" 'outline-previous-visible-heading) + (org-defkey map "\C-c\C-f" 'outline-forward-same-level) + (org-defkey map "\C-c\C-b" 'outline-backward-same-level) + (org-defkey map "\C-c\C-u" 'outline-up-heading) + ;; FIXME: Could we use suppress-keymap? + (let ((l '(1 2 3 4 5 6 7 8 9 0))) + (while l (org-defkey map (int-to-string (pop l)) 'digit-argument))) + map)) (defconst org-goto-help "Select a location to jump to, press RET @@ -5141,7 +5233,6 @@ the current headline." (unless (= (point) pos) (just-one-space) (backward-delete-char 1)) (run-hooks 'org-insert-heading-hook))))) - (defun org-insert-todo-heading (arg) "Insert a new heading with the same level and TODO state as current heading. If the heading has no TODO state, or if the state is DONE, use the first @@ -5159,6 +5250,24 @@ state (TODO by default). Also with prefix arg, force first state." (insert (car org-todo-keywords-1) " ") (insert (match-string 2) " ")))) +(defun org-insert-subheading (arg) + "Insert a new subheading and demote it. +Works for outline headings and for plain lists alike." + (interactive "P") + (org-insert-heading arg) + (cond + ((org-on-heading-p) (org-do-demote)) + ((org-at-item-p) (org-indent-item 1)))) + +(defun org-insert-todo-subheading (arg) + "Insert a new subheading with TODO keyword or checkbox and demote it. +Works for outline headings and for plain lists alike." + (interactive "P") + (org-insert-todo-heading arg) + (cond + ((org-on-heading-p) (org-do-demote)) + ((org-at-item-p) (org-indent-item 1)))) + ;;; Promotion and Demotion (defun org-promote-subtree () @@ -5825,11 +5934,13 @@ the whole buffer." (if (member (match-string 2) '("[ ]" "[-]")) (setq c-off (1+ c-off)) (setq c-on (1+ c-on)))) - (delete-region b1 e1) +; (delete-region b1 e1) (goto-char b1) (insert (if f1 (format "[%d%%]" (/ (* 100 c-on) (max 1 (+ c-on c-off)))) - (format "[%d/%d]" c-on (+ c-on c-off)))))) + (format "[%d/%d]" c-on (+ c-on c-off)))) + (and (looking-at "\\[.*?\\]") + (replace-match "")))) (when (interactive-p) (message "Checkbox satistics updated %s (%d places)" (if all "in entire file" "in current outline entry") cstat))))) @@ -6189,11 +6300,13 @@ I.e. to the first item in this list." (while t (catch 'next (beginning-of-line 0) - (if (looking-at "[ \t]*$") (throw 'next t)) + (if (looking-at "[ \t]*$") + (throw (if (bobp) 'exit 'next) t)) (skip-chars-forward " \t") (setq ind1 (current-column)) (if (or (< ind1 ind) (and (= ind1 ind) - (not (org-at-item-p)))) + (not (org-at-item-p))) + (bobp)) (throw 'exit t) (when (org-at-item-p) (setq pos (point-at-bol))))))) (goto-char pos))) @@ -6292,7 +6405,7 @@ I.e. to the first item in this list." ;; addresses this by checking explicitly for both bindings. (defvar orgstruct-mode-map (make-sparse-keymap) - "Keymap for the minor `org-cdlatex-mode'.") + "Keymap for the minor `orgstruct-mode'.") ;;;###autoload (define-minor-mode orgstruct-mode @@ -6377,7 +6490,8 @@ C-c C-c Set tags / toggle checkbox" (orgstruct-make-binding 'org-insert-todo-heading 107 [(meta return)] "\M-\C-m")) - (setq org-local-vars (org-get-local-variables)) + (unless org-local-vars + (setq org-local-vars (org-get-local-variables))) t)) @@ -6439,7 +6553,10 @@ to execute outside of tables." x nil)) varlist)))) +;;;###autoload (defun org-run-like-in-org-mode (cmd) + (unless org-local-vars + (setq org-local-vars (org-get-local-variables))) (eval (list 'let org-local-vars (list 'call-interactively (list 'quote cmd))))) @@ -6552,8 +6669,8 @@ this heading." ;; Mark the entry as done (when (and org-archive-mark-done (looking-at org-todo-line-regexp) - (or (not (match-end 3)) - (not (member (match-string 3) org-done-keywords)))) + (or (not (match-end 2)) + (not (member (match-string 2) org-done-keywords)))) (let (org-log-done) (org-todo (car (or (member org-archive-mark-done org-done-keywords) @@ -6617,7 +6734,7 @@ When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag." (message "%d trees archived" cntarch))) (defun org-cycle-hide-drawers (state) - "Re-hide all archived subtrees after a visibility state change." + "Re-hide all drawers after a visibility state change." (when (not (memq state '(overview folded))) (save-excursion (let* ((globalp (memq state '(contents all))) @@ -8874,7 +8991,7 @@ LISPP means to return something appropriate for a Lisp list." (if (eq lispp 'literal) x (prin1-to-string (if numbers (string-to-number x) x)))) - " ") + elements " ") (concat "[" (mapconcat (lambda (x) (if numbers (number-to-string (string-to-number x)) x)) @@ -9036,26 +9153,28 @@ Parameters get priority." (org-entry-get nil (substring const 5) 'inherit)) "#UNDEFINED_NAME")) -(defvar org-table-fedit-map (make-sparse-keymap)) -(org-defkey org-table-fedit-map "\C-x\C-s" 'org-table-fedit-finish) -(org-defkey org-table-fedit-map "\C-c\C-s" 'org-table-fedit-finish) -(org-defkey org-table-fedit-map "\C-c\C-c" 'org-table-fedit-finish) -(org-defkey org-table-fedit-map "\C-c\C-q" 'org-table-fedit-abort) -(org-defkey org-table-fedit-map "\C-c?" 'org-table-show-reference) -(org-defkey org-table-fedit-map [(meta shift up)] 'org-table-fedit-line-up) -(org-defkey org-table-fedit-map [(meta shift down)] 'org-table-fedit-line-down) -(org-defkey org-table-fedit-map [(shift up)] 'org-table-fedit-ref-up) -(org-defkey org-table-fedit-map [(shift down)] 'org-table-fedit-ref-down) -(org-defkey org-table-fedit-map [(shift left)] 'org-table-fedit-ref-left) -(org-defkey org-table-fedit-map [(shift right)] 'org-table-fedit-ref-right) -(org-defkey org-table-fedit-map [(meta up)] 'org-table-fedit-scroll-down) -(org-defkey org-table-fedit-map [(meta down)] 'org-table-fedit-scroll) -(org-defkey org-table-fedit-map [(meta tab)] 'lisp-complete-symbol) -(org-defkey org-table-fedit-map "\M-\C-i" 'lisp-complete-symbol) -(org-defkey org-table-fedit-map [(tab)] 'org-table-fedit-lisp-indent) -(org-defkey org-table-fedit-map "\C-i" 'org-table-fedit-lisp-indent) -(org-defkey org-table-fedit-map "\C-c\C-r" 'org-table-fedit-toggle-ref-type) -(org-defkey org-table-fedit-map "\C-c}" 'org-table-fedit-toggle-coordinates) +(defvar org-table-fedit-map + (let ((map (make-sparse-keymap))) + (org-defkey map "\C-x\C-s" 'org-table-fedit-finish) + (org-defkey map "\C-c\C-s" 'org-table-fedit-finish) + (org-defkey map "\C-c\C-c" 'org-table-fedit-finish) + (org-defkey map "\C-c\C-q" 'org-table-fedit-abort) + (org-defkey map "\C-c?" 'org-table-show-reference) + (org-defkey map [(meta shift up)] 'org-table-fedit-line-up) + (org-defkey map [(meta shift down)] 'org-table-fedit-line-down) + (org-defkey map [(shift up)] 'org-table-fedit-ref-up) + (org-defkey map [(shift down)] 'org-table-fedit-ref-down) + (org-defkey map [(shift left)] 'org-table-fedit-ref-left) + (org-defkey map [(shift right)] 'org-table-fedit-ref-right) + (org-defkey map [(meta up)] 'org-table-fedit-scroll-down) + (org-defkey map [(meta down)] 'org-table-fedit-scroll) + (org-defkey map [(meta tab)] 'lisp-complete-symbol) + (org-defkey map "\M-\C-i" 'lisp-complete-symbol) + (org-defkey map [(tab)] 'org-table-fedit-lisp-indent) + (org-defkey map "\C-i" 'org-table-fedit-lisp-indent) + (org-defkey map "\C-c\C-r" 'org-table-fedit-toggle-ref-type) + (org-defkey map "\C-c}" 'org-table-fedit-toggle-coordinates) + map)) (easy-menu-define org-table-fedit-menu org-table-fedit-map "Org Edit Formulas Menu" '("Edit-Formulas" @@ -9167,7 +9286,8 @@ full TBLFM line." ;; format match, just advance (setq start (match-end 0))) ((and (> (match-beginning 0) 0) - (equal ?. (aref s (max (1- (match-beginning 0)) 0)))) + (equal ?. (aref s (max (1- (match-beginning 0)) 0))) + (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) ;; 3.e5 or something like this. FIXME: is this ok???? (setq start (match-end 0))) (t @@ -9185,7 +9305,7 @@ full TBLFM line." "Convert spreadsheet references from to @7$28 to AB7. Works for single references, but also for entire formulas and even the full TBLFM line." - (while (string-match "@\\([0-9]+\\)$\\([0-9]+\\)" s) + (while (string-match "@\\([0-9]+\\)\\$\\([0-9]+\\)" s) (setq s (replace-match (format "%s%d" (org-number-to-letters @@ -10400,6 +10520,52 @@ this function is called." (defvar org-store-link-plist nil "Plist with info about the most recently link created with `org-store-link'.") +(defvar org-link-protocols nil + "Link protocols added to Org-mode using `org-add-link-type'.") + +(defvar org-store-link-functions nil + "List of functions that are called to create and store a link. +Each function will be called in turn until one returns a non-nil +value. Each function should check if it is responsible for creating +this link (for example by looking at the major mode). +If not, it must exit and return nil. +If yes, it should return a non-nil value after a calling +`org-store-link-properties' with a list of properties and values. +Special properties are: + +:type The link prefix. like \"http\". This must be given. +:link The link, like \"http://www.astro.uva.nl/~dominik\". + This is obligatory as well. +:description Optional default description for the second pair + of brackets in an Org-mode link. The user can still change + this when inserting this link into an Org-mode buffer. + +In addition to these, any additional properties can be specified +and then used in remember templates.") + +(defun org-add-link-type (type &optional follow publish) + "Add TYPE to the list of `org-link-types'. +Re-compute all regular expressions depending on `org-link-types' +FOLLOW and PUBLISH are two functions. Both take the link path as +an argument. +FOLLOW should do whatever is necessary to follow the link, for example +to find a file or display a mail message. +PUBLISH takes the path and retuns the string that should be used when +this document is published." + (add-to-list 'org-link-types type t) + (org-make-link-regexps) + (add-to-list 'org-link-protocols + (list type follow publish))) + +(defun org-add-agenda-custom-command (entry) + "Replace or add a command in `org-agenda-custom-commands'. +This is mostly for hacking and trying a new command - once the command +works you probably want to add it to `org-agenda-custom-commands' for good." + (let ((ass (assoc (car entry) org-agenda-custom-commands))) + (if ass + (setcdr ass (cdr entry)) + (push entry org-agenda-custom-commands)))) + ;;;###autoload (defun org-store-link (arg) "\\Store an org-link to the current location. @@ -10413,6 +10579,10 @@ For file links, arg negates `org-context-in-file-links'." (let (link cpltxt desc description search txt) (cond + ((run-hook-with-args-until-success 'org-store-link-functions) + (setq link (plist-get org-store-link-plist :link) + desc (or (plist-get org-store-link-plist :description) link))) + ((eq major-mode 'bbdb-mode) (let ((name (bbdb-record-name (bbdb-current-record))) (company (bbdb-record-getprop (bbdb-current-record) 'company))) @@ -10698,7 +10868,7 @@ according to FMT (default from `org-email-link-description-format')." (mapconcat 'identity (org-split-string s "[ \t]+") " "))) (defun org-make-link (&rest strings) - "Concatenate STRINGS, format resulting string with `org-link-format'." + "Concatenate STRINGS." (apply 'concat strings)) (defun org-make-link-string (link &optional description) @@ -10717,7 +10887,15 @@ according to FMT (default from `org-email-link-description-format')." (if description (concat "[" description "]") "") "]")) -(defconst org-link-escape-chars '(("[" . "%5B") ("]" . "%5D") (" " . "%20")) +(defconst org-link-escape-chars + '((" " . "%20") ("\340" . "%E0") + ("\342" . "%E2") ("\347" . "%E7") + ("\350" . "%E8") ("\351" . "%E9") + ("\352" . "%EA") ("\356" . "%EE") + ("\364" . "%F4") ("\371" . "%F9") + ("\373" . "%FB") (";" . "%3B") + ("?" . "%3F") ("=" . "%3D") + ("+" . "%2B")) "Association list of escapes for some characters problematic in links.") (defun org-link-escape (text) @@ -10782,6 +10960,14 @@ according to FMT (default from `org-email-link-description-format')." (setq s (replace-match "%40" t t s))) s) +;;;###autoload +(defun org-insert-link-global () + "Insert a link like Org-mode does. +This command can be called in any mode to follow a link that has +Org-mode syntax." + (interactive) + (org-run-like-in-org-mode 'org-insert-link)) + (defun org-insert-link (&optional complete-file) "Insert a link. At the prompt, enter the link. @@ -10994,6 +11180,14 @@ This is saved in case the need arises to restore it.") (defvar org-open-link-marker (make-marker) "Marker pointing to the location where `org-open-at-point; was called.") +;;;###autoload +(defun org-open-at-point-global () + "Follow a link like Org-mode does. +This command can be called in any mode to follow a link that has +Org-mode syntax." + (interactive) + (org-run-like-in-org-mode 'org-open-at-point)) + (defun org-open-at-point (&optional in-emacs) "Open link at or after point. If there is no link at point, this function will search forward up to @@ -11053,6 +11247,9 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file." (cond + ((assoc type org-link-protocols) + (funcall (nth 1 (assoc type org-link-protocols)) path)) + ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) args1 @@ -11364,7 +11561,7 @@ to read." (setq beg (match-end 0)) (if (re-search-forward "^[ \t]*[0-9]+" nil t) (setq end (1- (match-beginning 0))))) - (and beg end (let ((buffer-read-only)) (delete-region beg end))) + (and beg end (let ((inhibit-read-only t)) (delete-region beg end))) (goto-char (point-min)) (select-window cwin)))) @@ -11982,8 +12179,10 @@ RET no heading at cursor position, level taken from context. So the fastest way to store the note is to press RET RET to append it to the default file. This way your current train of thought is not -interrupted, in accordance with the principles of remember.el. But with -little extra effort, you can push it directly to the correct location. +interrupted, in accordance with the principles of remember.el. +You can also get the fast execution without prompting by using +C-u C-c C-c to exit the remember buffer. See also the variable +`org-remember-store-without-prompt'. Before being stored away, the function ensures that the text has a headline, i.e. a first line that starts with a \"*\". If not, a headline @@ -11999,7 +12198,8 @@ See also the variable `org-reverse-note-order'." (replace-match "")) (catch 'quit (let* ((txt (buffer-substring (point-min) (point-max))) - (fastp (equal current-prefix-arg '(4))) + (fastp (org-xor (equal current-prefix-arg '(4)) + org-remember-store-without-prompt)) (file (if fastp org-default-notes-file (org-get-org-file))) (heading org-remember-default-headline) (visiting (org-find-base-buffer-visiting file)) @@ -12451,6 +12651,7 @@ For calling through lisp, arg is also interpreted in the following way: (listp org-log-done) (memq 'state org-log-done))) (cond ((and state (not this)) + ;; FIXME: should we remove CLOSED already then state is nil? (org-add-planning-info nil nil 'closed) (and dostates (org-add-log-maybe 'state state 'findpos))) ((and state dostates) @@ -12619,7 +12820,7 @@ be removed." "[^\r\n]*")) (not (equal (match-string 1) org-clock-string))) (narrow-to-region (match-beginning 0) (match-end 0)) - (insert "\n") + (insert-before-markers "\n") (backward-char 1) (narrow-to-region (point) (point)) (indent-to-column col)) @@ -12678,7 +12879,14 @@ The auto-repeater uses this.") (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*" "\\(\n[^\r\n]*?" org-keyword-time-not-clock-regexp "[^\r\n]*\\)?")) - (goto-char (match-end 0))) + (goto-char (match-end 0)) + (unless org-log-states-order-reversed + (if (looking-at "\n[ \t]*- State") (forward-char 1)) + (while (looking-at "[ \t]*- State") + (condition-case nil + (org-next-item) + (error (org-end-of-item)))) + (skip-chars-backward " \t\n\r"))) (move-marker org-log-note-marker (point)) (setq org-log-note-purpose purpose) (setq org-log-note-state state) @@ -12736,10 +12944,13 @@ The auto-repeater uses this.") (move-marker org-log-note-marker nil) (end-of-line 1) (if (not (bolp)) (insert "\n")) (indent-relative nil) - (setq ind (concat (buffer-substring (point-at-bol) (point)) " ")) (insert " - " (pop lines)) - (while lines - (insert "\n" ind (pop lines))))))) + (org-indent-line-function) + (beginning-of-line 1) + (looking-at "[ \t]*") + (setq ind (concat (match-string 0) " ")) + (end-of-line 1) + (while lines (insert "\n" ind (pop lines))))))) (set-window-configuration org-log-note-window-configuration) (with-current-buffer (marker-buffer org-log-note-return-to) (goto-char org-log-note-return-to)) @@ -13672,7 +13883,9 @@ If the property is not present at all, nil is returned." (throw 'ex tmp)) (condition-case nil (org-up-heading-all 1) - (error (throw 'ex nil)))))))) + (error (throw 'ex nil)))))) + (or tmp (cdr (assoc property org-local-properties)) + (cdr (assoc property org-global-properties))))) (defun org-entry-put (pom property value) "Set PROPERTY to VALUE for entry at point-or-marker POM." @@ -13817,6 +14030,8 @@ If the property is not present at all, nil is returned." (replace-match "")) (message "Property \"%s\" removed from %d entries" property cnt))))) +(defvar org-columns-current-fmt-compiled) ; defined below + (defun org-compute-property-at-point () "FIXME:" (interactive) @@ -13845,6 +14060,7 @@ completion." ((member property org-special-properties)) (t (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) + (when (and vals (string-match "\\S-" vals)) (setq vals (car (read-from-string (concat "(" vals ")")))) (setq vals (mapcar (lambda (x) @@ -13855,6 +14071,36 @@ completion." vals))))) (if table (mapcar 'list vals) vals))) +(defun org-property-previous-allowed-value (&optional previous) + "Switch to the next allowed value for this property." + (interactive) + (org-property-next-allowed-value t)) + +(defun org-property-next-allowed-value (&optional previous) + "Switch to the next allowed value for this property." + (interactive) + (unless (org-at-property-p) + (error "Not at a property")) + (let* ((key (match-string 2)) + (value (match-string 3)) + (allowed (or (org-property-get-allowed-values (point) key) + (and (member value '("[ ]" "[-]" "[X]")) + '("[ ]" "[X]")))) + nval) + (unless allowed + (error "Allowed values for this property have not been defined")) + (if previous (setq allowed (reverse allowed))) + (if (member value allowed) + (setq nval (car (cdr (member value allowed))))) + (setq nval (or nval (car allowed))) + (if (equal nval value) + (error "Only one allowed value for this property")) + (org-at-property-p) + (replace-match (concat " :" key ": " nval) t t) + (org-indent-line-function) + (beginning-of-line 1) + (skip-chars-forward " \t"))) + ;;; Column View (defvar org-columns-overlays nil @@ -13891,6 +14137,7 @@ This is the compiled version of the format.") (org-defkey org-columns-map "a" 'org-columns-edit-allowed) (org-defkey org-columns-map "s" 'org-columns-edit-attributes) (org-defkey org-columns-map [right] 'forward-char) +(org-defkey org-columns-map [right] (lambda () (interactive) (goto-char (1+ (point))))) (org-defkey org-columns-map [(shift right)] 'org-columns-next-allowed-value) (org-defkey org-columns-map "\C-c\C-c" 'org-columns-next-allowed-value) (org-defkey org-columns-map "n" 'org-columns-next-allowed-value) @@ -13990,12 +14237,13 @@ This is the compiled version of the format.") (setq ov (org-columns-new-overlay beg (point-at-eol))) (org-overlay-put ov 'invisible t) (org-overlay-put ov 'keymap org-columns-map) + (org-overlay-put ov 'intangible t) (push ov org-columns-overlays) (setq ov (org-make-overlay (1- (point-at-eol)) (1+ (point-at-eol)))) (org-overlay-put ov 'keymap org-columns-map) (push ov org-columns-overlays) (let ((inhibit-read-only t)) - (put-text-property (1- (point-at-bol)) + (put-text-property (max (point-min) (1- (point-at-bol))) (min (point-max) (1+ (point-at-eol))) 'read-only "Type `e' to edit property"))))) @@ -14420,7 +14668,8 @@ display, or in the #+COLUMNS line of the current buffer." (defun org-columns-compute-all () "Compute all columns that have operators defined." - (remove-text-properties (point-min) (point-max) '(org-summaries t)) + (org-unmodified + (remove-text-properties (point-min) (point-max) '(org-summaries t))) (let ((columns org-columns-current-fmt-compiled) col) (while (setq col (pop columns)) (when (nth 3 col) @@ -14473,8 +14722,9 @@ display, or in the #+COLUMNS line of the current buffer." (if (assoc property sum-alist) (setcdr (assoc property sum-alist) str) (push (cons property str) sum-alist) - (add-text-properties sumpos (1+ sumpos) - (list 'org-summaries sum-alist))) + (org-unmodified + (add-text-properties sumpos (1+ sumpos) + (list 'org-summaries sum-alist)))) (when val ;?????????????????????????????????? and force????? (org-entry-put nil property str)) ;; add current to current level accumulator @@ -15082,7 +15332,7 @@ days in order to avoid rounding problems." (defun org-time-string-to-absolute (s &optional daynr) "Convert a time stamp to an absolute day number. If there is a specifyer for a cyclic time stamp, get the closest date to -DATE." +DAYNR." (cond ((and daynr (string-match "\\`%%\\((.*)\\)" s)) (if (org-diary-sexp-entry (match-string 1 s) "" date) @@ -15100,6 +15350,7 @@ DATE." (defun org-diary-sexp-entry (sexp entry date) "Process a SEXP diary ENTRY for DATE." + (require 'diary-lib) (let ((result (if calendar-debug-sexp (let ((stack-trace-on-error t)) (eval (car (read-from-string sexp)))) @@ -15151,7 +15402,10 @@ DATE." d m y y1 y2 date1 date2 nmonths nm ny m2) (setq start (org-date-to-gregorian start) - current (org-date-to-gregorian current) + current (org-date-to-gregorian + (if org-agenda-repeating-timestamp-show-all + current + (time-to-days (current-time)))) sday (calendar-absolute-from-gregorian start) cday (calendar-absolute-from-gregorian current)) @@ -15194,7 +15448,9 @@ DATE." (if (> m2 12) (setq y2 (1+ y2) m2 (- m2 12))) (setq n2 (calendar-absolute-from-gregorian (list m2 d y2)))))) - (if (> (abs (- cday n1)) (abs (- cday n2))) n2 n1)))) + (if org-agenda-repeating-timestamp-show-all + (if (> (abs (- cday n1)) (abs (- cday n2))) n2 n1) + (if (= cday n1) n1 n2))))) (defun org-date-to-gregorian (date) "Turn any specification of DATE into a gregorian date for the calendar." @@ -15310,7 +15566,7 @@ in the timestamp determines what will be changed." ts (match-string 0)) (replace-match "") (if (string-match - "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( \\+[0-9]+[dwmy]\\)?\\)[]>]" + "\\(\\(-[012][0-9]:[0-5][0-9]\\)?\\( [-+][0-9]+[dwmy]\\)*\\)[]>]" ts) (setq extra (match-string 1 ts))) (if (string-match "^.\\{10\\}.*?[0-9]+:[0-9][0-9]" ts) @@ -15643,8 +15899,10 @@ from the `before-change-functions' in the current buffer." (defun org-clock-out-if-current () "Clock out if the current entry contains the running clock. -This is used to stop the clock after a TODO entry is marked DONE." - (when (and (member state org-done-keywords) +This is used to stop the clock after a TODO entry is marked DONE, +and is only done if the variable `org-clock-out-when-done' is not nil." + (when (and org-clock-out-when-done + (member state org-done-keywords) (equal (marker-buffer org-clock-marker) (current-buffer)) (< (point) org-clock-marker) (> (save-excursion (outline-next-heading) (point)) @@ -16095,7 +16353,7 @@ The following commands are available: "In a series of undo commands, this is the list of remaning undo items.") (defmacro org-if-unprotected (&rest body) - "Execute BODY if ther is no `org-protected' text property at point." + "Execute BODY if there is no `org-protected' text property at point." (declare (debug t)) `(unless (get-text-property (point) 'org-protected) ,@body)) @@ -16145,7 +16403,7 @@ that have been changed along." (if (pop entry) (with-current-buffer buf (let ((last-undo-buffer buf) - buffer-read-only) + (inhibit-read-only t)) (unless (memq buf org-agenda-undo-has-started-in) (push buf org-agenda-undo-has-started-in) (make-local-variable 'pending-undo-list) @@ -16184,7 +16442,7 @@ T Call `org-todo-list' to display the global todo list, select only m Call `org-tags-view' to display headlines with tags matching a condition (the user is prompted for the condition). M Like `m', but select only TODO entries, no ordinary headlines. -l Create a timeline for the current buffer. +L Create a timeline for the current buffer. e Export views to associated files. More commands can be added by configuring the variable @@ -16206,6 +16464,8 @@ next use of \\[org-agenda]) restricted to the current file." (setq org-agenda-restrict nil) (move-marker org-agenda-restrict-begin nil) (move-marker org-agenda-restrict-end nil) + ;; Delete old local properties + (put 'org-agenda-redo-command 'org-lprops nil) ;; Remember where this call originated (setq org-agenda-last-dispatch-buffer (current-buffer)) (save-window-excursion @@ -16290,6 +16550,7 @@ L Timeline for current buffer # List stuck projects (!=configure) (progn (setq type (nth 1 entry) match (nth 2 entry) lprops (nth 3 entry) lprops (nth 3 entry)) + (put 'org-agenda-redo-command 'org-lprops lprops) (cond ((eq type 'agenda) (org-let lprops '(org-agenda-list current-prefix-arg))) @@ -16513,7 +16774,7 @@ agenda-day The day in the agenda where this is listed" (defmacro org-batch-store-agenda-views (&rest parameters) "Run all custom agenda commands that have a file argument." (let ((cmds org-agenda-custom-commands) - (dir (default-directory)) + (dir default-directory) pars cmd thiscmdkey files opts) (while parameters (push (list (pop parameters) (if parameters (pop parameters))) pars)) @@ -16741,7 +17002,7 @@ Optional argument FILE means, use this file instead of the current." (progn (setq buffer-read-only nil) (goto-char (point-max)) - (unless (= (point) 1) + (unless (bobp) (insert "\n" (make-string (window-width) ?=) "\n")) (narrow-to-region (point) (point-max))) (org-agenda-maybe-reset-markers 'force) @@ -16776,7 +17037,7 @@ Optional argument FILE means, use this file instead of the current." "Finishing touch for the agenda buffer, called just before displaying it." (unless org-agenda-multi (save-excursion - (let ((buffer-read-only)) + (let ((inhibit-read-only t)) (goto-char (point-min)) (while (org-activate-bracket-links (point-max)) (add-text-properties (match-beginning 0) (match-end 0) @@ -16799,6 +17060,7 @@ Optional argument FILE means, use this file instead of the current." (let ((pa '(:org-archived t)) (pc '(:org-comment t)) (pall '(:org-archived t :org-comment t)) + (inhibit-read-only t) (rea (concat ":" org-archive-tag ":")) bmp file re) (save-excursion @@ -16828,18 +17090,20 @@ Optional argument FILE means, use this file instead of the current." (defvar org-agenda-skip-function nil "Function to be called at each match during agenda construction. -If this function return nil, the current match should not be skipped. +If this function returns nil, the current match should not be skipped. Otherwise, the function must return a position from where the search should be continued. +This may also be a Lisp form, it will be evaluated. Never set this variable using `setq' or so, because then it will apply to all future agenda commands. Instead, bind it with `let' to scope -it dynamically into the agenda-constructing command.") +it dynamically into the agenda-constructing command. A good way to set +it is through options in org-agenda-custom-commands.") (defun org-agenda-skip () "Throw to `:skip' in places that should be skipped. Also moves point to the end of the skipped region, so that search can continue from there." - (let ((p (point-at-bol)) to) + (let ((p (point-at-bol)) to fp) (and org-agenda-skip-archived-trees (get-text-property p :org-archived) (org-end-of-subtree t) @@ -16848,10 +17112,13 @@ continue from there." (org-end-of-subtree t) (throw :skip t)) (if (equal (char-after p) ?#) (throw :skip t)) - (when (and (functionp org-agenda-skip-function) + (when (and (or (setq fp (functionp org-agenda-skip-function)) + (consp org-agenda-skip-function)) (setq to (save-excursion (save-match-data - (funcall org-agenda-skip-function))))) + (if fp + (funcall org-agenda-skip-function) + (eval org-agenda-skip-function)))))) (goto-char to) (throw :skip t)))) @@ -17366,12 +17633,66 @@ used by user-defined selections using `org-agenda-skip-function'.") If yes, it returns the end position of this tree, causing agenda commands to skip this subtree. This is a function that can be put into `org-agenda-skip-function' for the duration of a command." - (save-match-data - (let ((end (save-excursion (org-end-of-subtree t))) - skip) - (save-excursion - (setq skip (re-search-forward org-agenda-skip-regexp end t))) - (and skip end)))) + (let ((end (save-excursion (org-end-of-subtree t))) + skip) + (save-excursion + (setq skip (re-search-forward org-agenda-skip-regexp end t))) + (and skip end))) + +(defun org-agenda-skip-entry-if (&rest conditions) + "Skip entry is any of CONDITIONS is true. +See `org-agenda-skip-if for details." + (org-agenda-skip-if nil conditions)) +(defun org-agenda-skip-subtree-if (&rest conditions) + "Skip entry is any of CONDITIONS is true. +See `org-agenda-skip-if for details." + (org-agenda-skip-if t conditions)) + +(defun org-agenda-skip-if (subtree conditions) + "Checks current entity for CONDITIONS. +If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only +the entry, i.e. the text before the next heading is checked. + +CONDITIONS is a list of symbols, boolean OR is used to combine the results +from different tests. Valid conditions are: + +scheduled Check if there is a scheduled cookie +notscheduled Check if there is no scheduled cookie +deadline Check if there is a deadline +notdeadline Check if there is no deadline +regexp Check if regexp matches +notregexp Check if regexp does not match. + +The regexp is taken from the conditions list, it must com right after the +`regexp' of `notregexp' element. + +If any of these conditions is met, this function returns the end point of +the entity, causing the search to continue from there. This is a function +that can be put into `org-agenda-skip-function' for the duration of a command." + (let (beg end m r) + (org-back-to-heading t) + (setq beg (point) + end (if subtree + (progn (org-end-of-subtree t) (point)) + (progn (outline-next-heading) (1- (point))))) + (goto-char beg) + (and + (or + (and (memq 'scheduled conditions) + (re-search-forward org-scheduled-time-regexp end t)) + (and (memq 'notscheduled conditions) + (not (re-search-forward org-scheduled-time-regexp end t))) + (and (memq 'deadline conditions) + (re-search-forward org-deadline-time-regexp end t)) + (and (memq 'notdeadline conditions) + (not (re-search-forward org-deadline-time-regexp end t))) + (and (setq m (memq 'regexp conditions)) + (stringp (setq r (nth 1 m))) + (re-search-forward m end t)) + (and (setq m (memq 'notregexp conditions)) + (stringp (setq r (nth 1 m))) + (not (re-search-forward m end t)))) + end))) (defun org-agenda-list-stuck-projects (&rest ignore) "Create agenda view for projects that are stuck. @@ -17381,6 +17702,7 @@ of what a project is and how to check if it stuck, customize the variable MATCH is being ignored." (interactive) (let* ((org-agenda-skip-function 'org-agenda-skip-subtree-when-regexp-matches) + ;; FIXME: we could have used org-agenda-skip-if here. (org-agenda-overriding-header "List of stuck projects: ") (matcher (nth 0 org-stuck-projects)) (todo (nth 1 org-stuck-projects)) @@ -17439,13 +17761,13 @@ MATCH is being ignored." (setq entries nil) (with-current-buffer fancy-diary-buffer (setq buffer-read-only nil) - (if (= (point-max) 1) + (if (zerop (buffer-size)) ;; No entries (setq entries nil) ;; Omit the date and other unnecessary stuff (org-agenda-cleanup-fancy-diary) ;; Add prefix to each line and extend the text properties - (if (= (point-max) 1) + (if (zerop (buffer-size)) (setq entries nil) (setq entries (buffer-substring (point-min) (- (point-max) 1))))) (set-buffer-modified-p nil) @@ -17631,8 +17953,7 @@ the documentation of `org-diary'." ((eq arg :closed) (setq rtn (org-agenda-get-closed)) (setq results (append results rtn))) - ((and (eq arg :deadline) - (equal date (calendar-current-date))) + ((eq arg :deadline) (setq rtn (org-agenda-get-deadlines)) (setq results (append results rtn)))))))) results)))) @@ -17675,7 +17996,7 @@ the documentation of `org-diary'." (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) ;; FIXME: get rid of the \n at some point but watch out - (regexp (concat "\n\\*+[ \t]+\\(" + (regexp (concat "^\\*+[ \t]+\\(" (if org-select-this-todo-keyword (if (equal org-select-this-todo-keyword "*") org-todo-regexp @@ -17703,7 +18024,7 @@ the documentation of `org-diary'." (goto-char beg) (org-agenda-skip) (goto-char (match-beginning 1)) - (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) + (setq marker (org-agenda-new-marker (match-beginning 0)) category (org-get-category) tags (org-get-tags-at (point)) txt (org-format-agenda-item "" (match-string 1) category tags) @@ -17731,13 +18052,6 @@ the documentation of `org-diary'." 'help-echo (format "mouse-2 or RET jump to org file %s" (abbreviate-file-name buffer-file-name)))) -;???? (regexp (regexp-quote -; (substring -; (format-time-string -; (car org-time-stamp-formats) -; (apply 'encode-time ; DATE bound by calendar -; (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) -; 0 11))) (d1 (calendar-absolute-from-gregorian date)) (regexp (concat @@ -17774,12 +18088,7 @@ the documentation of `org-diary'." deadlinep (string-match org-deadline-regexp tmp) scheduledp (string-match org-scheduled-regexp tmp) donep (org-entry-is-done-p)) - (and org-agenda-skip-scheduled-if-done - scheduledp donep - (throw :skip t)) - (and org-agenda-skip-deadline-if-done - deadlinep donep - (throw :skip t)) + (if (or scheduledp deadlinep) (throw :skip t)) (if (string-match ">" timestr) ;; substring should only run to end of time stamp (setq timestr (substring timestr 0 (match-end 0)))) @@ -17791,29 +18100,14 @@ the documentation of `org-diary'." tags (org-get-tags-at)) (looking-at "\\*+[ \t]+\\([^\r\n]+\\)") (setq txt (org-format-agenda-item - (format "%s%s" - (if deadlinep "Deadline: " "") - (if scheduledp "Scheduled: " "")) - (match-string 1) category tags timestr))) + nil (match-string 1) category tags timestr))) (setq txt org-agenda-no-heading-message)) (setq priority (org-get-priority txt)) (org-add-props txt props 'org-marker marker 'org-hd-marker hdmarker) - (if deadlinep - (org-add-props txt nil - 'face (if donep 'org-done 'org-warning) - 'type "deadline" 'date date - 'undone-face 'org-warning 'done-face 'org-done - 'org-category category 'priority (+ 100 priority)) - (if scheduledp - (org-add-props txt nil - 'face 'org-scheduled-today - 'type "scheduled" 'date date - 'undone-face 'org-scheduled-today 'done-face 'org-done - 'org-category category 'priority (+ 99 priority)) - (org-add-props txt nil 'priority priority - 'org-category category 'date date - 'type "timestamp"))) + (org-add-props txt nil 'priority priority + 'org-category category 'date date + 'type "timestamp") (push txt ee)) (outline-next-heading))) (nreverse ee))) @@ -17915,8 +18209,7 @@ the documentation of `org-diary'." (defun org-agenda-get-deadlines () "Return the deadline information for agenda display." - (let* ((wdays org-deadline-warning-days) - (props (list 'mouse-face 'highlight + (let* ((props (list 'mouse-face 'highlight 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp 'keymap org-agenda-keymap @@ -17926,21 +18219,31 @@ the documentation of `org-diary'." (regexp org-deadline-time-regexp) (todayp (equal date (calendar-current-date))) ; DATE bound by calendar (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar - d2 diff pos pos1 category tags - ee txt head face) + d2 diff dfrac wdays pos pos1 category tags + ee txt head face s upcomingp) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip (org-agenda-skip) - (setq pos (1- (match-beginning 1)) -;??? d2 (time-to-days -;??? (org-time-string-to-time (match-string 1))) + (setq s (match-string 1) + pos (1- (match-beginning 1)) d2 (org-time-string-to-absolute (match-string 1) d1) diff (- d2 d1)) + (if (string-match "-\\([0-9]+\\)\\([dwmy]\\)\\'" s) + (setq wdays + (floor + (* (string-to-number (match-string 1 s)) + (cdr (assoc (match-string 2 s) + '(("d" . 1) ("w" . 7) + ("m" . 30.4) ("y" . 365.25))))))) + (setq wdays org-deadline-warning-days)) + (setq dfrac (/ (* 1.0 (- wdays diff)) wdays)) + (setq upcomingp (and todayp (> diff 0))) ;; When to show a deadline in the calendar: ;; If the expiration is within wdays warning time. ;; Past-due deadlines are only shown on the current date - (if (and (< diff wdays) todayp (not (= diff 0))) + (if (or (and (<= diff wdays) todayp) + (= diff 0)) (save-excursion (setq category (org-get-category)) (if (re-search-backward "^\\*+[ \t]+" nil t) @@ -17952,31 +18255,41 @@ the documentation of `org-diary'." (point) (progn (skip-chars-forward "^\r\n") (point)))) - (if (string-match org-looking-at-done-regexp head) + (if (and org-agenda-skip-deadline-if-done + (string-match org-looking-at-done-regexp head)) (setq txt nil) (setq txt (org-format-agenda-item - (format "In %3d d.: " diff) head category tags)))) + (if (= diff 0) + "Deadline: " + (format "In %3d d.: " diff)) + head category tags)))) (setq txt org-agenda-no-heading-message)) (when txt - (setq face (cond ((<= diff 0) 'org-warning) - ((<= diff 5) 'org-upcoming-deadline) - (t nil))) + (setq face (org-agenda-deadline-face dfrac)) (org-add-props txt props 'org-marker (org-agenda-new-marker pos) 'org-hd-marker (org-agenda-new-marker pos1) - 'priority (+ (- 10 diff) (org-get-priority txt)) + 'priority (+ (if upcomingp (floor (* dfrac 10.)) 100) + (org-get-priority txt)) 'org-category category - 'type "upcoming-deadline" 'date d2 + 'type (if upcomingp "upcoming-deadline" "deadline") + 'date (if upcomingp date d2) 'face face 'undone-face face 'done-face 'org-done) (push txt ee)))))) ee)) +(defun org-agenda-deadline-face (fraction) + "Return the face to displaying a deadline item. +FRACTION is what fraction of the head-warning time has passed." + (let ((faces org-agenda-deadline-faces) f) + (catch 'exit + (while (setq f (pop faces)) + (if (>= fraction (car f)) (throw 'exit (cdr f))))))) + (defun org-agenda-get-scheduled () "Return the scheduled information for agenda display." - (let* ((props (list 'face 'org-scheduled-previously - 'org-not-done-regexp org-not-done-regexp + (let* ((props (list 'org-not-done-regexp org-not-done-regexp 'org-todo-regexp org-todo-regexp - 'undone-face 'org-scheduled-previously 'done-face 'org-done 'mouse-face 'highlight 'keymap org-agenda-keymap @@ -17987,19 +18300,19 @@ the documentation of `org-diary'." (todayp (equal date (calendar-current-date))) ; DATE bound by calendar (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar d2 diff pos pos1 category tags - ee txt head) + ee txt head pastduep donep face) (goto-char (point-min)) (while (re-search-forward regexp nil t) (catch :skip (org-agenda-skip) (setq pos (1- (match-beginning 1)) d2 (org-time-string-to-absolute (match-string 1) d1) -;??? d2 (time-to-days -;??? (org-time-string-to-time (match-string 1))) diff (- d2 d1)) + (setq pastduep (and todayp (< diff 0))) ;; When to show a scheduled item in the calendar: ;; If it is on or past the date. - (if (and (< diff 0) todayp) + (if (or (and (< diff 0) todayp) + (= diff 0)) (save-excursion (setq category (org-get-category)) (if (re-search-backward "^\\*+[ \t]+" nil t) @@ -18010,17 +18323,26 @@ the documentation of `org-diary'." (setq head (buffer-substring-no-properties (point) (progn (skip-chars-forward "^\r\n") (point)))) - (if (string-match org-looking-at-done-regexp head) + (setq donep (string-match org-looking-at-done-regexp head)) + (if (and org-agenda-skip-scheduled-if-done donep) (setq txt nil) (setq txt (org-format-agenda-item - (format "Sched.%2dx: " (- 1 diff)) head - category tags)))) + (if (= diff 0) + "Scheduled: " + (format "Sched.%2dx: " (- 1 diff))) + head category tags)))) (setq txt org-agenda-no-heading-message)) (when txt + (setq face (if pastduep + 'org-scheduled-previously + 'org-scheduled-today)) (org-add-props txt props + 'undone-face face + 'face (if donep 'org-done face) 'org-marker (org-agenda-new-marker pos) 'org-hd-marker (org-agenda-new-marker pos1) - 'type "past-scheduled" 'date d2 + 'type (if pastduep "past-scheduled" "scheduled") + 'date (if pastduep d2 date) 'priority (+ (- 5 diff) (org-get-priority txt)) 'org-category category) (push txt ee)))))) @@ -18435,9 +18757,10 @@ When this is the global TODO list, a prefix argument will be interpreted." (interactive) (let* ((org-agenda-keep-modes t) (line (org-current-line)) - (window-line (- line (org-current-line (window-start))))) + (window-line (- line (org-current-line (window-start)))) + (lprops (get 'org-agenda-redo-command 'org-lprops))) (message "Rebuilding agenda buffer...") - (eval org-agenda-redo-command) + (org-let lprops '(eval org-agenda-redo-command)) (setq org-agenda-undo-list nil org-agenda-pending-undo-list nil) (message "Rebuilding agenda buffer...done") @@ -18783,7 +19106,7 @@ If this information is not given, the function uses the tree at point." (setq p (marker-position m)) (>= p beg) (<= p end)) - (let (buffer-read-only) + (let ((inhibit-read-only t)) (delete-region (point-at-bol) (1+ (point-at-eol))))) (beginning-of-line 0)))))) @@ -18894,7 +19217,7 @@ the same tree node, and the headline of the tree node in the Org-mode file." (buffer (marker-buffer marker)) (pos (marker-position marker)) (hdmarker (get-text-property (point) 'org-hd-marker)) - (buffer-read-only nil) + (inhibit-read-only t) newhead) (org-with-remote-undo buffer (with-current-buffer buffer @@ -18922,7 +19245,7 @@ The new content of the line will be NEWHEAD (as modified by `equal' against all `org-hd-marker' text properties in the file. If FIXFACE is non-nil, the face of each item is modified acording to the new TODO state." - (let* ((buffer-read-only nil) + (let* ((inhibit-read-only t) props m pl undone-face done-face finish new dotime cat tags) (save-excursion (goto-char (point-max)) @@ -18964,7 +19287,7 @@ the new TODO state." ;; See the code in set-tags for the way to do this. (defun org-agenda-align-tags (&optional line) "Align all tags in agenda items to `org-agenda-align-tags-to-column'." - (let ((buffer-read-only)) + (let ((inhibit-read-only t)) (save-excursion (goto-char (if line (point-at-bol) (point-min))) (while (re-search-forward (org-re "\\([ \t]+\\):[[:alnum:]_@:]+:[ \t]*$") @@ -18997,7 +19320,7 @@ the same tree node, and the headline of the tree node in the Org-mode file." (hdmarker (get-text-property (point) 'org-hd-marker)) (buffer (marker-buffer hdmarker)) (pos (marker-position hdmarker)) - (buffer-read-only nil) + (inhibit-read-only t) newhead) (org-with-remote-undo buffer (with-current-buffer buffer @@ -19047,7 +19370,7 @@ the tags of the current headline come last." (org-agenda-error))) (buffer (marker-buffer hdmarker)) (pos (marker-position hdmarker)) - (buffer-read-only nil) + (inhibit-read-only t) newhead) (org-with-remote-undo buffer (with-current-buffer buffer @@ -19074,7 +19397,7 @@ the tags of the current headline come last." (org-agenda-error))) (buffer (marker-buffer hdmarker)) (pos (marker-position hdmarker)) - (buffer-read-only nil) + (inhibit-read-only t) newhead) (org-with-remote-undo buffer (with-current-buffer buffer @@ -19117,7 +19440,7 @@ the tags of the current headline come last." (defun org-agenda-show-new-time (marker stamp) "Show new date stamp via text properties." ;; We use text properties to make this undoable - (let ((buffer-read-only nil)) + (let ((inhibit-read-only t)) (setq stamp (concat " => " stamp)) (save-excursion (goto-char (point-max)) @@ -19814,11 +20137,16 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." \[v] limit export to visible part of outline tree \[a] export as ASCII + \[h] export as HTML \[H] export as HTML to temporary buffer +\[R] export region as HTML \[b] export as HTML and browse immediately \[x] export as XOXO +\[l] export as LaTeX +\[L] export as LaTeX to temporary buffer + \[i] export current file as iCalendar file \[I] export all agenda files as iCalendar files \[c] export agenda files into combined iCalendar file @@ -19836,6 +20164,8 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." (?H . org-export-as-html-to-buffer) (?R . org-export-region-as-html) (?x . org-export-as-xoxo) + (?l . org-export-as-latex) + (?L . org-export-as-latex-to-buffer) (?i . org-export-icalendar-this-file) (?I . org-export-icalendar-all-agenda-files) (?c . org-export-icalendar-combine-agenda-files) @@ -20080,6 +20410,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]." ("clubs") ("clubsuit"."♣") ("hearts") ("diamondsuit"."♥") ("diams") ("diamondsuit"."♦") + ("smile"."☺") ("blacksmile"."☻") ("sad"."☹") ("quot") ("amp") ("lt") @@ -20157,7 +20488,7 @@ translations. There is currently no way for users to extend this.") ;;; General functions for all backends (defun org-cleaned-string-for-export (string &rest parameters) - "Cleanup a buffer substring so that links can be created safely." + "Cleanup a buffer STRING so that links can be created safely." (interactive) (let* ((re-radio (and org-target-link-regexp (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)"))) @@ -20165,13 +20496,16 @@ translations. There is currently no way for users to extend this.") (re-angle-link (concat "\\([^[]\\)" org-angle-link-re)) (re-archive (concat ":" org-archive-tag ":")) (re-quote (concat "^\\*+[ \t]+" org-quote-string "\\>")) + (re-commented (concat "^\\*+[ \t]+" org-comment-string "\\>")) (htmlp (plist-get parameters :for-html)) + (asciip (plist-get parameters :for-ascii)) + (latexp (plist-get parameters :for-LaTeX)) + (commentsp (plist-get parameters :comments)) (inhibit-read-only t) (outline-regexp "\\*+ ") a b xx rtn p) - (save-excursion - (set-buffer (get-buffer-create " org-mode-tmp")) + (with-current-buffer (get-buffer-create " org-mode-tmp") (erase-buffer) (insert string) ;; Remove license-to-kill stuff @@ -20211,25 +20545,43 @@ translations. There is currently no way for users to extend this.") (while (re-search-forward "^[ \t]*:PROPERTIES:[ \t]*\n\\([^@]*?\n\\)?[ \t]*:END:[ \t]*\n" nil t) (replace-match ""))) - ;; Protect stuff from HTML processing + ;; Find targets in comments and move them out of comments, + ;; but mark them as targets that should be invisible (goto-char (point-min)) - (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) - (add-text-properties (match-beginning 0) (match-end 0) - '(org-protected t))) - (when htmlp - (goto-char (point-min)) - (while (re-search-forward "^#\\+HTML:[ \t]*\\(.*\\)" nil t) - (replace-match "\\1" t) - (add-text-properties - (point-at-bol) (min (1+ (point-at-eol)) (point-max)) - '(org-protected t)))) + (while (re-search-forward "^#.*?\\(<<\r\n]+>>>?\\).*" nil t) + (replace-match "\\1(INVISIBLE)")) + + ;; Protect backend specific stuff, throw away the others. (goto-char (point-min)) - (while (re-search-forward - "^#\\+BEGIN_HTML\\>.*\\(\\(\n.*\\)*?\n\\)#\\+END_HTML\\>.*\n?" nil t) - (if htmlp - (add-text-properties (match-beginning 1) (1+ (match-end 1)) - '(org-protected t)) - (delete-region (match-beginning 0) (match-end 0)))) + (let ((formatters + `((,htmlp "HTML" "BEGIN_HTML" "END_HTML") + (,asciip "ASCII" "BEGIN_ASCII" "END_ASCII") + (,latexp "LaTeX" "BEGIN_LaTeX" "END_LaTeX"))) + fmt) + (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) + (add-text-properties (match-beginning 0) (match-end 0) + '(org-protected t))) + (while formatters + (setq fmt (pop formatters)) + (when (car fmt) + (goto-char (point-min)) + (while (re-search-forward (concat "^#\\+" (cadr fmt) + ":[ \t]*\\(.*\\)") nil t) + (replace-match "\\1" t) + (add-text-properties + (point-at-bol) (min (1+ (point-at-eol)) (point-max)) + '(org-protected t)))) + (goto-char (point-min)) + (while (re-search-forward + (concat "^#\\+" + (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+" + (cadddr fmt) "\\>.*\n?") nil t) + (if (car fmt) + (add-text-properties (match-beginning 1) (1+ (match-end 1)) + '(org-protected t)) + (delete-region (match-beginning 0) (match-end 0)))))) + + ;; Protect quoted subtreedes (goto-char (point-min)) (while (re-search-forward re-quote nil t) (goto-char (match-beginning 0)) @@ -20237,16 +20589,39 @@ translations. There is currently no way for users to extend this.") (add-text-properties (point) (org-end-of-subtree t) '(org-protected t))) - ;; Find targets in comments and move them out of comments, - ;; but mark them as targets that should be invisible + ;; Remove subtrees that are commented (goto-char (point-min)) - (while (re-search-forward "^#.*?\\(<<\r\n]+>>>?\\).*" nil t) - (replace-match "\\1(INVISIBLE)")) + (while (re-search-forward re-commented nil t) + (goto-char (match-beginning 0)) + (delete-region (point) (org-end-of-subtree t))) - ;; Remove comments + ;; Remove special table lines + (when org-export-table-remove-special-lines + (goto-char (point-min)) + (while (re-search-forward "^[ \t]*|" nil t) + (beginning-of-line 1) + (if (or (looking-at "[ \t]*| *[!_^] *|") + (and (looking-at ".*?| *<[0-9]+> *|") + (not (looking-at ".*?| *[^ <|]")))) + (delete-region (max (point-min) (1- (point-at-bol))) + (point-at-eol)) + (end-of-line 1)))) + + ;; Specific LaTeX cleaning + (when latexp + (require 'org-export-latex nil t) + (org-export-latex-cleaned-string)) + + ;; Remove or replace comments + ;; If :comments is set, use this char for commenting out comments and + ;; protect them. otherwise delete them (goto-char (point-min)) - (while (re-search-forward "^#.*\n?" nil t) - (replace-match "")) + (while (re-search-forward "^#\\(.*\n?\\)" nil t) + (if commentsp + (progn (add-text-properties + (match-beginning 0) (match-end 0) '(org-protected t)) + (replace-match (format commentsp (match-string 1)) t t)) + (replace-match ""))) ;; Find matches for radio targets and turn them into internal links (goto-char (point-min)) @@ -20277,30 +20652,31 @@ translations. There is currently no way for users to extend this.") (while (re-search-forward re-plain-link nil t) (goto-char (1- (match-end 0))) (org-if-unprotected - (replace-match - (concat - (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") - t t))) + (let* ((s (concat (match-string 1) "[[" (match-string 2) + ":" (match-string 3) "]]"))) + ;; added 'org-link face to links + (put-text-property 0 (length s) 'face 'org-link s) + (replace-match s t t)))) (goto-char (point-min)) (while (re-search-forward re-angle-link nil t) (goto-char (1- (match-end 0))) (org-if-unprotected - (replace-match - (concat - (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") - t t))) + (let* ((s (concat (match-string 1) "[[" (match-string 2) + ":" (match-string 3) "]]"))) + (put-text-property 0 (length s) 'face 'org-link s) + (replace-match s t t)))) (goto-char (point-min)) (while (re-search-forward org-bracket-link-regexp nil t) (org-if-unprotected - (replace-match - (concat "[[" (setq xx (save-match-data - (org-link-expand-abbrev (match-string 1)))) - "]" - (if (match-end 3) - (match-string 2) - (concat "[" xx "]")) - "]") - t t))) + (let* ((s (concat "[[" (setq xx (save-match-data + (org-link-expand-abbrev (match-string 1)))) + "]" + (if (match-end 3) + (match-string 2) + (concat "[" xx "]")) + "]"))) + (put-text-property 0 (length s) 'face 'org-link s) + (replace-match s t t)))) ;; Find multiline emphasis and put them into single line (when (plist-get parameters :emph-multiline) @@ -20320,7 +20696,7 @@ translations. There is currently no way for users to extend this.") (defun org-export-grab-title-from-buffer () "Get a title for the current document, from looking at the buffer." - (let (buffer-read-only) + (let ((inhibit-read-only t)) (save-excursion (goto-char (point-min)) (let ((end (save-excursion (outline-next-heading) (point)))) @@ -20440,18 +20816,18 @@ underlined headlines. The default is 3." (buffer-substring (if (org-region-active-p) (region-beginning) (point-min)) (if (org-region-active-p) (region-end) (point-max)))) - (lines (org-skip-comments - (org-split-string - (org-cleaned-string-for-export - region - :skip-before-1st-heading - (plist-get opt-plist :skip-before-1st-heading) - :add-text (plist-get opt-plist :text)) - "[\r\n]"))) ;; FIXME: why \r here???/ + (lines (org-split-string + (org-cleaned-string-for-export + region + :for-ascii t + :skip-before-1st-heading + (plist-get opt-plist :skip-before-1st-heading) + :add-text (plist-get opt-plist :text)) + "[\r\n]")) ;; FIXME: why \r here???/ thetoc have-headings first-heading-pos table-open table-buffer) - (let (buffer-read-only) + (let ((inhibit-read-only t)) (org-unmodified (remove-text-properties (point-min) (point-max) '(:org-license-to-kill t)))) @@ -20892,19 +21268,19 @@ itemized list in org-mode syntax in an HTML buffer and then use this command to convert it." (interactive "r") (let (reg html buf) - (if (org-mode-p) - (setq html (org-export-region-as-html - beg end t 'string)) - (setq reg (buffer-substring beg end) - buf (get-buffer-create "*Org tmp*")) - (save-excursion - (set-buffer buf) - (erase-buffer) - (insert reg) - (org-mode) - (setq html (org-export-region-as-html - (point-min) (point-max) t 'string))) - (kill-buffer buf)) + (save-window-excursion + (if (org-mode-p) + (setq html (org-export-region-as-html + beg end t 'string)) + (setq reg (buffer-substring beg end) + buf (get-buffer-create "*Org tmp*")) + (with-current-buffer buf + (erase-buffer) + (insert reg) + (org-mode) + (setq html (org-export-region-as-html + (point-min) (point-max) t 'string))) + (kill-buffer buf))) (delete-region beg end) (insert html))) @@ -20924,7 +21300,7 @@ When called interactively, the output buffer is selected, and shown in a window. A non-interactive call will only retunr the buffer." (interactive "r\nP") (when (interactive-p) - (setq buffer "*Org HTML EXPORT*")) + (setq buffer "*Org HTML Export*")) (let ((transient-mark-mode t) (zmacs-regions t) rtn) (goto-char end) @@ -20997,7 +21373,7 @@ the body tags themselves." (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create "*Org HTML Export*")) - (t (get-buffer-create to-buffer))) + (t (get-buffer-create to-buffer))) (find-file-noselect filename))) (org-levels-open (make-vector org-level-max nil)) (date (format-time-string "%Y/%m/%d" (current-time))) @@ -21040,25 +21416,25 @@ the body tags themselves." (if region-p (region-beginning) (point-min)) (if region-p (region-end) (point-max)))) (lines - (org-skip-comments (org-split-string - (org-cleaned-string-for-export - region - :emph-multiline t - :for-html t - :skip-before-1st-heading - (plist-get opt-plist :skip-before-1st-heading) - :add-text - (plist-get opt-plist :text) - :LaTeX-fragments - (plist-get opt-plist :LaTeX-fragments)) - "[\r\n]"))) + (org-split-string + (org-cleaned-string-for-export + region + :emph-multiline t + :for-html t + :skip-before-1st-heading + (plist-get opt-plist :skip-before-1st-heading) + :add-text + (plist-get opt-plist :text) + :LaTeX-fragments + (plist-get opt-plist :LaTeX-fragments)) + "[\r\n]")) table-open type table-buffer table-orig-buffer ind start-is-num starter didclose rpl path desc descp desc1 desc2 link ) - (let (buffer-read-only) + (let ((inhibit-read-only t)) (org-unmodified (remove-text-properties (point-min) (point-max) '(:org-license-to-kill t)))) @@ -21077,9 +21453,8 @@ the body tags themselves." (erase-buffer) (fundamental-mode) -;; FIXME: -; (and (fboundp 'set-buffer-file-coding-system)) -; (set-buffer-file-coding-system coding-system-for-write) + (and (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) (let ((case-fold-search nil) (org-odd-levels-only odd)) @@ -22274,7 +22649,11 @@ a time), or the day by one (if it does not contain a time)." (let ((s (car t2)) (mi (nth 1 t2)) (h (nth 2 t2)) (d (nth 3 t2)) (m (nth 4 t2)) (y (nth 5 t2))) (when inc - (if have-time (setq h (+ 2 h)) (setq d (1+ d)))) + (if have-time + (if org-agenda-default-appointment-duration + (setq mi (+ org-agenda-default-appointment-duration mi)) + (setq h (+ 2 h))) + (setq d (1+ d)))) (setq time (encode-time s mi h d m y))) (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d")) (concat keyword (format-time-string fmt time)))) @@ -23033,7 +23412,7 @@ See the individual commands for more information." "--" ["Jump" org-goto t] "--" - ["C-a/e find headline start/end" + ["C-a/e find headline/item start/end" (setq org-special-ctrl-a/e (not org-special-ctrl-a/e)) :style toggle :selected org-special-ctrl-a/e]) ("Edit Structure" @@ -23582,8 +23961,6 @@ work correctly." ;;;; Functions extending outline functionality -;; C-a should go to the beginning of a *visible* line, also in the -;; new outline.el. I guess this should be patched into Emacs? (defun org-beginning-of-line (&optional arg) "Go to the beginning of the current line. If that is invisible, continue to a visible line beginning. This makes the function of C-a more intuitive. @@ -23601,12 +23978,19 @@ beyond the end of the headline." (backward-char 1) (beginning-of-line 1)) (forward-char 1))) - (when (and org-special-ctrl-a/e (looking-at org-todo-line-regexp) - (= (char-after (match-end 1)) ?\ )) - (goto-char - (cond ((> pos (match-beginning 3)) (match-beginning 3)) - ((= pos (point)) (match-beginning 3)) - (t (point))))))) + (when org-special-ctrl-a/e + (cond + ((and (looking-at org-todo-line-regexp) + (= (char-after (match-end 1)) ?\ )) + (goto-char + (cond ((> pos (match-beginning 3)) (match-beginning 3)) + ((= pos (point)) (match-beginning 3)) + (t (point))))) + ((org-at-item-p) + (goto-char + (cond ((> pos (match-end 4)) (match-end 4)) + ((= pos (point)) (match-end 4)) + (t (point))))))))) (defun org-end-of-line (&optional arg) "Go to the end of the line. @@ -23708,7 +24092,7 @@ When ENTRY is non-nil, show the entire entry." (save-excursion (and (outline-next-heading) (org-flag-heading nil)))) - (outline-flag-region (max 1 (1- (point))) + (outline-flag-region (max (point-min) (1- (point))) (save-excursion (outline-end-of-heading) (point)) flag)))) @@ -23749,7 +24133,7 @@ Show the heading too, if it is currently invisible." (save-excursion (org-back-to-heading t) (outline-flag-region - (max 1 (1- (point))) + (max (point-min) (1- (point))) (save-excursion (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) (or (match-beginning 1) (point-max))) @@ -23818,6 +24202,29 @@ Show the heading too, if it is currently invisible." ;;;; Experimental code +;; Make appt aware of appointments from the agenda +(defun org-agenda-to-appt () + "Activate appointments found in `org-agenda-files'." + (interactive) + (require 'org) + (let* ((today (org-date-to-gregorian + (time-to-days (current-time)))) + (files org-agenda-files) entries file) + (while (setq file (pop files)) + (setq entries (append entries (org-agenda-get-day-entries + file today :timestamp)))) + (setq entries (delq nil entries)) + (mapc (lambda(x) + (let* ((event (org-trim (get-text-property 1 'txt x))) + (time-of-day (get-text-property 1 'time-of-day x)) tod) + (when time-of-day + (setq tod (number-to-string time-of-day) + tod (when (string-match + "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod) + (concat (match-string 1 tod) ":" + (match-string 2 tod)))) + (if tod (appt-add tod event))))) entries))) + (defun org-closed-in-range () "Sparse tree of items closed in a certain time range. Still experimental, may disappear in the furture." @@ -23857,35 +24264,7 @@ Still experimental, may disappear in the furture." t))) (t nil)))) ; call paragraph-fill -(defun org-property-previous-allowed-value (&optional previous) - "Switch to the next allowed value for this property." - (interactive) - (org-property-next-allowed-value t)) -(defun org-property-next-allowed-value (&optional previous) - "Switch to the next allowed value for this property." - (interactive) - (unless (org-at-property-p) - (error "Not at a property")) - (let* ((key (match-string 2)) - (value (match-string 3)) - (allowed (or (org-property-get-allowed-values (point) key) - (and (member value '("[ ]" "[-]" "[X]")) - '("[ ]" "[X]")))) - nval) - (unless allowed - (error "Allowed values for this property have not been defined")) - (if previous (setq allowed (reverse allowed))) - (if (member value allowed) - (setq nval (car (cdr (member value allowed))))) - (setq nval (or nval (car allowed))) - (if (equal nval value) - (error "Only one allowed value for this property")) - (org-at-property-p) - (replace-match (concat " :" key ": " nval)) - (org-indent-line-function) - (beginning-of-line 1) - (skip-chars-forward " \t"))) ;;;; Finish up diff --git a/org.pdf b/org.pdf index 006b75501..2d1e0ef1b 100644 Binary files a/org.pdf and b/org.pdf differ diff --git a/org.texi b/org.texi index 86efdb7e6..d709de8d5 100644 --- a/org.texi +++ b/org.texi @@ -3,8 +3,8 @@ @setfilename ../info/org @settitle Org Mode Manual -@set VERSION 5.04 -@set DATE July 2007 +@set VERSION 5.05 +@set DATE August 2007 @dircategory Emacs @direntry @@ -146,6 +146,7 @@ Hyperlinks * Internal links:: Links to other places in the current file * External links:: URL-like links to the world * Handling links:: Creating, inserting and following +* Using links outside Org-mode:: Linking from my C source code? * Link abbreviations:: Shortcuts for writing complex links * Search options:: Linking to a specific location * Custom searches:: When the default search is not enough @@ -197,8 +198,8 @@ Column View Defining Columns -* Scope of column definitions:: -* Column attributes:: +* Scope of column definitions:: Where defined, where valid? +* Column attributes:: Appearance and content of a column Timestamps @@ -214,8 +215,8 @@ Creating timestamps Deadlines and Scheduling -* Inserting deadline/schedule:: -* Repeated tasks:: +* Inserting deadline/schedule:: Planning items +* Repeated tasks:: Items that show up again and again Progress Logging @@ -266,17 +267,23 @@ Exporting * ASCII export:: Exporting to plain ASCII * HTML export:: Exporting to HTML +* LaTeX export:: Exporting to LaTeX * XOXO export:: Exporting to XOXO * iCalendar export:: Exporting in iCalendar format * Text interpretation:: How the exporter looks at the file HTML export -* Export commands:: How to invoke HTML export +* HTML Export commands:: How to invoke LaTeX export * Quoting HTML tags:: Using direct HTML in Org-mode -* Links:: How hyperlinks get transferred to HTML -* Images:: To inline or not to inline? -* CSS support:: Style specifications +* Links:: Transformation of links for HTML +* Images:: How to include images +* CSS support:: Changing the appearence of the output + +LaTeX export + +* LaTeX export commands:: How to invoke LaTeX export +* Quoting LaTeX code:: Incorporating literal LaTeX code Text interpretation by the exporter @@ -326,6 +333,7 @@ Interaction with other packages Extensions, Hooks and Hacking * Extensions:: Existing 3rd-part extensions +* Adding hyperlink types:: New custom link types * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs * Dynamic blocks:: Automatically filled blocks * Special agenda views:: Customized views @@ -403,7 +411,7 @@ example as: Org-mode's automatic, context sensitive table editor with spreadsheet capabilities can be integrated into any major mode by activating the minor Orgtbl-mode. Using a translation step, it can be used to maintain -tables in arbitrary file types, for example in LaTeX. The structure +tables in arbitrary file types, for example in La@TeX{}. The structure editing and list creation capabilities can be used outside Org-mode with the minor Orgstruct-mode. @@ -599,15 +607,14 @@ edit the structure of the document. @cindex outlines @cindex outline-mode -Org-mode is implemented on top of outline-mode. Outlines allow to -organize a document in a hierarchical structure, which (at least for -me) is the best representation of notes and thoughts. Overview over -this structure is achieved by folding (hiding) large parts of the +Org-mode is implemented on top of outline-mode. Outlines allow a +document to be organized in a hierarchical structure, which (at least +for me) is the best representation of notes and thoughts. An overview +of this structure is achieved by folding (hiding) large parts of the document to show only the general document structure and the parts currently being worked on. Org-mode greatly simplifies the use of -outlines by compressing the entire show/hide functionality into a -single command @command{org-cycle}, which is bound to the @key{TAB} -key. +outlines by compressing the entire show/hide functionality into a single +command @command{org-cycle}, which is bound to the @key{TAB} key. @node Headlines, Visibility cycling, Outlines, Document structure @section Headlines @@ -638,7 +645,7 @@ An empty line after the end of a subtree is considered part of it and will be hidden when the subtree is folded. However, if you leave at least two empty lines, one empty line will remain visible after folding the subtree, in order to structure the collapsed view. See the -variable @code{org-cycle-separator-lines} for modifying this behavior. +variable @code{org-cycle-separator-lines} to modify this behavior. @node Visibility cycling, Motion, Headlines, Document structure @section Visibility cycling @@ -987,7 +994,7 @@ match is in the body of an entry, headline and body are made visible. In order to provide minimal context, also the full hierarchy of headlines above the match is shown, as well as the headline following the match. Each match is also highlighted; the highlights disappear -when the buffer is changes an editing command, or by pressing @kbd{C-c +when the buffer is changed an editing command, or by pressing @kbd{C-c C-c}. When called with a @kbd{C-u} prefix argument, previous highlights are kept, so several calls to this command can be stacked. @end table @@ -1202,9 +1209,9 @@ Emacs @file{calc} package. @cindex table editor, built-in Org-mode makes it easy to format tables in plain ASCII. Any line with -@samp{|} as the first non-white character is considered part of a -table. @samp{|} is also the column separator. A table might look -like this: +@samp{|} as the first non-whitespace character is considered part of a +table. @samp{|} is also the column separator. A table might look like +this: @example | Name | Phone | Age | @@ -1510,7 +1517,7 @@ example in mail mode, use Furthermore, with some special setup, it is possible to maintain tables in arbitrary syntax with Orgtbl-mode. For example, it is possible to -construct LaTeX tables with the underlying ease and power of +construct La@TeX{} tables with the underlying ease and power of Orgtbl-mode, including spreadsheet capabilities. For details, see @ref{Tables in arbitrary syntax}. @@ -2084,6 +2091,7 @@ links to other files, Usenet articles, emails, and much more. * Internal links:: Links to other places in the current file * External links:: URL-like links to the world * Handling links:: Creating, inserting and following +* Using links outside Org-mode:: Linking from my C source code? * Link abbreviations:: Shortcuts for writing complex links * Search options:: Linking to a specific location * Custom searches:: When the default search is not enough @@ -2256,7 +2264,7 @@ as links. If spaces must be part of the link (for example in @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities about the end of the link, enclose them in angular brackets. -@node Handling links, Link abbreviations, External links, Hyperlinks +@node Handling links, Using links outside Org-mode, External links, Hyperlinks @section Handling links @cindex links, handling @@ -2389,7 +2397,20 @@ to @kbd{C-n} and @kbd{C-p} @end lisp @end table -@node Link abbreviations, Search options, Handling links, Hyperlinks +@node Using links outside Org-mode, Link abbreviations, Handling links, Hyperlinks +@section Using links outside Org-mode + +You can insert and follow links that have Org-mode syntax not only in +Org-mode, but in any Emacs buffer. For this, you should create two +global commands, like this (please select suitable global keys +yourself): + +@lisp +(define-key global-map 'org-insert-link-global "\\C-c L") +(define-key global-map 'org-open-at-point-global "\\C-c o") +@end lisp + +@node Link abbreviations, Search options, Using links outside Org-mode, Hyperlinks @section Link abbreviations @cindex link abbreviations @cindex abbreviation, links @@ -3384,6 +3405,17 @@ publishers and the number of disks in a box like this: :END: @end example +If you want to set properties that can be inherited by any entry in a +file, use a line like + +@example +#+PROPERTY: NDisks_ALL 1 2 3 4 +@end example + +Property values set with the global variable +@code{org-global-properties} can be inherited by all entries in all +Org-mode files. + @noindent The following commands help to work with properties: @@ -3932,6 +3964,10 @@ and continuing until the entry is marked DONE. An example: DEADLINE: <2004-02-29 Sun> @end example +You can specify a different lead time for warnings for a specific +deadlines using the following syntax. Here is an example with a warning +period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}. + @item SCHEDULED @cindex SCHEDULED keyword You are planning to start working on that task on the given date. The @@ -3949,8 +3985,8 @@ I.e., the task will automatically be forwarded until completed. @end table @menu -* Inserting deadline/schedule:: -* Repeated tasks:: +* Inserting deadline/schedule:: Planning items +* Repeated tasks:: Items that show up again and again @end menu @node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling @@ -5429,21 +5465,23 @@ are surrounded with @code{} and @code{} tags, respectively. With symbols, sub- and superscripts, HTML is pretty much at its end when it comes to representing mathematical formulas@footnote{Yes, there is MathML, but that is not yet fully supported by many browsers, and there -is no decent converter for turning LaTeX of ASCII representations of -formulas into MathML. So for the time being, converting formulas into -images seems the way to go.}. More complex -expressions need a dedicated formula processor. To this end, Org-mode -can contain arbitrary La@TeX{} fragments. It provides commands to -preview the typeset result of these fragments, and upon export to HTML, -all fragments will be converted to images and inlined into the HTML -document. For this to work you need to be on a system with a working -La@TeX{} installation. You also need the @file{dvipng} program, -available at @url{http://sourceforge.net/projects/dvipng/}. The LaTeX -header that will be used when processing a fragment can be configured -with the variable @code{org-format-latex-header}. +is no decent converter for turning La@TeX{} or ASCII representations of +formulas into MathML. So for the time being, converting formulas into +images seems the way to go.}. More complex expressions need a dedicated +formula processor. To this end, Org-mode can contain arbitrary La@TeX{} +fragments. It provides commands to preview the typeset result of these +fragments, and upon export to HTML, all fragments will be converted to +images and inlined into the HTML document@footnote{The La@TeX{} export +will not use images for displaying La@TeX{} fragments but include these +fragments directly into the La@TeX{} code.}. For this to work you +need to be on a system with a working La@TeX{} installation. You also +need the @file{dvipng} program, available at +@url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that +will be used when processing a fragment can be configured with the +variable @code{org-format-latex-header}. La@TeX{} fragments don't need any special marking at all. The following -snippets will be identified as LaTeX source code: +snippets will be identified as La@TeX{} source code: @itemize @bullet @item Environments of any kind. The only requirement is that the @@ -5509,7 +5547,7 @@ setting is active: @cindex CDLaTeX CDLaTeX-mode is a minor mode that is normally used in combination with a -major LaTeX mode like AUCTeX in order to speed-up insertion of +major La@TeX{} mode like AUCTeX in order to speed-up insertion of environments and math templates. Inside Org-mode, you can make use of some of the features of cdlatex-mode. You need to install @file{cdlatex.el} and @file{texmathp.el} (the latter comes also with @@ -5532,7 +5570,7 @@ Environment templates can be inserted with @kbd{C-c @{}. @item @kindex @key{TAB} The @key{TAB} key will do template expansion if the cursor is inside a -LaTeX fragment@footnote{Org-mode has a method to test if the cursor is +La@TeX{} fragment@footnote{Org-mode has a method to test if the cursor is inside such a fragment, see the documentation of the function @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor @@ -5545,7 +5583,7 @@ To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}. @item @kindex _ @kindex ^ -Pressing @kbd{_} and @kbd{^} inside a LaTeX fragment will insert these +Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these characters together with a pair of braces. If you use @key{TAB} to move out of the braces, and if the braces surround only a single character or macro, they are removed again (depending on the variable @@ -5553,7 +5591,7 @@ macro, they are removed again (depending on the variable @item @kindex ` Pressing the backquote @kbd{`} followed by a character inserts math -macros, also outside LaTeX fragments. If you wait more than 1.5 seconds +macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds after the backquote, a help window will pop up. @item @kindex ' @@ -5572,11 +5610,12 @@ Org-mode documents can be exported into a variety of other formats. For printing and sharing of notes, ASCII export produces a readable and simple version of an Org-mode file. HTML export allows you to publish a notes file on the web, while the XOXO format provides a solid base for -exchange with a broad range of other applications. To incorporate -entries with associated times like deadlines or appointments into a -desktop calendar program like iCal, Org-mode can also produce extracts -in the iCalendar format. Currently Org-mode only supports export, not -import of these different formats. +exchange with a broad range of other applications. La@TeX{} export lets +you use Org-mode and its structured editing functions to easily create +La@TeX{} files. To incorporate entries with associated times like +deadlines or appointments into a desktop calendar program like iCal, +Org-mode can also produce extracts in the iCalendar format. Currently +Org-mode only supports export, not import of these different formats. When exporting, Org-mode uses special conventions to enrich the output produced. @xref{Text interpretation}, for more details. @@ -5592,6 +5631,7 @@ command. @menu * ASCII export:: Exporting to plain ASCII * HTML export:: Exporting to HTML +* LaTeX export:: Exporting to LaTeX * XOXO export:: Exporting to XOXO * iCalendar export:: Exporting in iCalendar format * Text interpretation:: How the exporter looks at the file @@ -5638,7 +5678,7 @@ the body text. Any indentation larger than this is adjusted to preserve the layout relative to the first line. Should there be lines with less indentation than the first, these are left alone. -@node HTML export, XOXO export, ASCII export, Exporting +@node HTML export, LaTeX export, ASCII export, Exporting @section HTML export @cindex HTML export @@ -5647,14 +5687,14 @@ HTML formatting, in ways similar to John Grubers @emph{markdown} language, but with additional support for tables. @menu -* Export commands:: How to invoke HTML export +* HTML Export commands:: How to invoke LaTeX export * Quoting HTML tags:: Using direct HTML in Org-mode -* Links:: How hyperlinks get transferred to HTML -* Images:: To inline or not to inline? -* CSS support:: Style specifications +* Links:: Transformation of links for HTML +* Images:: How to include images +* CSS support:: Changing the appearence of the output @end menu -@node Export commands, Quoting HTML tags, HTML export, HTML export +@node HTML Export commands, Quoting HTML tags, HTML export, HTML export @subsection HTML export commands @cindex region, active @@ -5688,6 +5728,9 @@ Export only the visible part of the document. Convert the region to HTML under the assumption that it was org-mode syntax before. This is a global command that can be invoked in any buffer. +@item M-x org-replace-region-by-HTML +Replace the active region (assumed to be in Org-mode syntax) by HTML +code. @end table @cindex headline levels, for exporting @@ -5703,7 +5746,7 @@ at a different level, specify it with a prefix argument. For example, @noindent creates two levels of headings and does the rest as items. -@node Quoting HTML tags, Links, Export commands, HTML export +@node Quoting HTML tags, Links, HTML Export commands, HTML export @subsection Quoting HTML tags Plain @samp{<} and @samp{>} are always transformed to @samp{<} and @@ -5807,7 +5850,78 @@ section in the buffer. @c FIXME: More about header and footer styles @c FIXME: Talk about links and targets. -@node XOXO export, iCalendar export, HTML export, Exporting +@node LaTeX export, XOXO export, HTML export, Exporting +@section LaTeX export +@cindex LaTeX export + +Org-mode contains a La@TeX{} exporter written by Bastien Guerry. + +@menu +* LaTeX export commands:: How to invoke LaTeX export +* Quoting LaTeX code:: Incorporating literal LaTeX code +@end menu + +@node LaTeX export commands, Quoting LaTeX code, LaTeX export, LaTeX export +@subsection LaTeX export commands + +@table @kbd +@kindex C-c C-e l +@item C-c C-e l +Export as La@TeX{} file @file{myfile.tex}. +@kindex C-c C-e L +@item C-c C-e L +Export to a temporary buffer, do not create a file. +@kindex C-c C-e v l +@kindex C-c C-e v L +@item C-c C-e v l +@item C-c C-e v L +Export only the visible part of the document. +@item M-x org-export-region-as-latex +Convert the region to La@TeX{} under the assumption that it was org-mode +syntax before. This is a global command that can be invoked in any +buffer. +@item M-x org-replace-region-by-latex +Replace the active region (assumed to be in Org-mode syntax) by La@TeX{} +code. +@end table + +@cindex headline levels, for exporting +In the exported version, the first 3 outline levels will become +headlines, defining a general document structure. Additional levels +will be exported as description lists. The exporter can ignore them or +convert them to a custom string depending on +@code{org-latex-low-levels}. + +If you want that transition to occur at a different level, specify it +with a prefix argument. For example, + +@example +@kbd{C-2 C-c C-e l} +@end example + +@noindent +creates two levels of headings and does the rest as items. + +@node Quoting LaTeX code, , LaTeX export commands, LaTeX export +@subsection Quoting LaTeX code + +Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly +inserted into the La@TeX{} file. Forthermore, you can add special code +that should only be present in La@TeX{} export with the following +constructs: + +@example +#+LaTeX: Literal LaTeX code for export +@end example + +@noindent or + +@example +#+BEGIN_LaTeX +All lines between these markers are exported literally +#+END_LaTeX +@end example +@node XOXO export, iCalendar export, LaTeX export, Exporting @section XOXO export @cindex XOXO export @@ -5955,9 +6069,9 @@ the settings in Org-mode. @cindex richer text Some of the export backends of Org-mode allow for sophisticated text -formatting, this is true in particular for the HTML backend. Org-mode -has a number of typing conventions that allow to produce a richly -formatted output. +formatting, this is true in particular for the HTML and La@TeX{} +backends. Org-mode has a number of typing conventions that allow to +produce a richly formatted output. @itemize @bullet @@ -6084,6 +6198,10 @@ author: @r{turn on/off inclusion of author name/email into exported file} timestamp: @r{turn on/off inclusion creation time into exported file} @end example +These options take effect in both the HTML and La@TeX{} export, except +for @code{TeX} and @code{LaTeX}, which are respectively @code{t} and +@code{nil} for the La@TeX{} export. + @node Publishing, Miscellaneous, Exporting, Top @chapter Publishing @cindex publishing @@ -6092,11 +6210,16 @@ Org-mode includes@footnote{@file{org-publish.el} is not distributed with Emacs 21, if you are still using Emacs 21, you need you need to download this file separately.} a publishing management system that allows you to configure automatic HTML conversion of @emph{projects} composed of -interlinked org files. This system is called @emph{org-publish}. You -can also configure org-publish to automatically upload your exported -HTML pages and related attachments, such as images and source code -files, to a web server. Org-publish turns org-mode into a web-site -authoring tool. +interlinked org files. This system is called @emph{org-publish}. You can +also configure org-publish to automatically upload your exported HTML +pages and related attachments, such as images and source code files, to +a web server. Org-publish turns org-mode into a web-site authoring tool. + +You can also use Org-publish to convert files into La@TeX{}, or even +combine HTML and La@TeX{} conversion so that files are available in both +formats on the server@footnote{Since La@TeX{} files on a server are not +that helpful, you surely want to perform further conversion on them -- +e.g. convert them to @code{PDF} format.}. Org-publish has been contributed to Org-mode by David O'Toole. @@ -6199,9 +6322,11 @@ Publishing means that a file is copied to the destination directory and possibly transformed in the process. The default transformation is to export Org-mode files as HTML files, and this is done by the function @code{org-publish-org-to-html} which calls the HTML exporter -(@pxref{HTML export}). Other files like images only need to be copied -to the publishing destination. For non-Org-mode files, you need to -specify the publishing function. +(@pxref{HTML export}). But you also can publish your files in La@TeX{} by +using the function @code{org-publish-org-to-latex} instead. Other files +like images only need to be copied to the publishing destination. For +non-Org-mode files, you need to specify the publishing function. + @multitable @columnfractions 0.3 0.7 @item @code{:publishing-function} @@ -6218,13 +6343,13 @@ provides one for attachments (files that only need to be copied): @code{org-publish-attachment}. @node Publishing options, Publishing links, Publishing action, Configuration -@subsection Options for the HTML exporter +@subsection Options for the HTML/LaTeX exporters @cindex options, for publishing The property list can be used to set many export options for the HTML -exporter. In most cases, these properties correspond to user variables -in Org-mode. The table below lists these properties along with the -variable they belong to. See the documentation string for the +and La@TeX{} exporters. In most cases, these properties correspond to user +variables in Org-mode. The table below lists these properties along +with the variable they belong to. See the documentation string for the respective variable for details. @multitable @columnfractions 0.3 0.7 @@ -6256,6 +6381,11 @@ respective variable for details. @item @code{:email} @tab @code{user-mail-address} @end multitable +Most of the @code{org-export-with-*} variables have the same effect in +both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and +@code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the +La@TeX{} export. + When a property is given a value in org-publish-project-alist, its setting overrides the value of the corresponding user variable (if any) during publishing. Options set within a file (@pxref{Export @@ -6524,7 +6654,7 @@ when the file is visited again in a new Emacs session. @table @kbd @item #+ARCHIVE: %s_done:: This line sets the archive location for the agenda file. It applies for -all subsequent lines until the next @samp{#+CATEGORY} line, or the end +all subsequent lines until the next @samp{#+ARCHIVE} line, or the end of the file. The first such line also applies to any entries before it. The corresponding variable is @code{org-archive-location}. @item #+CATEGORY: @@ -6548,8 +6678,11 @@ These lines (several are allowed) specify link abbreviations. This line sets the limits and the default for the priorities. All three must be either letters A-Z or numbers 0-9. The highest priority must have a lower ASCII number that the lowest priority. +@item #+PROPERTY: Property_Name Value +This line sets a default inheritance value for entries in the current +buffer, most useful for specifying the allowed values of a property. @item #+STARTUP: -This line sets options to be used at startup of org-mode, when an +This line sets options to be used at startup of Org-mode, when an Org-mode file is being visited. The first set of options deals with the initial visibility of the outline tree. The corresponding variable for global default settings is @code{org-startup-folded}, with a default @@ -6924,7 +7057,7 @@ used by CUA-mode (as well as pc-select-mode and s-region-mode) to select and extend the region. If you want to use one of these packages along with Org-mode, configure the variable @code{org-CUA-compatible}. When set, Org-mode will move the following -keybindings in org-mode files, and in the agenda buffer (but not +keybindings in Org-mode files, and in the agenda buffer (but not during date selection). @example @@ -6944,7 +7077,7 @@ in the paragraph above about CUA mode also applies here. @item @file{footnote.el} by Steven L. Baur Org-mode supports the syntax of the footnote package, but only the numerical footnote markers. Also, the default key for footnote -commands, @kbd{C-c !} is already used by org-mode. You could use the +commands, @kbd{C-c !} is already used by Org-mode. You could use the variable @code{footnote-prefix} to switch footnotes commands to another key. Or, you could use @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change the settings in Org-mode. @@ -6999,13 +7132,14 @@ Org-mode. @menu * Extensions:: Existing 3rd-part extensions +* Adding hyperlink types:: New custom link types * Tables in arbitrary syntax:: Orgtbl for LaTeX and other programs * Dynamic blocks:: Automatically filled blocks * Special agenda views:: Customized views * Using the property API:: Writing programs that use entry properties @end menu -@node Extensions, Tables in arbitrary syntax, Extensions and Hacking, Extensions and Hacking +@node Extensions, Adding hyperlink types, Extensions and Hacking, Extensions and Hacking @section Third-party extensions for Org-mode @cindex extension, third-party @@ -7049,14 +7183,111 @@ Remind. @url{http://www.cognition.ens.fr/~guerry/u/org2rem.el}. @page -@node Tables in arbitrary syntax, Dynamic blocks, Extensions, Extensions and Hacking +@node Adding hyperlink types, Tables in arbitrary syntax, Extensions, Extensions and Hacking +@section Adding hyperlink types +@cindex hyperlinks, adding new types + +Org-mode has a large number of hyperlink types built-in +(@pxref{Hyperlinks}). If you would like to add new link types, it +provides an interface for doing so. Lets look at an example file +@file{org-man.el} that will add support for creating links like +@samp{[[man:printf][The printf manpage]]} to show unix manual pages inside +emacs: + +@lisp +;;; org-man.el - Support for links to manpages in Org-mode + +(require 'org) + +(org-add-link-type "man" 'org-man-open) +(add-hook 'org-store-link-functions 'org-man-store-link) + +(defcustom org-man-command 'man + "The Emacs command to be used to display a man page." + :group 'org-link + :type '(choice (const man) (const woman))) + +(defun org-man-open (path) + "Visit the manpage on PATH. +PATH should be a topic that can be thrown at the man command." + (funcall org-man-command path)) + +(defun org-man-store-link () + "Store a link to a manpage." + (when (memq major-mode '(Man-mode woman-mode)) + ;; This is a man page, we do make this link + (let* ((page (org-man-get-page-name)) + (link (concat "man:" page)) + (description (format "Manpage for %s" page))) + (org-store-link-props + :type "man" + :link link + :description description)))) + +(defun org-man-get-page-name () + "Extract the page name from the buffer name." + ;; This works for both `Man-mode' and `woman-mode'. + (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) + (match-string 1 (buffer-name)) + (error "Cannot create link to this man page"))) + +(provide 'org-man) + +;;; org-man.el ends here +@end lisp + +@noindent +You would activate this new link type in @file{.emacs} with + +@lisp +(require 'org-man) +@end lisp + +@noindent +Lets go through the file and see what it does. +@enumerate +@item +It does @code{(require 'org)} to make sure that @file{org.el} has been +loaded. +@item +The next line calls @code{org-add-link-type} to define a new link type +with prefix @samp{man}. The call also contains the name of a function +that will be called to follow such a link. +@item +The next line adds a function to @code{org-store-link-functions}, in +order to allow the command @kbd{C-c l} to record a useful link in a +buffer displaying a man page. +@end enumerate + +The rest of the file defines the necessary variables and functions. +First there is a customization variable that determines which emacs +command should be used to display manpages. There are two options, +@code{man} and @code{woman}. Then the function to follow a link is +defined. It gets the link path as an argument - in this case the link +path is just a topic for the manual command. The function calls the +value of @code{org-man-command} to display the man page. + +Finally the function @code{org-man-store-link} is defined. When you try +to store a link with @kbd{C-c l}, also this function will be called to +try to make a link. The function must first decide if it is supposed to +create the link for this buffer type, we do this by checking the value +of the variable @code{major-mode}. If not, the function must exit and +retunr the value @code{nil}. If yes, the link is created by getting the +manual tpoic from the buffer name and prefixing it with the string +@samp{man:}. Then it must call the command @code{org-store-link-props} +and set the @code{:type} and @code{:link} properties. Optionally you +can also set the @code{:description} property to provide a default for +the link description when the link is later inserted into tan Org-mode +buffer with @kbd{C-c C-l}. + +@node Tables in arbitrary syntax, Dynamic blocks, Adding hyperlink types, Extensions and Hacking @section Tables in arbitrary syntax @cindex tables, in other modes @cindex orgtbl-mode Since Orgtbl-mode can be used as a minor mode in arbitrary buffers, a frequent feature request has been to make it work with native tables in -specific languages, for example LaTeX. However, this is extremely hard +specific languages, for example La@TeX{}. However, this is extremely hard to do in a general way, would lead to a customization nightmare, and would take away much of the simplicity of the Orgtbl-mode table editor. @@ -7118,7 +7349,7 @@ additional columns. @noindent The one problem remaining is how to keep the source table in the buffer without disturbing the normal workings of the file, for example during -compilation of a C file or processing of a LaTeX file. There are a +compilation of a C file or processing of a La@TeX{} file. There are a number of different solutions: @itemize @bullet @@ -7129,7 +7360,7 @@ language. For example, in C-mode you could wrap the table between @item Sometimes it is possible to put the table after some kind of @i{END} statement, for example @samp{\bye} in TeX and @samp{\end@{document@}} -in LaTeX. +in La@TeX{}. @item You can just comment the table line by line whenever you want to process the file, and uncomment it whenever you need to edit the table. This @@ -7142,11 +7373,11 @@ key. @subsection A LaTeX example @cindex LaTeX, and orgtbl-mode -The best way to wrap the source table in LaTeX is to use the +The best way to wrap the source table in La@TeX{} is to use the @code{comment} environment provided by @file{comment.sty}. It has to be activated by placing @code{\usepackage@{comment@}} into the document header. Orgtbl-mode can insert a radio table skeleton@footnote{By -default this works only for LaTeX, HTML, and TeXInfo. Configure the +default this works only for La@TeX{}, HTML, and TeXInfo. Configure the variable @code{orgtbl-radio-tables} to install templates for other modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will be prompted for a table name, lets say we use @samp{salesfigures}. You @@ -7163,7 +7394,7 @@ will then get the following template: @noindent The @code{#+ORGTBL: SEND} line tells orgtbl-mode to use the function -@code{orgtbl-to-latex} to convert the table into LaTeX and to put it +@code{orgtbl-to-latex} to convert the table into La@TeX{} and to put it into the receiver location with name @code{salesfigures}. You may now fill in the table, feel free to use the spreadsheet features@footnote{If the @samp{#+TBLFM} line contains an odd number of dollar characters, @@ -7217,7 +7448,7 @@ Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\ \end@{comment@} @end example -The LaTeX translator function @code{orgtbl-to-latex} is already part of +The La@TeX{} translator function @code{orgtbl-to-latex} is already part of Orgtbl-mode. It uses a @code{tabular} environment to typeset the table and marks horizontal lines with @code{\hline}. Furthermore, it interprets the following parameters: @@ -7278,7 +7509,7 @@ As you can see, the properties passed into the function (variable @var{PARAMS}) are combined with the ones newly defined in the function (variable @var{PARAMS2}). The ones passed into the function (i.e. the ones set by the @samp{ORGTBL SEND} line) take precedence. So if you -would like to use the LaTeX translator, but wanted the line endings to +would like to use the La@TeX{} translator, but wanted the line endings to be @samp{\\[2mm]} instead of the default @samp{\\}, you could just overrule the default with @@ -7287,7 +7518,7 @@ overrule the default with @end example For a new language, you can either write your own converter function in -analogy with the LaTeX translator, or you can use the generic function +analogy with the La@TeX{} translator, or you can use the generic function directly. For example, if you have a language where a table is started with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are started with @samp{!BL!}, ended with @samp{!EL!} and where the field @@ -7407,28 +7638,51 @@ search should continue from there. subtree-end))) ; tag not found, continue after end of subtree @end lisp -Furthermore you must write a command that uses @code{let} to temporarily -put this function into the variable @code{org-agenda-skip-function}, -sets the header string for the agenda buffer, and calls the todo-list -generator while asking for the specific TODO keyword PROJECT. The -function must also accept one argument MATCH, but it can choose to -ignore it@footnote{MATCH must be present in case you want to define a -custom command for producing this special list. Custom commands always -supply the MATCH argument, but it can be empty if you do not specify it -while defining the command(@pxref{Custom agenda -views}).} (as we do in the example below). Here is the example: +Now you may use this function in an agenda custom command, for example +like this: @lisp -(defun my-org-waiting-projects (&optional match) - "Produce a list of projects that contain a WAITING tag. -MATCH is being ignored." - (interactive) - (let ((org-agenda-skip-function 'my-skip-unless-waiting) - (org-agenda-overriding-header "Projects waiting for something: ")) - ;; make the list - (org-todo-list "PROJECT"))) +(org-add-agenda-custom-command + '("b" todo "PROJECT" + ((org-agenda-skip-function 'my-org-waiting-projects) + (org-agenda-overriding-header "Projects waiting for something: ")))) @end lisp +Note that this also binds @code{org-agenda-overriding-header} to get a +meaningful header in the agenda view. + +You may also put a Lisp form into @code{org-agenda-skip-function}. In +particular, you may use the functions @code{org-agenda-skip-entry-if} +and @code{org-agenda-skip-subtree-if} in this form, for example: + +@table @code +@item '(org-agenda-skip-entry-if 'scheduled) +Skip current entry if it has been scheduled. +@item '(org-agenda-skip-entry-if 'notscheduled) +Skip current entry if it has not been scheduled. +@item '(org-agenda-skip-entry-if 'deadline) +Skip current entry if it has a deadline. +@item '(org-agenda-skip-entry-if 'scheduled 'deadline) +Skip current entry if it has a deadline, or if it is scheduled. +@item '(org-agenda-skip-entry 'regexp "regular expression") +Skip current entry if the regular expression contained in the variable +@code{org-agenda-skip-regexp} matches in the entry. +@item '(org-agenda-skip-subtree-if 'regexp "regular expression") +Same as above, but check and skip the entire subtree. +@end table + +Therefore we could also have written the search for WAITING projects +like this, even without defining a special function: + +@lisp +(org-add-agenda-custom-command + '("b" todo "PROJECT" + ((org-agenda-skip-function '(org-agenda-skip-subtree-if + 'regexp ":WAITING:")) + (org-agenda-overriding-header "Projects waiting for something: ")))) +@end lisp + + @node Using the property API, , Special agenda views, Extensions and Hacking @section Using the property API @cindex API, for properties @@ -7544,15 +7798,16 @@ around a match in a hidden outline tree. @item @i{Niels Giessen} had the idea to automatically archive DONE trees. @item -@i{Bastien Guerry} provided extensive feedback and some patches, and -translated David O'Toole's tutorial into French. +@i{Bastien Guerry} wrote the La@TeX{} exporter and has been prolific +with patches, ideas, and bug reports. +to Org-mode. @item @i{Kai Grossjohann} pointed out key-binding conflicts with other packages. @item @i{Scott Jaderholm} proposed footnotes, control over whitespace between folded entries, and column view for properties. @item -@i{Shidai Liu} ("Leo") asked for embedded LaTeX and tested it. He also +@i{Shidai Liu} ("Leo") asked for embedded La@TeX{} and tested it. He also provided frequent feedback and some patches. @item @i{Jason F. McBrayer} suggested agenda export to CSV format. @@ -7607,6 +7862,9 @@ subtrees. @item @i{Dale Smith} proposed link abbreviations. @item +@i{Adam Spiers} asked for global linking commands and inspired the link +extension system. support mairix. +@item @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual chapter about publishing. @item @@ -7625,6 +7883,7 @@ really different beasts in their basic ideas and implementation details. I later looked at John's code, however, and learned from his implementation of (i) links where the link itself is hidden and only a description is shown, and (ii) popping up a calendar to select a date. +John has also contributed a number of great ideas directly to Org-mode. @item @i{Carsten Wimmer} suggested some changes and helped fix a bug in linking to GNUS. diff --git a/orgcard.pdf b/orgcard.pdf index b64336246..f402b0db6 100644 Binary files a/orgcard.pdf and b/orgcard.pdf differ diff --git a/orgcard.tex b/orgcard.tex index 489741e45..b39aa622c 100644 --- a/orgcard.tex +++ b/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{5.04} +\def\orgversionnumber{5.05} \def\versionyear{2007} % latest update \def\year{2007} % latest copyright year