aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBastien Guerry2012-04-01 11:49:25 +0200
committerBastien Guerry2012-04-01 11:49:25 +0200
commit153ae947f845f6d4f31d3d239a1449899c3384f0 (patch)
treeb7ef6c7f4b94f4a4ee19eecd079c36aff84bddc5
parent42ee526b1adbe2ba7766203980a9d7089aae1a68 (diff)
downloademacs-153ae947f845f6d4f31d3d239a1449899c3384f0.tar.gz
emacs-153ae947f845f6d4f31d3d239a1449899c3384f0.zip
Update to Org version 7.8.07 (commit da0e6f in Org's repo)
-rw-r--r--doc/misc/ChangeLog112
-rw-r--r--doc/misc/org.texi597
-rw-r--r--etc/ChangeLog8
-rw-r--r--etc/org/OrgOdtContentTemplate.xml55
-rw-r--r--etc/org/OrgOdtStyles.xml66
-rw-r--r--etc/org/README2
-rw-r--r--etc/refcards/orgcard.pdfbin81199 -> 118613 bytes
-rw-r--r--etc/refcards/orgcard.tex6
-rw-r--r--lisp/org/ChangeLog1439
-rw-r--r--lisp/org/ob-C.el4
-rw-r--r--lisp/org/ob-R.el3
-rw-r--r--lisp/org/ob-clojure.el5
-rw-r--r--lisp/org/ob-ditaa.el18
-rw-r--r--lisp/org/ob-emacs-lisp.el14
-rw-r--r--lisp/org/ob-exp.el134
-rw-r--r--lisp/org/ob-fortran.el25
-rw-r--r--lisp/org/ob-lilypond.el16
-rw-r--r--lisp/org/ob-lob.el12
-rw-r--r--lisp/org/ob-maxima.el9
-rw-r--r--lisp/org/ob-sql.el1
-rw-r--r--lisp/org/ob-sqlite.el9
-rw-r--r--lisp/org/ob-table.el7
-rw-r--r--lisp/org/ob-tangle.el10
-rw-r--r--lisp/org/ob.el199
-rw-r--r--lisp/org/org-agenda.el68
-rw-r--r--lisp/org/org-ascii.el4
-rw-r--r--lisp/org/org-attach.el2
-rw-r--r--lisp/org/org-bbdb.el26
-rw-r--r--lisp/org/org-beamer.el48
-rw-r--r--lisp/org/org-bibtex.el6
-rw-r--r--lisp/org/org-capture.el46
-rw-r--r--lisp/org/org-clock.el18
-rw-r--r--lisp/org/org-colview.el25
-rw-r--r--lisp/org/org-crypt.el16
-rw-r--r--lisp/org/org-eshell.el1
-rw-r--r--lisp/org/org-exp-blocks.el17
-rw-r--r--lisp/org/org-exp.el34
-rw-r--r--lisp/org/org-footnote.el167
-rw-r--r--lisp/org/org-habit.el26
-rw-r--r--lisp/org/org-html.el6
-rw-r--r--lisp/org/org-indent.el1
-rw-r--r--lisp/org/org-latex.el66
-rw-r--r--lisp/org/org-list.el86
-rw-r--r--lisp/org/org-lparse.el215
-rw-r--r--lisp/org/org-mouse.el8
-rw-r--r--lisp/org/org-odt.el650
-rw-r--r--lisp/org/org-protocol.el13
-rw-r--r--lisp/org/org-special-blocks.el12
-rw-r--r--lisp/org/org-src.el46
-rw-r--r--lisp/org/org-table.el16
-rw-r--r--lisp/org/org.el376
51 files changed, 3471 insertions, 1279 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 8d40ab5ab15..6c8a9d29c2e 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,115 @@
12012-04-01 Jambunathan K <kjambunathan@gmail.com>
2
3 * org.texi (Customizing tables in ODT export): Correct few errors.
4
52012-04-01 Jambunathan K <kjambunathan@gmail.com>
6
7 * org.texi (Links in ODT export): Update.
8 (Labels and captions in ODT export): New node.
9
102012-04-01 Jambunathan K <kjambunathan@gmail.com>
11
12 * org.texi (Literal examples in ODT export): htmlfontify.el in
13 Emacs-24.1 now supports fontification. So ODT source blocks will
14 be fontified by default.
15
162012-04-01 Julian Gehring <julian.gehring@googlemail.com> (tiny change)
17
18 * org.texi (Refiling notes): Remove duplicated keybinding.
19
202012-04-01 Eric Schulte <eric.schulte@gmx.com>
21
22 * org.texi (noweb): Documentation of this new option to the :noweb
23 header argument.
24
252012-04-01 Suvayu Ali <fatkasuvayu+linux@gmail.com>
26
27 * org.texi (Header and sectioning): Add example demonstrating how
28 to use "LaTeX_CLASS_OPTIONS".
29
302012-04-01 Eric Schulte <eric.schulte@gmx.com>
31
32 * org.texi (Noweb reference syntax): Describe the ability to
33 execute noweb references in the manual.
34
352012-04-01 Eric Schulte <eric.schulte@gmx.com>
36
37 * org.texi (cache): Improve cache documentation when session
38 evaluation is used.
39
402012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
41
42 * org.texi (Plain lists): Document removal.
43
442012-04-01 Michael Brand <michael.ch.brand@gmail.com>
45
46 * org.texi: Decapitalize file name in references to Calc manual.
47
482012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
49
50 * org.texi (Plain lists): Document removal.
51
522012-04-01 Jambunathan K <kjambunathan@gmail.com>
53
54 * org.texi (Top, OpenDocument Text export)
55 (ODT export commands, Extending ODT export)
56 (Images in ODT export, Tables in ODT export)
57 (Configuring a document converter): Add or Update.
58
592012-04-01 Carsten Dominik <carsten.dominik@gmail.com>
60
61 * org.texi (MobileOrg): Change the wording to reflect that the
62 Android Version is no longer just the little brother of the iOS
63 version.
64
652012-04-01 Eric Schulte <eric.schulte@gmx.com>
66
67 * org.texi (Key bindings and useful functions): Updated babel key
68 binding documentation in manual.
69
702012-04-01 Eric Schulte <eric.schulte@gmx.com>
71
72 * org.texi (noweb): Document new noweb header value.
73
742012-04-01 Eric Schulte <eric.schulte@gmx.com>
75
76 * org.texi (noweb-sep): Document new header argument.
77
782012-04-01 Eric Schulte <eric.schulte@gmx.com>
79
80 * org.texi (noweb-ref): Documentation of this new custom variable.
81
822012-04-01 Eric Schulte <eric.schulte@gmx.com>
83
84 * org.texi (wrap): Update the new :wrap documentation to match the
85 current implementation.
86
872012-04-01 Thomas Dye <dk@poto.myhome.westell.com>
88
89 * org.texi: Added documentation for :wrap.
90
912012-04-01 Thomas Dye <dk@poto.myhome.westell.com>
92
93 * org.texi: #+RESULTS now user-configurable.
94
952012-04-01 Thomas Dye <dk@poto.myhome.westell.com>
96
97 * org.texi: Documented :noweb no-export.
98
992012-04-01 Thomas Dye <dk@poto.local>
100
101 * org.texi: Edit :noweb no header argument for correctness.
102
1032012-04-01 Bastien Guerry <bzg@altern.org>
104
105 * org.texi (Customization): Update the approximate number of Org
106 variables.
107
1082012-04-01 Thomas Dye <dk@poto.local>
109
110 * org.texi: The :results wrap produces a drawer instead of a
111 begin_results block.
112
12012-03-22 Peder O. Klingenberg <peder@klingenberg.no> (tiny change) 1132012-03-22 Peder O. Klingenberg <peder@klingenberg.no> (tiny change)
2 114
3 * gnus.texi (Archived Messages): Update `gnus-message-archive-group' to 115 * gnus.texi (Archived Messages): Update `gnus-message-archive-group' to
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index 2a41d6b9301..ab9de71277f 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -4,8 +4,8 @@
4@setfilename ../../info/org 4@setfilename ../../info/org
5@settitle The Org Manual 5@settitle The Org Manual
6 6
7@set VERSION 7.8.03 7@set VERSION 7.8.07
8@set DATE January 2012 8@set DATE March 2012
9 9
10@c Use proper quote and backtick for code sections in PDF output 10@c Use proper quote and backtick for code sections in PDF output
11@c Cf. Texinfo manual 14.2 11@c Cf. Texinfo manual 14.2
@@ -265,7 +265,7 @@
265@copying 265@copying
266This manual is for Org version @value{VERSION}. 266This manual is for Org version @value{VERSION}.
267 267
268Copyright @copyright{} 2004-2012 Free Software Foundation, Inc. 268Copyright @copyright{} 2004-2011 Free Software Foundation, Inc.
269 269
270@quotation 270@quotation
271Permission is granted to copy, distribute and/or modify this document 271Permission is granted to copy, distribute and/or modify this document
@@ -612,27 +612,29 @@ DocBook export
612 612
613OpenDocument Text export 613OpenDocument Text export
614 614
615* Pre-requisites for @acronym{ODT} export:: What packages @acronym{ODT} exporter relies on 615* Pre-requisites for ODT export:: What packages ODT exporter relies on
616* @acronym{ODT} export commands:: How to invoke @acronym{ODT} export 616* ODT export commands:: How to invoke ODT export
617* Extending ODT export:: How to produce @samp{doc}, @samp{pdf} files
617* Applying custom styles:: How to apply custom styles to the output 618* Applying custom styles:: How to apply custom styles to the output
618* Links in @acronym{ODT} export:: How links will be interpreted and formatted 619* Links in ODT export:: How links will be interpreted and formatted
619* Tables in @acronym{ODT} export:: How Tables are exported 620* Tables in ODT export:: How Tables are exported
620* Images in @acronym{ODT} export:: How to insert images 621* Images in ODT export:: How to insert images
621* Math formatting in @acronym{ODT} export:: How @LaTeX{} fragments are formatted 622* Math formatting in ODT export:: How @LaTeX{} fragments are formatted
622* Literal examples in @acronym{ODT} export:: How source and example blocks are formatted 623* Labels and captions in ODT export:: How captions are rendered
623* Advanced topics in @acronym{ODT} export:: Read this if you are a power user 624* Literal examples in ODT export:: How source and example blocks are formatted
625* Advanced topics in ODT export:: Read this if you are a power user
624 626
625Math formatting in @acronym{ODT} export 627Math formatting in ODT export
626 628
627* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments 629* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments
628* Working with MathML or OpenDocument formula files:: How to embed equations in native format 630* Working with MathML or OpenDocument formula files:: How to embed equations in native format
629 631
630Advanced topics in @acronym{ODT} export 632Advanced topics in ODT export
631 633
632* Exporting and converting to other formats:: How to produce @samp{pdf} and other formats 634* Configuring a document converter:: How to register a document converter
633* Working with OpenDocument style files:: Explore the internals 635* Working with OpenDocument style files:: Explore the internals
634* Creating one-off styles:: How to produce custom highlighting etc 636* Creating one-off styles:: How to produce custom highlighting etc
635* Customizing tables in @acronym{ODT} export:: How to define and use Table templates 637* Customizing tables in ODT export:: How to define and use Table templates
636* Validating OpenDocument XML:: How to debug corrupt OpenDocument files 638* Validating OpenDocument XML:: How to debug corrupt OpenDocument files
637 639
638Publishing 640Publishing
@@ -708,6 +710,7 @@ Specific header arguments
708* session:: Preserve the state of code evaluation 710* session:: Preserve the state of code evaluation
709* noweb:: Toggle expansion of noweb references 711* noweb:: Toggle expansion of noweb references
710* noweb-ref:: Specify block's noweb reference resolution target 712* noweb-ref:: Specify block's noweb reference resolution target
713* noweb-sep:: String used to separate noweb references
711* cache:: Avoid re-evaluating unchanged code blocks 714* cache:: Avoid re-evaluating unchanged code blocks
712* sep:: Delimiter for writing tabular results outside Org 715* sep:: Delimiter for writing tabular results outside Org
713* hlines:: Handle horizontal lines in tables 716* hlines:: Handle horizontal lines in tables
@@ -1004,7 +1007,7 @@ from within Emacs, please copy and paste the content into your Email program.
1004 1007
1005Sometimes you might face a problem due to an error in your Emacs or Org mode 1008Sometimes you might face a problem due to an error in your Emacs or Org mode
1006setup. Before reporting a bug, it is very helpful to start Emacs with minimal 1009setup. Before reporting a bug, it is very helpful to start Emacs with minimal
1007customizations and reproduce the problem. Doing so often helps you determine 1010customisations and reproduce the problem. Doing so often helps you determine
1008if the problem is with your customization or with Org mode itself. You can 1011if the problem is with your customization or with Org mode itself. You can
1009start a typical minimal session with a command like the example below. 1012start a typical minimal session with a command like the example below.
1010 1013
@@ -1435,8 +1438,7 @@ creation time, scheduled time, deadline time), by priority, by TODO keyword
1435(in the sequence the keywords have been defined in the setup) or by the value 1438(in the sequence the keywords have been defined in the setup) or by the value
1436of a property. Reverse sorting is possible as well. You can also supply 1439of a property. Reverse sorting is possible as well. You can also supply
1437your own function to extract the sorting key. With a @kbd{C-u} prefix, 1440your own function to extract the sorting key. With a @kbd{C-u} prefix,
1438sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes, duplicate 1441sorting will be case-sensitive.
1439entries will also be removed.
1440@orgcmd{C-x n s,org-narrow-to-subtree} 1442@orgcmd{C-x n s,org-narrow-to-subtree}
1441Narrow buffer to current subtree. 1443Narrow buffer to current subtree.
1442@orgcmd{C-x n b,org-narrow-to-block} 1444@orgcmd{C-x n b,org-narrow-to-block}
@@ -1587,16 +1589,11 @@ line. In particular, if an ordered list reaches number @samp{10.}, then the
1587list. An item ends before the next line that is less or equally indented 1589list. An item ends before the next line that is less or equally indented
1588than its bullet/number. 1590than its bullet/number.
1589 1591
1590@vindex org-list-ending-method
1591@vindex org-list-end-regexp
1592@vindex org-empty-line-terminates-plain-lists 1592@vindex org-empty-line-terminates-plain-lists
1593Two methods@footnote{To disable either of them, configure 1593A list ends whenever every item has ended, which means before any line less
1594@code{org-list-ending-method}.} are provided to terminate lists. A list ends 1594or equally indented than items at top level. It also ends before two blank
1595whenever every item has ended, which means before any line less or equally
1596indented than items at top level. It also ends before two blank
1597lines@footnote{See also @code{org-empty-line-terminates-plain-lists}.}. In 1595lines@footnote{See also @code{org-empty-line-terminates-plain-lists}.}. In
1598that case, all items are closed. For finer control, you can end lists with 1596that case, all items are closed. Here is an example:
1599any pattern set in @code{org-list-end-regexp}. Here is an example:
1600 1597
1601@example 1598@example
1602@group 1599@group
@@ -1949,13 +1946,7 @@ item.
1949 1946
1950Org comes with a fast and intuitive table editor. Spreadsheet-like 1947Org comes with a fast and intuitive table editor. Spreadsheet-like
1951calculations are supported using the Emacs @file{calc} package 1948calculations are supported using the Emacs @file{calc} package
1952@ifinfo 1949(@pxref{Top, Calc, , calc, Gnu Emacs Calculator Manual}).
1953(@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
1954@end ifinfo
1955@ifnotinfo
1956(see the Emacs Calculator manual for more information about the Emacs
1957calculator).
1958@end ifnotinfo
1959 1950
1960@menu 1951@menu
1961* Built-in table editor:: Simple tables 1952* Built-in table editor:: Simple tables
@@ -2253,7 +2244,8 @@ of columns, much like horizontal lines can do for groups of rows. In
2253order to specify column groups, you can use a special row where the 2244order to specify column groups, you can use a special row where the
2254first field contains only @samp{/}. The further fields can either 2245first field contains only @samp{/}. The further fields can either
2255contain @samp{<} to indicate that this column should start a group, 2246contain @samp{<} to indicate that this column should start a group,
2256@samp{>} to indicate the end of a column, or @samp{<>} to make a column 2247@samp{>} to indicate the end of a column, or @samp{<>} (no space between @samp{<}
2248and @samp{>}) to make a column
2257a group of its own. Boundaries between column groups will upon export be 2249a group of its own. Boundaries between column groups will upon export be
2258marked with vertical lines. Here is an example: 2250marked with vertical lines. Here is an example:
2259 2251
@@ -2515,9 +2507,8 @@ A formula can be any algebraic expression understood by the Emacs
2515non-standard convention that @samp{/} has lower precedence than 2507non-standard convention that @samp{/} has lower precedence than
2516@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before 2508@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before
2517evaluation by @code{calc-eval} (@pxref{Calling Calc from 2509evaluation by @code{calc-eval} (@pxref{Calling Calc from
2518Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU 2510Your Programs, calc-eval, Calling Calc from Your Lisp Programs, calc, GNU
2519Emacs Calc Manual}), 2511Emacs Calc Manual}),
2520@c FIXME: The link to the Calc manual in HTML does not work.
2521variable substitution takes place according to the rules described above. 2512variable substitution takes place according to the rules described above.
2522@cindex vectors, in table calculations 2513@cindex vectors, in table calculations
2523The range vectors can be directly fed into the Calc vector functions 2514The range vectors can be directly fed into the Calc vector functions
@@ -5407,10 +5398,11 @@ the settings. This has been the source of much confusion. Org mode users
5407can resort to special versions of these functions like @code{org-date} or 5398can resort to special versions of these functions like @code{org-date} or
5408@code{org-anniversary}. These work just like the corresponding @code{diary-} 5399@code{org-anniversary}. These work just like the corresponding @code{diary-}
5409functions, but with stable ISO order of arguments (year, month, day) wherever 5400functions, but with stable ISO order of arguments (year, month, day) wherever
5410applicable, independent of the value of @code{calendar-date-style}.}. For example 5401applicable, independent of the value of @code{calendar-date-style}.}. For
5402example with optional time
5411 5403
5412@example 5404@example
5413* The nerd meeting on every 2nd Thursday of the month 5405* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
5414 <%%(org-float t 4 2)> 5406 <%%(org-float t 4 2)>
5415@end example 5407@end example
5416 5408
@@ -6162,7 +6154,7 @@ applying it to another one.
6162By customizing the variable @code{org-clock-idle-time} to some integer, such 6154By customizing the variable @code{org-clock-idle-time} to some integer, such
6163as 10 or 15, Emacs can alert you when you get back to your computer after 6155as 10 or 15, Emacs can alert you when you get back to your computer after
6164being idle for that many minutes@footnote{On computers using Mac OS X, 6156being idle for that many minutes@footnote{On computers using Mac OS X,
6165idleness is based on actual user idleness, not just Emacs's idle time. For 6157idleness is based on actual user idleness, not just Emacs' idle time. For
6166X11, you can install a utility program @file{x11idle.c}, available in the 6158X11, you can install a utility program @file{x11idle.c}, available in the
6167UTILITIES directory of the Org git distribution, to get the same general 6159UTILITIES directory of the Org git distribution, to get the same general
6168treatment of idleness. On other systems, idle time refers to Emacs idle time 6160treatment of idleness. On other systems, idle time refers to Emacs idle time
@@ -6905,10 +6897,7 @@ Use the refile interface to jump to a heading.
6905Jump to the location where @code{org-refile} last moved a tree to. 6897Jump to the location where @code{org-refile} last moved a tree to.
6906@item C-2 C-c C-w 6898@item C-2 C-c C-w
6907Refile as the child of the item currently being clocked. 6899Refile as the child of the item currently being clocked.
6908@item C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w
6909
6910@orgcmdtkc{C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w,C-0 C-c C-w,org-refile-cache-clear} 6900@orgcmdtkc{C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w,C-0 C-c C-w,org-refile-cache-clear}
6911
6912Clear the target cache. Caching of refile targets can be turned on by 6901Clear the target cache. Caching of refile targets can be turned on by
6913setting @code{org-refile-use-cache}. To make the command see new possible 6902setting @code{org-refile-use-cache}. To make the command see new possible
6914targets, you have to clear the cache with this command. 6903targets, you have to clear the cache with this command.
@@ -9548,7 +9537,7 @@ the web, while the XOXO format provides a solid base for exchange with a
9548broad range of other applications. @LaTeX{} export lets you use Org mode and 9537broad range of other applications. @LaTeX{} export lets you use Org mode and
9549its structured editing functions to easily create @LaTeX{} files. DocBook 9538its structured editing functions to easily create @LaTeX{} files. DocBook
9550export makes it possible to convert Org files to many other formats using 9539export makes it possible to convert Org files to many other formats using
9551DocBook tools. OpenDocument Text(@acronym{ODT}) export allows seamless 9540DocBook tools. OpenDocument Text(ODT) export allows seamless
9552collaboration across organizational boundaries. For project management you 9541collaboration across organizational boundaries. For project management you
9553can create gantt and resource charts by using TaskJuggler export. To 9542can create gantt and resource charts by using TaskJuggler export. To
9554incorporate entries with associated times like deadlines or appointments into 9543incorporate entries with associated times like deadlines or appointments into
@@ -10803,34 +10792,36 @@ special characters included in XHTML entities:
10803@cindex org-modules 10792@cindex org-modules
10804 10793
10805Orgmode@footnote{Versions 7.8 or later} supports export to OpenDocument Text 10794Orgmode@footnote{Versions 7.8 or later} supports export to OpenDocument Text
10806(@acronym{ODT}) format using the @file{org-odt.el} module. Documents created 10795(ODT) format using the @file{org-odt.el} module. Documents created
10807by this exporter use the @cite{OpenDocument-v1.2 10796by this exporter use the @cite{OpenDocument-v1.2
10808specification}@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, 10797specification}@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html,
10809Open Document Format for Office Applications (OpenDocument) Version 1.2}} and 10798Open Document Format for Office Applications (OpenDocument) Version 1.2}} and
10810are compatible with LibreOffice 3.4. 10799are compatible with LibreOffice 3.4.
10811 10800
10812@menu 10801@menu
10813* Pre-requisites for @acronym{ODT} export:: What packages @acronym{ODT} exporter relies on 10802* Pre-requisites for ODT export:: What packages ODT exporter relies on
10814* @acronym{ODT} export commands:: How to invoke @acronym{ODT} export 10803* ODT export commands:: How to invoke ODT export
10804* Extending ODT export:: How to produce @samp{doc}, @samp{pdf} files
10815* Applying custom styles:: How to apply custom styles to the output 10805* Applying custom styles:: How to apply custom styles to the output
10816* Links in @acronym{ODT} export:: How links will be interpreted and formatted 10806* Links in ODT export:: How links will be interpreted and formatted
10817* Tables in @acronym{ODT} export:: How Tables are exported 10807* Tables in ODT export:: How Tables are exported
10818* Images in @acronym{ODT} export:: How to insert images 10808* Images in ODT export:: How to insert images
10819* Math formatting in @acronym{ODT} export:: How @LaTeX{} fragments are formatted 10809* Math formatting in ODT export:: How @LaTeX{} fragments are formatted
10820* Literal examples in @acronym{ODT} export:: How source and example blocks are formatted 10810* Labels and captions in ODT export:: How captions are rendered
10821* Advanced topics in @acronym{ODT} export:: Read this if you are a power user 10811* Literal examples in ODT export:: How source and example blocks are formatted
10812* Advanced topics in ODT export:: Read this if you are a power user
10822@end menu 10813@end menu
10823 10814
10824@node Pre-requisites for @acronym{ODT} export, @acronym{ODT} export commands, OpenDocument Text export, OpenDocument Text export 10815@node Pre-requisites for ODT export, ODT export commands, OpenDocument Text export, OpenDocument Text export
10825@subsection Pre-requisites for @acronym{ODT} export 10816@subsection Pre-requisites for ODT export
10826@cindex zip 10817@cindex zip
10827The @acronym{ODT} exporter relies on the @file{zip} program to create the final 10818The ODT exporter relies on the @file{zip} program to create the final
10828output. Check the availability of this program before proceeding further. 10819output. Check the availability of this program before proceeding further.
10829 10820
10830@node @acronym{ODT} export commands, Applying custom styles, Pre-requisites for @acronym{ODT} export, OpenDocument Text export 10821@node ODT export commands, Extending ODT export, Pre-requisites for ODT export, OpenDocument Text export
10831@subsection @acronym{ODT} export commands 10822@subsection ODT export commands
10832 10823
10833@subsubheading Exporting to @acronym{ODT} 10824@subsubheading Exporting to ODT
10834@anchor{x-export-to-odt} 10825@anchor{x-export-to-odt}
10835 10826
10836@cindex region, active 10827@cindex region, active
@@ -10841,12 +10832,13 @@ output. Check the availability of this program before proceeding further.
10841@cindex property EXPORT_FILE_NAME 10832@cindex property EXPORT_FILE_NAME
10842 10833
10843Export as OpenDocument Text file. 10834Export as OpenDocument Text file.
10835
10844@vindex org-export-odt-preferred-output-format 10836@vindex org-export-odt-preferred-output-format
10845If @code{org-export-odt-preferred-output-format} is specified, automatically 10837If @code{org-export-odt-preferred-output-format} is specified, automatically
10846convert the exported file to that format. 10838convert the exported file to that format. @xref{x-export-to-other-formats, ,
10847@xref{x-export-to-other-formats,,Automatically exporting to other formats}. 10839Automatically exporting to other formats}.
10848 10840
10849For an Org file @file{myfile.org}, the @acronym{ODT} file will be 10841For an Org file @file{myfile.org}, the ODT file will be
10850@file{myfile.odt}. The file will be overwritten without warning. If there 10842@file{myfile.odt}. The file will be overwritten without warning. If there
10851is an active region,@footnote{This requires @code{transient-mark-mode} to be 10843is an active region,@footnote{This requires @code{transient-mark-mode} to be
10852turned on} only the region will be exported. If the selected region is a 10844turned on} only the region will be exported. If the selected region is a
@@ -10857,30 +10849,66 @@ export.
10857 10849
10858@orgcmd{C-c C-e O,org-export-as-odt-and-open} 10850@orgcmd{C-c C-e O,org-export-as-odt-and-open}
10859Export as OpenDocument Text file and open the resulting file. 10851Export as OpenDocument Text file and open the resulting file.
10852
10860@vindex org-export-odt-preferred-output-format 10853@vindex org-export-odt-preferred-output-format
10861If @code{org-export-odt-preferred-output-format} is specified, open the 10854If @code{org-export-odt-preferred-output-format} is specified, open the
10862converted file instead. 10855converted file instead. @xref{x-export-to-other-formats, , Automatically
10863@xref{x-export-to-other-formats,,Automatically exporting to other formats}. 10856exporting to other formats}.
10864@end table 10857@end table
10865 10858
10866@subsubheading Automatically exporting to other formats 10859@node Extending ODT export, Applying custom styles, ODT export commands, OpenDocument Text export
10860@subsection Extending ODT export
10861
10862The ODT exporter can interface with a variety of document
10863converters and supports popular converters out of the box. As a result, you
10864can use it to export to formats like @samp{doc} or convert a document from
10865one format (say @samp{csv}) to another format (say @samp{ods} or @samp{xls}).
10866
10867@cindex @file{unoconv}
10868@cindex LibreOffice
10869If you have a working installation of LibreOffice, a document converter is
10870pre-configured for you and you can use it right away. If you would like to
10871use @file{unoconv} as your preferred converter, customize the variable
10872@code{org-export-odt-convert-process} to point to @code{unoconv}. If you
10873would like to use a converter of your own choosing or tweak the default
10874settings of the default @file{LibreOffice} and @samp{unoconv} converters
10875@xref{Configuring a document converter}.
10876
10877@subsubsection Automatically exporting to other formats
10867@anchor{x-export-to-other-formats} 10878@anchor{x-export-to-other-formats}
10879
10868@vindex org-export-odt-preferred-output-format 10880@vindex org-export-odt-preferred-output-format
10869Very often, you will find yourself exporting to @acronym{ODT} format, only to 10881Very often, you will find yourself exporting to ODT format, only to
10870immediately save the exported document to a different format like @samp{pdf}. 10882immediately save the exported document to other formats like @samp{doc},
10871In such cases, you will find it convenient to configure a converter 10883@samp{docx}, @samp{rtf}, @samp{pdf} etc. In such cases, you can specify your
10872(@pxref{Exporting and converting to other formats}) and specify your
10873preferred output format by customizing the variable 10884preferred output format by customizing the variable
10874@code{org-export-odt-preferred-output-format}. This way, the export commands 10885@code{org-export-odt-preferred-output-format}. This way, the export commands
10875(@pxref{x-export-to-odt,,Exporting to ODT}) can be extended to also export to 10886(@pxref{x-export-to-odt,,Exporting to ODT}) can be extended to export to a
10876the preferred format. 10887format that is of immediate interest to you.
10888
10889@subsubsection Converting between document formats
10890@anchor{x-convert-to-other-formats}
10891
10892There are many document converters in the wild which support conversion to
10893and from various file formats, including, but not limited to the
10894ODT format. LibreOffice converter, mentioned above, is one such
10895converter. Once a converter is configured, you can interact with it using
10896the following command.
10877 10897
10878@node Applying custom styles, Links in @acronym{ODT} export, @acronym{ODT} export commands, OpenDocument Text export 10898@vindex org-export-odt-convert
10899@table @kbd
10900
10901@item M-x org-export-odt-convert
10902Convert an existing document from one format to another. With a prefix
10903argument, also open the newly produced file.
10904@end table
10905
10906@node Applying custom styles, Links in ODT export, Extending ODT export, OpenDocument Text export
10879@subsection Applying custom styles 10907@subsection Applying custom styles
10880@cindex styles, custom 10908@cindex styles, custom
10881@cindex template, custom 10909@cindex template, custom
10882 10910
10883The @acronym{ODT} exporter ships with a set of OpenDocument styles 10911The ODT exporter ships with a set of OpenDocument styles
10884(@pxref{Working with OpenDocument style files}) that ensure a well-formatted 10912(@pxref{Working with OpenDocument style files}) that ensure a well-formatted
10885output. These factory styles, however, may not cater to your specific 10913output. These factory styles, however, may not cater to your specific
10886tastes. To customize the output, you can either modify the above styles 10914tastes. To customize the output, you can either modify the above styles
@@ -10893,7 +10921,7 @@ users alike, and is described here.
10893@enumerate 10921@enumerate
10894@item 10922@item
10895Create a sample @file{example.org} file with the below settings and export it 10923Create a sample @file{example.org} file with the below settings and export it
10896to @acronym{ODT} format. 10924to ODT format.
10897 10925
10898@example 10926@example
10899#+OPTIONS: H:10 num:t 10927#+OPTIONS: H:10 num:t
@@ -10936,15 +10964,22 @@ met, the output is going to be less than satisfactory. So it is highly
10936recommended that you only work with templates that are directly derived from 10964recommended that you only work with templates that are directly derived from
10937the factory settings. 10965the factory settings.
10938 10966
10939@node Links in @acronym{ODT} export, Tables in @acronym{ODT} export, Applying custom styles, OpenDocument Text export 10967@node Links in ODT export, Tables in ODT export, Applying custom styles, OpenDocument Text export
10940@subsection Links in @acronym{ODT} export 10968@subsection Links in ODT export
10941@cindex tables, in DocBook export 10969@cindex tables, in DocBook export
10942 10970
10943The @acronym{ODT} exporter creates cross-references (aka bookmarks) for 10971ODT exporter creates native cross-references for internal links. It creates
10944internal links. It creates Internet-style links for all other links. 10972Internet-style links for all other links.
10973
10974A link with no description and destined to a regular (un-itemized) outline
10975heading is replaced with a cross-reference and section number of the heading.
10945 10976
10946@node Tables in @acronym{ODT} export, Images in @acronym{ODT} export, Links in @acronym{ODT} export, OpenDocument Text export 10977A @samp{\ref@{label@}}-style reference to an image, table etc. is replaced
10947@subsection Tables in @acronym{ODT} export 10978with a cross-reference and sequence number of the labelled entity.
10979@xref{Labels and captions in ODT export}.
10980
10981@node Tables in ODT export, Images in ODT export, Links in ODT export, OpenDocument Text export
10982@subsection Tables in ODT export
10948@cindex tables, in DocBook export 10983@cindex tables, in DocBook export
10949 10984
10950Export of native Org mode tables (@pxref{Tables}) and simple @file{table.el} 10985Export of native Org mode tables (@pxref{Tables}) and simple @file{table.el}
@@ -10952,21 +10987,47 @@ tables is supported. However, export of complex @file{table.el} tables -
10952tables that have column or row spans - is not supported. Such tables are 10987tables that have column or row spans - is not supported. Such tables are
10953stripped from the exported document. 10988stripped from the exported document.
10954 10989
10955By default, a table is exported with top and bottom frames and with 10990By default, a table is exported with top and bottom frames and with rules
10956rules separating row and column groups (@pxref{Column groups}). If the table 10991separating row and column groups (@pxref{Column groups}). Furthermore, all
10957specifies alignment and relative width for its columns (@pxref{Column width 10992tables are typeset to occupy the same width. If the table specifies
10958and alignment}) then these are honored on export.@footnote{The column widths 10993alignment and relative width for its columns (@pxref{Column width and
10959are interpreted as weighted ratios with the default weight being 1} 10994alignment}) then these are honored on export.@footnote{The column widths are
10995interpreted as weighted ratios with the default weight being 1}
10960 10996
10961@cindex #+ATTR_ODT 10997@cindex #+ATTR_ODT
10962If you are not satisfied with the default formatting of tables, you can 10998You can control the width of the table by specifying @code{:rel-width}
10963create custom table styles and associate them with a table using 10999property using an @code{#+ATTR_ODT} line.
10964the @code{#+ATTR_ODT} line. @xref{Customizing tables in @acronym{ODT} export}. 11000
11001For example, consider the following table which makes use of all the rules
11002mentoned above.
11003
11004@example
11005#+ATTR_ODT: :rel-width 50
11006| Area/Month | Jan | Feb | Mar | Sum |
11007|---------------+-------+-------+-------+-------|
11008| / | < | | | < |
11009| <l13> | <r5> | <r5> | <r5> | <r6> |
11010| North America | 1 | 21 | 926 | 948 |
11011| Middle East | 6 | 75 | 844 | 925 |
11012| Asia Pacific | 9 | 27 | 790 | 826 |
11013|---------------+-------+-------+-------+-------|
11014| Sum | 16 | 123 | 2560 | 2699 |
11015@end example
11016
11017On export, the table will occupy 50% of text area. The columns will be sized
11018(roughly) in the ratio of 13:5:5:5:6. The first column will be left-aligned
11019and rest of the columns will be right-aligned. There will be vertical rules
11020after separating the header and last columns from other columns. There will
11021be horizontal rules separating the header and last rows from other rows.
11022
11023If you are not satisfied with the above formatting options, you can create
11024custom table styles and associate them with a table using the
11025@code{#+ATTR_ODT} line. @xref{Customizing tables in ODT export}.
10965 11026
10966@node Images in @acronym{ODT} export, Math formatting in @acronym{ODT} export, Tables in @acronym{ODT} export, OpenDocument Text export 11027@node Images in ODT export, Math formatting in ODT export, Tables in ODT export, OpenDocument Text export
10967@subsection Images in @acronym{ODT} export 11028@subsection Images in ODT export
10968@cindex images, embedding in @acronym{ODT} 11029@cindex images, embedding in ODT
10969@cindex embedding images in @acronym{ODT} 11030@cindex embedding images in ODT
10970 11031
10971@subsubheading Embedding images 11032@subsubheading Embedding images
10972You can embed images within the exported document by providing a link to the 11033You can embed images within the exported document by providing a link to the
@@ -10993,14 +11054,21 @@ link to an image file. For example, to embed a image
10993 11054
10994@subsubheading Sizing and scaling of embedded images 11055@subsubheading Sizing and scaling of embedded images
10995 11056
11057@cindex #+ATTR_ODT
10996You can control the size and scale of the embedded images using the 11058You can control the size and scale of the embedded images using the
10997@code{#+ATTR_ODT} attribute. 11059@code{#+ATTR_ODT} attribute.
10998 11060
11061@cindex identify, ImageMagick
10999@vindex org-export-odt-pixels-per-inch 11062@vindex org-export-odt-pixels-per-inch
11000Note that the exporter specifies the desired size of the image in the final 11063The exporter specifies the desired size of the image in the final document in
11001document in units of centimeters. In order to scale the embedded images, the 11064units of centimeters. In order to scale the embedded images, the exporter
11002exporter needs to compute the size of the image. This is done by retrieving 11065queries for pixel dimensions of the images using one of a) ImageMagick's
11003the image size in pixels and converting the pixel units to centimeters using 11066@file{identify} program or b) Emacs `create-image' and `image-size'
11067APIs.@footnote{Use of @file{ImageMagick} is only desirable. However, if you
11068routinely produce documents that have large images or you export your Org
11069files that has images using a Emacs batch script, then the use of
11070@file{ImageMagick} is mandatory.} The pixel dimensions are subsequently
11071converted in to units of centimeters using
11004@code{org-export-odt-pixels-per-inch}. The default value of this variable is 11072@code{org-export-odt-pixels-per-inch}. The default value of this variable is
11005set to @code{display-pixels-per-inch}. You can tweak this variable to 11073set to @code{display-pixels-per-inch}. You can tweak this variable to
11006achieve the best results. 11074achieve the best results.
@@ -11008,7 +11076,6 @@ achieve the best results.
11008The examples below illustrate the various possibilities. 11076The examples below illustrate the various possibilities.
11009 11077
11010@table @asis 11078@table @asis
11011
11012@item Explicitly size the image 11079@item Explicitly size the image
11013To embed @file{img.png} as a 10 cm x 10 cm image, do the following: 11080To embed @file{img.png} as a 10 cm x 10 cm image, do the following:
11014 11081
@@ -11044,17 +11111,31 @@ height:width ratio, do the following
11044@end example 11111@end example
11045@end table 11112@end table
11046 11113
11047@node Math formatting in @acronym{ODT} export, Literal examples in @acronym{ODT} export, Images in @acronym{ODT} export, OpenDocument Text export 11114@subsubheading Anchoring of images
11048@subsection Math formatting in @acronym{ODT} export 11115
11116@cindex #+ATTR_ODT
11117You can control the manner in which an image is anchored by setting the
11118@code{:anchor} property of it's @code{#+ATTR_ODT} line. You can specify one
11119of the the following three values for the @code{:anchor} property -
11120@samp{"as-char"}, @samp{"paragraph"} and @samp{"page"}.
11121
11122To create an image that is anchored to a page, do the following:
11123@example
11124#+ATTR_ODT: :anchor "page"
11125[[./img.png]]
11126@end example
11127
11128@node Math formatting in ODT export, Labels and captions in ODT export, Images in ODT export, OpenDocument Text export
11129@subsection Math formatting in ODT export
11049 11130
11050The @acronym{ODT} exporter has special support for handling math. 11131The ODT exporter has special support for handling math.
11051 11132
11052@menu 11133@menu
11053* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments 11134* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments
11054* Working with MathML or OpenDocument formula files:: How to embed equations in native format 11135* Working with MathML or OpenDocument formula files:: How to embed equations in native format
11055@end menu 11136@end menu
11056 11137
11057@node Working with @LaTeX{} math snippets, Working with MathML or OpenDocument formula files, Math formatting in @acronym{ODT} export, Math formatting in @acronym{ODT} export 11138@node Working with @LaTeX{} math snippets, Working with MathML or OpenDocument formula files, Math formatting in ODT export, Math formatting in ODT export
11058@subsubsection Working with @LaTeX{} math snippets 11139@subsubsection Working with @LaTeX{} math snippets
11059 11140
11060@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be embedded in the ODT 11141@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be embedded in the ODT
@@ -11120,11 +11201,11 @@ resulting images are embedded in the exported document. This method requires
11120that the @file{dvipng} program be available on your system. 11201that the @file{dvipng} program be available on your system.
11121@end enumerate 11202@end enumerate
11122 11203
11123@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in @acronym{ODT} export 11204@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in ODT export
11124@subsubsection Working with MathML or OpenDocument formula files 11205@subsubsection Working with MathML or OpenDocument formula files
11125 11206
11126For various reasons, you may find embedding @LaTeX{} math snippets in an 11207For various reasons, you may find embedding @LaTeX{} math snippets in an
11127@acronym{ODT} document less than reliable. In that case, you can embed a 11208ODT document less than reliable. In that case, you can embed a
11128math equation by linking to its MathML(@file{.mml}) source or its 11209math equation by linking to its MathML(@file{.mml}) source or its
11129OpenDocument formula (@file{.odf}) file as shown below: 11210OpenDocument formula (@file{.odf}) file as shown below:
11130 11211
@@ -11138,102 +11219,95 @@ or
11138[[./equation.odf]] 11219[[./equation.odf]]
11139@end example 11220@end example
11140 11221
11141@node Literal examples in @acronym{ODT} export, Advanced topics in @acronym{ODT} export, Math formatting in @acronym{ODT} export, OpenDocument Text export 11222@node Labels and captions in ODT export, Literal examples in ODT export, Math formatting in ODT export, OpenDocument Text export
11142@subsection Literal examples in @acronym{ODT} export 11223@subsection Labels and captions in ODT export
11143 11224
11144Export of literal examples (@pxref{Literal examples}) with full fontification 11225You can label and caption various category of objects - an inline image, a
11145is supported. This feature is enabled by default and is activated 11226table, a @LaTeX{} fragment or a Math formula - using @code{#+LABEL} and
11146automatically if an enhanced version of @file{htmlfontify.el} is available in 11227@code{#+CAPTION} lines. @xref{Images and tables}. ODT exporter enumerates
11147the @code{load-path}.@footnote{The @file{htmlfontify.el} that ships with 11228each labelled or captioned object of a given category separately. As a
11148standard Emacs <= 24.1 has no support for @acronym{ODT} fontification. A 11229result, each such object is assigned a sequence number based on order of it's
11149copy of the proposed version is available as an attachment to 11230appearance in the Org file.
11150@url{http://debbugs.gnu.org/cgi/bugreport.cgi?msg=5;filename=htmlfontify.el;att=9;bug=9914,
11151Emacs Bug #9914}.}
11152 11231
11153@vindex org-export-odt-fontify-srcblocks 11232In the exported document, a user-provided caption is augmented with the
11233category and sequence number. Consider the following inline image in an Org
11234file.
11235
11236@example
11237#+CAPTION: Bell curve
11238#+LABEL: fig:SED-HR4049
11239[[./img/a.png]]
11240@end example
11154 11241
11155The character styles used for fontification of the literal blocks are 11242It could be rendered as shown below in the exported document.
11156auto-generated by the exporter in conjunction with @file{htmlfontify.el}
11157library and need not be included in the default @file{styles.xml} file.
11158These auto-generated styles have the @samp{OrgSrc} prefix and inherit their color
11159based on the face used by Emacs @code{font-lock} library.
11160 11243
11161@vindex org-export-odt-create-custom-styles-for-srcblocks 11244@example
11162If you prefer to use your own custom styles for fontification and disable 11245Figure 2: Bell curve
11163their auto-generation altogether, you can do so by customizing the variable 11246@end example
11164@code{org-export-odt-create-custom-styles-for-srcblocks}. 11247
11248@vindex org-export-odt-category-strings
11249You can modify the category component of the caption by customizing the
11250variable @code{org-export-odt-category-strings}. For example, to tag all
11251embedded images with the string @samp{Illustration} (instead of the default
11252@samp{Figure}) use the following setting.
11253
11254@lisp
11255(setq org-export-odt-category-strings
11256 '(("en" "Table" "Illustration" "Equation" "Equation")))
11257@end lisp
11165 11258
11166You can turn off fontification support for literal examples by customizing 11259With this, previous image will be captioned as below in the exported
11167the variable @code{org-export-odt-fontify-srcblocks}. 11260document.
11168 11261
11262@example
11263Illustration 2: Bell curve
11264@end example
11265
11266@node Literal examples in ODT export, Advanced topics in ODT export, Labels and captions in ODT export, OpenDocument Text export
11267@subsection Literal examples in ODT export
11169 11268
11170@node Advanced topics in @acronym{ODT} export, , Literal examples in @acronym{ODT} export, OpenDocument Text export 11269Export of literal examples (@pxref{Literal examples}) with full fontification
11171@subsection Advanced topics in @acronym{ODT} export 11270is supported. Internally, the exporter relies on @file{htmlfontify.el} to
11271generate all style definitions needed for a fancy listing.@footnote{Your
11272@file{htmlfontify.el} library must atleast be at Emacs 24.1 levels for
11273fontification to be turned on.} The auto-generated styles have @samp{OrgSrc}
11274as prefix and inherit their color from the faces used by Emacs
11275@code{font-lock} library for the source language.
11172 11276
11173If you rely heavily on @acronym{ODT} export, you may want to exploit the full 11277@vindex org-export-odt-fontify-srcblocks
11278If you prefer to use your own custom styles for fontification, you can do so
11279by customizing the variable
11280@code{org-export-odt-create-custom-styles-for-srcblocks}.
11281
11282@vindex org-export-odt-create-custom-styles-for-srcblocks
11283You can turn off fontification of literal examples by customizing the
11284variable @code{org-export-odt-fontify-srcblocks}.
11285
11286@node Advanced topics in ODT export, , Literal examples in ODT export, OpenDocument Text export
11287@subsection Advanced topics in ODT export
11288
11289If you rely heavily on ODT export, you may want to exploit the full
11174set of features that the exporter offers. This section describes features 11290set of features that the exporter offers. This section describes features
11175that would be of interest to power users. 11291that would be of interest to power users.
11176 11292
11177@menu 11293@menu
11178* Exporting and converting to other formats:: How to produce @samp{pdf} and other formats 11294* Configuring a document converter:: How to register a document converter
11179* Working with OpenDocument style files:: Explore the internals 11295* Working with OpenDocument style files:: Explore the internals
11180* Creating one-off styles:: How to produce custom highlighting etc 11296* Creating one-off styles:: How to produce custom highlighting etc
11181* Customizing tables in @acronym{ODT} export:: How to define and use Table templates 11297* Customizing tables in ODT export:: How to define and use Table templates
11182* Validating OpenDocument XML:: How to debug corrupt OpenDocument files 11298* Validating OpenDocument XML:: How to debug corrupt OpenDocument files
11183@end menu 11299@end menu
11184 11300
11185@node Exporting and converting to other formats, Working with OpenDocument style files, Advanced topics in @acronym{ODT} export, Advanced topics in @acronym{ODT} export 11301@node Configuring a document converter, Working with OpenDocument style files, Advanced topics in ODT export, Advanced topics in ODT export
11186@subsubsection Exporting and converting to other formats 11302@subsubsection Configuring a document converter
11187@cindex convert 11303@cindex convert
11188@cindex doc, docx 11304@cindex doc, docx, rtf
11189
11190The @acronym{ODT} exporter adds support for exporting Org outlines to formats
11191that are not supported natively by Org. It also adds support to convert
11192document from one format to another. To use these features, you need to
11193configure a command-line converter. Once a command-line converter is
11194configured you can use it to extend the list of formats to which Org can
11195export. @xref{x-export-to-other-formats,,Automatically exporting to other
11196formats}. You can also use it to perform one-off document conversion as
11197detailed below.
11198
11199@vindex org-export-odt-convert
11200@table @kbd
11201
11202@item M-x org-export-odt-convert
11203Convert an existing document from one format to another as determined by the
11204variable @code{org-export-odt-convert-capabilities}
11205(@pxref{x-odt-converter-capabilities,,Configure converter
11206capabilities}). @strong{Please note} that you can use this command to even
11207convert documents that are produced outside of Org and in other formats than
11208@acronym{ODT} format.
11209@end table
11210
11211@subsubheading Pre-configured converters
11212
11213@cindex converter 11305@cindex converter
11214The @acronym{ODT} exporter supports two converters out of the box:
11215
11216@enumerate
11217
11218@cindex @file{unoconv}
11219@item @file{unoconv}
11220
11221This converter is available as an installable package in your favorite
11222distribution.
11223
11224@cindex @file{BasicODConverter}
11225@item @file{BasicODConverter}
11226 11306
11227@vindex org-odt-data-dir 11307The ODT exporter can work with popular converters with little or no
11228This converter is distributed as a LibreOffice extension and can be found in 11308extra configuration from your side. @xref{Extending ODT export}.
11229your Org distribution. See the subdirectory pointed to by the variable 11309If you are using a converter that is not supported by default or if you would
11230@code{org-odt-data-dir}. 11310like to tweak the default converter settings, proceed as below.
11231
11232@end enumerate
11233
11234@subsubheading Installing a new converter
11235If you prefer to use a converter other than the two mentioned above, then you
11236may have to do additional configuration. You can proceed as follows:
11237 11311
11238@enumerate 11312@enumerate
11239@item Register the converter 11313@item Register the converter
@@ -11262,12 +11336,12 @@ Select the newly added converter as the preferred one by customizing the
11262variable @code{org-export-odt-convert-process}. 11336variable @code{org-export-odt-convert-process}.
11263@end enumerate 11337@end enumerate
11264 11338
11265@node Working with OpenDocument style files, Creating one-off styles, Exporting and converting to other formats, Advanced topics in @acronym{ODT} export 11339@node Working with OpenDocument style files, Creating one-off styles, Configuring a document converter, Advanced topics in ODT export
11266@subsubsection Working with OpenDocument style files 11340@subsubsection Working with OpenDocument style files
11267@cindex styles, custom 11341@cindex styles, custom
11268@cindex template, custom 11342@cindex template, custom
11269 11343
11270This section explores the internals of the @acronym{ODT} exporter and the 11344This section explores the internals of the ODT exporter and the
11271means by which it produces styled documents. Read this section if you are 11345means by which it produces styled documents. Read this section if you are
11272interested in exploring the automatic and custom OpenDocument styles used by 11346interested in exploring the automatic and custom OpenDocument styles used by
11273the exporter. 11347the exporter.
@@ -11275,7 +11349,7 @@ the exporter.
11275@anchor{x-factory-styles} 11349@anchor{x-factory-styles}
11276@subsubheading Factory styles 11350@subsubheading Factory styles
11277 11351
11278The @acronym{ODT} exporter relies on two files for generating its output. 11352The ODT exporter relies on two files for generating its output.
11279These files are bundled with the distribution under the directory pointed to 11353These files are bundled with the distribution under the directory pointed to
11280by the variable @code{org-odt-styles-dir}. The two files are: 11354by the variable @code{org-odt-styles-dir}. The two files are:
11281 11355
@@ -11321,7 +11395,7 @@ are numbered.
11321 11395
11322@anchor{x-overriding-factory-styles} 11396@anchor{x-overriding-factory-styles}
11323@subsubheading Overriding factory styles 11397@subsubheading Overriding factory styles
11324The following two variables control the location from which the @acronym{ODT} 11398The following two variables control the location from which the ODT
11325exporter picks up the custom styles and content template files. You can 11399exporter picks up the custom styles and content template files. You can
11326customize these variables to override the factory styles used by the 11400customize these variables to override the factory styles used by the
11327exporter. 11401exporter.
@@ -11366,7 +11440,7 @@ Use this variable to specify the blank @file{content.xml} that will be used
11366in the final output. 11440in the final output.
11367@end itemize 11441@end itemize
11368 11442
11369@node Creating one-off styles, Customizing tables in @acronym{ODT} export, Working with OpenDocument style files, Advanced topics in @acronym{ODT} export 11443@node Creating one-off styles, Customizing tables in ODT export, Working with OpenDocument style files, Advanced topics in ODT export
11370@subsubsection Creating one-off styles 11444@subsubsection Creating one-off styles
11371 11445
11372There are times when you would want one-off formatting in the exported 11446There are times when you would want one-off formatting in the exported
@@ -11433,14 +11507,14 @@ This paragraph is specially formatted and uses bold text.
11433 11507
11434@end enumerate 11508@end enumerate
11435 11509
11436@node Customizing tables in @acronym{ODT} export, Validating OpenDocument XML, Creating one-off styles, Advanced topics in @acronym{ODT} export 11510@node Customizing tables in ODT export, Validating OpenDocument XML, Creating one-off styles, Advanced topics in ODT export
11437@subsubsection Customizing tables in @acronym{ODT} export 11511@subsubsection Customizing tables in ODT export
11438@cindex tables, in ODT export 11512@cindex tables, in ODT export
11439 11513
11440@cindex #+ATTR_ODT 11514@cindex #+ATTR_ODT
11441You can override the default formatting of the table by specifying a custom 11515You can override the default formatting of the table by specifying a custom
11442table style with the @code{#+ATTR_ODT} line. For a discussion on default 11516table style with the @code{#+ATTR_ODT} line. For a discussion on default
11443formatting of tables @pxref{Tables in @acronym{ODT} export}. 11517formatting of tables @pxref{Tables in ODT export}.
11444 11518
11445This feature closely mimics the way table templates are defined in the 11519This feature closely mimics the way table templates are defined in the
11446OpenDocument-v1.2 11520OpenDocument-v1.2
@@ -11466,7 +11540,7 @@ the table that follows.
11466@end lisp 11540@end lisp
11467 11541
11468@example 11542@example
11469#+ATTR_ODT: TableWithHeaderRowAndColumn 11543#+ATTR_ODT: :style "TableWithHeaderRowAndColumn"
11470| Name | Phone | Age | 11544| Name | Phone | Age |
11471| Peter | 1234 | 17 | 11545| Peter | 1234 | 17 |
11472| Anna | 4321 | 25 | 11546| Anna | 4321 | 25 |
@@ -11571,9 +11645,9 @@ To define a table style, create an entry for the style in the variable
11571@end itemize 11645@end itemize
11572 11646
11573For example, the entry below defines two different table styles 11647For example, the entry below defines two different table styles
11574@samp{TableWithHeaderRowsAndColumns} and @samp{TableWithHeaderColumns} based 11648@samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow}
11575on the same template @samp{Custom}. The styles achieve their intended effect 11649based on the same template @samp{Custom}. The styles achieve their intended
11576by selectively activating the individual cell styles in that template. 11650effect by selectively activating the individual cell styles in that template.
11577 11651
11578@lisp 11652@lisp
11579(setq org-export-odt-table-styles 11653(setq org-export-odt-table-styles
@@ -11593,18 +11667,18 @@ To do this, specify the table style created in step (2) as part of
11593the @code{ATTR_ODT} line as shown below. 11667the @code{ATTR_ODT} line as shown below.
11594 11668
11595@example 11669@example
11596#+ATTR_ODT: TableWithHeaderRowAndColumn 11670#+ATTR_ODT: :style "TableWithHeaderRowAndColumn"
11597| Name | Phone | Age | 11671| Name | Phone | Age |
11598| Peter | 1234 | 17 | 11672| Peter | 1234 | 17 |
11599| Anna | 4321 | 25 | 11673| Anna | 4321 | 25 |
11600@end example 11674@end example
11601@end enumerate 11675@end enumerate
11602 11676
11603@node Validating OpenDocument XML, , Customizing tables in @acronym{ODT} export, Advanced topics in @acronym{ODT} export 11677@node Validating OpenDocument XML, , Customizing tables in ODT export, Advanced topics in ODT export
11604@subsubsection Validating OpenDocument XML 11678@subsubsection Validating OpenDocument XML
11605 11679
11606Occasionally, you will discover that the document created by the 11680Occasionally, you will discover that the document created by the
11607@acronym{ODT} exporter cannot be opened by your favorite application. One of 11681ODT exporter cannot be opened by your favorite application. One of
11608the common reasons for this is that the @file{.odt} file is corrupt. In such 11682the common reasons for this is that the @file{.odt} file is corrupt. In such
11609cases, you may want to validate the document against the OpenDocument RELAX 11683cases, you may want to validate the document against the OpenDocument RELAX
11610NG Compact Syntax (RNC) schema. 11684NG Compact Syntax (RNC) schema.
@@ -11618,7 +11692,7 @@ general help with validation (and schema-sensitive editing) of XML files:
11618If you have ready access to OpenDocument @file{.rnc} files and the needed 11692If you have ready access to OpenDocument @file{.rnc} files and the needed
11619schema-locating rules in a single folder, you can customize the variable 11693schema-locating rules in a single folder, you can customize the variable
11620@code{org-export-odt-schema-dir} to point to that directory. The 11694@code{org-export-odt-schema-dir} to point to that directory. The
11621@acronym{ODT} exporter will take care of updating the 11695ODT exporter will take care of updating the
11622@code{rng-schema-locating-files} for you. 11696@code{rng-schema-locating-files} for you.
11623 11697
11624@c end opendocument 11698@c end opendocument
@@ -12622,17 +12696,24 @@ of tangled code files.
12622@section Evaluating code blocks 12696@section Evaluating code blocks
12623@cindex code block, evaluating 12697@cindex code block, evaluating
12624@cindex source code, evaluating 12698@cindex source code, evaluating
12699@cindex #+RESULTS
12625 12700
12626Code blocks can be evaluated@footnote{Whenever code is evaluated there is a 12701Code blocks can be evaluated@footnote{Whenever code is evaluated there is a
12627potential for that code to do harm. Org mode provides safeguards to ensure 12702potential for that code to do harm. Org mode provides safeguards to ensure
12628that code is only evaluated after explicit confirmation from the user. For 12703that code is only evaluated after explicit confirmation from the user. For
12629information on these safeguards (and on how to disable them) see @ref{Code 12704information on these safeguards (and on how to disable them) see @ref{Code
12630evaluation security}.} and the results of evaluation optionally placed in the 12705evaluation security}.} and the results of evaluation optionally placed in the
12631Org mode buffer. By default, the evaluation facility is only enabled for 12706Org mode buffer. The results of evaluation are placed following a line that
12632Lisp code blocks specified as @code{emacs-lisp}. However, source code blocks 12707begins by default with @code{#+RESULTS} and optionally a cache identifier
12633in many languages can be evaluated within Org mode (see @ref{Languages} for a 12708and/or the name of the evaluated code block. The default value of
12634list of supported languages and @ref{Structure of code blocks} for 12709@code{#+RESULTS} can be changed with the customizable variable
12635information on the syntax used to define a code block). 12710@code{org-babel-results-keyword}.
12711
12712By default, the evaluation facility is only enabled for Lisp code blocks
12713specified as @code{emacs-lisp}. However, source code blocks in many languages
12714can be evaluated within Org mode (see @ref{Languages} for a list of supported
12715languages and @ref{Structure of code blocks} for information on the syntax
12716used to define a code block).
12636 12717
12637@kindex C-c C-c 12718@kindex C-c C-c
12638There are a number of ways to evaluate code blocks. The simplest is to press 12719There are a number of ways to evaluate code blocks. The simplest is to press
@@ -13000,6 +13081,7 @@ argument in lowercase letters. The following header arguments are defined:
13000* session:: Preserve the state of code evaluation 13081* session:: Preserve the state of code evaluation
13001* noweb:: Toggle expansion of noweb references 13082* noweb:: Toggle expansion of noweb references
13002* noweb-ref:: Specify block's noweb reference resolution target 13083* noweb-ref:: Specify block's noweb reference resolution target
13084* noweb-sep:: String used to separate noweb references
13003* cache:: Avoid re-evaluating unchanged code blocks 13085* cache:: Avoid re-evaluating unchanged code blocks
13004* sep:: Delimiter for writing tabular results outside Org 13086* sep:: Delimiter for writing tabular results outside Org
13005* hlines:: Handle horizontal lines in tables 13087* hlines:: Handle horizontal lines in tables
@@ -13351,9 +13433,9 @@ The result is converted to pretty-printed code and is enclosed in a code
13351block. This option currently supports Emacs Lisp, Python, and Ruby. E.g., 13433block. This option currently supports Emacs Lisp, Python, and Ruby. E.g.,
13352@code{:results value pp}. 13434@code{:results value pp}.
13353@item @code{wrap} 13435@item @code{wrap}
13354The result is wrapped in a @code{begin_result} block. This can be useful for 13436The result is wrapped in a RESULTS drawer. This can be useful for
13355inserting @code{raw} or @code{org} syntax results in such a way that their 13437inserting @code{raw} or @code{org} syntax results in such a way that their
13356extend is known and they can be automatically removed or replaced. 13438extent is known and they can be automatically removed or replaced.
13357@end itemize 13439@end itemize
13358 13440
13359@subsubheading Handling 13441@subsubheading Handling
@@ -13583,9 +13665,8 @@ argument can have one of three values: @code{yes}, @code{no}, or @code{tangle}.
13583All ``noweb'' syntax references in the body of the code block will be 13665All ``noweb'' syntax references in the body of the code block will be
13584expanded before the block is evaluated, tangled or exported. 13666expanded before the block is evaluated, tangled or exported.
13585@item @code{no} 13667@item @code{no}
13586The default. No ``noweb'' syntax specific action is taken on evaluating 13668The default. No ``noweb'' syntax specific action is taken when the code
13587code blocks, However, noweb references will still be expanded during 13669block is evaluated, tangled or exported.
13588tangling.
13589@item @code{tangle} 13670@item @code{tangle}
13590All ``noweb'' syntax references in the body of the code block will be 13671All ``noweb'' syntax references in the body of the code block will be
13591expanded before the block is tangled, however ``noweb'' references will not 13672expanded before the block is tangled, however ``noweb'' references will not
@@ -13617,7 +13698,7 @@ Note that noweb replacement text that does not contain any newlines will not
13617be affected by this change, so it is still possible to use inline noweb 13698be affected by this change, so it is still possible to use inline noweb
13618references. 13699references.
13619 13700
13620@node noweb-ref, cache, noweb, Specific header arguments 13701@node noweb-ref, noweb-sep, noweb, Specific header arguments
13621@subsubsection @code{:noweb-ref} 13702@subsubsection @code{:noweb-ref}
13622When expanding ``noweb'' style references the bodies of all code block with 13703When expanding ``noweb'' style references the bodies of all code block with
13623@emph{either} a block name matching the reference name @emph{or} a 13704@emph{either} a block name matching the reference name @emph{or} a
@@ -13661,13 +13742,27 @@ inheritance}).}.
13661 #+END_SRC 13742 #+END_SRC
13662@end example 13743@end example
13663 13744
13664@node cache, sep, noweb-ref, Specific header arguments 13745The @code{:noweb-sep} (see @ref{noweb-sep}) header argument holds the string
13746used to separate accumulate noweb references like those above. By default a
13747newline is used.
13748
13749@node noweb-sep, cache, noweb-ref, Specific header arguments
13750@subsubsection @code{:noweb-sep}
13751
13752The @code{:noweb-sep} header argument holds the string used to separate
13753accumulate noweb references (see @ref{noweb-ref}). By default a newline is
13754used.
13755
13756@node cache, sep, noweb-sep, Specific header arguments
13665@subsubsection @code{:cache} 13757@subsubsection @code{:cache}
13666 13758
13667The @code{:cache} header argument controls the use of in-buffer caching of 13759The @code{:cache} header argument controls the use of in-buffer caching of
13668the results of evaluating code blocks. It can be used to avoid re-evaluating 13760the results of evaluating code blocks. It can be used to avoid re-evaluating
13669unchanged code blocks. This header argument can have one of two 13761unchanged code blocks. Note that the @code{:cache} header argument will not
13670values: @code{yes} or @code{no}. 13762attempt to cache results when the @code{:session} header argument is used,
13763because the results of the code block execution may be stored in the session
13764outside of the Org-mode buffer. The @code{:cache} header argument can have
13765one of two values: @code{yes} or @code{no}.
13671 13766
13672@itemize @bullet 13767@itemize @bullet
13673@item @code{no} 13768@item @code{no}
@@ -14004,6 +14099,14 @@ evaluation. If @code{:noweb no}, the default, then the reference is not
14004expanded before evaluation. See the @ref{noweb-ref} header argument for 14099expanded before evaluation. See the @ref{noweb-ref} header argument for
14005a more flexible way to resolve noweb references. 14100a more flexible way to resolve noweb references.
14006 14101
14102It is possible to include the @emph{results} of a code block rather than the
14103body. This is done by appending parenthesis to the code block name which may
14104optionally contain arguments to the code block as shown below.
14105
14106@example
14107<<code-block-name(optional arguments)>>
14108@end example
14109
14007Note: the default value, @code{:noweb no}, was chosen to ensure that 14110Note: the default value, @code{:noweb no}, was chosen to ensure that
14008correct code is not broken in a language, such as Ruby, where 14111correct code is not broken in a language, such as Ruby, where
14009@code{<<arg>>} is a syntactically valid construct. If @code{<<arg>>} is not 14112@code{<<arg>>} is a syntactically valid construct. If @code{<<arg>>} is not
@@ -14040,34 +14143,72 @@ are active:
14040In an Org mode buffer, the following key bindings are active: 14143In an Org mode buffer, the following key bindings are active:
14041 14144
14042@multitable @columnfractions 0.45 0.55 14145@multitable @columnfractions 0.45 0.55
14043@kindex C-c C-v a 14146@kindex C-c C-v p
14044@kindex C-c C-v C-a 14147@kindex C-c C-v C-p
14045@item @kbd{C-c C-v a} @ @ @r{or} @ @ @kbd{C-c C-v C-a} @tab @code{org-babel-sha1-hash} 14148@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab @code{org-babel-previous-src-block}
14149@kindex C-c C-v n
14150@kindex C-c C-v C-n
14151@item @kbd{C-c C-v n} @ @ @r{or} @ @ @kbd{C-c C-v C-n} @tab @code{org-babel-next-src-block}
14152@kindex C-c C-v e
14153@kindex C-c C-v C-e
14154@item @kbd{C-c C-v e} @ @ @r{or} @ @ @kbd{C-c C-v C-e} @tab @code{org-babel-execute-maybe}
14155@kindex C-c C-v o
14156@kindex C-c C-v C-o
14157@item @kbd{C-c C-v o} @ @ @r{or} @ @ @kbd{C-c C-v C-o} @tab @code{org-babel-open-src-block-result}
14158@kindex C-c C-v v
14159@kindex C-c C-v C-v
14160@item @kbd{C-c C-v v} @ @ @r{or} @ @ @kbd{C-c C-v C-v} @tab @code{org-babel-expand-src-block}
14161@kindex C-c C-v u
14162@kindex C-c C-v C-u
14163@item @kbd{C-c C-v u} @ @ @r{or} @ @ @kbd{C-c C-v C-u} @tab @code{org-babel-goto-src-block-head}
14164@kindex C-c C-v g
14165@kindex C-c C-v C-g
14166@item @kbd{C-c C-v g} @ @ @r{or} @ @ @kbd{C-c C-v C-g} @tab @code{org-babel-goto-named-src-block}
14167@kindex C-c C-v r
14168@kindex C-c C-v C-r
14169@item @kbd{C-c C-v r} @ @ @r{or} @ @ @kbd{C-c C-v C-r} @tab @code{org-babel-goto-named-result}
14046@kindex C-c C-v b 14170@kindex C-c C-v b
14047@kindex C-c C-v C-b 14171@kindex C-c C-v C-b
14048@item @kbd{C-c C-v b} @ @ @r{or} @ @ @kbd{C-c C-v C-b} @tab @code{org-babel-execute-buffer} 14172@item @kbd{C-c C-v b} @ @ @r{or} @ @ @kbd{C-c C-v C-b} @tab @code{org-babel-execute-buffer}
14049@kindex C-c C-v f
14050@kindex C-c C-v C-f
14051@item @kbd{C-c C-v f} @ @ @r{or} @ @ @kbd{C-c C-v C-f} @tab @code{org-babel-tangle-file}
14052@kindex C-c C-v g
14053@item @kbd{C-c C-v g} @tab @code{org-babel-goto-named-source-block}
14054@kindex C-c C-v h
14055@item @kbd{C-c C-v h} @tab @code{org-babel-describe-bindings}
14056@kindex C-c C-v l
14057@kindex C-c C-v C-l
14058@item @kbd{C-c C-v l} @ @ @r{or} @ @ @kbd{C-c C-v C-l} @tab @code{org-babel-lob-ingest}
14059@kindex C-c C-v p
14060@kindex C-c C-v C-p
14061@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab @code{org-babel-expand-src-block}
14062@kindex C-c C-v s 14173@kindex C-c C-v s
14063@kindex C-c C-v C-s 14174@kindex C-c C-v C-s
14064@item @kbd{C-c C-v s} @ @ @r{or} @ @ @kbd{C-c C-v C-s} @tab @code{org-babel-execute-subtree} 14175@item @kbd{C-c C-v s} @ @ @r{or} @ @ @kbd{C-c C-v C-s} @tab @code{org-babel-execute-subtree}
14176@kindex C-c C-v d
14177@kindex C-c C-v C-d
14178@item @kbd{C-c C-v d} @ @ @r{or} @ @ @kbd{C-c C-v C-d} @tab @code{org-babel-demarcate-block}
14065@kindex C-c C-v t 14179@kindex C-c C-v t
14066@kindex C-c C-v C-t 14180@kindex C-c C-v C-t
14067@item @kbd{C-c C-v t} @ @ @r{or} @ @ @kbd{C-c C-v C-t} @tab @code{org-babel-tangle} 14181@item @kbd{C-c C-v t} @ @ @r{or} @ @ @kbd{C-c C-v C-t} @tab @code{org-babel-tangle}
14182@kindex C-c C-v f
14183@kindex C-c C-v C-f
14184@item @kbd{C-c C-v f} @ @ @r{or} @ @ @kbd{C-c C-v C-f} @tab @code{org-babel-tangle-file}
14185@kindex C-c C-v c
14186@kindex C-c C-v C-c
14187@item @kbd{C-c C-v c} @ @ @r{or} @ @ @kbd{C-c C-v C-c} @tab @code{org-babel-check-src-block}
14188@kindex C-c C-v j
14189@kindex C-c C-v C-j
14190@item @kbd{C-c C-v j} @ @ @r{or} @ @ @kbd{C-c C-v C-j} @tab @code{org-babel-insert-header-arg}
14191@kindex C-c C-v l
14192@kindex C-c C-v C-l
14193@item @kbd{C-c C-v l} @ @ @r{or} @ @ @kbd{C-c C-v C-l} @tab @code{org-babel-load-in-session}
14194@kindex C-c C-v i
14195@kindex C-c C-v C-i
14196@item @kbd{C-c C-v i} @ @ @r{or} @ @ @kbd{C-c C-v C-i} @tab @code{org-babel-lob-ingest}
14197@kindex C-c C-v I
14198@kindex C-c C-v C-I
14199@item @kbd{C-c C-v I} @ @ @r{or} @ @ @kbd{C-c C-v C-I} @tab @code{org-babel-view-src-block-info}
14068@kindex C-c C-v z 14200@kindex C-c C-v z
14069@kindex C-c C-v C-z 14201@kindex C-c C-v C-z
14070@item @kbd{C-c C-v z} @ @ @r{or} @ @ @kbd{C-c C-v C-z} @tab @code{org-babel-switch-to-session} 14202@item @kbd{C-c C-v z} @ @ @r{or} @ @ @kbd{C-c C-v C-z} @tab @code{org-babel-switch-to-session-with-code}
14203@kindex C-c C-v a
14204@kindex C-c C-v C-a
14205@item @kbd{C-c C-v a} @ @ @r{or} @ @ @kbd{C-c C-v C-a} @tab @code{org-babel-sha1-hash}
14206@kindex C-c C-v h
14207@kindex C-c C-v C-h
14208@item @kbd{C-c C-v h} @ @ @r{or} @ @ @kbd{C-c C-v C-h} @tab @code{org-babel-describe-bindings}
14209@kindex C-c C-v x
14210@kindex C-c C-v C-x
14211@item @kbd{C-c C-v x} @ @ @r{or} @ @ @kbd{C-c C-v C-x} @tab @code{org-babel-do-key-sequence-in-edit-buffer}
14071@end multitable 14212@end multitable
14072 14213
14073@c When possible these keybindings were extended to work when the control key is 14214@c When possible these keybindings were extended to work when the control key is
@@ -14839,7 +14980,7 @@ checks for the availability of Calc by looking for the function
14839been installed properly. As of Emacs 22, Calc is part of the Emacs 14980been installed properly. As of Emacs 22, Calc is part of the Emacs
14840distribution. Another possibility for interaction between the two 14981distribution. Another possibility for interaction between the two
14841packages is using Calc for embedded calculations. @xref{Embedded Mode, 14982packages is using Calc for embedded calculations. @xref{Embedded Mode,
14842, Embedded Mode, Calc, GNU Emacs Calc Manual}. 14983, Embedded Mode, calc, GNU Emacs Calc Manual}.
14843@item @file{constants.el} by Carsten Dominik 14984@item @file{constants.el} by Carsten Dominik
14844@cindex @file{constants.el} 14985@cindex @file{constants.el}
14845@cindex Dominik, Carsten 14986@cindex Dominik, Carsten
@@ -15215,7 +15356,7 @@ not accept any arguments, and return the full link with prefix.
15215@vindex org-ctrl-c-ctrl-c-hook 15356@vindex org-ctrl-c-ctrl-c-hook
15216 15357
15217Org has several commands that act differently depending on context. The most 15358Org has several commands that act differently depending on context. The most
15218important example it the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}). 15359important example is the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}).
15219Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property. 15360Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property.
15220 15361
15221Add-ons can tap into this functionality by providing a function that detects 15362Add-ons can tap into this functionality by providing a function that detects
@@ -16431,7 +16572,7 @@ with links transformation to Org syntax.
16431@i{David O'Toole} wrote @file{org-publish.el} and drafted the manual 16572@i{David O'Toole} wrote @file{org-publish.el} and drafted the manual
16432chapter about publishing. 16573chapter about publishing.
16433@item 16574@item
16434@i{Jambunathan K} contributed the @acronym{ODT} exporter. 16575@i{Jambunathan K} contributed the ODT exporter.
16435@item 16576@item
16436@i{Sebastien Vauban} reported many issues with @LaTeX{} and BEAMER export and 16577@i{Sebastien Vauban} reported many issues with @LaTeX{} and BEAMER export and
16437enabled source code highlighting in Gnus. 16578enabled source code highlighting in Gnus.
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 94a9ae6ed4d..370f009a291 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,11 @@
12012-04-01 Jambunathan K <kjambunathan@gmail.com>
2
3 * org/OrgOdtContentTemplate.xml (OrgIndentedSection-Level-*):
4 New section styles. These sections are indented to the same
5 level as the corresponding list entries. These sections hold
6 tables that occur within a list. (OrgTable): Increased
7 relative width from 90% to 96% for aesthetic reasons.
8
12012-03-16 Glenn Morris <rgm@gnu.org> 92012-03-16 Glenn Morris <rgm@gnu.org>
2 10
3 * HELLO: Say that this is not a comprehensive list. 11 * HELLO: Say that this is not a comprehensive list.
diff --git a/etc/org/OrgOdtContentTemplate.xml b/etc/org/OrgOdtContentTemplate.xml
index f50588b2adb..cd7ff0e1564 100644
--- a/etc/org/OrgOdtContentTemplate.xml
+++ b/etc/org/OrgOdtContentTemplate.xml
@@ -46,8 +46,61 @@
46 46
47 <!-- automatic styles --> 47 <!-- automatic styles -->
48 <office:automatic-styles> 48 <office:automatic-styles>
49 <!-- Section styles -->
50 <style:style style:name="OrgIndentedSection-Level-1" style:family="section">
51 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="1.281cm" fo:margin-right="0cm" style:editable="false">
52 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
53 </style:section-properties>
54 </style:style>
55 <style:style style:name="OrgIndentedSection-Level-2" style:family="section">
56 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="1.905cm" fo:margin-right="0cm" style:editable="false">
57 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
58 </style:section-properties>
59 </style:style>
60 <style:style style:name="OrgIndentedSection-Level-3" style:family="section">
61 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="2.54cm" fo:margin-right="0cm" style:editable="false">
62 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
63 </style:section-properties>
64 </style:style>
65 <style:style style:name="OrgIndentedSection-Level-4" style:family="section">
66 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="3.175cm" fo:margin-right="0cm" style:editable="false">
67 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
68 </style:section-properties>
69 </style:style>
70 <style:style style:name="OrgIndentedSection-Level-5" style:family="section">
71 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="3.81cm" fo:margin-right="0cm" style:editable="false">
72 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
73 </style:section-properties>
74 </style:style>
75 <style:style style:name="OrgIndentedSection-Level-6" style:family="section">
76 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="4.445cm" fo:margin-right="0cm" style:editable="false">
77 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
78 </style:section-properties>
79 </style:style>
80 <style:style style:name="OrgIndentedSection-Level-7" style:family="section">
81 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="5.08cm" fo:margin-right="0cm" style:editable="false">
82 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
83 </style:section-properties>
84 </style:style>
85 <style:style style:name="OrgIndentedSection-Level-8" style:family="section">
86 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="5.715cm" fo:margin-right="0cm" style:editable="false">
87 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
88 </style:section-properties>
89 </style:style>
90 <style:style style:name="OrgIndentedSection-Level-9" style:family="section">
91 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="6.35cm" fo:margin-right="0cm" style:editable="false">
92 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
93 </style:section-properties>
94 </style:style>
95 <style:style style:name="OrgIndentedSection-Level-10" style:family="section">
96 <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="6.985cm" fo:margin-right="0cm" style:editable="false">
97 <style:columns fo:column-count="1" fo:column-gap="0cm"/>
98 </style:section-properties>
99 </style:style>
100
101 <!-- Table styles -->
49 <style:style style:name="OrgTable" style:family="table"> 102 <style:style style:name="OrgTable" style:family="table">
50 <style:table-properties style:rel-width="90%" fo:margin-top="0cm" fo:margin-bottom="0.20cm" table:align="center"/> 103 <style:table-properties style:rel-width="96%" fo:margin-top="0cm" fo:margin-bottom="0.20cm" table:align="center"/>
51 </style:style> 104 </style:style>
52 105
53 <style:style style:name="OrgTableColumn" style:family="table-column"> 106 <style:style style:name="OrgTableColumn" style:family="table-column">
diff --git a/etc/org/OrgOdtStyles.xml b/etc/org/OrgOdtStyles.xml
index 4fb282064b0..470b7b134a7 100644
--- a/etc/org/OrgOdtStyles.xml
+++ b/etc/org/OrgOdtStyles.xml
@@ -718,15 +718,75 @@
718 <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> 718 <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/>
719 </office:styles> 719 </office:styles>
720 <office:automatic-styles> 720 <office:automatic-styles>
721 <style:page-layout style:name="Mpm1"> 721 <style:style style:name="MP1" style:family="paragraph" style:parent-style-name="Footer">
722 <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
723 </style:style>
724 <style:page-layout style:name="Mpm1" style:page-usage="mirrored">
722 <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm"> 725 <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
723 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> 726 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
727 </style:page-layout-properties>
728 <style:header-style/>
729 <style:footer-style>
730 <style:header-footer-properties fo:min-height="0.6cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.499cm" style:dynamic-spacing="false"/>
731 </style:footer-style>
732 </style:page-layout>
733 <style:page-layout style:name="Mpm2">
734 <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
735 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
724 </style:page-layout-properties> 736 </style:page-layout-properties>
725 <style:header-style/> 737 <style:header-style/>
726 <style:footer-style/> 738 <style:footer-style/>
727 </style:page-layout> 739 </style:page-layout>
740 <style:page-layout style:name="Mpm3" style:page-usage="mirrored">
741 <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="i" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
742 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
743 </style:page-layout-properties>
744 <style:header-style/>
745 <style:footer-style>
746 <style:header-footer-properties fo:min-height="0cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.499cm"/>
747 </style:footer-style>
748 </style:page-layout>
749 <style:page-layout style:name="Mpm4" style:page-usage="right">
750 <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" fo:background-color="transparent" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
751 <style:background-image/>
752 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
753 </style:page-layout-properties>
754 <style:header-style/>
755 <style:footer-style>
756 <style:header-footer-properties fo:min-height="0.6cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.499cm" style:dynamic-spacing="false"/>
757 </style:footer-style>
758 </style:page-layout>
759 <style:page-layout style:name="Mpm5" style:page-usage="mirrored">
760 <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:footnote-max-height="0cm">
761 <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
762 </style:page-layout-properties>
763 <style:header-style/>
764 <style:footer-style>
765 <style:header-footer-properties fo:min-height="0.6cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.499cm" style:dynamic-spacing="false"/>
766 </style:footer-style>
767 </style:page-layout>
728 </office:automatic-styles> 768 </office:automatic-styles>
729 <office:master-styles> 769 <office:master-styles>
730 <style:master-page style:name="Standard" style:page-layout-name="Mpm1"/> 770 <style:master-page style:name="Standard" style:page-layout-name="Mpm1">
771 <style:footer>
772 <text:p text:style-name="MP1"><text:page-number text:select-page="current"></text:page-number></text:p>
773 </style:footer>
774 </style:master-page>
775 <style:master-page style:name="OrgTitlePage" style:page-layout-name="Mpm2" style:next-style-name="OrgFrontMatterPage"/>
776 <style:master-page style:name="OrgFrontMatterPage" style:page-layout-name="Mpm3">
777 <style:footer>
778 <text:p text:style-name="MP1"><text:page-number text:select-page="current"/></text:p>
779 </style:footer>
780 </style:master-page>
781 <style:master-page style:name="OrgFirstPage" style:page-layout-name="Mpm4" style:next-style-name="OrgPage">
782 <style:footer>
783 <text:p text:style-name="MP1"><text:page-number text:select-page="current"/></text:p>
784 </style:footer>
785 </style:master-page>
786 <style:master-page style:name="OrgPage" style:page-layout-name="Mpm5">
787 <style:footer>
788 <text:p text:style-name="MP1"><text:page-number text:select-page="current"/></text:p>
789 </style:footer>
790 </style:master-page>
731 </office:master-styles> 791 </office:master-styles>
732</office:document-styles> 792</office:document-styles>
diff --git a/etc/org/README b/etc/org/README
index 206f3a26b52..bdebef3f303 100644
--- a/etc/org/README
+++ b/etc/org/README
@@ -1,7 +1,7 @@
1The files OrgOdtContentTemplate.xml and OrgOdtStyles.xml have the 1The files OrgOdtContentTemplate.xml and OrgOdtStyles.xml have the
2following copyright information: 2following copyright information:
3 3
4Copyright (C) 2010-2012 Free Software Foundation, Inc. 4Copyright (C) 2010-2011 Free Software Foundation, Inc.
5 5
6These files are part of GNU Emacs. 6These files are part of GNU Emacs.
7 7
diff --git a/etc/refcards/orgcard.pdf b/etc/refcards/orgcard.pdf
index 92df030d4d2..201bb892dc0 100644
--- a/etc/refcards/orgcard.pdf
+++ b/etc/refcards/orgcard.pdf
Binary files differ
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 64200742ae9..d0f5d29d87f 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,6 +1,6 @@
1% Reference Card for Org Mode 1% Reference Card for Org Mode
2\def\orgversionnumber{7.8.02} 2\def\orgversionnumber{7.8.07}
3\def\versionyear{2011} % latest update 3\def\versionyear{2012} % latest update
4\def\year{2012} % latest copyright year 4\def\year{2012} % latest copyright year
5 5
6%**start of header 6%**start of header
@@ -17,7 +17,7 @@
17\pdflayout=(0l) 17\pdflayout=(0l)
18 18
19% Nothing else needs to be changed below this line. 19% Nothing else needs to be changed below this line.
20% Copyright (C) 1987, 1993, 1996-1997, 2001-2012 20% Copyright (C) 1987, 1993, 1996-1997, 2001-2011
21% Free Software Foundation, Inc. 21% Free Software Foundation, Inc.
22 22
23% This file is part of GNU Emacs. 23% This file is part of GNU Emacs.
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog
index 392fe25202f..a5e33f1ea9e 100644
--- a/lisp/org/ChangeLog
+++ b/lisp/org/ChangeLog
@@ -1,3 +1,1442 @@
12012-04-01 Eric Schulte <eric.schulte@gmx.com>
2
3 * ob-C.el (org-babel-C-execute): Add .exe to the end of compiled
4 C files on windows.
5
62012-04-01 Eric Schulte <eric.schulte@gmx.com>
7
8 * ob-exp.el (org-babel-exp-code): Escape all lines when exporting
9 Org-mode blocks.
10
11 * ob.el (org-babel-parse-src-block-match): Make use of the new
12 language argument to org-babel-strip-protective-commas.
13 (org-babel-parse-inline-src-block-match): Make use of the new
14 language argument to org-babel-strip-protective-commas.
15 (org-babel-strip-protective-commas): Now accepts a language
16 argument.
17
182012-04-01 Bastien Guerry <bzg@gnu.org>
19
20 * org.el (org-fast-tag-selection): Fix an bug when listing tags
21 for completion.
22
232012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change)
24
25 * org.el (org-delete-property-globally): Fixed a bug that left
26 blank line in place of the property, instead of removing the line.
27
282012-04-01 Bastien Guerry <bzg@gnu.org>
29
30 * ob-maxima.el (org-babel-maxima-command): Add group information
31 to the defcustom.
32
332012-04-01 Bastien Guerry <bzg@gnu.org>
34
35 * org.el (org-mode): Use `buffer-face-mode' to remap the 'default
36 face to 'org-default.
37
382012-04-01 Bastien Guerry <bzg@gnu.org>
39
40 * org-ascii.el (org-export-as-ascii): Fix escaping of underscores
41 in links.
42
432012-04-01 Bastien Guerry <bzg@gnu.org>
44
45 * org.el: Prevent a bug while defining the menu by requiring
46 `org-beamer' when necessary.
47
482012-04-01 Bastien Guerry <bzg@gnu.org>
49
50 * org-table.el (orgtbl-self-insert-command): Use
51 `backward-delete-char' instead of `delete-backward-char' as this
52 last command gets caught by the compiler which says to not use it
53 in programs. `backward-delete-char' is just an alias for
54 `delete-backward-char' which is internally remapped to
55 `org-delete-backward-char' for optimization purpose.
56
572012-04-01 Bastien Guerry <bzg@gnu.org>
58
59 * org-latex.el (org-export-latex-subcontent): Bugfix: when
60 `org-export-latex-low-levels' is nil, do not export low levels.
61
622012-04-01 Eric Schulte <eric.schulte@gmx.com>
63
64 * ob.el (org-babel-insert-result): Fix bug in indented wrapped
65 results insertion.
66
672012-04-01 Bastien Guerry <bzg@gnu.org>
68
69 * org.el (org-set-tags): Include `org-tag-alist' in the list of
70 possible completions, even when there are tags defined in the
71 buffer.
72
732012-04-01 Bastien Guerry <bzg@gnu.org>
74
75 * org-mime.el (org-mime-htmlize): Set
76 `org-export-with-LaTeX-fragments' correctly.
77
782012-04-01 Bastien Guerry <bzg@gnu.org>
79
80 * org.el (org-set-tags): Don't add a column when there is only one
81 tag offered for completion.
82
832012-04-01 Bastien Guerry <bzg@gnu.org>
84
85 * org.el (org-fast-tag-selection): Include tags from
86 `org-tag-alist' when completing with the TAB key.
87
882012-04-01 Shoji Nishimura <nishimura.shoji@gmail.com> (tiny change)
89
90 * org.el (org-display-inline-images): Honor the ̀beg' parameter.
91
922012-04-01 Bastien Guerry <bzg@gnu.org>
93
94 * org-latex.el (org-export-latex-subcontent): Don't insert a
95 linebreak when itemizing a subtree that is just a headline.
96
972012-04-01 Eric Schulte <eric.schulte@gmx.com>
98
99 * ob-lob.el (org-babel-lob-get-info): Removed extra []s when
100 parsing inline call_foo lines.
101
1022012-04-01 Eric Schulte <eric.schulte@gmx.com>
103
104 * ob-maxima.el (org-babel-maxima-command): The maxima command used
105 should be configurable (defaults to maxima-command if defined).
106 (org-babel-execute:maxima): The maxima command used should be
107 configurable (defaults to maxima-command if defined).
108
1092012-04-01 Eric Schulte <eric.schulte@gmx.com>
110
111 * ob-C.el (org-babel-C-execute): Add the local directory to the
112 library search path for C/C++ block compilation.
113
1142012-04-01 Eric Schulte <eric.schulte@gmx.com>
115
116 * ob.el (org-babel-where-is-src-block-result): Don't truncate
117 results name on call line execution.
118
1192012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change)
120
121 * org-colview.el (org-columns-cleanup-item): Handle case of empty
122 headline
123
1242012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
125
126 * org-footnote.el (org-footnote-delete-definitions): Fix LaTeX
127 export error when a src block produces fake footnotes.
128
1292012-04-01 Bastien Guerry <bzg@gnu.org>
130
131 * org.el (org-read-date): Don't mention `parse-time-weekdays' and
132 `parse-time-months' in the docstring.
133
1342012-04-01 Bastien Guerry <bzg@gnu.org>
135
136 * org-agenda.el (org-agenda-filter-apply): Bugfix: Add let
137 binding.
138
1392012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
140
141 * org-colview.el (org-columns-compute): Also consider inline tasks
142 when computing the sum.
143
1442012-04-01 Thomas Morgan <tlm@ziiuu.com> (tiny change)
145
146 * org-habit.el (org-habit-insert-consistency-graphs): Fix
147 alignment of consistency graph in filtered agenda view.
148
1492012-04-01 Bastien Guerry <bzg@gnu.org>
150
151 * org-latex.el (org-export-as-latex): Fix bug in setting the
152 export directory according to the LaTeX options.
153
1542012-04-01 K.Nagashima <uni.naga@gmail.com> (tiny change)
155
156 * org.el (org-show-subtree): Make interactive.
157
1582012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu>
159
160 * org-clock.el: (org-clock-get-table-data): Make sure todo-only
161 does not leak when it is set by make-org-tags-macher.
162
1632012-04-01 Bastien Guerry <bzg@gnu.org>
164
165 * org.el (org-cycle-internal-local): Don't try to hide drawers
166 within subtrees in this function, it slows cycling down.
167
1682012-04-01 Bastien Guerry <bzg@gnu.org>
169
170 * org-agenda.el (org-agenda-custom-commands-local-options): Fix
171 incorrect custom option definition.
172
1732012-04-01 Bastien Guerry <bzg@gnu.org>
174
175 * org-colview.el (org-columns-display-here): Bugfix: use the date
176 as the value for the ITEM column when displaying a summary.
177
1782012-04-01 Martyn Jago <martyn.jago@btinternet.com>
179
180 * ob-lilypond.el: Re-direct homepage to Worg.
181
1822012-04-01 Martyn Jago <martyn.jago@btinternet.com>
183
184 * ob-lilypond.el: Leave versioning to Org.
185
1862012-04-01 Martyn Jago <martyn.jago@btinternet.com>
187
188 * ob-lilypond.el: Fix compiler warning.
189
1902012-04-01 Jambunathan K <kjambunathan@gmail.com>
191
192 * org-odt.el (org-odt-format-entity-caption): Enumerate entities
193 that have either a caption or a label.
194 (org-odt-label-styles, org-odt-category-map-alist): Add a
195 separator between sequence number and caption. Introduced two
196 new label styles for handling of math formula and math label.
197 (org-odt-format-label-definition)
198 (org-export-odt-format-formula): Propagate above changes.
199
2002012-04-01 Bastien Guerry <bzg@gnu.org>
201
202 * org.el (org-enforce-todo-dependencies): Fix docstring.
203
2042012-04-01 Jambunathan K <kjambunathan@gmail.com>
205
206 * org-odt.el (org-export-odt-category-strings): New custom
207 variable.
208 (org-odt-category-map-alist): Modify interpretation. Don't
209 use the same field to double up as both a OpenDocument
210 variable and a category string. Entries in this list now
211 specify only the OpenDocument variable. Category strings are
212 obtained through an indirect lookup of
213 `org-export-odt-category-strings'. Use same OpenDocument
214 variables as what LibreOffice uses for various entities. Fix
215 docstring.
216 (org-odt-add-label-definition)
217 (org-odt-format-label-definition)
218 (org-odt-format-label-reference): Propagate above changes.
219
2202012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
221
222 * org-latex.el (org-export-as-latex): Check TeX-master correctly.
223
2242012-04-01 Jambunathan K <kjambunathan@gmail.com>
225
226 * org-odt.el (org-odt-category-map-alist): Update docstring.
227 (org-export-odt-user-categories)
228 (org-export-odt-get-category-from-label)
229 (org-odt-get-label-category-and-style): Remove.
230 (org-odt-add-label-definition): Propagate above changes.
231
2322012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
233
234 * org.el (org-refile): Don't allow creation of parents when using
235 the refile command to go to a headline.
236
2372012-04-01 Jambunathan K <kjambunathan@gmail.com>
238
239 * org-odt.el (org-odt-format-org-link): Resolve links to headlines
240 as section numbers only if section numbering is on.
241
2422012-04-01 Bastien Guerry <bzg@gnu.org>
243
244 * org.el (format-spec): Require 'format-spec.
245
2462012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
247
248 * org-latex.el (org-export-as-latex): Fix TeX-master declaration.
249
2502012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change)
251
252 * org.el (org-imenu-get-tree): Check that looking-at succeeds
253 before using match results.
254
2552012-04-01 Bastien Guerry <bzg@gnu.org>
256
257 * org-exp-blocks.el (org-ditaa-jar-path): Make a defcustom.
258
2592012-04-01 Jambunathan K <kjambunathan@gmail.com>
260
261 * org-lparse.el (org-do-lparse): Make effective setting of
262 `org-export-headline-levels' available to the ODT exporter. Also
263 remove some stale comments.
264
2652012-04-01 Jambunathan K <kjambunathan@gmail.com>
266
267 * org-odt.el (org-odt-begin-toc): Handle named HTML entities in
268 per-language string for "Table Of Contents".
269
2702012-04-01 Bastien Guerry <bzg@gnu.org>
271
272 * org-exp-blocks.el (org-ditaa-jar-path): Fix merge conflict.
273
2742012-04-01 Shaun Johnson <shaun@slugfest.demon.co.uk> (tiny change)
275
276 * org-exp-blocks.el (org-ditaa-jar-path): Better heuristic to find
277 the libary name.
278
2792012-04-01 Suvayu Ali <fatkasuvayu+linux@gmail.com>
280
281 * org-src.el (org-edit-src-code): Change let bind to let*, e.g. if
282 case-fold-search is bound to nil globally, the
283 (case-fold-search t) doesn't work until we get to the body.
284
2852012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
286
287 * org-latex.el (org-export-latex-tables): Allow to use
288 sidewaystable.
289
2902012-04-01 Eric Schulte <eric.schulte@gmx.com>
291
292 * ob.el (org-babel-expand-noweb-references): Fix bug in src name
293 regexp when using *org-babel-use-quick-and-dirty-noweb-expansion*.
294
2952012-04-01 David Maus <dmaus@ictsoc.de>
296
297 * org.el (org-scan-tags): Require one or more spaces (+) between
298 keyword and headline.
299
3002012-04-01 David Maus <dmaus@ictsoc.de>
301
302 * org-agenda.el (org-prepare-agenda): Don't reset
303 `org-done-keywords-for-agenda' when `org-agenda-multi'.
304
3052012-04-01 Thomas Morgan <tlm@ziiuu.com> (tiny change)
306
307 * org-habit.el (org-habit-insert-consistency-graphs): Fix bug
308 while inserting habit graph in the agenda buffer.
309
3102012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
311
312 * org-src.el (org-src-edit-buffer-p): New function.
313
3142012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
315
316 * org-agenda.el (org-agenda-skip-if): Fix the order conditions are
317 being checked. Also enhance the docstring a bit.
318
3192012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
320
321 * org-agenda.el (org-agenda-tree-to-indirect-buffer): Fix the
322 display of indirect agenda window.
323
3242012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change)
325
326 * org.el (org-create-formula-image, org-dvipng-color): Fix XEmacs
327 compatibility bug.
328
3292012-04-01 Carsten Dominik <carsten.dominik@gmail.com> (tiny change)
330
331 * org-clock.el (org-clock-get-table-data): Bind org-scanner-tags
332 to tags-list and org-trust-scanner-tags to t while evaluating the
333 matcher, since the matcher is always evaluated at the current
334 entry.
335
3362012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change)
337
338 * org.el (org-scan-tags): Bind org-trust-scanner-tags to t while
339 evaluating the matcher, since the matcher is always evaluated at
340 the current entry.
341
3422012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change)
343
344 * ob-lilypond.el (ly-compile-lilyfile): Fixed misplaced comma in a
345 quoting expression.
346
3472012-04-01 Eric Schulte <eric.schulte@gmx.com>
348
349 * ob.el (org-babel-merge-params): Add "eval" as acceptable noweb
350 argument.
351 (org-babel-noweb-p): The "eval" argument only expands during
352 evaluation.
353
3542012-04-01 Eric Schulte <eric.schulte@gmx.com>
355
356 * ob.el (org-strip-protective-commas): Declared.
357
358 * org-agenda.el (org-agenda-filtered-by-category): Declared.
359 (org-agenda-filter-apply): Capture free variable.
360
361 * org-footnote.el (org-skip-whitespace): Declared.
362
363 * org-mobile.el (org-agenda-filter): Declared.
364
365 * org-src.el (org-strip-protective-commas): Declared.
366
3672012-04-01 Sebastien Vauban <sva@mygooglest.com> (tiny change)
368
369 * org.el (org-version): Add autoload cookie.
370
3712012-04-01 David Maus <dmaus@ictsoc.de>
372
373 * org-attach.el (org-attach-store-link-p): Remove spurious quote
374 in customization form choice.
375
3762012-04-01 Tassilo Horn <tassilo@member.fsf.org>
377
378 * org-contacts.el (org-contacts-check-mail-address): Add missing
379 word to `y-or-n-p' question.
380
3812012-04-01 Eric Schulte <eric.schulte@gmx.com>
382
383 * ob-sh.el (org-babel-execute:sh): Pass all params to subroutine.
384 (org-babel-sh-evaluate): Apply :shebang and :padline to shell script
385 execution.
386
3872012-04-01 Eric Schulte <eric.schulte@gmx.com>
388
389 * ob.el (org-babel-insert-result): Ensure correct order for empty
390 result wrapping blocks.
391
3922012-04-01 Martyn Jago <martyn.jago@btinternet.com>
393
394 * ob-lilypond.el: Make auditioning of midi and pdf asynchronous,
395 and add easy pdf generation in the form of `ly-gen-pdf' variable.
396
3972012-04-01 Deech <deech@deech-ThinkPad-X200.none> (tiny change)
398
399 * ob-tangle.el (org-babel-spec-to-string): The link generated by
400 org-store-link is escaped twice when tangling with ":comments yes"
401 flag.
402
4032012-04-01 Bastien Guerry <bzg@gnu.org>
404
405 * org-html.el (org-export-as-html): Remove another useless space
406 before tag.
407
4082012-04-01 Bastien Guerry <bzg@gnu.org>
409
410 * org-html.el (org-export-as-html): Remove another useless space
411 before tag.
412
4132012-04-01 Bastien Guerry <bzg@gnu.org>
414
415 * org-html.el (org-export-as-html): Remove useless space before
416 tag.
417
4182012-04-01 Sebastien Vauban <sva@mygooglest.com> (tiny change)
419
420 * org.el (org-version): Add autoload cookie.
421
4222012-04-01 Bastien Guerry <bzg@gnu.org>
423
424 * org.el (org-get-category): Save match data.
425
4262012-04-01 Eric Schulte <eric.schulte@gmx.com>
427
428 * ob-tangle.el (org-babel-tangle): Don't prompt for a file name if
429 :tangle is specified.
430
431 * ob.el (org-babel-expand-noweb-references): Widen buffer when
432 expanding noweb references.
433
4342012-04-01 Eric Schulte <eric.schulte@gmx.com>
435
436 * ob-table.el (sbe): Don't accidentally leave a `t' value when
437 variables are force interpreted as strings.
438
4392012-04-01 David Maus <dmaus@ictsoc.de>
440
441 * org-bbdb.el (org-bbdb-open, org-bbdb-open-old)
442 (org-bbdb-open-new): Pass record name to avoid dynamic scoping.
443
4442012-04-01 David Maus <dmaus@ictsoc.de>
445
446 * org-bbdb.el (bbdb-record-get-field, bbdb-search-name)
447 (bbdb-search-organization): Declare functions to silence byte
448 compiler.
449
4502012-04-01 Bernt Hansen <bernt@norang.ca>
451
452 * org.el (org-clone-subtree-with-time-shift): Fix task cloning for
453 repeating tasks using .+n and ++n syntax
454
4552012-04-01 Karl Fogel <kfogel@red-bean.com> (tiny change)
456
457 * org-agenda.el (org-agenda-highlight-todo): Handle the case of a
458 heading that has a date but no todo keyword.
459
4602012-04-01 Eric Schulte <eric.schulte@gmx.com>
461
462 * ob.el (org-babel-find-named-result): Fix code block replacement
463 with results.
464
4652012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
466
467 * org-footnote.el (org-footnote-normalize): Do not normalize
468 labels when sort-only is non-nil.
469
4702012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
471
472 * org-footnote.el (org-footnote-normalize): Remove an useless part
473 of the function.
474 (org-insert-footnote-reference-near-definition): Remove function.
475
4762012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
477
478 * org-footnote.el (org-footnote-normalize): Fix normalization of
479 inline footnotes with no footnote section.
480
4812012-04-01 David Maus <dmaus@ictsoc.de>
482
483 * org-bbdb.el (org-bbdb-old): Replace `defvar' after loading 'bbdb
484 to check for old or new version by a check for the required
485 function in `org-bbdb-open' and `org-bbdb-store-link'.
486 (org-bbdb-store-link, org-bbdb-open): Check which version of bbdb is
487 to be used.
488
4892012-04-01 Eric Schulte <eric.schulte@gmx.com>
490
491 * ob.el (org-babel-find-named-result): Don't miss a code block
492 when there are confounding spaces after the result name.
493
4942012-04-01 Eric Schulte <eric.schulte@gmx.com>
495
496 * ob-lob.el (org-babel-block-lob-one-liner-regexp): Less greedy
497 regular expressions.
498 (org-babel-inline-lob-one-liner-regexp): Less greedy regular
499 expressions.
500
5012012-04-01 Eric Schulte <eric.schulte@gmx.com>
502
503 * ob.el (org-babel-examplize-region): Fixed bug in examplization.
504
5052012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
506
507 * org.el (org-link-search): Search for #+name affiliated keywords
508 and invisible targets.
509
5102012-04-01 Jambunathan K <kjambunathan@gmail.com>
511
512 * org-lparse.el (org-lparse-end-footnote-definition): Cleanup
513 newlines in a transcoded footnote definition. This ensures that
514 the line that is currently being processed by `org-do-lparse' loop
515 doesn't get broken up into multiple lines. Fix for the following
516 bug -
517
5182012-04-01 Jambunathan K <kjambunathan@gmail.com>
519
520 * org-footnote.el (org-footnote-normalize): Force a paragraph
521 break after the last footnote definition. This is an an implicit
522 assumption made by the org-lparse.el library. With this change,
523 footnote definitions can reliably be exported with ODT backend.
524 See http://lists.gnu.org/archive/html/emacs-orgmode/2012-02/msg01013.html.
525
5262012-04-01 Eric Schulte <eric.schulte@gmx.com>
527
528 * ob-ditaa.el (org-ditaa-jar-path): Fix a recursive load error.
529
5302012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
531
532 * org-list.el (org-list-struct): Fix small bug introduced by
533 commit 8b7a3f249803aba612f9ad3ae50c2fc986247da4 in Org's git repo.
534
5352012-04-01 Eric Schulte <eric.schulte@gmx.com>
536
537 * ob-ditaa.el (org-ditaa-jar-path): Already defined in
538 org-exp-blocks.el.
539
540 * org-exp-blocks.el (org-ditaa-jar-path): Declare appropriately
541 for the fact that this is really now a Babel thing -- even if it
542 is used here and the definition should remain here for reasons of
543 load dependencies.
544
5452012-04-01 David Maus <dmaus@ictsoc.de>
546
547 * org-bbdb.el (org-bbdb-old): Wrap `defvar' so the variable gets
548 defined after bbdb was loaded.
549
5502012-04-01 Eric Schulte <eric.schulte@gmx.com>
551
552 * org-latex.el (org-export-latex-tables): Don't add spurious
553 preceding newline if caption is not above a longtable.
554
5552012-04-01 Jambunathan K <kjambunathan@gmail.com>
556
557 * org-odt.el (org-odt-insert-toc): Remove this stray,
558 dysfunctional routine. This possibly has crept in because of the
559 broken merges between "maint" and "origin" branches.
560 (org-odt-begin-table): Don't emit an empty paragraph when a table is
561 neither labelled or captioned.
562 (org-odt-init-outfile): Remove reference to an unused variable.
563
5642012-04-01 Viktor Rosenfeld <listuser36@googlemail.com>
565
566 * ob-sql.el (org-babel-execute:sql): Add support for MonetDB to
567 SQL code blocks.
568
5692012-04-01 Andreas Leha <andreas.leha@med.uni-goettingen.de>
570
571 * ob.el (org-babel-goto-named-src-block): Pushing the point to the
572 org-mark-ring and guessing at the code block name to jump to.
573
5742012-04-01 David Maus <dmaus@ictsoc.de>
575
576 * org-agenda.el (org-agenda-tree-to-indirect-buffer): Fix handling
577 of indirect buffer and window.
578
5792012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
580
581 * org-footnote.el (org-footnote-forbidden-blocks): Allow footnotes
582 in verse blocks.
583
5842012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
585
586 * org-footnote.el (org-footnote-forbidden-blocks): Allow footnotes
587 in verse blocks.
588
5892012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
590
591 * org-exp.el (org-table-clean-before-export): Ignore table rows
592 defining parameters for formulas during export.
593
5942012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
595
596 * org-list.el (org-list-get-item-number): New function.
597
5982012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
599
600 * org-list.el (org-list-ending-method, org-list-end-regexp):
601 Removed variables.
602 (org-in-item-p, org-list-separating-blank-lines-number)
603 (org-list-parse-list, org-list-struct): Apply changes.
604
605 * org-exp.el (org-export-mark-list-end)
606 (org-export-mark-list-properties): Apply changes.
607
608 * org-latex.el (org-export-latex-lists): Apply changes.
609
6102012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
611
612 * org.el (org-cycle-internal-local): Correctly unfold headlines
613 containing an inlinetask.
614
6152012-04-01 Bastien Guerry <bzg@gnu.org>
616
617 * org.el (org-structure-template-alist): Fix missing angle
618 brackets for muse export style.
619
6202012-04-01 David Maus <dmaus@ictsoc.de>
621
622 * org.el (org-recenter-calendar): Use `with-selected-window' to
623 select calendar window and save currently selected window and
624 current buffer.
625
6262012-04-01 Toby S. Cubitt <tsc25@cantab.net> (tiny change)
627
628 * org.el (org-goto): call org-refile-get-location with NO-EXCLUDE
629 argument set, otherwise not only are headlines in the current
630 subtree excluded, but it throws an error if point happens not to
631 be within a subtree (e.g. at start of buffer).
632
6332012-04-01 David Maus <dmaus@ictsoc.de>
634
635 * org.el (org-scan-tags): Fix highlighting in sparse-tree.
636
6372012-04-01 David Maus <dmaus@ictsoc.de>
638
639 * org-clock.el (org-in-clocktable-p): Moved to org.el.
640
641 * org.el (org-in-clocktable-p): New function. Moved from
642 org-clock.el
643
6442012-04-01 David Maus <dmaus@ictsoc.de>
645
646 * org-exp.el (org-export-get-title-from-subtree): Don't format
647 tags in title if title headline does not have tags.
648
6492012-04-01 Bastien Guerry <bzg@gnu.org>
650
651 * org.el (org-cycle-internal-local): Fix bug: hide drawers in
652 inline tasks too.
653
6542012-04-01 Jambunathan K <kjambunathan@gmail.com>
655
656 * org-odt.el (org-odt-format-preamble): Don't insert TOC here.
657 Delay it till the end of export.
658 (org-odt-begin-document-body): Make a note of the default
659 position of TOC in `org-lparse-dyn-first-heading-pos'.
660 (org-odt-insert-toc): Insert TOC as directed by
661 [TABLE-OF-CONTENTS] line or at the default position.
662 (org-odt-end-export): Call `org-odt-insert-toc'.
663
6642012-04-01 Bastien Guerry <bzg@gnu.org>
665
666 * org.el (org-preview-latex-fragment): Throw an error when called
667 from a non-file buffer.
668
6692012-04-01 David Maus <dmaus@ictsoc.de>
670
671 * org-capture.el (org-capture-place-item): Don't search for
672 position in existing list if :exact-position was supplied.
673
6742012-04-01 Bastien Guerry <bzg@gnu.org>
675
676 * org.el (org-set-font-lock-defaults): Fix bug in done headline
677 fontification.
678
6792012-04-01 Jambunathan K <kjambunathan@gmail.com>
680
681 * org-odt.el (org-odt-format-textbox): Honor user-specified width
682 in captioned images.
683
6842012-04-01 Eric Schulte <eric.schulte@gmx.com>
685
686 * org.el (org-update-property-plist): Fix bug in property list
687 updates.
688
6892012-04-01 Eric Schulte <eric.schulte@gmx.com>
690
691 * ob.el (org-babel-balanced-split): Explicit checking if list
692 before calling member.
693
6942012-04-01 Eric Schulte <eric.schulte@gmx.com>
695
696 * ob-sqlite.el (org-babel-execute:sqlite): Specify the use of ","
697 as the separator to `org-table-convert-region'. Fixes errors when
698 only one result per line of output.
699
7002012-04-01 Eric Schulte <eric.schulte@gmx.com>
701
702 * ob.el (org-babel-strip-protective-commas): Use
703 `org-strip-protective-commas'.
704
705 * org-exp.el (org-export-select-backend-specific-text): Use
706 `org-strip-protective-commas'.
707
708 * org-src.el (org-edit-src-code): Use
709 `org-strip-protective-commas'.
710
711 * org.el (org-strip-protective-commas): Single definition for this
712 functionality.
713
7142012-04-01 Eric Schulte <eric.schulte@gmx.com>
715
716 * ob-sql.el: Mention ob-sqlite in the comments of ob-sql.
717
7182012-04-01 David Maus <dmaus@ictsoc.de>
719
720 * org-capture.el (org-capture-prepare-finalize-hook): New hook.
721 Run before the finalization process starts.
722 (org-capture-finalize): Run new hook.
723
7242012-04-01 Eric Schulte <eric.schulte@gmx.com>
725
726 * org.el (org-entry-get): Generalize to multiple "prop+"
727 properties.
728
7292012-04-01 Eric Schulte <eric.schulte@gmx.com>
730
731 * org-src.el (org-src-mode-map): Rebinding `org-edit-src-save' in
732 the `org-src-mode-map'.
733
7342012-04-01 David Maus <dmaus@ictsoc.de>
735
736 * org.el (org-recenter-calendar): Use `with-selected-window' to
737 select calendar window and save currently selected window and
738 current buffer.
739
7402012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
741
742 * org-list.el (org-list-ending-method, org-list-end-regexp):
743 Removed variables.
744 (org-in-item-p, org-list-separating-blank-lines-number)
745 (org-list-parse-list, org-list-struct): Apply changes.
746
747 * org-exp.el (org-export-mark-list-end)
748 (org-export-mark-list-properties): Apply changes.
749
750 * org-latex.el (org-export-latex-lists): Apply changes.
751
7522012-04-01 Eric Schulte <eric.schulte@gmx.com>
753
754 * org.el (org-entry-get): Accumulate properties from subtree
755 property drawers.
756
7572012-04-01 Eric Schulte <eric.schulte@gmx.com>
758
759 * org.el (org-entry-get): Accumulate properties from subtree
760 property drawers.
761
7622012-04-01 Jambunathan K <kjambunathan@gmail.com>
763
764 * org-odt.el (org-export-odt-image-size-probe-method)
765 (org-odt-do-image-size): Use imagemagick preferentially to
766 determine image sizes.
767
7682012-04-01 Jambunathan K <kjambunathan@gmail.com>
769
770 * org-odt.el (org-export-as-odt-to-buffer)
771 (org-replace-region-by-odt, org-export-region-as-odt): Remove
772 these interactive functions. They are of questionable value.
773
7742012-04-01 Toby S. Cubitt <tsc25@cantab.net> (tiny change)
775
776 * org.el (org-goto): call org-refile-get-location with NO-EXCLUDE
777 argument set, otherwise not only are headlines in the current
778 subtree excluded, but it throws an error if point happens not to
779 be within a subtree (e.g. at start of buffer).
780
7812012-04-01 Bastien Guerry <bzg@gnu.org>
782
783 * org-exp.el (org-export-kill-product-buffer-when-displayed)
784 (org-export-initial-scope, org-export-date-timestamp-format)
785 (org-export-with-tasks, org-export-email-info)
786 (org-export-table-remove-empty-lines): Add version tag.
787
7882012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
789
790 * org.el (org-cycle-internal-local): Correctly unfold headlines
791 containing an inlinetask.
792
7932012-04-01 Bernt Hansen <bernt@norang.ca>
794
795 * org-clock.el (org-clock-out): Do not delete the current clocking
796 task when org-clock-out-hook clocks in another task
797
7982012-04-01 David Maus <dmaus@ictsoc.de>
799
800 * org.el (org-scan-tags): Fix highlighting in sparse-tree.
801
8022012-04-01 Jambunathan K <kjambunathan@gmail.com>
803
804 * org-odt.el (org-export-odt-convert-processes): Re-define
805 (org-export-odt-convert-capabilities): Fix an accidental
806 regression.
807
8082012-04-01 Jambunathan K <kjambunathan@gmail.com>
809
810 * org-odt.el (org-export-odt-convert-capabilities): Change the
811 default value.
812
8132012-04-01 David Maus <dmaus@ictsoc.de>
814
815 * org-clock.el (org-in-clocktable-p): Moved to org.el.
816
817 * org.el (org-in-clocktable-p): New function. Moved from org-clock.el
818
8192012-04-01 David Maus <dmaus@ictsoc.de>
820
821 * org-exp.el (org-export-get-title-from-subtree): Don't format
822 tags in title if title headline does not have tags.
823
8242012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
825
826 * org-footnote.el (org-blank-before-new-entry)
827 (org-export-footnotes-seen, org-export-footnotes-data): Fix bogus
828 declarations.
829
8302012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
831
832 * org.el (org-beginning-of-line, org-end-of-line): Fix special C-a
833 and C-e behaviour with visual lines.
834
8352012-04-01 Eric Schulte <eric.schulte@gmx.com>
836
837 * org-exp-blocks.el (org-export-blocks): Changed the name of
838 exporting comment blocks given that it seems regular comment
839 blocks no longer export.
840
8412012-04-01 Eric Schulte <eric.schulte@gmx.com>
842
843 * ob-exp.el (org-babel-exp-get-export-buffer): Access current
844 export buffer.
845 (org-babel-exp-in-export-file): Access current export buffer.
846 (org-babel-exp-src-block): Access current export buffer.
847 (org-babel-exp-inline-src-blocks): Access current export buffer.
848
8492012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
850
851 * ob-exp.el (org-babel-exp-in-export-file)
852 (org-babel-exp-src-block, org-babel-exp-inline-src-blocks): Allow
853 org-current-export-file to contain a buffer.
854
8552012-04-01 Jambunathan K <kjambunathan@gmail.com>
856
857 * org-lparse.el (org-lparse-do-convert): Replace `call-process'
858 with `shell-command-to-string'.
859
8602012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
861
862 * org-footnote.el (org-footnote-create-definition): Fix space
863 insertion when creating a new footnote. This fixes newline
864 munching when `org-footnote-section' is nil and blank lines
865 stacking when it isn't nil.
866
8672012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
868
869 * org-footnote.el (org-footnote-normalize): Make sure that
870 footnotes are moved to a single place during export.
871
8722012-04-01 Bastien Guerry <bzg@gnu.org>
873
874 * org.el (org-cycle-internal-global): Prevent the display of
875 messages when cycling from with a Gnus article buffer.
876
8772012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
878
879 * org-footnote.el (org-footnote-normalize): Ensure footnote
880 definition will be inserted at the end of the section
881 corresponding to to its first reference.
882
8832012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
884
885 * org-footnote.el (org-footnote-at-definition-p): Make sure to
886 move point at the beginning of the separator before skiping white
887 spaces. Refactor code.
888
8892012-04-01 Eric Schulte <eric.schulte@gmx.com>
890
891 * ob-exp.el (org-babel-exp-src-block): Strip noweb references on
892 export when "strip-export".
893
894 * ob.el (org-babel-common-header-args-w-values): New noweb
895 header value.
896 (org-babel-merge-params): New noweb header value.
897 (org-babel-noweb-p): New noweb header value.
898
8992012-04-01 Eric Schulte <eric.schulte@gmx.com>
900
901 * ob-tangle.el (org-babel-tangle-clean): Just use default value.
902
903 * ob.el (org-babel-noweb-wrap): Add default value.
904 (org-babel-expand-noweb-references): Just use default value.
905
9062012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
907
908 * org-exp.el (org-export-select-backend-specific-text): Always
909 preserve original indentation as a text property so that lists do
910 not get broken by indentation at column 0.
911
9122012-04-01 Eric Schulte <eric.schulte@gmx.com>
913
914 * ob.el (org-babel-expand-noweb-references): Don't allow newlines
915 in source names in noweb references.
916
9172012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
918
919 * org.el (org-fill-line-break-nobreak-p): New function.
920 (org-set-autofill-regexps): Add previous function to
921 `fill-nobreak-predicate'.
922
9232012-04-01 Vitalie Spinu <spinuvit@gmail.com>
924
925 * ob-R.el (org-babel-R-evaluate-session): Inhibit R evaluation
926 visibility regardless of local user customization.
927
9282012-04-01 Vitalie Spinu <spinuvit@gmail.com>
929
930 * ob-R.el (org-babel-R-evaluate-session): Inhibit R evaluation
931 visibility regardless of local user customization.
932
9332012-04-01 Carsten Dominik <carsten.dominik@gmail.com>
934
935 * org-inlinetask.el (org-inlinetask-show-first-star): New option.
936 (org-inlinetask-fontify): Honor `org-inlinetask-show-first-star'.
937
938 * org-indent.el (org-indent-set-line-properties): Honor
939 `org-inlinetask-show-first-star'.
940
9412012-04-01 Bastien Guerry <bzg@gnu.org>
942
943 * org.el (org-set-regexps-and-options): Ensure `org-drawers'
944 doesn't contain duplicates.
945
9462012-04-01 Bastien Guerry <bzg@gnu.org>
947
948 * org.el (org-at-drawer-p): Normalize the docstring to match other
949 `org-at-*-p' docstrings.
950 (org-indent-block, org-indent-drawer, org-at-block-p): New
951 functions.
952 (org-metaright): Use the new functions to indent a drawer or a
953 block depending on the context. Also update the docstring.
954
9552012-04-01 Bastien Guerry <bzg@gnu.org>
956
957 * org.el (org-set-regexps-and-options): Set the value of
958 `org-drawers' by adding the value of the infile #+DRAWERS option
959 to that of the existing `org-drawers'.
960
9612012-04-01 Bastien Guerry <bzg@gnu.org>
962
963 * org.el (org-cycle-internal-local): Fix bug: hide drawers in
964 inline tasks too.
965
9662012-04-01 Bastien Guerry <bzg@gnu.org>
967
968 * org-inlinetask.el (org-inlinetask-toggle-visibility): Use
969 `org-show-entry' instead of `outline-flag-region' to keep the
970 drawers folded when unfolding an inline task.
971
9722012-04-01 Torsten Anders <torsten.anders@beds.ac.uk> (tiny change)
973
974 * org-beamer.el (org-beamer-environments-default): Add support and
975 keybinding for the `exampleblock' environment.
976
9772012-04-01 Michael Brand <michael.ch.brand@gmail.com>
978
979 * org.el (org-open-link-from-string): Regard `reference-buffer'
980 when setting `org-inhibit-startup'.
981
9822012-04-01 Eric Schulte <eric.schulte@gmx.com>
983
984 * ob-exp.el (org-babel-exp-non-block-elements): Don't insert extra
985 space between inline src block and results on export.
986
9872012-04-01 Eric Schulte <eric.schulte@gmx.com>
988
989 * ob.el (org-babel-get-inline-src-block-matches): Allow *any*
990 punctuation to proceed an inline src block.
991
9922012-04-01 Eric Schulte <eric.schulte@gmx.com>
993
994 * ob.el (org-babel-get-inline-src-block-matches): Add ( to the
995 list of characters allowed to proceed an inline src block.
996
9972012-04-01 Eric Schulte <eric.schulte@gmx.com>
998
999 * ob-tangle.el (org-babel-tangle-clean): Use the customizable
1000 noweb wrappers.
1001
1002 * ob.el (org-babel-noweb-wrap-start): Begin a noweb reference.
1003 (org-babel-noweb-wrap-end): End a noweb reference.
1004 (org-babel-noweb-wrap): Apply the customizable noweb wrappers.
1005 (org-babel-expand-noweb-references): Use the customizable noweb
1006 wrappers.
1007
10082012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
1009
1010 * org.el (org-beginning-of-line): Handle case when there's no
1011 character after box.
1012
10132012-04-01 Jambunathan K <kjambunathan@gmail.com>
1014
1015 * org-odt.el (org-odt-format-preamble): Don't insert TOC here.
1016 Delay it till the end of export.
1017 (org-odt-begin-document-body): Make a note of the default
1018 position of TOC in `org-lparse-dyn-first-heading-pos'.
1019 (org-odt-insert-toc): Insert TOC as directed by
1020 [TABLE-OF-CONTENTS] line or at the default position.
1021 (org-odt-end-export): Call `org-odt-insert-toc'.
1022
10232012-04-01 Bastien Guerry <bzg@gnu.org>
1024
1025 * org.el (org-preview-latex-fragment): Throw an error when called
1026 from a non-file buffer.
1027
10282012-04-01 Bastien Guerry <bzg@gnu.org>
1029
1030 * org.el (org-insert-property-drawer): Not an interactive
1031 command anymore.
1032 (org-insert-drawer): With a prefix argument, insert a property
1033 drawer. Check for headline within the region before inserting the
1034 drawer. Don't include special drawers in the completion table.
1035 (org-mode-map): New keybinding `C-c C-x d' for
1036 `org-insert-drawer'.
1037
10382012-04-01 Bastien Guerry <bzg@gnu.org>
1039
1040 * org.el (org-insert-drawer): Support completion over known drawer
1041 names and inserting a drawer around the current region.
1042
10432012-04-01 Bastien Guerry <bzg@gnu.org>
1044
1045 * org.el (org-insert-drawer): New function.
1046 (org-insert-property-drawer): Use it.
1047
10482012-04-01 Bastien Guerry <bzg@gnu.org>
1049
1050 * org-list.el (org-mark-list): New function.
1051
10522012-04-01 Bastien Guerry <bzg@gnu.org>
1053
1054 * org-pcomplete.el (pcomplete/org-mode/drawer): New function to
1055 complete drawer at point.
1056 (org-thing-at-point): Use it.
1057
10582012-04-01 Bastien Guerry <bzg@gnu.org>
1059
1060 * org.el (org-meta-return): Use `newline-and-indent' when in a
1061 property drawer.
1062
10632012-04-01 Bastien Guerry <bzg@gnu.org>
1064
1065 * org.el (org-structure-template-alist): Fix docstring: the
1066 feature is not experimental anymore.
1067
10682012-04-01 Bastien Guerry <bzg@gnu.org>
1069
1070 * org-agenda.el (org-agenda-show-and-scroll-up): Allow `C-u' to
1071 display the item without unfolding drawers and logbooks.
1072
10732012-04-01 Bastien Guerry <bzg@gnu.org>
1074
1075 * org-src.el (org-edit-src-code): Make sure `buffer-file-name' is
1076 always nil.
1077
10782012-04-01 Bastien Guerry <bzg@gnu.org>
1079
1080 * org.el (org-structure-template-alist): Fix missing angle
1081 brackets for muse export style.
1082
10832012-04-01 Bastien Guerry <bzg@gnu.org>
1084
1085 * org.el (org-read-date): New parameter `inactive' when reading
1086 for insertion of inactive timestamps.
1087 (org-time-stamp, org-read-date-display): Use the new
1088 parameter.
1089
10902012-04-01 Eric Schulte <eric.schulte@gmx.com>
1091
1092 * ob.el (org-babel-expand-noweb-references): Only allow
1093 reference names which start and end with non-whitespace characters.
1094 Also, raise errors as appropriate given org-babel-noweb-error-langs.
1095
10962012-04-01 Bastien Guerry <bzg@gnu.org>
1097
1098 * org-src.el (org-src-in-org-buffer): Save and restore
1099 `buffer-undo-list' after editing.
1100
11012012-04-01 Eric Schulte <eric.schulte@gmx.com>
1102
1103 * ob.el (org-babel-common-header-args-w-values): Add new header
1104 argument.
1105 (org-babel-expand-noweb-references): Use header argument rather than
1106 customization variable.
1107
11082012-04-01 David Maus <dmaus@ictsoc.de>
1109
1110 * org-capture.el (org-capture-place-item): Don't search for
1111 position in existing list if :exact-position was supplied.
1112
11132012-04-01 Eric Schulte <eric.schulte@gmx.com>
1114
1115 * ob.el (org-babel-noweb-separator): Custom variable for
1116 accumulated noweb references.
1117 (org-babel-expand-noweb-references): Allow separator for noweb
1118 references.
1119
11202012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
1121
1122 * org.el (org-beginning-of-line): In an item, special position
1123 for C-a is after check-box, if any.
1124 (org-special-ctrl-a/e): Modify doc-string accordingly.
1125
11262012-04-01 Jambunathan K <kjambunathan@gmail.com>
1127
1128 * org-odt.el (org-export-odt-format-formula): Use :style
1129 property to specify custom table styles.
1130
11312012-04-01 Eric Schulte <eric.schulte@gmx.com>
1132
1133 * ob-exp.el (org-babel-exp-call-line-template): Control export of
1134 additional call line information.
1135 (org-babel-exp-non-block-elements): Fancier call line export.
1136
11372012-04-01 Jambunathan K <kjambunathan@gmail.com>
1138
1139 * org-odt.el (org-odt-entity-frame-styles): Add frame params
1140 for images that are anchored as character.
1141 (org-export-odt-format-image): Handle new anchor type
1142 "as-char".
1143 (org-export-odt-default-image-sizes-alist): Misc. change.
1144 (org-export-odt-format-formula): Misc. change.
1145
11462012-04-01 Eric Schulte <eric.schulte@gmx.com>
1147
1148 * ob.el (org-babel-check-src-block): Don't report valid header
1149 arguments as suspicious.
1150
11512012-04-01 Eric Schulte <eric.schulte@gmx.com>
1152
1153 * ob-exp.el (org-babel-exp-non-block-elements): Map over both
1154 inline src blocks and call lines on export.
1155
11562012-04-01 Jambunathan K <kjambunathan@gmail.com>
1157
1158 * org-odt.el (org-odt-label-styles): Add a new style.
1159 (org-odt-category-map-alist): Use it.
1160
11612012-04-01 Jambunathan K <kjambunathan@gmail.com>
1162
1163 * org-odt.el (org-odt-table-style-format): New. Template for
1164 auto-generated table styles.
1165 (org-odt-automatic-styles, org-odt-object-counters): New
1166 variables.
1167 (org-odt-add-automatic-style): New function.
1168 (org-odt-write-automatic-styles): New function. Create
1169 automatic styles for tables that have custom :rel-width.
1170 (org-odt-begin-table): Parse attributes specified with
1171 "#+ATTR_ODT: " option and use it to create an automatic table
1172 style.
1173 (org-odt-save-as-outfile): Call
1174 `org-odt-add-write-automatic-styles'.
1175 (org-odt-init-outfile): Init newly add variables.
1176 (org-odt-section-count): Remove it.
1177 (org-odt-begin-section): Use `org-odt-add-automatic-style' to
1178 generate an automatic section name.
1179
11802012-04-01 Eric Schulte <eric.schulte@gmx.com>
1181
1182 * ob.el (org-babel-map-executables): Correctly position point when
1183 mapping hits an inline code block.
1184
11852012-04-01 Eric Schulte <eric.schulte@gmx.com>
1186
1187 * ob.el (org-babel-execute-src-block): Ensure params are
1188 incorporated *before* checking if evaluation is legal.
1189
11902012-04-01 Eric Schulte <eric.schulte@gmx.com>
1191
1192 * ob-exp.el (org-babel-exp-lob-one-liners): Ensure `end' is a
1193 marker so it is updated as required during export.
1194
11952012-04-01 Eric Schulte <eric.schulte@gmx.com>
1196
1197 * org-src.el (org-src-in-org-buffer): Run commands in the parent
1198 buffer.
1199 (org-edit-src-save): Use new macro.
1200 (org-src-tangle): Tangle the parent buffer.
1201
12022012-04-01 Bastien Guerry <bzg@gnu.org>
1203
1204 * org.el (org-set-font-lock-defaults): Fix bug in done
1205 headline fontification.
1206
12072012-04-01 Bastien Guerry <bzg@gnu.org>
1208
1209 * org.el (org-set-font-lock-defaults): Fix bug in done
1210 headline fontification.
1211
12122012-04-01 Bastien Guerry <bzg@gnu.org>
1213
1214 * org.el (org-return): Act normally when in code blocks.
1215
12162012-04-01 Bastien Guerry <bzg@gnu.org>
1217
1218 * org.el (org-in-src-block-p): New function.
1219 (org-context): Return new contexts :clocktable and :src-block.
1220
12212012-04-01 Bastien Guerry <bzg@gnu.org>
1222
1223 * org.el (org-set-tags-command, org-set-tags): Make ̀C-u C-c
1224 C-q' do the right thing even when point is before the first
1225 heading.
1226
12272012-04-01 Eric Schulte <eric.schulte@gmx.com>
1228
1229 * ob.el (org-babel-noweb-p): Disambiguate intersection name.
1230
12312012-04-01 Jambunathan K <kjambunathan@gmail.com>
1232
1233 * org-odt.el (org-odt-format-textbox): Honor user-specified
1234 width in captioned images.
1235
12362012-04-01 Eric Schulte <eric.schulte@gmx.com>
1237
1238 * ob.el (org-babel-map-src-blocks): Replace gensym with make-symbol.
1239 (org-babel-map-inline-src-blocks): Replace gensym with make-symbol.
1240 (org-babel-map-call-lines): Replace gensym with make-symbol.
1241 (org-babel-map-executables): Replace gensym with make-symbol.
1242
12432012-04-01 Eric Schulte <eric.schulte@gmx.com>
1244
1245 * ob-exp.el (org-babel-exp-results): Alter a copy of info.
1246
12472012-04-01 Bastien Guerry <bzg@gnu.org>
1248
1249 * org-html.el (org-export-as-html): Initialize
1250 `html-pre-real-contents' correctly.
1251
12522012-04-01 Bastien Guerry <bzg@gnu.org>
1253
1254 * org-html.el (org-export-as-html): Initialize
1255 `html-pre-real-contents' correctly.
1256
12572012-04-01 Eric Schulte <eric.schulte@gmx.com>
1258
1259 * ob-exp.el (org-babel-exp-code): Ensure code block name is a
1260 string on export.
1261
12622012-04-01 Eric Schulte <eric.schulte@gmx.com>
1263
1264 * ob-exp.el (org-babel-exp-code-template): Customizable code
1265 block export format string.
1266 (org-babel-exp-code): Customizable code block export.
1267
12682012-04-01 Eric Schulte <eric.schulte@gmx.com>
1269
1270 * ob-clojure.el (org-babel-execute:clojure): Removed dependency
1271 on deprecated swank-clojure.
1272
12732012-04-01 Eric Schulte <eric.schulte@gmx.com>
1274
1275 * ob.el (org-babel-map-src-blocks): Don't pollute symbol space.
1276 (org-babel-map-inline-src-blocks): Don't pollute symbol space.
1277 (org-babel-map-call-lines): Don't pollute symbol space.
1278 (org-babel-map-executables): Map over *all* executable Org-mode
1279 elements.
1280 (org-babel-execute-buffer): Execute elements in buffer order instead
1281 of arbitrarily.
1282
12832012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
1284
1285 * org.el (org-ctrl-c-ctrl-c): Fix a naive structure backup.
1286 Those must be done with `copy-tree'.
1287
12882012-04-01 Eric Schulte <eric.schulte@gmx.com>
1289
1290 * org-src.el (org-edit-src-code): Referenced code block should
1291 not be evaluated on code block edit.
1292
12932012-04-01 Bastien Guerry <bzg@gnu.org>
1294
1295 * org.el (org-structure-template-alist): Use uppercase for
1296 keywords.
1297
12982012-04-01 Eric Schulte <eric.schulte@gmx.com>
1299
1300 * ob.el (org-babel-insert-result): Capitalize RESULTS in :wrap'd
1301 code block results.
1302
13032012-04-01 Eric Schulte <eric.schulte@gmx.com>
1304
1305 * ob.el (org-babel-results-keyword): New user-configurable
1306 results keyword.
1307 (org-babel-where-is-src-block-result): Use new user-configurable
1308 results keyword.
1309
13102012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
1311
1312 * org-indent.el (org-indent-refresh-maybe): Check for new
1313 headlines from the beginning of the line to be sure to catch
1314 any newly inserted headline there.
1315
13162012-04-01 Eric Schulte <eric.schulte@gmx.com>
1317
1318 * ob-exp.el (org-babel-exp-src-block): Use `org-babel-noweb-p'.
1319 (org-babel-exp-inline-src-blocks): Use `org-babel-noweb-p'.
1320
1321 * ob-tangle.el (org-babel-tangle-collect-blocks): Use
1322 `org-babel-noweb-p'.
1323
1324 * ob.el (org-babel-execute-src-block): Use `org-babel-noweb-p'.
1325 (org-babel-expand-src-block): Use `org-babel-noweb-p'.
1326 (org-babel-load-in-session): Use `org-babel-noweb-p'.
1327 (org-babel-merge-params): Use `org-babel-noweb-p'.
1328 (org-babel-noweb-p): New function used to determine if noweb
1329 expansion should be carried out in a given context.
1330
13312012-04-01 Eric Schulte <eric.schulte@gmx.com>
1332
1333 * org.el (org-update-property-plist): Fix bug in property list
1334 updates.
1335
13362012-04-01 François Pinard <pinard@iro.umontreal.ca> (tiny change)
1337
1338 * org.el (org-kill-line): Use `kill-visual-line' in
1339 `visual-line-mode'.
1340
13412012-04-01 Bernt Hansen <bernt@norang.ca>
1342
1343 * org-agenda.el (org-agenda-switch-to): Widen org buffer only if point is
1344 outside the current restriction
1345
13462012-04-01 Bernt Hansen <bernt@norang.ca>
1347
1348 * org-agenda.el (org-agenda-clock-in): Save restriction when clocking in from the agenda
1349
13502012-04-01 Bernt Hansen <bernt@norang.ca>
1351
1352 * org.el: Honour existing restrictions when regenerating the agenda
1353
13542012-04-01 Bastien Guerry <bzg@gnu.org>
1355
1356 * org-agenda.el: New alias for `list-diary-entries-hook'.
1357
13582012-04-01 Eric Schulte <eric.schulte@gmx.com>
1359
1360 * ob.el (org-babel-common-header-args-w-values): Add the new
1361 header argument name.
1362 (org-babel-insert-result): Respect the value of the :wrap header
1363 argument when inserting results.
1364 (org-babel-result-end): Find the end of arbitrarily named result
1365 blocks.
1366
13672012-04-01 Nicolas Goaziou <n.goaziou@gmail.com>
1368
1369 * org-indent.el (org-indent-refresh-maybe): Check for new
1370 headlines from the beginning of the line to be sure to catch
1371 any newly inserted headline there.
1372
13732012-04-01 Eric Schulte <eric.schulte@gmx.com>
1374
1375 * org.el (org-update-property-plist): Remove old instances of
1376 property when adding a new value for property.
1377
13782012-04-01 Martyn Jago <martyn.jago@btinternet.com>
1379
1380 * ob-emacs-lisp.el: A comment on the last line of an emacs-lisp
1381 code block would cause an error when the block is was executed. This
1382 fix cures this behaviour.
1383
13842012-04-01 Eric Schulte <eric.schulte@gmx.com>
1385
1386 * ob.el (org-babel-expand-noweb-references): Resurrect dropped
1387 pieces of a previous patch.
1388
13892012-04-01 Eric Schulte <eric.schulte@gmx.com>
1390
1391 * ob-maxima.el (org-babel-execute:maxima): Fix compiler warning.
1392
13932012-04-01 Eric Schulte <eric.schulte@gmx.com>
1394
1395 * ob.el (org-babel-expand-noweb-references): Resurrect dropped
1396 pieces of a previous patch.
1397
13982012-04-01 Eric Schulte <eric.schulte@gmx.com>
1399
1400 * ob-maxima.el (org-babel-execute:maxima): Fix compiler warning.
1401
14022012-04-01 Bastien Guerry <bzg@gnu.org>
1403
1404 * org-eshell.el (org-eshell-open): Use (goto-char (point-max))
1405 instead of (end-of-buffer).
1406
14072012-04-01 Bastien Guerry <bzg@gnu.org>
1408
1409 * org-bbdb.el (name): Declare variable.
1410 (bbdb-record-get-field, bbdb-search-name)
1411 (bbdb-search-organization): Declare as part of ext:bbdb.
1412
14132012-04-01 Bastien Guerry <bzg@gnu.org>
1414
1415 * org-mobile.el (org-mobile-push): Use `org-agenda-tag-filter'
1416 instead of the obsolete `org-agenda-filter'.
1417
14182012-04-01 Bastien Guerry <bzg@gnu.org>
1419
1420 * org-agenda.el: Add an alias for `org-agenda-filter'.
1421 (diary-list-entries-hook): Use the non-obsolete hook.
1422 (org-agenda-filter-apply): Silent compiler warning.
1423
14242012-04-01 Bastien Guerry <bzg@gnu.org>
1425
1426 * ob-ditaa.el (org-ditaa-jar-path): Make a defcustom.
1427 (org-ditaa-jar-option): New option.
1428 (org-babel-execute:ditaa): Use it.
1429
14302012-04-01 Eric Schulte <eric.schulte@gmx.com>
1431
1432 * ob.el (org-babel-balanced-split): Explicit checking if list
1433 before calling member.
1434
14352012-04-01 Eric Schulte <eric.schulte@gmx.com>
1436
1437 * ob.el (org-babel-balanced-split): Explicit checking if list
1438 before calling member.
1439
12012-02-14 Chong Yidong <cyd@gnu.org> 14402012-02-14 Chong Yidong <cyd@gnu.org>
2 1441
3 * org-footnote.el: Remove bogus defvar values (Bug#10745). 1442 * org-footnote.el: Remove bogus defvar values (Bug#10745).
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el
index 4f33fc45310..5f6c1cb1dd1 100644
--- a/lisp/org/ob-C.el
+++ b/lisp/org/ob-C.el
@@ -88,7 +88,9 @@ or `org-babel-execute:C++'."
88 (cond 88 (cond
89 ((equal org-babel-c-variant 'c) ".c") 89 ((equal org-babel-c-variant 'c) ".c")
90 ((equal org-babel-c-variant 'cpp) ".cpp")))) 90 ((equal org-babel-c-variant 'cpp) ".cpp"))))
91 (tmp-bin-file (org-babel-temp-file "C-bin-")) 91 (tmp-bin-file (org-babel-temp-file
92 "C-bin-"
93 (if (equal system-type 'windows-nt) ".exe" "")))
92 (cmdline (cdr (assoc :cmdline params))) 94 (cmdline (cdr (assoc :cmdline params)))
93 (flags (cdr (assoc :flags params))) 95 (flags (cdr (assoc :flags params)))
94 (full-body (org-babel-C-expand body params)) 96 (full-body (org-babel-C-expand body params))
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el
index e8400f494ad..49a8a85cf6d 100644
--- a/lisp/org/ob-R.el
+++ b/lisp/org/ob-R.el
@@ -279,7 +279,8 @@ last statement in BODY, as elisp."
279 (with-temp-buffer 279 (with-temp-buffer
280 (insert (org-babel-chomp body)) 280 (insert (org-babel-chomp body))
281 (let ((ess-local-process-name 281 (let ((ess-local-process-name
282 (process-name (get-buffer-process session)))) 282 (process-name (get-buffer-process session)))
283 (ess-eval-visibly-p nil))
283 (ess-eval-buffer nil))) 284 (ess-eval-buffer nil)))
284 (let ((tmp-file (org-babel-temp-file "R-"))) 285 (let ((tmp-file (org-babel-temp-file "R-")))
285 (org-babel-comint-eval-invisibly-and-wait-for-file 286 (org-babel-comint-eval-invisibly-and-wait-for-file
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el
index 1c0c37c1dd4..69d3db86de4 100644
--- a/lisp/org/ob-clojure.el
+++ b/lisp/org/ob-clojure.el
@@ -31,7 +31,6 @@
31;;; - clojure (at least 1.2.0) 31;;; - clojure (at least 1.2.0)
32;;; - clojure-mode 32;;; - clojure-mode
33;;; - slime 33;;; - slime
34;;; - swank-clojure
35 34
36;;; By far, the best way to install these components is by following 35;;; By far, the best way to install these components is by following
37;;; the directions as set out by Phil Hagelberg (Technomancy) on the 36;;; the directions as set out by Phil Hagelberg (Technomancy) on the
@@ -75,7 +74,7 @@
75 74
76(defun org-babel-execute:clojure (body params) 75(defun org-babel-execute:clojure (body params)
77 "Execute a block of Clojure code with Babel." 76 "Execute a block of Clojure code with Babel."
78 (require 'slime) (require 'swank-clojure) 77 (require 'slime)
79 (with-temp-buffer 78 (with-temp-buffer
80 (insert (org-babel-expand-body:clojure body params)) 79 (insert (org-babel-expand-body:clojure body params))
81 ((lambda (result) 80 ((lambda (result)
@@ -86,7 +85,7 @@
86 (condition-case nil (org-babel-script-escape result) 85 (condition-case nil (org-babel-script-escape result)
87 (error result))))) 86 (error result)))))
88 (slime-eval 87 (slime-eval
89 `(swank:interactive-eval-region 88 `(swank:eval-and-grab-output
90 ,(buffer-substring-no-properties (point-min) (point-max))) 89 ,(buffer-substring-no-properties (point-min) (point-max)))
91 (cdr (assoc :package params)))))) 90 (cdr (assoc :package params))))))
92 91
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el
index 17e9d5d0ccf..57ae4b94758 100644
--- a/lisp/org/ob-ditaa.el
+++ b/lisp/org/ob-ditaa.el
@@ -39,22 +39,10 @@
39(require 'ob) 39(require 'ob)
40 40
41(defvar org-babel-default-header-args:ditaa 41(defvar org-babel-default-header-args:ditaa
42 '((:results . "file") 42 '((:results . "file") (:exports . "results") (:java . "-Dfile.encoding=UTF-8"))
43 (:exports . "results")
44 (:java . "-Dfile.encoding=UTF-8"))
45 "Default arguments for evaluating a ditaa source block.") 43 "Default arguments for evaluating a ditaa source block.")
46 44
47(defcustom org-ditaa-jar-path nil 45(defvar org-ditaa-jar-path)
48 "Path for the ditaa jar file."
49 :group 'org-babel
50 :type 'string)
51
52(defcustom org-ditaa-jar-option "-jar"
53 "Option for the ditaa jar file.
54Do not leave leading or trailing spaces in this string."
55 :group 'org-babel
56 :type 'string)
57
58(defun org-babel-execute:ditaa (body params) 46(defun org-babel-execute:ditaa (body params)
59 "Execute a block of Ditaa code with org-babel. 47 "Execute a block of Ditaa code with org-babel.
60This function is called by `org-babel-execute-src-block'." 48This function is called by `org-babel-execute-src-block'."
@@ -67,7 +55,7 @@ This function is called by `org-babel-execute-src-block'."
67 (cmdline (cdr (assoc :cmdline params))) 55 (cmdline (cdr (assoc :cmdline params)))
68 (java (cdr (assoc :java params))) 56 (java (cdr (assoc :java params)))
69 (in-file (org-babel-temp-file "ditaa-")) 57 (in-file (org-babel-temp-file "ditaa-"))
70 (cmd (concat "java " java " " org-ditaa-jar-option " " 58 (cmd (concat "java " java " -jar "
71 (shell-quote-argument 59 (shell-quote-argument
72 (expand-file-name org-ditaa-jar-path)) 60 (expand-file-name org-ditaa-jar-path))
73 " " cmdline 61 " " cmdline
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el
index afbc20d5fc5..c8af6062002 100644
--- a/lisp/org/ob-emacs-lisp.el
+++ b/lisp/org/ob-emacs-lisp.el
@@ -41,13 +41,13 @@
41 (result-params (cdr (assoc :result-params params))) 41 (result-params (cdr (assoc :result-params params)))
42 (print-level nil) (print-length nil) 42 (print-level nil) (print-length nil)
43 (body (if (> (length vars) 0) 43 (body (if (> (length vars) 0)
44 (concat "(let (" 44 (concat "(let ("
45 (mapconcat 45 (mapconcat
46 (lambda (var) 46 (lambda (var)
47 (format "%S" (print `(,(car var) ',(cdr var))))) 47 (format "%S" (print `(,(car var) ',(cdr var)))))
48 vars "\n ") 48 vars "\n ")
49 ")\n" body ")") 49 ")\n" body "\n)")
50 body))) 50 (concat body "\n"))))
51 (if (or (member "code" result-params) 51 (if (or (member "code" result-params)
52 (member "pp" result-params)) 52 (member "pp" result-params))
53 (concat "(pp " body ")") body))) 53 (concat "(pp " body ")") body)))
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index bfb3aa85bca..ecfb91f083a 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -34,8 +34,7 @@
34(defvar org-babel-ref-split-regexp) 34(defvar org-babel-ref-split-regexp)
35(declare-function org-babel-lob-get-info "ob-lob" ()) 35(declare-function org-babel-lob-get-info "ob-lob" ())
36(declare-function org-babel-eval-wipe-error-buffer "ob-eval" ()) 36(declare-function org-babel-eval-wipe-error-buffer "ob-eval" ())
37(add-to-list 'org-export-interblocks '(src org-babel-exp-inline-src-blocks)) 37(add-to-list 'org-export-interblocks '(src org-babel-exp-non-block-elements))
38(add-to-list 'org-export-interblocks '(lob org-babel-exp-lob-one-liners))
39 38
40(org-export-blocks-add-block '(src org-babel-exp-src-block nil)) 39(org-export-blocks-add-block '(src org-babel-exp-src-block nil))
41 40
@@ -117,33 +116,74 @@ none ----- do not display either code or results upon export"
117 (nth 1 info))) 116 (nth 1 info)))
118 (org-babel-exp-do-export info 'block hash))))) 117 (org-babel-exp-do-export info 'block hash)))))
119 118
120(defun org-babel-exp-inline-src-blocks (start end) 119(defvar org-babel-default-lob-header-args)
121 "Process inline source blocks between START and END for export. 120(defun org-babel-exp-non-block-elements (start end)
122See `org-babel-exp-src-block' for export options, currently the 121 "Process inline source and call lines between START and END for export."
123options and are taken from `org-babel-default-inline-header-args'."
124 (interactive) 122 (interactive)
125 (save-excursion 123 (save-excursion
126 (goto-char start) 124 (goto-char start)
127 (while (and (< (point) end) 125 (unless (markerp end)
128 (re-search-forward org-babel-inline-src-block-regexp end t)) 126 (let ((m (make-marker)))
129 (let* ((info (save-match-data (org-babel-parse-inline-src-block-match))) 127 (set-marker m end (current-buffer))
130 (params (nth 2 info))) 128 (setq end m)))
131 (save-match-data 129 (let ((rx (concat "\\(" org-babel-inline-src-block-regexp
132 (goto-char (match-beginning 2)) 130 "\\|" org-babel-lob-one-liner-regexp "\\)")))
131 (while (and (< (point) (marker-position end))
132 (re-search-forward rx end t))
133 (if (save-excursion
134 (goto-char (match-beginning 0))
135 (looking-at org-babel-inline-src-block-regexp))
136 (progn
137 (forward-char 1)
138 (let* ((info (save-match-data
139 (org-babel-parse-inline-src-block-match)))
140 (params (nth 2 info)))
141 (save-match-data
142 (goto-char (match-beginning 2))
143 (unless (org-babel-in-example-or-verbatim)
144 ;; expand noweb references in the original file
145 (setf (nth 1 info)
146 (if (and (cdr (assoc :noweb params))
147 (string= "yes" (cdr (assoc :noweb params))))
148 (org-babel-expand-noweb-references
149 info (get-file-buffer org-current-export-file))
150 (nth 1 info)))
151 (let ((code-replacement (save-match-data
152 (org-babel-exp-do-export
153 info 'inline))))
154 (if code-replacement
155 (progn (replace-match code-replacement nil nil nil 1)
156 (delete-char 1))
157 (org-babel-examplize-region (match-beginning 1)
158 (match-end 1))
159 (forward-char 2)))))))
133 (unless (org-babel-in-example-or-verbatim) 160 (unless (org-babel-in-example-or-verbatim)
134 ;; expand noweb references in the original file 161 (let* ((lob-info (org-babel-lob-get-info))
135 (setf (nth 1 info) 162 (inlinep (match-string 11))
136 (if (and (cdr (assoc :noweb params)) 163 (inline-start (match-end 11))
137 (string= "yes" (cdr (assoc :noweb params)))) 164 (inline-end (match-end 0))
138 (org-babel-expand-noweb-references 165 (rep (let ((lob-info (org-babel-lob-get-info)))
139 info (get-file-buffer org-current-export-file)) 166 (save-match-data
140 (nth 1 info))) 167 (org-babel-exp-do-export
141 (let ((code-replacement (save-match-data 168 (list "emacs-lisp" "results"
142 (org-babel-exp-do-export info 'inline)))) 169 (org-babel-merge-params
143 (if code-replacement 170 org-babel-default-header-args
144 (replace-match code-replacement nil nil nil 1) 171 org-babel-default-lob-header-args
145 (org-babel-examplize-region (match-beginning 1) (match-end 1)) 172 (org-babel-params-from-properties)
146 (forward-char 2))))))))) 173 (org-babel-parse-header-arguments
174 (org-babel-clean-text-properties
175 (concat ":var results="
176 (mapconcat #'identity
177 (butlast lob-info)
178 " ")))))
179 "" nil (car (last lob-info)))
180 'lob)))))
181 (if inlinep
182 (save-excursion
183 (goto-char inline-start)
184 (delete-region inline-start inline-end)
185 (insert rep))
186 (replace-match rep t t)))))))))
147 187
148(defun org-babel-in-example-or-verbatim () 188(defun org-babel-in-example-or-verbatim ()
149 "Return true if point is in example or verbatim code. 189 "Return true if point is in example or verbatim code.
@@ -158,46 +198,6 @@ org-mode text."
158 (org-in-block-p org-list-forbidden-blocks) 198 (org-in-block-p org-list-forbidden-blocks)
159 (org-between-regexps-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src"))) 199 (org-between-regexps-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src")))
160 200
161(defvar org-babel-default-lob-header-args)
162(defun org-babel-exp-lob-one-liners (start end)
163 "Process Library of Babel calls between START and END for export.
164See `org-babel-exp-src-block' for export options. Currently the
165options are taken from `org-babel-default-header-args'."
166 (interactive)
167 (save-excursion
168 (goto-char start)
169 (while (and (< (point) end)
170 (re-search-forward org-babel-lob-one-liner-regexp end t))
171 (unless (org-babel-in-example-or-verbatim)
172 (let* ((lob-info (org-babel-lob-get-info))
173 (inlinep (match-string 11))
174 (inline-start (match-end 11))
175 (inline-end (match-end 0))
176 (rep (let ((lob-info (org-babel-lob-get-info)))
177 (save-match-data
178 (org-babel-exp-do-export
179 (list "emacs-lisp" "results"
180 (org-babel-merge-params
181 org-babel-default-header-args
182 org-babel-default-lob-header-args
183 (org-babel-params-from-properties)
184 (org-babel-parse-header-arguments
185 (org-babel-clean-text-properties
186 (concat ":var results="
187 (mapconcat #'identity
188 (butlast lob-info) " ")))))
189 "" nil (car (last lob-info)))
190 'lob)))))
191 (setq end (+ end (- (length rep)
192 (- (length (match-string 0))
193 (length (or (match-string 11) ""))))))
194 (if inlinep
195 (save-excursion
196 (goto-char inline-start)
197 (delete-region inline-start inline-end)
198 (insert rep))
199 (replace-match rep t t)))))))
200
201(defun org-babel-exp-do-export (info type &optional hash) 201(defun org-babel-exp-do-export (info type &optional hash)
202 "Return a string with the exported content of a code block. 202 "Return a string with the exported content of a code block.
203The function respects the value of the :exports header argument." 203The function respects the value of the :exports header argument."
@@ -218,7 +218,9 @@ The function respects the value of the :exports header argument."
218 "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC" 218 "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC"
219 `(("lang" . ,(nth 0 info)) 219 `(("lang" . ,(nth 0 info))
220 ("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info))) 220 ("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info)))
221 ("body" . ,(nth 1 info))))) 221 ("body" . ,(if (string= (nth 0 info) "org")
222 (replace-regexp-in-string "^" "," (nth 1 info))
223 (nth 1 info))))))
222 224
223(defun org-babel-exp-results (info type &optional silent hash) 225(defun org-babel-exp-results (info type &optional silent hash)
224 "Evaluate and return the results of the current code block for export. 226 "Evaluate and return the results of the current code block for export.
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 46d2269a1d7..e9ff78dcd38 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -1,32 +1,29 @@
1;;; ob-fortran.el --- org-babel functions for fortran 1;;; ob-fortran.el --- org-babel functions for fortran
2 2
3;; Copyright (C) 2011-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Sergey Litvinov, Eric Schulte
4 4
5;; Authors: Sergey Litvinov 5;; Authors: Sergey Litvinov (based on ob-C.el by Eric Schulte), Eric Schulte
6;; Eric Schulte
7;; Keywords: literate programming, reproducible research, fortran 6;; Keywords: literate programming, reproducible research, fortran
8;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
9;; Version: 7.8.02
10 8
11;; This file is part of GNU Emacs. 9;; This program is free software; you can redistribute it and/or modify
12
13;; GNU Emacs is free software: you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by 10;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation, either version 3 of the License, or 11;; the Free Software Foundation; either version 3, or (at your option)
16;; (at your option) any later version. 12;; any later version.
17 13;;
18;; GNU Emacs is distributed in the hope that it will be useful, 14;; This program is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;; GNU General Public License for more details. 17;; GNU General Public License for more details.
22 18;;
23;; You should have received a copy of the GNU General Public License 19;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 20;; along with GNU Emacs; see the file COPYING. If not, write to the
21;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22;; Boston, MA 02110-1301, USA.
25 23
26;;; Commentary: 24;;; Commentary:
27 25
28;; Org-Babel support for evaluating fortran code. 26;; Org-Babel support for evaluating fortran code.
29;; Based on ob-C.el by Eric Schulte.
30 27
31;;; Code: 28;;; Code:
32(require 'ob) 29(require 'ob)
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el
index 0dde0de9e42..a1e4c9f83e4 100644
--- a/lisp/org/ob-lilypond.el
+++ b/lisp/org/ob-lilypond.el
@@ -4,7 +4,7 @@
4 4
5;; Author: Martyn Jago 5;; Author: Martyn Jago
6;; Keywords: babel language, literate programming 6;; Keywords: babel language, literate programming
7;; Homepage: https://github.com/mjago/ob-lilypond 7;; Homepage: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
10 10
@@ -30,18 +30,14 @@
30(require 'ob) 30(require 'ob)
31(require 'ob-eval) 31(require 'ob-eval)
32(require 'ob-tangle) 32(require 'ob-tangle)
33(require 'outline)
33(defalias 'lilypond-mode 'LilyPond-mode) 34(defalias 'lilypond-mode 'LilyPond-mode)
34 35
35(declare-function show-all "outline" ())
36
37(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly")) 36(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
38 37
39(defvar org-babel-default-header-args:lilypond '() 38(defvar org-babel-default-header-args:lilypond '()
40 "Default header arguments for js code blocks.") 39 "Default header arguments for js code blocks.")
41 40
42(defconst ly-version "0.3"
43 "The version number of the file ob-lilypond.el.")
44
45(defvar ly-compile-post-tangle t 41(defvar ly-compile-post-tangle t
46 "Following the org-babel-tangle (C-c C-v t) command, 42 "Following the org-babel-tangle (C-c C-v t) command,
47ly-compile-post-tangle determines whether ob-lilypond should 43ly-compile-post-tangle determines whether ob-lilypond should
@@ -408,13 +404,7 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes"
408 (message (concat "Arrange mode has been " 404 (message (concat "Arrange mode has been "
409 (if ly-arrange-mode "ENABLED." "DISABLED.")))) 405 (if ly-arrange-mode "ENABLED." "DISABLED."))))
410 406
411(defun ly-version (&optional insert-at-point) 407(defun ly-switch-extension (file-name ext)
412 (interactive)
413 (let ((version (format "ob-lilypond version %s" ly-version)))
414 (when insert-at-point (insert version))
415 (message version)))
416
417 (defun ly-switch-extension (file-name ext)
418 "Utility command to swap current FILE-NAME extension with EXT" 408 "Utility command to swap current FILE-NAME extension with EXT"
419 409
420 (concat (file-name-sans-extension 410 (concat (file-name-sans-extension
diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el
index 8976427ab7e..91ae0751722 100644
--- a/lisp/org/ob-lob.el
+++ b/lisp/org/ob-lob.el
@@ -65,14 +65,14 @@ To add files to this list use the `org-babel-lob-ingest' command."
65 65
66(defconst org-babel-block-lob-one-liner-regexp 66(defconst org-babel-block-lob-one-liner-regexp
67 (concat 67 (concat
68 "^\\([ \t]*\\)#\\+call:[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" 68 "^\\([ \t]*?\\)#\\+call:[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)"
69 "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)[ \t]*\\(\\([^\n]*\\)\\)?") 69 "\(\\([^\n]*?\\)\)\\(\\[.+\\]\\|\\)[ \t]*\\(\\([^\n]*\\)\\)?")
70 "Regexp to match non-inline calls to predefined source block functions.") 70 "Regexp to match non-inline calls to predefined source block functions.")
71 71
72(defconst org-babel-inline-lob-one-liner-regexp 72(defconst org-babel-inline-lob-one-liner-regexp
73 (concat 73 (concat
74 "\\([^\n]*\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" 74 "\\([^\n]*?\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*?\\)\\]\\|\\(\\)\\)"
75 "\(\\([^\n]*\\)\)\\(\\[\\(.*?\\)\\]\\)?") 75 "\(\\([^\n]*?\\)\)\\(\\[\\(.*?\\)\\]\\)?")
76 "Regexp to match inline calls to predefined source block functions.") 76 "Regexp to match inline calls to predefined source block functions.")
77 77
78(defconst org-babel-lob-one-liner-regexp 78(defconst org-babel-lob-one-liner-regexp
@@ -108,8 +108,8 @@ if so then run the appropriate source block from the Library."
108 (list 108 (list
109 (format "%s%s(%s)%s" 109 (format "%s%s(%s)%s"
110 (nonempty 3 12) 110 (nonempty 3 12)
111 (if (not (= 0 (length (nonempty 5 13)))) 111 (if (not (= 0 (length (nonempty 5 14))))
112 (concat "[" (nonempty 5 13) "]") "") 112 (concat "[" (nonempty 5 14) "]") "")
113 (or (nonempty 7 16) "") 113 (or (nonempty 7 16) "")
114 (or (nonempty 8 19) "")) 114 (or (nonempty 8 19) ""))
115 (nonempty 9 18))) 115 (nonempty 9 18)))
diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el
index 74bcb069434..8da20af74fb 100644
--- a/lisp/org/ob-maxima.el
+++ b/lisp/org/ob-maxima.el
@@ -40,6 +40,11 @@
40 40
41(defvar org-babel-default-header-args:maxima '()) 41(defvar org-babel-default-header-args:maxima '())
42 42
43(defcustom org-babel-maxima-command
44 (if (boundp 'maxima-command) maxima-command "maxima")
45 "Command used to call maxima on the shell."
46 :group 'org-babel)
47
43(defun org-babel-maxima-expand (body params) 48(defun org-babel-maxima-expand (body params)
44 "Expand a block of Maxima code according to its header arguments." 49 "Expand a block of Maxima code according to its header arguments."
45 (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) 50 (let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
@@ -67,8 +72,8 @@ called by `org-babel-execute-src-block'."
67 (result 72 (result
68 (let* ((cmdline (cdr (assoc :cmdline params))) 73 (let* ((cmdline (cdr (assoc :cmdline params)))
69 (in-file (org-babel-temp-file "maxima-" ".max")) 74 (in-file (org-babel-temp-file "maxima-" ".max"))
70 (cmd (format "maxima --very-quiet -r 'batchload(%S)$' %s" 75 (cmd (format "%s --very-quiet -r 'batchload(%S)$' %s"
71 in-file cmdline))) 76 org-babel-maxima-command in-file cmdline)))
72 (with-temp-file in-file (insert (org-babel-maxima-expand body params))) 77 (with-temp-file in-file (insert (org-babel-maxima-expand body params)))
73 (message cmd) 78 (message cmd)
74 ((lambda (raw) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' " 79 ((lambda (raw) ;; " | grep -v batch | grep -v 'replaced' | sed '/^$/d' "
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 3f7882c9919..68bd95af9f9 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -24,6 +24,7 @@
24;;; Commentary: 24;;; Commentary:
25 25
26;; Org-Babel support for evaluating sql source code. 26;; Org-Babel support for evaluating sql source code.
27;; (see also ob-sqlite.el)
27;; 28;;
28;; SQL is somewhat unique in that there are many different engines for 29;; SQL is somewhat unique in that there are many different engines for
29;; the evaluation of sql (Mysql, PostgreSQL, etc...), so much of this 30;; the evaluation of sql (Mysql, PostgreSQL, etc...), so much of this
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el
index 599113ca830..84d6bb26bae 100644
--- a/lisp/org/ob-sqlite.el
+++ b/lisp/org/ob-sqlite.el
@@ -93,7 +93,14 @@ This function is called by `org-babel-execute-src-block'."
93 (member "code" result-params) 93 (member "code" result-params)
94 (equal (point-min) (point-max))) 94 (equal (point-min) (point-max)))
95 (buffer-string) 95 (buffer-string)
96 (org-table-convert-region (point-min) (point-max)) 96 (org-table-convert-region (point-min) (point-max)
97 (if (or (member :csv others)
98 (member :column others)
99 (member :line others)
100 (member :list others)
101 (member :html others) separator)
102 nil
103 '(4)))
97 (org-babel-sqlite-table-or-scalar 104 (org-babel-sqlite-table-or-scalar
98 (org-babel-sqlite-offset-colnames 105 (org-babel-sqlite-offset-colnames
99 (org-table-to-lisp) headers-p)))))) 106 (org-table-to-lisp) headers-p))))))
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el
index 7b4920e1ec4..f636415d987 100644
--- a/lisp/org/ob-table.el
+++ b/lisp/org/ob-table.el
@@ -75,9 +75,8 @@ results
75 75
76NOTE: by default string variable names are interpreted as 76NOTE: by default string variable names are interpreted as
77references to source-code blocks, to force interpretation of a 77references to source-code blocks, to force interpretation of a
78cell's value as a string, prefix the identifier with two \"$\"s 78cell's value as a string, prefix the identifier a \"$\" (e.g.,
79rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the 79\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\").
80example above.
81 80
82NOTE: it is also possible to pass header arguments to the code 81NOTE: it is also possible to pass header arguments to the code
83block. In this case a table cell should hold the string value of 82block. In this case a table cell should hold the string value of
@@ -97,7 +96,7 @@ as shown in the example below.
97 (delq nil (mapcar 96 (delq nil (mapcar
98 (lambda (el) 97 (lambda (el)
99 (if (eq '$ el) 98 (if (eq '$ el)
100 (setq quote t) 99 (prog1 nil (setq quote t))
101 (prog1 (if quote 100 (prog1 (if quote
102 (format "\"%s\"" el) 101 (format "\"%s\"" el)
103 (org-babel-clean-text-properties el)) 102 (org-babel-clean-text-properties el))
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
index 0b4eaf1fafa..5e498ab6c0c 100644
--- a/lisp/org/ob-tangle.el
+++ b/lisp/org/ob-tangle.el
@@ -185,9 +185,11 @@ exported source code blocks by language."
185 (when only-this-block 185 (when only-this-block
186 (unless (org-babel-where-is-src-block-head) 186 (unless (org-babel-where-is-src-block-head)
187 (error "Point is not currently inside of a code block")) 187 (error "Point is not currently inside of a code block"))
188 (unless target-file 188 (save-match-data
189 (setq target-file 189 (unless (or (cdr (assoc :tangle (nth 2 (org-babel-get-src-block-info))))
190 (read-from-minibuffer "Tangle to: " (buffer-file-name)))) 190 target-file)
191 (setq target-file
192 (read-from-minibuffer "Tangle to: " (buffer-file-name)))))
191 (narrow-to-region (match-beginning 0) (match-end 0))) 193 (narrow-to-region (match-beginning 0) (match-end 0)))
192 (save-excursion 194 (save-excursion
193 (let ((block-counter 0) 195 (let ((block-counter 0)
@@ -393,7 +395,7 @@ form
393 (start-line file link source-name params body comment)" 395 (start-line file link source-name params body comment)"
394 (let* ((start-line (nth 0 spec)) 396 (let* ((start-line (nth 0 spec))
395 (file (nth 1 spec)) 397 (file (nth 1 spec))
396 (link (org-link-escape (nth 2 spec))) 398 (link (nth 2 spec))
397 (source-name (nth 3 spec)) 399 (source-name (nth 3 spec))
398 (body (nth 5 spec)) 400 (body (nth 5 spec))
399 (comment (nth 6 spec)) 401 (comment (nth 6 spec))
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index 0288eb357b5..04c011c867d 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -79,6 +79,7 @@
79(declare-function org-list-struct "org-list" ()) 79(declare-function org-list-struct "org-list" ())
80(declare-function org-list-prevs-alist "org-list" (struct)) 80(declare-function org-list-prevs-alist "org-list" (struct))
81(declare-function org-list-get-list-end "org-list" (item struct prevs)) 81(declare-function org-list-get-list-end "org-list" (item struct prevs))
82(declare-function org-strip-protective-commas "org" (beg end))
82 83
83(defgroup org-babel nil 84(defgroup org-babel nil
84 "Code block evaluation and management in `org-mode' documents." 85 "Code block evaluation and management in `org-mode' documents."
@@ -113,6 +114,13 @@ remove code block execution from the C-c C-c keybinding."
113 :group 'org-babel 114 :group 'org-babel
114 :type 'boolean) 115 :type 'boolean)
115 116
117(defcustom org-babel-results-keyword "RESULTS"
118 "Keyword used to name results generated by code blocks.
119Should be either RESULTS or NAME however any capitalization may
120be used."
121 :group 'org-babel
122 :type 'string)
123
116(defvar org-babel-src-name-regexp 124(defvar org-babel-src-name-regexp
117 "^[ \t]*#\\+name:[ \t]*" 125 "^[ \t]*#\\+name:[ \t]*"
118 "Regular expression used to match a source name line.") 126 "Regular expression used to match a source name line.")
@@ -169,8 +177,8 @@ Returns non-nil if match-data set"
169 (first-line-p (= 1 (line-number-at-pos))) 177 (first-line-p (= 1 (line-number-at-pos)))
170 (orig (point))) 178 (orig (point)))
171 (let ((search-for (cond ((and src-at-0-p first-line-p "src_")) 179 (let ((search-for (cond ((and src-at-0-p first-line-p "src_"))
172 (first-line-p "[ \t]src_") 180 (first-line-p "[[:punct:] \t]src_")
173 (t "[ \f\t\n\r\v]src_"))) 181 (t "[[:punct:] \f\t\n\r\v]src_")))
174 (lower-limit (if first-line-p 182 (lower-limit (if first-line-p
175 nil 183 nil
176 (- (point-at-bol) 1)))) 184 (- (point-at-bol) 1))))
@@ -376,6 +384,7 @@ then run `org-babel-pop-to-session'."
376 (noeval) 384 (noeval)
377 (noweb . ((yes no tangle))) 385 (noweb . ((yes no tangle)))
378 (noweb-ref . :any) 386 (noweb-ref . :any)
387 (noweb-sep . :any)
379 (padline . ((yes no))) 388 (padline . ((yes no)))
380 (results . ((file list vector table scalar verbatim) 389 (results . ((file list vector table scalar verbatim)
381 (raw org html latex code pp wrap) 390 (raw org html latex code pp wrap)
@@ -469,7 +478,10 @@ the header arguments specified at the front of the source code
469block." 478block."
470 (interactive) 479 (interactive)
471 (let ((info (or info (org-babel-get-src-block-info)))) 480 (let ((info (or info (org-babel-get-src-block-info))))
472 (when (org-babel-confirm-evaluate info) 481 (when (org-babel-confirm-evaluate
482 (let ((i info))
483 (setf (nth 2 i) (org-babel-merge-params (nth 2 info) params))
484 i))
473 (let* ((lang (nth 0 info)) 485 (let* ((lang (nth 0 info))
474 (params (if params 486 (params (if params
475 (org-babel-process-params 487 (org-babel-process-params
@@ -597,15 +609,17 @@ arguments and pop open the results in a preview buffer."
597 ;; TODO: report malformed code block 609 ;; TODO: report malformed code block
598 ;; TODO: report incompatible combinations of header arguments 610 ;; TODO: report incompatible combinations of header arguments
599 ;; TODO: report uninitialized variables 611 ;; TODO: report uninitialized variables
600 (let ((too-close 2)) ;; <- control closeness to report potential match 612 (let ((too-close 2) ;; <- control closeness to report potential match
613 (names (mapcar #'symbol-name org-babel-header-arg-names)))
601 (dolist (header (mapcar (lambda (arg) (substring (symbol-name (car arg)) 1)) 614 (dolist (header (mapcar (lambda (arg) (substring (symbol-name (car arg)) 1))
602 (and (org-babel-where-is-src-block-head) 615 (and (org-babel-where-is-src-block-head)
603 (org-babel-parse-header-arguments 616 (org-babel-parse-header-arguments
604 (org-babel-clean-text-properties 617 (org-babel-clean-text-properties
605 (match-string 4)))))) 618 (match-string 4))))))
606 (dolist (name (mapcar #'symbol-name org-babel-header-arg-names)) 619 (dolist (name names)
607 (when (and (not (string= header name)) 620 (when (and (not (string= header name))
608 (<= (org-babel-edit-distance header name) too-close)) 621 (<= (org-babel-edit-distance header name) too-close)
622 (not (member header names)))
609 (error "supplied header \"%S\" is suspiciously close to \"%S\"" 623 (error "supplied header \"%S\" is suspiciously close to \"%S\""
610 header name)))) 624 header name))))
611 (message "No suspicious header arguments found."))) 625 (message "No suspicious header arguments found.")))
@@ -885,6 +899,31 @@ buffer."
885(def-edebug-spec org-babel-map-call-lines (form body)) 899(def-edebug-spec org-babel-map-call-lines (form body))
886 900
887;;;###autoload 901;;;###autoload
902(defmacro org-babel-map-executables (file &rest body)
903 (declare (indent 1))
904 (let ((tempvar (make-symbol "file"))
905 (rx (make-symbol "rx")))
906 `(let* ((,tempvar ,file)
907 (,rx (concat "\\(" org-babel-src-block-regexp
908 "\\|" org-babel-inline-src-block-regexp
909 "\\|" org-babel-lob-one-liner-regexp "\\)"))
910 (visited-p (or (null ,tempvar)
911 (get-file-buffer (expand-file-name ,tempvar))))
912 (point (point)) to-be-removed)
913 (save-window-excursion
914 (when ,tempvar (find-file ,tempvar))
915 (setq to-be-removed (current-buffer))
916 (goto-char (point-min))
917 (while (re-search-forward ,rx nil t)
918 (goto-char (match-beginning 1))
919 (when (looking-at org-babel-inline-src-block-regexp)(forward-char 1))
920 (save-match-data ,@body)
921 (goto-char (match-end 0))))
922 (unless visited-p (kill-buffer to-be-removed))
923 (goto-char point))))
924(def-edebug-spec org-babel-map-executables (form body))
925
926;;;###autoload
888(defun org-babel-execute-buffer (&optional arg) 927(defun org-babel-execute-buffer (&optional arg)
889 "Execute source code blocks in a buffer. 928 "Execute source code blocks in a buffer.
890Call `org-babel-execute-src-block' on every source block in 929Call `org-babel-execute-src-block' on every source block in
@@ -892,12 +931,10 @@ the current buffer."
892 (interactive "P") 931 (interactive "P")
893 (org-babel-eval-wipe-error-buffer) 932 (org-babel-eval-wipe-error-buffer)
894 (org-save-outline-visibility t 933 (org-save-outline-visibility t
895 (org-babel-map-src-blocks nil 934 (org-babel-map-executables nil
896 (org-babel-execute-src-block arg)) 935 (if (looking-at org-babel-lob-one-liner-regexp)
897 (org-babel-map-inline-src-blocks nil 936 (org-babel-lob-execute-maybe)
898 (org-babel-execute-src-block arg)) 937 (org-babel-execute-src-block arg)))))
899 (org-babel-map-call-lines nil
900 (org-babel-lob-execute-maybe))))
901 938
902;;;###autoload 939;;;###autoload
903(defun org-babel-execute-subtree (&optional arg) 940(defun org-babel-execute-subtree (&optional arg)
@@ -999,6 +1036,89 @@ This can be called with C-c C-c."
999 (when hash (kill-new hash) (message hash)))) 1036 (when hash (kill-new hash) (message hash))))
1000(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point) 1037(add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point)
1001 1038
1039(defun org-babel-result-hide-spec ()
1040 "Hide portions of results lines.
1041Add `org-babel-hide-result' as an invisibility spec for hiding
1042portions of results lines."
1043 (add-to-invisibility-spec '(org-babel-hide-result . t)))
1044(add-hook 'org-mode-hook 'org-babel-result-hide-spec)
1045
1046(defvar org-babel-hide-result-overlays nil
1047 "Overlays hiding results.")
1048
1049(defun org-babel-result-hide-all ()
1050 "Fold all results in the current buffer."
1051 (interactive)
1052 (org-babel-show-result-all)
1053 (save-excursion
1054 (while (re-search-forward org-babel-result-regexp nil t)
1055 (save-excursion (goto-char (match-beginning 0))
1056 (org-babel-hide-result-toggle-maybe)))))
1057
1058(defun org-babel-show-result-all ()
1059 "Unfold all results in the current buffer."
1060 (mapc 'delete-overlay org-babel-hide-result-overlays)
1061 (setq org-babel-hide-result-overlays nil))
1062
1063;;;###autoload
1064(defun org-babel-hide-result-toggle-maybe ()
1065 "Toggle visibility of result at point."
1066 (interactive)
1067 (let ((case-fold-search t))
1068 (if (save-excursion
1069 (beginning-of-line 1)
1070 (looking-at org-babel-result-regexp))
1071 (progn (org-babel-hide-result-toggle)
1072 t) ;; to signal that we took action
1073 nil))) ;; to signal that we did not
1074
1075(defun org-babel-hide-result-toggle (&optional force)
1076 "Toggle the visibility of the current result."
1077 (interactive)
1078 (save-excursion
1079 (beginning-of-line)
1080 (if (re-search-forward org-babel-result-regexp nil t)
1081 (let ((start (progn (beginning-of-line 2) (- (point) 1)))
1082 (end (progn
1083 (while (looking-at org-babel-multi-line-header-regexp)
1084 (forward-line 1))
1085 (goto-char (- (org-babel-result-end) 1)) (point)))
1086 ov)
1087 (if (memq t (mapcar (lambda (overlay)
1088 (eq (overlay-get overlay 'invisible)
1089 'org-babel-hide-result))
1090 (overlays-at start)))
1091 (if (or (not force) (eq force 'off))
1092 (mapc (lambda (ov)
1093 (when (member ov org-babel-hide-result-overlays)
1094 (setq org-babel-hide-result-overlays
1095 (delq ov org-babel-hide-result-overlays)))
1096 (when (eq (overlay-get ov 'invisible)
1097 'org-babel-hide-result)
1098 (delete-overlay ov)))
1099 (overlays-at start)))
1100 (setq ov (make-overlay start end))
1101 (overlay-put ov 'invisible 'org-babel-hide-result)
1102 ;; make the block accessible to isearch
1103 (overlay-put
1104 ov 'isearch-open-invisible
1105 (lambda (ov)
1106 (when (member ov org-babel-hide-result-overlays)
1107 (setq org-babel-hide-result-overlays
1108 (delq ov org-babel-hide-result-overlays)))
1109 (when (eq (overlay-get ov 'invisible)
1110 'org-babel-hide-result)
1111 (delete-overlay ov))))
1112 (push ov org-babel-hide-result-overlays)))
1113 (error "Not looking at a result line"))))
1114
1115;; org-tab-after-check-for-cycling-hook
1116(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe)
1117;; Remove overlays when changing major mode
1118(add-hook 'org-mode-hook
1119 (lambda () (org-add-hook 'change-major-mode-hook
1120 'org-babel-show-result-all 'append 'local)))
1121
1002(defvar org-file-properties) 1122(defvar org-file-properties)
1003(defun org-babel-params-from-properties (&optional lang) 1123(defun org-babel-params-from-properties (&optional lang)
1004 "Retrieve parameters specified as properties. 1124 "Retrieve parameters specified as properties.
@@ -1042,7 +1162,7 @@ may be specified in the properties of the current outline entry."
1042 ;; get block body less properties, protective commas, and indentation 1162 ;; get block body less properties, protective commas, and indentation
1043 (with-temp-buffer 1163 (with-temp-buffer
1044 (save-match-data 1164 (save-match-data
1045 (insert (org-babel-strip-protective-commas body)) 1165 (insert (org-babel-strip-protective-commas body lang))
1046 (unless preserve-indentation (org-do-remove-indentation)) 1166 (unless preserve-indentation (org-do-remove-indentation))
1047 (buffer-string))) 1167 (buffer-string)))
1048 (org-babel-merge-params 1168 (org-babel-merge-params
@@ -1060,7 +1180,7 @@ may be specified in the properties of the current outline entry."
1060 (lang-headers (intern (concat "org-babel-default-header-args:" lang)))) 1180 (lang-headers (intern (concat "org-babel-default-header-args:" lang))))
1061 (list lang 1181 (list lang
1062 (org-babel-strip-protective-commas 1182 (org-babel-strip-protective-commas
1063 (org-babel-clean-text-properties (match-string 5))) 1183 (org-babel-clean-text-properties (match-string 5)) lang)
1064 (org-babel-merge-params 1184 (org-babel-merge-params
1065 org-babel-default-inline-header-args 1185 org-babel-default-inline-header-args
1066 (org-babel-params-from-properties lang) 1186 (org-babel-params-from-properties lang)
@@ -1376,9 +1496,10 @@ buffer or nil if no such result exists."
1376 (catch 'is-a-code-block 1496 (catch 'is-a-code-block
1377 (when (re-search-forward 1497 (when (re-search-forward
1378 (concat org-babel-result-regexp 1498 (concat org-babel-result-regexp
1379 "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) 1499 "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]+") nil t)
1380 (when (and (string= "name" (downcase (match-string 1))) 1500 (when (and (string= "name" (downcase (match-string 1)))
1381 (or (looking-at org-babel-src-block-regexp) 1501 (or (beginning-of-line 1)
1502 (looking-at org-babel-src-block-regexp)
1382 (looking-at org-babel-multi-line-header-regexp))) 1503 (looking-at org-babel-multi-line-header-regexp)))
1383 (throw 'is-a-code-block (org-babel-find-named-result name (point)))) 1504 (throw 'is-a-code-block (org-babel-find-named-result name (point))))
1384 (beginning-of-line 0) (point))))) 1505 (beginning-of-line 0) (point)))))
@@ -1491,7 +1612,7 @@ following the source block."
1491 (inlinep (when (org-babel-get-inline-src-block-matches) 1612 (inlinep (when (org-babel-get-inline-src-block-matches)
1492 (match-end 0))) 1613 (match-end 0)))
1493 (name (if on-lob-line 1614 (name (if on-lob-line
1494 (nth 0 (org-babel-lob-get-info)) 1615 (mapconcat #'identity (butlast (org-babel-lob-get-info)) "")
1495 (nth 4 (or info (org-babel-get-src-block-info 'light))))) 1616 (nth 4 (or info (org-babel-get-src-block-info 'light)))))
1496 (head (unless on-lob-line (org-babel-where-is-src-block-head))) 1617 (head (unless on-lob-line (org-babel-where-is-src-block-head)))
1497 found beg end) 1618 found beg end)
@@ -1544,7 +1665,7 @@ following the source block."
1544 (lambda (el) " ") 1665 (lambda (el) " ")
1545 (org-number-sequence 1 indent) "") 1666 (org-number-sequence 1 indent) "")
1546 "") 1667 "")
1547 "#+results" 1668 "#+" org-babel-results-keyword
1548 (when hash (concat "["hash"]")) 1669 (when hash (concat "["hash"]"))
1549 ":" 1670 ":"
1550 (when name (concat " " name)) "\n")) 1671 (when name (concat " " name)) "\n"))
@@ -1715,8 +1836,9 @@ code ---- the results are extracted in the syntax of the source
1715 (setq results-switches 1836 (setq results-switches
1716 (if results-switches (concat " " results-switches) "")) 1837 (if results-switches (concat " " results-switches) ""))
1717 (flet ((wrap (start finish) 1838 (flet ((wrap (start finish)
1718 (goto-char beg) (insert (concat start "\n"))
1719 (goto-char end) (insert (concat finish "\n")) 1839 (goto-char end) (insert (concat finish "\n"))
1840 (goto-char beg) (insert (concat start "\n"))
1841 (goto-char end) (goto-char (point-at-eol))
1720 (setq end (point-marker))) 1842 (setq end (point-marker)))
1721 (proper-list-p (it) (and (listp it) (null (cdr (last it)))))) 1843 (proper-list-p (it) (and (listp it) (null (cdr (last it))))))
1722 ;; insert results based on type 1844 ;; insert results based on type
@@ -1802,7 +1924,8 @@ code ---- the results are extracted in the syntax of the source
1802 (prvs (org-list-prevs-alist struct))) 1924 (prvs (org-list-prevs-alist struct)))
1803 (org-list-get-list-end (point-at-bol) struct prvs))) 1925 (org-list-get-list-end (point-at-bol) struct prvs)))
1804 ((looking-at "^\\([ \t]*\\):RESULTS:") 1926 ((looking-at "^\\([ \t]*\\):RESULTS:")
1805 (re-search-forward (concat "^" (match-string 1) ":END:"))) 1927 (progn (re-search-forward (concat "^" (match-string 1) ":END:"))
1928 (forward-char 1) (point)))
1806 (t 1929 (t
1807 (let ((case-fold-search t) 1930 (let ((case-fold-search t)
1808 (blocks-re (regexp-opt 1931 (blocks-re (regexp-opt
@@ -1835,7 +1958,8 @@ file's directory then expand relative links."
1835(defun org-babel-examplize-region (beg end &optional results-switches) 1958(defun org-babel-examplize-region (beg end &optional results-switches)
1836 "Comment out region using the inline '==' or ': ' org example quote." 1959 "Comment out region using the inline '==' or ': ' org example quote."
1837 (interactive "*r") 1960 (interactive "*r")
1838 (flet ((chars-between (b e) (string-match "[\\S]" (buffer-substring b e)))) 1961 (flet ((chars-between (b e)
1962 (not (string-match "^[\\s]*$" (buffer-substring b e)))))
1839 (if (or (chars-between (save-excursion (goto-char beg) (point-at-bol)) beg) 1963 (if (or (chars-between (save-excursion (goto-char beg) (point-at-bol)) beg)
1840 (chars-between end (save-excursion (goto-char end) (point-at-eol)))) 1964 (chars-between end (save-excursion (goto-char end) (point-at-eol))))
1841 (save-excursion 1965 (save-excursion
@@ -2031,7 +2155,8 @@ block but are passed literally to the \"example-block\"."
2031 (with-temp-buffer 2155 (with-temp-buffer
2032 (insert body) (goto-char (point-min)) 2156 (insert body) (goto-char (point-min))
2033 (setq index (point)) 2157 (setq index (point))
2034 (while (and (re-search-forward "<<\\(.+?\\)>>" nil t)) 2158 (while (and (re-search-forward "<<\\([^ \t\n].+?[^ \t\n]\\|[^ \t\n]\\)>>"
2159 nil t))
2035 (save-match-data (setf source-name (match-string 1))) 2160 (save-match-data (setf source-name (match-string 1)))
2036 (save-match-data (setq evaluate (string-match "\(.*\)" source-name))) 2161 (save-match-data (setq evaluate (string-match "\(.*\)" source-name)))
2037 (save-match-data 2162 (save-match-data
@@ -2046,6 +2171,8 @@ block but are passed literally to the \"example-block\"."
2046 (setq index (point)) 2171 (setq index (point))
2047 (nb-add 2172 (nb-add
2048 (with-current-buffer parent-buffer 2173 (with-current-buffer parent-buffer
2174 (save-restriction
2175 (widen)
2049 (mapconcat ;; interpose PREFIX between every line 2176 (mapconcat ;; interpose PREFIX between every line
2050 #'identity 2177 #'identity
2051 (split-string 2178 (split-string
@@ -2061,7 +2188,7 @@ block but are passed literally to the \"example-block\"."
2061 (when (org-babel-ref-goto-headline-id source-name) 2188 (when (org-babel-ref-goto-headline-id source-name)
2062 (org-babel-ref-headline-body))) 2189 (org-babel-ref-headline-body)))
2063 ;; find the expansion of reference in this buffer 2190 ;; find the expansion of reference in this buffer
2064 (let ((rx (concat rx-prefix source-name)) 2191 (let ((rx (concat rx-prefix source-name "[ \t\n]"))
2065 expansion) 2192 expansion)
2066 (save-excursion 2193 (save-excursion
2067 (goto-char (point-min)) 2194 (goto-char (point-min))
@@ -2069,6 +2196,8 @@ block but are passed literally to the \"example-block\"."
2069 (while (re-search-forward rx nil t) 2196 (while (re-search-forward rx nil t)
2070 (let* ((i (org-babel-get-src-block-info 'light)) 2197 (let* ((i (org-babel-get-src-block-info 'light))
2071 (body (org-babel-expand-noweb-references i)) 2198 (body (org-babel-expand-noweb-references i))
2199 (sep (or (cdr (assoc :noweb-sep (nth 2 i)))
2200 "\n"))
2072 (full (if comment 2201 (full (if comment
2073 ((lambda (cs) 2202 ((lambda (cs)
2074 (concat (c-wrap (car cs)) "\n" 2203 (concat (c-wrap (car cs)) "\n"
@@ -2076,13 +2205,15 @@ block but are passed literally to the \"example-block\"."
2076 (c-wrap (cadr cs)))) 2205 (c-wrap (cadr cs))))
2077 (org-babel-tangle-comment-links i)) 2206 (org-babel-tangle-comment-links i))
2078 body))) 2207 body)))
2079 (setq expansion (concat expansion full)))) 2208 (setq expansion (cons sep (cons full expansion)))))
2080 (org-babel-map-src-blocks nil 2209 (org-babel-map-src-blocks nil
2081 (let ((i (org-babel-get-src-block-info 'light))) 2210 (let ((i (org-babel-get-src-block-info 'light)))
2082 (when (equal (or (cdr (assoc :noweb-ref (nth 2 i))) 2211 (when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
2083 (nth 4 i)) 2212 (nth 4 i))
2084 source-name) 2213 source-name)
2085 (let* ((body (org-babel-expand-noweb-references i)) 2214 (let* ((body (org-babel-expand-noweb-references i))
2215 (sep (or (cdr (assoc :noweb-sep (nth 2 i)))
2216 "\n"))
2086 (full (if comment 2217 (full (if comment
2087 ((lambda (cs) 2218 ((lambda (cs)
2088 (concat (c-wrap (car cs)) "\n" 2219 (concat (c-wrap (car cs)) "\n"
@@ -2090,8 +2221,10 @@ block but are passed literally to the \"example-block\"."
2090 (c-wrap (cadr cs)))) 2221 (c-wrap (cadr cs))))
2091 (org-babel-tangle-comment-links i)) 2222 (org-babel-tangle-comment-links i))
2092 body))) 2223 body)))
2093 (setq expansion (concat expansion full)))))))) 2224 (setq expansion
2094 expansion) 2225 (cons sep (cons full expansion)))))))))
2226 (and expansion
2227 (mapconcat #'identity (nreverse (cdr expansion)) "")))
2095 ;; possibly raise an error if named block doesn't exist 2228 ;; possibly raise an error if named block doesn't exist
2096 (if (member lang org-babel-noweb-error-langs) 2229 (if (member lang org-babel-noweb-error-langs)
2097 (error "%s" (concat 2230 (error "%s" (concat
@@ -2099,7 +2232,7 @@ block but are passed literally to the \"example-block\"."
2099 "could not be resolved (see " 2232 "could not be resolved (see "
2100 "`org-babel-noweb-error-langs')")) 2233 "`org-babel-noweb-error-langs')"))
2101 ""))) 2234 "")))
2102 "[\n\r]") (concat "\n" prefix))))) 2235 "[\n\r]") (concat "\n" prefix))))))
2103 (nb-add (buffer-substring index (point-max))))) 2236 (nb-add (buffer-substring index (point-max)))))
2104 new-body)) 2237 new-body))
2105 2238
@@ -2108,10 +2241,16 @@ block but are passed literally to the \"example-block\"."
2108 (when text 2241 (when text
2109 (set-text-properties 0 (length text) nil text) text)) 2242 (set-text-properties 0 (length text) nil text) text))
2110 2243
2111(defun org-babel-strip-protective-commas (body) 2244(defun org-babel-strip-protective-commas (body &optional lang)
2112 "Strip protective commas from bodies of source blocks." 2245 "Strip protective commas from bodies of source blocks."
2113 (when body 2246 (with-temp-buffer
2114 (replace-regexp-in-string "^,#" "#" body))) 2247 (insert body)
2248 (if (and lang (string= lang "org"))
2249 (progn (goto-char (point-min))
2250 (while (re-search-forward "^[ \t]*\\(,\\)" nil t)
2251 (replace-match "" nil nil nil 1)))
2252 (org-strip-protective-commas (point-min) (point-max)))
2253 (buffer-string)))
2115 2254
2116(defun org-babel-script-escape (str &optional force) 2255(defun org-babel-script-escape (str &optional force)
2117 "Safely convert tables into elisp lists." 2256 "Safely convert tables into elisp lists."
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index bdf68819089..f70605069d2 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -91,7 +91,7 @@
91(defvar org-agenda-buffer-name) 91(defvar org-agenda-buffer-name)
92(defvar org-agenda-overriding-header) 92(defvar org-agenda-overriding-header)
93(defvar org-agenda-title-append nil) 93(defvar org-agenda-title-append nil)
94(defvar entry) 94(defvar org-entry)
95(defvar date) 95(defvar date)
96(defvar org-agenda-undo-list) 96(defvar org-agenda-undo-list)
97(defvar org-agenda-pending-undo-list) 97(defvar org-agenda-pending-undo-list)
@@ -247,9 +247,7 @@ you can \"misuse\" it to also add other text to the header. However,
247 247
248;; Keep custom values for `org-agenda-filter-preset' compatible with 248;; Keep custom values for `org-agenda-filter-preset' compatible with
249;; the new variable `org-agenda-tag-filter-preset'. 249;; the new variable `org-agenda-tag-filter-preset'.
250(if (fboundp 'defvaralias) 250(defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset)
251 (defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset)
252 (defvaralias 'org-agenda-filter 'org-agenda-tag-filter))
253 251
254(defconst org-agenda-custom-commands-local-options 252(defconst org-agenda-custom-commands-local-options
255 `(repeat :tag "Local settings for this command. Remember to quote values" 253 `(repeat :tag "Local settings for this command. Remember to quote values"
@@ -306,11 +304,13 @@ you can \"misuse\" it to also add other text to the header. However,
306 (string :tag "+tag or -tag")))) 304 (string :tag "+tag or -tag"))))
307 (list :tag "Set daily/weekly entry types" 305 (list :tag "Set daily/weekly entry types"
308 (const org-agenda-entry-types) 306 (const org-agenda-entry-types)
309 (set :greedy t :value (:deadline :scheduled :timestamp :sexp) 307 (list
310 (const :deadline) 308 (const :format "" quote)
311 (const :scheduled) 309 (set :greedy t :value (:deadline :scheduled :timestamp :sexp)
312 (const :timestamp) 310 (const :deadline)
313 (const :sexp))) 311 (const :scheduled)
312 (const :timestamp)
313 (const :sexp))))
314 (list :tag "Standard skipping condition" 314 (list :tag "Standard skipping condition"
315 :value (org-agenda-skip-function '(org-agenda-skip-entry-if)) 315 :value (org-agenda-skip-function '(org-agenda-skip-entry-if))
316 (const org-agenda-skip-function) 316 (const org-agenda-skip-function)
@@ -408,7 +408,7 @@ where
408 408
409desc A description string to be displayed in the dispatcher menu. 409desc A description string to be displayed in the dispatcher menu.
410cmd An agenda command, similar to the above. However, tree commands 410cmd An agenda command, similar to the above. However, tree commands
411 are no allowed, but instead you can get agenda and global todo list. 411 are not allowed, but instead you can get agenda and global todo list.
412 So valid commands for a set are: 412 So valid commands for a set are:
413 (agenda \"\" settings) 413 (agenda \"\" settings)
414 (alltodo \"\" settings) 414 (alltodo \"\" settings)
@@ -1770,7 +1770,7 @@ works you probably want to add it to `org-agenda-custom-commands' for good."
1770 (setcdr ass (cdr entry)) 1770 (setcdr ass (cdr entry))
1771 (push entry org-agenda-custom-commands)))) 1771 (push entry org-agenda-custom-commands))))
1772 1772
1773;;; Define the org-agenda-mode 1773;;; Define the Org-agenda-mode
1774 1774
1775(defvar org-agenda-mode-map (make-sparse-keymap) 1775(defvar org-agenda-mode-map (make-sparse-keymap)
1776 "Keymap for `org-agenda-mode'.") 1776 "Keymap for `org-agenda-mode'.")
@@ -3075,7 +3075,6 @@ the global options and expect it to be applied to the entire view.")
3075 3075
3076(defun org-prepare-agenda (&optional name) 3076(defun org-prepare-agenda (&optional name)
3077 (setq org-todo-keywords-for-agenda nil) 3077 (setq org-todo-keywords-for-agenda nil)
3078 (setq org-done-keywords-for-agenda nil)
3079 (setq org-drawers-for-agenda nil) 3078 (setq org-drawers-for-agenda nil)
3080 (unless org-agenda-persistent-filter 3079 (unless org-agenda-persistent-filter
3081 (setq org-agenda-tag-filter nil 3080 (setq org-agenda-tag-filter nil
@@ -3094,6 +3093,7 @@ the global options and expect it to be applied to the entire view.")
3094 (make-string (window-width) org-agenda-block-separator)) 3093 (make-string (window-width) org-agenda-block-separator))
3095 "\n")) 3094 "\n"))
3096 (narrow-to-region (point) (point-max))) 3095 (narrow-to-region (point) (point-max)))
3096 (setq org-done-keywords-for-agenda nil)
3097 (org-agenda-reset-markers) 3097 (org-agenda-reset-markers)
3098 (setq org-agenda-contributing-files nil) 3098 (setq org-agenda-contributing-files nil)
3099 (setq org-agenda-columns-active nil) 3099 (setq org-agenda-columns-active nil)
@@ -4221,7 +4221,7 @@ See `org-agenda-skip-if' for details."
4221(defun org-agenda-skip-if (subtree conditions) 4221(defun org-agenda-skip-if (subtree conditions)
4222 "Checks current entity for CONDITIONS. 4222 "Checks current entity for CONDITIONS.
4223If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only 4223If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only
4224the entry, i.e. the text before the next heading is checked. 4224the entry (i.e. the text before the next heading) is checked.
4225 4225
4226CONDITIONS is a list of symbols, boolean OR is used to combine the results 4226CONDITIONS is a list of symbols, boolean OR is used to combine the results
4227from different tests. Valid conditions are: 4227from different tests. Valid conditions are:
@@ -4247,12 +4247,12 @@ keywords, which may include \"*\" to match any todo keyword.
4247 4247
4248would skip all entries with \"TODO\" or \"WAITING\" keywords. 4248would skip all entries with \"TODO\" or \"WAITING\" keywords.
4249 4249
4250Instead of a list a keyword class may be given 4250Instead of a list, a keyword class may be given. For example:
4251 4251
4252 (org-agenda-skip-entry-if 'nottodo 'done) 4252 (org-agenda-skip-entry-if 'nottodo 'done)
4253 4253
4254would skip entries that haven't been marked with any of \"DONE\" 4254would skip entries that haven't been marked with any of \"DONE\"
4255keywords. Possible classes are: `todo', `done', `any'. 4255keywords. Possible classes are: `todo', `done', `any'.
4256 4256
4257If any of these conditions is met, this function returns the end point of 4257If any of these conditions is met, this function returns the end point of
4258the entity, causing the search to continue from there. This is a function 4258the entity, causing the search to continue from there. This is a function
@@ -4285,8 +4285,8 @@ that can be put into `org-agenda-skip-function' for the duration of a command."
4285 (stringp (nth 1 m)) 4285 (stringp (nth 1 m))
4286 (not (re-search-forward (nth 1 m) end t))) 4286 (not (re-search-forward (nth 1 m) end t)))
4287 (and (or 4287 (and (or
4288 (setq m (memq 'todo conditions)) 4288 (setq m (memq 'nottodo conditions))
4289 (setq m (memq 'nottodo conditions))) 4289 (setq m (memq 'todo conditions)))
4290 (org-agenda-skip-if-todo m end))) 4290 (org-agenda-skip-if-todo m end)))
4291 end))) 4291 end)))
4292 4292
@@ -4377,7 +4377,7 @@ of what a project is and how to check if it stuck, customize the variable
4377;;; Diary integration 4377;;; Diary integration
4378 4378
4379(defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param. 4379(defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param.
4380(defvar diary-list-entries-hook) 4380(defvar list-diary-entries-hook)
4381(defvar diary-time-regexp) 4381(defvar diary-time-regexp)
4382(defun org-get-entries-from-diary (date) 4382(defun org-get-entries-from-diary (date)
4383 "Get the (Emacs Calendar) diary entries for DATE." 4383 "Get the (Emacs Calendar) diary entries for DATE."
@@ -4386,8 +4386,8 @@ of what a project is and how to check if it stuck, customize the variable
4386 (diary-display-hook '(fancy-diary-display)) 4386 (diary-display-hook '(fancy-diary-display))
4387 (diary-display-function 'fancy-diary-display) 4387 (diary-display-function 'fancy-diary-display)
4388 (pop-up-frames nil) 4388 (pop-up-frames nil)
4389 (diary-list-entries-hook 4389 (list-diary-entries-hook
4390 (cons 'org-diary-default-entry diary-list-entries-hook)) 4390 (cons 'org-diary-default-entry list-diary-entries-hook))
4391 (diary-file-name-prefix-function nil) ; turn this feature off 4391 (diary-file-name-prefix-function nil) ; turn this feature off
4392 (diary-modify-entry-list-string-function 'org-modify-diary-entry-string) 4392 (diary-modify-entry-list-string-function 'org-modify-diary-entry-string)
4393 entries 4393 entries
@@ -4530,8 +4530,8 @@ function from a program - use `org-agenda-get-day-entries' instead."
4530 (org-compile-prefix-format 'agenda) 4530 (org-compile-prefix-format 'agenda)
4531 (org-set-sorting-strategy 'agenda) 4531 (org-set-sorting-strategy 'agenda)
4532 (setq args (or args '(:deadline :scheduled :timestamp :sexp))) 4532 (setq args (or args '(:deadline :scheduled :timestamp :sexp)))
4533 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) 4533 (let* ((files (if (and org-entry (stringp org-entry) (string-match "\\S-" org-entry))
4534 (list entry) 4534 (list org-entry)
4535 (org-agenda-files t))) 4535 (org-agenda-files t)))
4536 (time (org-float-time)) 4536 (time (org-float-time))
4537 file rtn results) 4537 file rtn results)
@@ -4936,7 +4936,7 @@ holiday will also be skipped."
4936 (not (member (car (calendar-iso-from-absolute d)) skip-weeks)))) 4936 (not (member (car (calendar-iso-from-absolute d)) skip-weeks))))
4937 (not (and (memq 'holidays skip-weeks) 4937 (not (and (memq 'holidays skip-weeks)
4938 (calendar-check-holidays date))) 4938 (calendar-check-holidays date)))
4939 entry))) 4939 org-entry)))
4940 4940
4941(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks) 4941(defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks)
4942 "Like `org-class', but honor `calendar-date-style'. 4942 "Like `org-class', but honor `calendar-date-style'.
@@ -5870,8 +5870,18 @@ could bind the variable in the options section of a custom command.")
5870 (let ((pl (text-property-any 0 (length x) 'org-heading t x))) 5870 (let ((pl (text-property-any 0 (length x) 'org-heading t x)))
5871 (setq re (get-text-property 0 'org-todo-regexp x)) 5871 (setq re (get-text-property 0 'org-todo-regexp x))
5872 (when (and re 5872 (when (and re
5873 ;; Test `pl' because if there's no heading content,
5874 ;; there's no point matching to highlight. Note
5875 ;; that if we didn't test `pl' first, and there
5876 ;; happened to be no keyword from `org-todo-regexp'
5877 ;; on this heading line, then the `equal' comparison
5878 ;; afterwards would spuriously succeed in the case
5879 ;; where `pl' is nil -- causing an args-out-of-range
5880 ;; error when we try to add text properties to text
5881 ;; that isn't there.
5882 pl
5873 (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)") 5883 (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)")
5874 x (or pl 0)) pl)) 5884 x pl) pl))
5875 (add-text-properties 5885 (add-text-properties
5876 (or (match-end 1) (match-end 0)) (match-end 0) 5886 (or (match-end 1) (match-end 0)) (match-end 0)
5877 (list 'face (org-get-todo-face (match-string 2 x))) 5887 (list 'face (org-get-todo-face (match-string 2 x)))
@@ -6182,8 +6192,8 @@ When this is the global TODO list, a prefix argument will be interpreted."
6182 (recenter window-line))) 6192 (recenter window-line)))
6183 6193
6184(defvar org-global-tags-completion-table nil) 6194(defvar org-global-tags-completion-table nil)
6185(defvar org-agenda-filtered-by-category nil)
6186(defvar org-agenda-filter-form nil) 6195(defvar org-agenda-filter-form nil)
6196(defvar org-agenda-filtered-by-category nil)
6187 6197
6188(defun org-agenda-filter-by-category (strip) 6198(defun org-agenda-filter-by-category (strip)
6189 "Keep only those lines in the agenda buffer that have a specific category. 6199 "Keep only those lines in the agenda buffer that have a specific category.
@@ -7282,16 +7292,18 @@ use the dedicated frame)."
7282 (if (and current-prefix-arg (listp current-prefix-arg)) 7292 (if (and current-prefix-arg (listp current-prefix-arg))
7283 (org-agenda-do-tree-to-indirect-buffer) 7293 (org-agenda-do-tree-to-indirect-buffer)
7284 (let ((agenda-window (selected-window)) 7294 (let ((agenda-window (selected-window))
7285 (indirect-window (get-buffer-window org-last-indirect-buffer))) 7295 (indirect-window
7296 (and org-last-indirect-buffer
7297 (get-buffer-window org-last-indirect-buffer))))
7286 (save-window-excursion (org-agenda-do-tree-to-indirect-buffer)) 7298 (save-window-excursion (org-agenda-do-tree-to-indirect-buffer))
7287 (unwind-protect 7299 (unwind-protect
7288 (progn 7300 (progn
7289 (unless indirect-window 7301 (unless (and indirect-window (window-live-p indirect-window))
7290 (setq indirect-window (split-window agenda-window))) 7302 (setq indirect-window (split-window agenda-window)))
7291 (select-window indirect-window) 7303 (select-window indirect-window)
7292 (switch-to-buffer org-last-indirect-buffer :norecord) 7304 (switch-to-buffer org-last-indirect-buffer :norecord)
7293 (fit-window-to-buffer indirect-window)) 7305 (fit-window-to-buffer indirect-window))
7294 (select-window agenda-window))))) 7306 (select-window (get-buffer-window org-agenda-buffer-name))))))
7295 7307
7296(defun org-agenda-do-tree-to-indirect-buffer () 7308(defun org-agenda-do-tree-to-indirect-buffer ()
7297 "Same as `org-agenda-tree-to-indirect-buffer' without saving window." 7309 "Same as `org-agenda-tree-to-indirect-buffer' without saving window."
diff --git a/lisp/org/org-ascii.el b/lisp/org/org-ascii.el
index 90f39fd3d8d..b4c92cfe088 100644
--- a/lisp/org/org-ascii.el
+++ b/lisp/org/org-ascii.el
@@ -438,7 +438,9 @@ publishing directory."
438 link (concat (match-string 1 line) path) 438 link (concat (match-string 1 line) path)
439 type (match-string 2 line) 439 type (match-string 2 line)
440 desc0 (match-string 5 line) 440 desc0 (match-string 5 line)
441 desc (or desc0 link)) 441 desc0 (replace-regexp-in-string "\\\\_" "_" desc0)
442 desc (or desc0 link)
443 desc (replace-regexp-in-string "\\\\_" "_" desc))
442 (if (and (> (length link) 8) 444 (if (and (> (length link) 8)
443 (equal (substring link 0 8) "coderef:")) 445 (equal (substring link 0 8) "coderef:"))
444 (setq line (replace-match 446 (setq line (replace-match
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 6f7476c6ba9..73d0fa42056 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -104,7 +104,7 @@ ln create a hard link. Note that this is not supported
104 :type '(choice 104 :type '(choice
105 (const :tag "Don't store link" nil) 105 (const :tag "Don't store link" nil)
106 (const :tag "Link to origin location" t) 106 (const :tag "Link to origin location" t)
107 (const :tag "Link to the attach-dir location" 'attached))) 107 (const :tag "Link to the attach-dir location" attached)))
108 108
109;;;###autoload 109;;;###autoload
110(defun org-attach () 110(defun org-attach ()
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el
index 3df4c2044e9..49b9cf7746a 100644
--- a/lisp/org/org-bbdb.el
+++ b/lisp/org/org-bbdb.el
@@ -112,20 +112,14 @@
112 (&optional dont-check-disk already-in-db-buffer)) 112 (&optional dont-check-disk already-in-db-buffer))
113(declare-function bbdb-split "ext:bbdb" (string separators)) 113(declare-function bbdb-split "ext:bbdb" (string separators))
114(declare-function bbdb-string-trim "ext:bbdb" (string)) 114(declare-function bbdb-string-trim "ext:bbdb" (string))
115(declare-function bbdb-record-get-field "ext:bbdb" 115(declare-function bbdb-record-get-field "ext:bbdb" (record field))
116 (fn file &optional arglist fileonly)) 116(declare-function bbdb-search-name "ext:bbdb-com" (regexp &optional layout))
117;; These two functions below are part of BBDB3: 117(declare-function bbdb-search-organization "ext:bbdb-com" (regexp &optional layout))
118(declare-function bbdb-search-name "ext:bbdb" (regexp &optional layout))
119(declare-function bbdb-search-organization "ext:bbdb" (regexp &optional layout))
120 118
121(declare-function calendar-leap-year-p "calendar" (year)) 119(declare-function calendar-leap-year-p "calendar" (year))
122(declare-function diary-ordinal-suffix "diary-lib" (n)) 120(declare-function diary-ordinal-suffix "diary-lib" (n))
123 121
124(defvar date) ;; dynamically scoped from Org 122(defvar date) ;; dynamically scoped from Org
125(defvar name) ;; dynamically scoped from Org
126
127;; Support for version 2.35
128(defvar org-bbdb-old (fboundp 'bbdb-record-get-field-internal))
129 123
130;; Customization 124;; Customization
131 125
@@ -206,7 +200,7 @@ date year)."
206 ;; This is BBDB, we make this link! 200 ;; This is BBDB, we make this link!
207 (let* ((rec (bbdb-current-record)) 201 (let* ((rec (bbdb-current-record))
208 (name (bbdb-record-name rec)) 202 (name (bbdb-record-name rec))
209 (company (if org-bbdb-old 203 (company (if (fboundp 'bbdb-record-getprop)
210 (bbdb-record-getprop rec 'company) 204 (bbdb-record-getprop rec 'company)
211 (car (bbdb-record-get-field rec 'organization)))) 205 (car (bbdb-record-get-field rec 'organization))))
212 (link (org-make-link "bbdb:" name))) 206 (link (org-make-link "bbdb:" name)))
@@ -227,14 +221,14 @@ italicized, in all other cases it is left unchanged."
227 221
228(defun org-bbdb-open (name) 222(defun org-bbdb-open (name)
229 "Follow a BBDB link to NAME." 223 "Follow a BBDB link to NAME."
230 (require 'bbdb) 224 (require 'bbdb-com)
231 (let ((inhibit-redisplay (not debug-on-error)) 225 (let ((inhibit-redisplay (not debug-on-error))
232 (bbdb-electric-p nil)) 226 (bbdb-electric-p nil))
233 (if org-bbdb-old 227 (if (fboundp 'bbdb-name)
234 (org-bbdb-open-old) 228 (org-bbdb-open-old name)
235 (org-bbdb-open-new)))) 229 (org-bbdb-open-new name))))
236 230
237(defun org-bbdb-open-old () 231(defun org-bbdb-open-old (name)
238 (catch 'exit 232 (catch 'exit
239 ;; Exact match on name 233 ;; Exact match on name
240 (bbdb-name (concat "\\`" name "\\'") nil) 234 (bbdb-name (concat "\\`" name "\\'") nil)
@@ -254,7 +248,7 @@ italicized, in all other cases it is left unchanged."
254 (delete-window (get-buffer-window "*BBDB*")) 248 (delete-window (get-buffer-window "*BBDB*"))
255 (error "No matching BBDB record")))) 249 (error "No matching BBDB record"))))
256 250
257(defun org-bbdb-open-new () 251(defun org-bbdb-open-new (name)
258 (catch 'exit 252 (catch 'exit
259 ;; Exact match on name 253 ;; Exact match on name
260 (bbdb-search-name (concat "\\`" name "\\'") nil) 254 (bbdb-search-name (concat "\\`" name "\\'") nil)
diff --git a/lisp/org/org-beamer.el b/lisp/org/org-beamer.el
index 28b79a03dfe..7882b27be71 100644
--- a/lisp/org/org-beamer.el
+++ b/lisp/org/org-beamer.el
@@ -235,7 +235,7 @@ in org-export-latex-classes."
235 (envs (append org-beamer-environments-extra 235 (envs (append org-beamer-environments-extra
236 org-beamer-environments-default)) 236 org-beamer-environments-default))
237 (props (org-get-text-property-any 0 'org-props text)) 237 (props (org-get-text-property-any 0 'org-props text))
238 (in "") (out "") option action defaction environment extra 238 (in "") (out "") org-beamer-option org-beamer-action org-beamer-defaction org-beamer-environment org-beamer-extra
239 columns-option column-option 239 columns-option column-option
240 env have-text ass tmp) 240 env have-text ass tmp)
241 (if (= frame-level 0) (setq frame-level nil)) 241 (if (= frame-level 0) (setq frame-level nil))
@@ -266,10 +266,10 @@ in org-export-latex-classes."
266 266
267 (setq in (org-fill-template 267 (setq in (org-fill-template
268 "\\begin{frame}%a%A%o%T%S%x" 268 "\\begin{frame}%a%A%o%T%S%x"
269 (list (cons "a" (or action "")) 269 (list (cons "a" (or org-beamer-action ""))
270 (cons "A" (or defaction "")) 270 (cons "A" (or org-beamer-defaction ""))
271 (cons "o" (or option org-beamer-frame-default-options "")) 271 (cons "o" (or org-beamer-option org-beamer-frame-default-options ""))
272 (cons "x" (if extra (concat "\n" extra) "")) 272 (cons "x" (if org-beamer-extra (concat "\n" org-beamer-extra) ""))
273 (cons "h" "%s") 273 (cons "h" "%s")
274 (cons "T" (if (string-match "\\S-" text) 274 (cons "T" (if (string-match "\\S-" text)
275 "\n\\frametitle{%s}" "")) 275 "\n\\frametitle{%s}" ""))
@@ -294,10 +294,10 @@ in org-export-latex-classes."
294 (setq have-text (string-match "\\S-" text)) 294 (setq have-text (string-match "\\S-" text))
295 (setq in (org-fill-template 295 (setq in (org-fill-template
296 (nth 2 ass) 296 (nth 2 ass)
297 (list (cons "a" (or action "")) 297 (list (cons "a" (or org-beamer-action ""))
298 (cons "A" (or defaction "")) 298 (cons "A" (or org-beamer-defaction ""))
299 (cons "o" (or option "")) 299 (cons "o" (or org-beamer-option ""))
300 (cons "x" (if extra (concat "\n" extra) "")) 300 (cons "x" (if org-beamer-extra (concat "\n" org-beamer-extra) ""))
301 (cons "h" "%s") 301 (cons "h" "%s")
302 (cons "H" (if have-text (concat "{" text "}") "")) 302 (cons "H" (if have-text (concat "{" text "}") ""))
303 (cons "U" (if have-text (concat "[" text "]") "")))) 303 (cons "U" (if have-text (concat "[" text "]") ""))))
@@ -321,31 +321,31 @@ in org-export-latex-classes."
321 (cons text (cdr (assoc level default)))) 321 (cons text (cdr (assoc level default))))
322 (t nil)))) 322 (t nil))))
323 323
324(defvar extra) 324(defvar org-beamer-extra)
325(defvar option) 325(defvar org-beamer-option)
326(defvar action) 326(defvar org-beamer-action)
327(defvar defaction) 327(defvar org-beamer-defaction)
328(defvar environment) 328(defvar org-beamer-environment)
329(defun org-beamer-get-special (props) 329(defun org-beamer-get-special (props)
330 "Extract an option, action, and default action string from text. 330 "Extract an option, action, and default action string from text.
331The variables option, action, defaction, extra are all scoped into 331The variables org-beamer-option, org-beamer-action, org-beamer-defaction,
332this function dynamically." 332org-beamer-extra are all scoped into this function dynamically."
333 (let (tmp) 333 (let (tmp)
334 (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props)) 334 (setq org-beamer-environment (org-beamer-assoc-not-empty "BEAMER_env" props))
335 (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props)) 335 (setq org-beamer-extra (org-beamer-assoc-not-empty "BEAMER_extra" props))
336 (when extra 336 (when org-beamer-extra
337 (setq extra (replace-regexp-in-string "\\\\n" "\n" extra))) 337 (setq org-beamer-extra (replace-regexp-in-string "\\\\n" "\n" org-beamer-extra)))
338 (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props)) 338 (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props))
339 (when tmp 339 (when tmp
340 (setq tmp (copy-sequence tmp)) 340 (setq tmp (copy-sequence tmp))
341 (if (string-match "\\[<[^][<>]*>\\]" tmp) 341 (if (string-match "\\[<[^][<>]*>\\]" tmp)
342 (setq defaction (match-string 0 tmp) 342 (setq org-beamer-defaction (match-string 0 tmp)
343 tmp (replace-match "" t t tmp))) 343 tmp (replace-match "" t t tmp)))
344 (if (string-match "\\[[^][]*\\]" tmp) 344 (if (string-match "\\[[^][]*\\]" tmp)
345 (setq option (match-string 0 tmp) 345 (setq org-beamer-option (match-string 0 tmp)
346 tmp (replace-match "" t t tmp))) 346 tmp (replace-match "" t t tmp)))
347 (if (string-match "<[^<>]*>" tmp) 347 (if (string-match "<[^<>]*>" tmp)
348 (setq action (match-string 0 tmp) 348 (setq org-beamer-action (match-string 0 tmp)
349 tmp (replace-match "" t t tmp)))))) 349 tmp (replace-match "" t t tmp))))))
350 350
351(defun org-beamer-assoc-not-empty (elt list) 351(defun org-beamer-assoc-not-empty (elt list)
@@ -579,7 +579,7 @@ include square brackets."
579(add-hook 'org-export-preprocess-before-selecting-backend-code-hook 579(add-hook 'org-export-preprocess-before-selecting-backend-code-hook
580 'org-beamer-select-beamer-code) 580 'org-beamer-select-beamer-code)
581 581
582(defun org-insert-beamer-options-template (kind) 582(defun org-insert-beamer-options-template (&optional kind)
583 "Insert a settings template, to make sure users do this right." 583 "Insert a settings template, to make sure users do this right."
584 (interactive (progn 584 (interactive (progn
585 (message "Current [s]ubtree or [g]lobal?") 585 (message "Current [s]ubtree or [g]lobal?")
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el
index 17cdbc27f29..c1788b4bb52 100644
--- a/lisp/org/org-bibtex.el
+++ b/lisp/org/org-bibtex.el
@@ -112,7 +112,7 @@
112(eval-when-compile 112(eval-when-compile
113 (require 'cl)) 113 (require 'cl))
114 114
115(defvar description nil) ; dynamically scoped from org.el 115(defvar org-bibtex-description nil) ; dynamically scoped from org.el
116(defvar org-id-locations) 116(defvar org-id-locations)
117 117
118(declare-function bibtex-beginning-of-entry "bibtex" ()) 118(declare-function bibtex-beginning-of-entry "bibtex" ())
@@ -467,7 +467,7 @@ With optional argument OPTIONAL, also prompt for optional fields."
467 :btype (or (cdr (assoc "=type=" entry)) "[no type]") 467 :btype (or (cdr (assoc "=type=" entry)) "[no type]")
468 :type "bibtex" 468 :type "bibtex"
469 :link link 469 :link link
470 :description description)))) 470 :description org-bibtex-description))))
471 471
472(defun org-create-file-search-in-bibtex () 472(defun org-create-file-search-in-bibtex ()
473 "Create the search string and description for a BibTeX database entry." 473 "Create the search string and description for a BibTeX database entry."
@@ -485,7 +485,7 @@ With optional argument OPTIONAL, also prompt for optional fields."
485 (bibtex-autokey-titleword-case-convert-function 'identity) 485 (bibtex-autokey-titleword-case-convert-function 'identity)
486 (bibtex-autokey-titleword-length 'infty) 486 (bibtex-autokey-titleword-length 'infty)
487 (bibtex-autokey-year-title-separator ": ")) 487 (bibtex-autokey-year-title-separator ": "))
488 (setq description (bibtex-generate-autokey))) 488 (setq org-bibtex-description (bibtex-generate-autokey)))
489 ;; Now parse the entry, get the key and return it. 489 ;; Now parse the entry, get the key and return it.
490 (save-excursion 490 (save-excursion
491 (bibtex-beginning-of-entry) 491 (bibtex-beginning-of-entry)
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 31694d47bc0..01ec85d6d7c 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -911,30 +911,30 @@ it. When it is a variable, retrieve the value. Return whatever we get."
911 (target-entry-p (org-capture-get :target-entry-p)) 911 (target-entry-p (org-capture-get :target-entry-p))
912 (ind 0) 912 (ind 0)
913 beg end) 913 beg end)
914 (cond 914 (if (org-capture-get :exact-position)
915 ((org-capture-get :exact-position) 915 (goto-char (org-capture-get :exact-position))
916 (goto-char (org-capture-get :exact-position))) 916 (cond
917 ((not target-entry-p) 917 ((not target-entry-p)
918 ;; Insert as top-level entry, either at beginning or at end of file 918 ;; Insert as top-level entry, either at beginning or at end of file
919 (setq beg (point-min) end (point-max))) 919 (setq beg (point-min) end (point-max)))
920 (t 920 (t
921 (setq beg (1+ (point-at-eol)) 921 (setq beg (1+ (point-at-eol))
922 end (save-excursion (outline-next-heading) (point))))) 922 end (save-excursion (outline-next-heading) (point)))))
923 (if (org-capture-get :prepend) 923 (if (org-capture-get :prepend)
924 (progn
925 (goto-char beg)
926 (if (org-list-search-forward (org-item-beginning-re) end t)
927 (progn
928 (goto-char (match-beginning 0))
929 (setq ind (org-get-indentation)))
930 (goto-char end)
931 (setq ind 0)))
932 (goto-char end)
933 (if (org-list-search-backward (org-item-beginning-re) beg t)
934 (progn 924 (progn
935 (setq ind (org-get-indentation)) 925 (goto-char beg)
936 (org-end-of-item)) 926 (if (org-list-search-forward (org-item-beginning-re) end t)
937 (setq ind 0))) 927 (progn
928 (goto-char (match-beginning 0))
929 (setq ind (org-get-indentation)))
930 (goto-char end)
931 (setq ind 0)))
932 (goto-char end)
933 (if (org-list-search-backward (org-item-beginning-re) beg t)
934 (progn
935 (setq ind (org-get-indentation))
936 (org-end-of-item))
937 (setq ind 0))))
938 ;; Remove common indentation 938 ;; Remove common indentation
939 (setq txt (org-remove-indentation txt)) 939 (setq txt (org-remove-indentation txt))
940 ;; Make sure this is indeed an item 940 ;; Make sure this is indeed an item
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 6211ae45b1b..b1133024b34 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1691,7 +1691,7 @@ from the `before-change-functions' in the current buffer."
1691 (remove-hook 'before-change-functions 1691 (remove-hook 'before-change-functions
1692 'org-clock-remove-overlays 'local)))) 1692 'org-clock-remove-overlays 'local))))
1693 1693
1694(defvar state) ;; dynamically scoped into this function 1694(defvar org-clock-state) ;; dynamically scoped into this function
1695(defun org-clock-out-if-current () 1695(defun org-clock-out-if-current ()
1696 "Clock out if the current entry contains the running clock. 1696 "Clock out if the current entry contains the running clock.
1697This is used to stop the clock after a TODO entry is marked DONE, 1697This is used to stop the clock after a TODO entry is marked DONE,
@@ -1700,9 +1700,9 @@ and is only done if the variable `org-clock-out-when-done' is not nil."
1700 org-clock-out-when-done 1700 org-clock-out-when-done
1701 (marker-buffer org-clock-marker) 1701 (marker-buffer org-clock-marker)
1702 (or (and (eq t org-clock-out-when-done) 1702 (or (and (eq t org-clock-out-when-done)
1703 (member state org-done-keywords)) 1703 (member org-clock-state org-done-keywords))
1704 (and (listp org-clock-out-when-done) 1704 (and (listp org-clock-out-when-done)
1705 (member state org-clock-out-when-done))) 1705 (member org-clock-state org-clock-out-when-done)))
1706 (equal (or (buffer-base-buffer (org-clocking-buffer)) 1706 (equal (or (buffer-base-buffer (org-clocking-buffer))
1707 (org-clocking-buffer)) 1707 (org-clocking-buffer))
1708 (or (buffer-base-buffer (current-buffer)) 1708 (or (buffer-base-buffer (current-buffer))
@@ -1763,17 +1763,6 @@ buffer and update it."
1763 (org-combine-plists org-clock-clocktable-default-properties props)))) 1763 (org-combine-plists org-clock-clocktable-default-properties props))))
1764 (org-update-dblock)) 1764 (org-update-dblock))
1765 1765
1766(defun org-in-clocktable-p ()
1767 "Check if the cursor is in a clocktable."
1768 (let ((pos (point)) start)
1769 (save-excursion
1770 (end-of-line 1)
1771 (and (re-search-backward "^[ \t]*#\\+BEGIN:[ \t]+clocktable" nil t)
1772 (setq start (match-beginning 0))
1773 (re-search-forward "^[ \t]*#\\+END:.*" nil t)
1774 (>= (match-end 0) pos)
1775 start))))
1776
1777(defun org-day-of-week (day month year) 1766(defun org-day-of-week (day month year)
1778 "Returns the day of the week as an integer." 1767 "Returns the day of the week as an integer."
1779 (nth 6 1768 (nth 6
@@ -2445,6 +2434,7 @@ TIME: The sum of all time spend in this tree, in minutes. This time
2445 (tags (plist-get params :tags)) 2434 (tags (plist-get params :tags))
2446 (properties (plist-get params :properties)) 2435 (properties (plist-get params :properties))
2447 (inherit-property-p (plist-get params :inherit-props)) 2436 (inherit-property-p (plist-get params :inherit-props))
2437 todo-only
2448 (matcher (if tags (cdr (org-make-tags-matcher tags)))) 2438 (matcher (if tags (cdr (org-make-tags-matcher tags))))
2449 cc range-text st p time level hdl props tsp tbl) 2439 cc range-text st p time level hdl props tsp tbl)
2450 2440
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index 04d2b626f91..fb158800cee 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -194,7 +194,9 @@ This is the compiled version of the format.")
194 (point-at-bol) (point-at-eol))))) 194 (point-at-bol) (point-at-eol)))))
195 ;; In agenda, just get the `txt' property 195 ;; In agenda, just get the `txt' property
196 (org-no-properties 196 (org-no-properties
197 (org-get-at-bol 'txt)))) 197 (or (org-get-at-bol 'txt)
198 (buffer-substring
199 (point) (progn (end-of-line) (point)))))))
198 (assoc property props)) 200 (assoc property props))
199 width (or (cdr (assoc property org-columns-current-maxwidths)) 201 width (or (cdr (assoc property org-columns-current-maxwidths))
200 (nth 2 column) 202 (nth 2 column)
@@ -355,7 +357,7 @@ CPHR is the complex heading regexp to use for parsing ITEM."
355 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) 357 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1))))))
356 (and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item))) 358 (and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item)))
357 (and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item))) 359 (and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item)))
358 " " (save-match-data (org-columns-compact-links (match-string 4 item))) 360 " " (save-match-data (org-columns-compact-links (or (match-string 4 item) "")))
359 (and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item))))) 361 (and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item)))))
360 (add-text-properties 362 (add-text-properties
361 0 (1+ (match-end 1)) 363 0 (1+ (match-end 1))
@@ -928,6 +930,8 @@ Don't set this, this is meant for dynamic scoping.")
928 (overlay-put ov 'display (format fmt val))))) 930 (overlay-put ov 'display (format fmt val)))))
929 org-columns-overlays)))) 931 org-columns-overlays))))
930 932
933(defvar org-inlinetask-min-level
934 (if (featurep 'org-inlinetask) org-inlinetask-min-level 15))
931(defun org-columns-compute (property) 935(defun org-columns-compute (property)
932 "Sum the values of property PROPERTY hierarchically, for the entire buffer." 936 "Sum the values of property PROPERTY hierarchically, for the entire buffer."
933 (interactive) 937 (interactive)
@@ -942,7 +946,9 @@ Don't set this, this is meant for dynamic scoping.")
942 (fun (nth 6 ass)) 946 (fun (nth 6 ass))
943 (calc (or (nth 7 ass) 'identity)) 947 (calc (or (nth 7 ass) 'identity))
944 (beg org-columns-top-level-marker) 948 (beg org-columns-top-level-marker)
945 last-level val valflag flag end sumpos sum-alist sum str str1 useval) 949 (inminlevel org-inlinetask-min-level)
950 (last-level org-inlinetask-min-level)
951 val valflag flag end sumpos sum-alist sum str str1 useval)
946 (save-excursion 952 (save-excursion
947 ;; Find the region to compute 953 ;; Find the region to compute
948 (goto-char beg) 954 (goto-char beg)
@@ -951,16 +957,21 @@ Don't set this, this is meant for dynamic scoping.")
951 ;; Walk the tree from the back and do the computations 957 ;; Walk the tree from the back and do the computations
952 (while (re-search-backward re beg t) 958 (while (re-search-backward re beg t)
953 (setq sumpos (match-beginning 0) 959 (setq sumpos (match-beginning 0)
954 last-level level 960 last-level (if (not (or (zerop level) (eq level inminlevel)))
961 level last-level)
955 level (org-outline-level) 962 level (org-outline-level)
956 val (org-entry-get nil property) 963 val (org-entry-get nil property)
957 valflag (and val (string-match "\\S-" val))) 964 valflag (and val (string-match "\\S-" val)))
958 (cond 965 (cond
959 ((< level last-level) 966 ((< level last-level)
960 ;; put the sum of lower levels here as a property 967 ;; put the sum of lower levels here as a property
961 (setq sum (when (aref lvals last-level) 968 (setq sum (+ (if (and (/= last-level inminlevel)
962 (apply fun (aref lvals last-level))) 969 (aref lvals last-level))
963 flag (aref lflag last-level) ; any valid entries from children? 970 (apply fun (aref lvals last-level)) 0)
971 (if (aref lvals inminlevel)
972 (apply fun (aref lvals inminlevel)) 0))
973 flag (or (aref lflag last-level) ; any valid entries from children?
974 (aref lflag inminlevel)) ; or inline tasks?
964 str (org-columns-number-to-string sum format printf) 975 str (org-columns-number-to-string sum format printf)
965 str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold) 976 str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold)
966 useval (if flag str1 (if valflag val "")) 977 useval (if flag str1 (if valflag val ""))
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index a128b046038..c613ba20e48 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -236,16 +236,20 @@ See `org-crypt-disable-auto-save'."
236(defun org-encrypt-entries () 236(defun org-encrypt-entries ()
237 "Encrypt all top-level entries in the current buffer." 237 "Encrypt all top-level entries in the current buffer."
238 (interactive) 238 (interactive)
239 (org-scan-tags 239 (let (todo-only)
240 'org-encrypt-entry 240 (org-scan-tags
241 (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) 241 'org-encrypt-entry
242 (cdr (org-make-tags-matcher org-crypt-tag-matcher))
243 todo-only)))
242 244
243(defun org-decrypt-entries () 245(defun org-decrypt-entries ()
244 "Decrypt all entries in the current buffer." 246 "Decrypt all entries in the current buffer."
245 (interactive) 247 (interactive)
246 (org-scan-tags 248 (let (todo-only)
247 'org-decrypt-entry 249 (org-scan-tags
248 (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) 250 'org-decrypt-entry
251 (cdr (org-make-tags-matcher org-crypt-tag-matcher))
252 todo-only)))
249 253
250(defun org-crypt-use-before-save-magic () 254(defun org-crypt-use-before-save-magic ()
251 "Add a hook to automatically encrypt entries before a file is saved to disk." 255 "Add a hook to automatically encrypt entries before a file is saved to disk."
diff --git a/lisp/org/org-eshell.el b/lisp/org/org-eshell.el
index 16b19e26d08..f572095d818 100644
--- a/lisp/org/org-eshell.el
+++ b/lisp/org/org-eshell.el
@@ -3,7 +3,6 @@
3;; Copyright (C) 2011-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
4 4
5;; Author: Konrad Hinsen <konrad.hinsen AT fastmail.net> 5;; Author: Konrad Hinsen <konrad.hinsen AT fastmail.net>
6;; Version: 0.1
7 6
8;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
9 8
diff --git a/lisp/org/org-exp-blocks.el b/lisp/org/org-exp-blocks.el
index e5ff5c59eec..438a580d8b5 100644
--- a/lisp/org/org-exp-blocks.el
+++ b/lisp/org/org-exp-blocks.el
@@ -57,9 +57,9 @@
57;; using the dot utility. For information on dot see 57;; using the dot utility. For information on dot see
58;; http://www.graphviz.org/ 58;; http://www.graphviz.org/
59;; 59;;
60;; comment :: Wrap comments with titles and author information, in 60;; export-comment :: Wrap comments with titles and author information,
61;; their own divs with author-specific ids allowing for css 61;; in their own divs with author-specific ids allowing for
62;; coloring of comments based on the author. 62;; css coloring of comments based on the author.
63;; 63;;
64;;; Adding new blocks 64;;; Adding new blocks
65;; 65;;
@@ -73,6 +73,7 @@
73(eval-when-compile 73(eval-when-compile
74 (require 'cl)) 74 (require 'cl))
75(require 'org) 75(require 'org)
76(require 'find-func)
76 77
77(defun org-export-blocks-set (var value) 78(defun org-export-blocks-set (var value)
78 "Set the value of `org-export-blocks' and install fontification." 79 "Set the value of `org-export-blocks' and install fontification."
@@ -87,7 +88,7 @@
87 value)) 88 value))
88 89
89(defcustom org-export-blocks 90(defcustom org-export-blocks
90 '((comment org-export-blocks-format-comment t) 91 '((export-comment org-export-blocks-format-comment t)
91 (ditaa org-export-blocks-format-ditaa nil) 92 (ditaa org-export-blocks-format-ditaa nil)
92 (dot org-export-blocks-format-dot nil)) 93 (dot org-export-blocks-format-dot nil))
93 "Use this alist to associate block types with block exporting functions. 94 "Use this alist to associate block types with block exporting functions.
@@ -224,7 +225,7 @@ which defaults to the value of `org-export-blocks-witheld'."
224 225
225;;-------------------------------------------------------------------------------- 226;;--------------------------------------------------------------------------------
226;; ditaa: create images from ASCII art using the ditaa utility 227;; ditaa: create images from ASCII art using the ditaa utility
227(defvar org-ditaa-jar-path (expand-file-name 228(defcustom org-ditaa-jar-path (expand-file-name
228 "ditaa.jar" 229 "ditaa.jar"
229 (file-name-as-directory 230 (file-name-as-directory
230 (expand-file-name 231 (expand-file-name
@@ -232,8 +233,10 @@ which defaults to the value of `org-export-blocks-witheld'."
232 (file-name-as-directory 233 (file-name-as-directory
233 (expand-file-name 234 (expand-file-name
234 "../contrib" 235 "../contrib"
235 (file-name-directory (or load-file-name buffer-file-name))))))) 236 (file-name-directory (find-library-name "org")))))))
236 "Path to the ditaa jar executable.") 237 "Path to the ditaa jar executable."
238 :group 'org-babel
239 :type 'string)
237 240
238(defvar org-export-current-backend) ; dynamically bound in org-exp.el 241(defvar org-export-current-backend) ; dynamically bound in org-exp.el
239(defun org-export-blocks-format-ditaa (body &rest headers) 242(defun org-export-blocks-format-ditaa (body &rest headers)
diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el
index c7e1a94216e..b5901a54bc5 100644
--- a/lisp/org/org-exp.el
+++ b/lisp/org/org-exp.el
@@ -1730,10 +1730,11 @@ from the buffer."
1730 ":[ \t]*\\(.*\\)") nil t) 1730 ":[ \t]*\\(.*\\)") nil t)
1731 (if (not (eq backend org-export-current-backend)) 1731 (if (not (eq backend org-export-current-backend))
1732 (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))) 1732 (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))
1733 (replace-match "\\1\\2" t) 1733 (let ((ind (get-text-property (point-at-bol) 'original-indentation)))
1734 (add-text-properties 1734 (replace-match "\\1\\2" t)
1735 (point-at-bol) (min (1+ (point-at-eol)) (point-max)) 1735 (add-text-properties
1736 `(org-protected t original-indentation ,ind org-native-text t)))) 1736 (point-at-bol) (min (1+ (point-at-eol)) (point-max))
1737 `(org-protected t original-indentation ,ind org-native-text t)))))
1737 ;; Delete #+ATTR_BACKEND: stuff of another backend. Those 1738 ;; Delete #+ATTR_BACKEND: stuff of another backend. Those
1738 ;; matching the current backend will be taken care of by 1739 ;; matching the current backend will be taken care of by
1739 ;; `org-export-attach-captions-and-attributes' 1740 ;; `org-export-attach-captions-and-attributes'
@@ -1748,7 +1749,8 @@ from the buffer."
1748 (while (re-search-forward (concat "^[ \t]*#\\+BEGIN_" backend-name "\\>.*\n?") 1749 (while (re-search-forward (concat "^[ \t]*#\\+BEGIN_" backend-name "\\>.*\n?")
1749 nil t) 1750 nil t)
1750 (setq beg (match-beginning 0) beg-content (match-end 0)) 1751 (setq beg (match-beginning 0) beg-content (match-end 0))
1751 (setq ind (save-excursion (goto-char beg) (org-get-indentation))) 1752 (setq ind (or (get-text-property beg 'original-indentation)
1753 (save-excursion (goto-char beg) (org-get-indentation))))
1752 (when (re-search-forward (concat "^[ \t]*#\\+END_" backend-name "\\>.*\n?") 1754 (when (re-search-forward (concat "^[ \t]*#\\+END_" backend-name "\\>.*\n?")
1753 nil t) 1755 nil t)
1754 (setq end (match-end 0) end-content (match-beginning 0)) 1756 (setq end (match-end 0) end-content (match-beginning 0))
@@ -1759,17 +1761,7 @@ from the buffer."
1759 beg-content end-content 1761 beg-content end-content
1760 `(org-protected t original-indentation ,ind org-native-text t)) 1762 `(org-protected t original-indentation ,ind org-native-text t))
1761 ;; strip protective commas 1763 ;; strip protective commas
1762 (save-excursion 1764 (org-strip-protective-commas beg-content end-content)
1763 (save-match-data
1764 (goto-char beg-content)
1765 (let ((front-line (save-excursion
1766 (re-search-forward
1767 "[^[:space:]]" end-content t)
1768 (goto-char (match-beginning 0))
1769 (current-column))))
1770 (while (re-search-forward "^[ \t]*\\(,\\)" end-content t)
1771 (when (= (current-column) front-line)
1772 (replace-match "" nil nil nil 1))))))
1773 (delete-region (match-beginning 0) (match-end 0)) 1765 (delete-region (match-beginning 0) (match-end 0))
1774 (save-excursion 1766 (save-excursion
1775 (goto-char beg) 1767 (goto-char beg)
@@ -1816,8 +1808,7 @@ These special cookies will later be interpreted by the backend."
1816 (top (point-at-bol)) 1808 (top (point-at-bol))
1817 (top-ind (org-list-get-ind top struct))) 1809 (top-ind (org-list-get-ind top struct)))
1818 (goto-char bottom) 1810 (goto-char bottom)
1819 (when (and (not (eq org-list-ending-method 'indent)) 1811 (when (and (not (looking-at "[ \t]*$"))
1820 (not (looking-at "[ \t]*$"))
1821 (looking-at org-list-end-re)) 1812 (looking-at org-list-end-re))
1822 (replace-match "")) 1813 (replace-match ""))
1823 (unless (bolp) (insert "\n")) 1814 (unless (bolp) (insert "\n"))
@@ -1875,8 +1866,7 @@ These special properties will later be interpreted by the backend."
1875 ;; useful to line processing exporters. 1866 ;; useful to line processing exporters.
1876 (goto-char bottom) 1867 (goto-char bottom)
1877 (when (or (looking-at "^ORG-LIST-END-MARKER\n") 1868 (when (or (looking-at "^ORG-LIST-END-MARKER\n")
1878 (and (not (eq org-list-ending-method 'indent)) 1869 (and (not (looking-at "[ \t]*$"))
1879 (not (looking-at "[ \t]*$"))
1880 (looking-at org-list-end-re))) 1870 (looking-at org-list-end-re)))
1881 (replace-match "")) 1871 (replace-match ""))
1882 (unless (bolp) (insert "\n")) 1872 (unless (bolp) (insert "\n"))
@@ -2203,7 +2193,7 @@ can work correctly."
2203 ;; This is a subtree, we take the title from the first heading 2193 ;; This is a subtree, we take the title from the first heading
2204 (goto-char rbeg) 2194 (goto-char rbeg)
2205 (looking-at org-todo-line-tags-regexp) 2195 (looking-at org-todo-line-tags-regexp)
2206 (setq title (if (eq tags t) 2196 (setq title (if (and (eq tags t) (match-string 4))
2207 (format "%s\t%s" (match-string 3) (match-string 4)) 2197 (format "%s\t%s" (match-string 3) (match-string 4))
2208 (match-string 3))) 2198 (match-string 3)))
2209 (org-unmodified 2199 (org-unmodified
@@ -3277,7 +3267,7 @@ If yes remove the column and the special lines."
3277 ((org-table-cookie-line-p x) 3267 ((org-table-cookie-line-p x)
3278 ;; This line contains formatting cookies, discard it 3268 ;; This line contains formatting cookies, discard it
3279 nil) 3269 nil)
3280 ((string-match "^[ \t]*| *[!_^/] *|" x) 3270 ((string-match "^[ \t]*| *\\([!_^/$]\\|\\\\\\$\\) *|" x)
3281 ;; ignore this line 3271 ;; ignore this line
3282 nil) 3272 nil)
3283 ((or (string-match "^\\([ \t]*\\)|-+\\+" x) 3273 ((or (string-match "^\\([ \t]*\\)|-+\\+" x)
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index 573bd648959..34fc31f39d6 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -58,6 +58,7 @@
58(declare-function org-show-context "org" (&optional key)) 58(declare-function org-show-context "org" (&optional key))
59(declare-function org-trim "org" (s)) 59(declare-function org-trim "org" (s))
60(declare-function outline-next-heading "outline") 60(declare-function outline-next-heading "outline")
61(declare-function org-skip-whitespace "org" ())
61 62
62(defvar org-outline-regexp-bol) ; defined in org.el 63(defvar org-outline-regexp-bol) ; defined in org.el
63(defvar org-odd-levels-only) ; defined in org.el 64(defvar org-odd-levels-only) ; defined in org.el
@@ -84,8 +85,8 @@
84 (org-re "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]") 85 (org-re "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]")
85 "Regular expression matching the definition of a footnote.") 86 "Regular expression matching the definition of a footnote.")
86 87
87(defvar org-footnote-forbidden-blocks '("example" "verse" "src" "ascii" "beamer" 88(defconst org-footnote-forbidden-blocks
88 "docbook" "html" "latex" "odt") 89 '("ascii" "beamer" "comment" "docbook" "example" "html" "latex" "odt" "src")
89 "Names of blocks where footnotes are not allowed.") 90 "Names of blocks where footnotes are not allowed.")
90 91
91(defgroup org-footnote nil 92(defgroup org-footnote nil
@@ -242,40 +243,46 @@ positions, and the definition, when inlined."
242 (match-end 0) (1- end))))))))) 243 (match-end 0) (1- end)))))))))
243 244
244(defun org-footnote-at-definition-p () 245(defun org-footnote-at-definition-p ()
245 "Is the cursor at a footnote definition? 246 "Is point within a footnote definition?
246 247
247This matches only pure definitions like [1] or [fn:name] at the beginning 248This matches only pure definitions like [1] or [fn:name] at the
248of a line. It does not match references like [fn:name:definition], where the 249beginning of a line. It does not match references like
249footnote text is included and defined locally. 250\[fn:name:definition], where the footnote text is included and
251defined locally.
250 252
251The return value will be nil if not at a footnote definition, and a list with 253The return value will be nil if not at a footnote definition, and
252label, start, end and definition of the footnote otherwise." 254a list with label, start, end and definition of the footnote
255otherwise."
253 (when (save-excursion (beginning-of-line) (org-footnote-in-valid-context-p)) 256 (when (save-excursion (beginning-of-line) (org-footnote-in-valid-context-p))
254 (save-excursion 257 (save-excursion
255 (end-of-line) 258 (end-of-line)
259 ;; Footnotes definitions are separated by new headlines or blank
260 ;; lines.
256 (let ((lim (save-excursion (re-search-backward 261 (let ((lim (save-excursion (re-search-backward
257 (concat org-outline-regexp-bol 262 (concat org-outline-regexp-bol
258 "\\|^[ \t]*$") nil t)))) 263 "\\|^[ \t]*$") nil t))))
259 (when (re-search-backward org-footnote-definition-re lim t) 264 (when (re-search-backward org-footnote-definition-re lim t)
260 (end-of-line) 265 (let ((label (org-match-string-no-properties 1))
261 (list (org-match-string-no-properties 1) 266 (beg (match-beginning 0))
262 (match-beginning 0) 267 (beg-def (match-end 0))
263 (save-match-data 268 ;; In message-mode, do not search after signature.
264 ;; In a message, limit search to signature. 269 (end (let ((bound (and (derived-mode-p 'message-mode)
265 (let ((bound (and (derived-mode-p 'message-mode) 270 (save-excursion
266 (save-excursion 271 (goto-char (point-max))
267 (goto-char (point-max)) 272 (re-search-backward
268 (re-search-backward 273 message-signature-separator nil t)))))
269 message-signature-separator nil t))))) 274 (if (progn
270 (or (and (re-search-forward 275 (end-of-line)
276 (re-search-forward
271 (concat org-outline-regexp-bol "\\|" 277 (concat org-outline-regexp-bol "\\|"
272 org-footnote-definition-re "\\|" 278 org-footnote-definition-re "\\|"
273 "^[ \t]*$") 279 "^[ \t]*$") bound 'move))
274 bound 'move) 280 (progn (goto-char (match-beginning 0))
275 (progn (skip-chars-forward " \t\n") (point-at-bol))) 281 (org-skip-whitespace)
276 (point)))) 282 (point-at-bol))
277 (org-trim (buffer-substring-no-properties 283 (point)))))
278 (match-end 0) (point))))))))) 284 (list label beg end
285 (org-trim (buffer-substring-no-properties beg-def end)))))))))
279 286
280(defun org-footnote-get-next-reference (&optional label backward limit) 287(defun org-footnote-get-next-reference (&optional label backward limit)
281 "Return complete reference of the next footnote. 288 "Return complete reference of the next footnote.
@@ -541,7 +548,9 @@ or new, let the user edit the definition of the footnote."
541 (unless (bolp) (newline)) 548 (unless (bolp) (newline))
542 (set-marker max nil)))) 549 (set-marker max nil))))
543 ;; Insert footnote label. 550 ;; Insert footnote label.
544 (insert "\n[" label "] ") 551 (when (zerop (org-back-over-empty-lines)) (newline))
552 (insert "[" label "] \n")
553 (backward-char)
545 ;; Only notify user about next possible action when in an Org 554 ;; Only notify user about next possible action when in an Org
546 ;; buffer, as the bindings may have different meanings otherwise. 555 ;; buffer, as the bindings may have different meanings otherwise.
547 (when (eq major-mode 'org-mode) 556 (when (eq major-mode 'org-mode)
@@ -651,6 +660,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
651 (goto-char (point-min)) 660 (goto-char (point-min))
652 (while (setq ref (org-footnote-get-next-reference)) 661 (while (setq ref (org-footnote-get-next-reference))
653 (let* ((lbl (car ref)) 662 (let* ((lbl (car ref))
663 (pos (nth 1 ref))
654 ;; When footnote isn't anonymous, check if it's label 664 ;; When footnote isn't anonymous, check if it's label
655 ;; (REF) is already stored in REF-TABLE. In that case, 665 ;; (REF) is already stored in REF-TABLE. In that case,
656 ;; extract number used to identify it (MARKER). If 666 ;; extract number used to identify it (MARKER). If
@@ -667,8 +677,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
667 ;; If EXPORT-PROPS isn't nil, also add `org-footnote' 677 ;; If EXPORT-PROPS isn't nil, also add `org-footnote'
668 ;; property to it, so it can be easily recognized by 678 ;; property to it, so it can be easily recognized by
669 ;; exporters. 679 ;; exporters.
670 (if sort-only 680 (if sort-only (goto-char (nth 2 ref))
671 (goto-char (nth 2 ref))
672 (delete-region (nth 1 ref) (nth 2 ref)) 681 (delete-region (nth 1 ref) (nth 2 ref))
673 (goto-char (nth 1 ref)) 682 (goto-char (nth 1 ref))
674 (let ((new-ref (format "[%d]" marker))) 683 (let ((new-ref (format "[%d]" marker)))
@@ -678,7 +687,8 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
678 org-footnote-fill-after-inline-note-extraction 687 org-footnote-fill-after-inline-note-extraction
679 (org-fill-paragraph))) 688 (org-fill-paragraph)))
680 ;; Add label (REF), identifier (MARKER), definition (DEF) 689 ;; Add label (REF), identifier (MARKER), definition (DEF)
681 ;; and type (INLINEP) to REF-TABLE if data was unknown. 690 ;; type (INLINEP) and position (POS) to REF-TABLE if data
691 ;; was unknown.
682 (unless a 692 (unless a
683 (let ((def (or (nth 3 ref) ; inline 693 (let ((def (or (nth 3 ref) ; inline
684 (and export-props 694 (and export-props
@@ -696,27 +706,35 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
696 '(:todo-keywords t :tags t :priority t)))) 706 '(:todo-keywords t :tags t :priority t))))
697 (org-export-preprocess-string def parameters)) 707 (org-export-preprocess-string def parameters))
698 def) 708 def)
699 inlinep) ref-table))))) 709 ;; Reference beginning position is a marker
710 ;; to preserve it during further buffer
711 ;; modifications.
712 inlinep (copy-marker pos)) ref-table)))))
700 ;; 2. Find and remove the footnote section, if any. Also 713 ;; 2. Find and remove the footnote section, if any. Also
701 ;; determine where footnotes shall be inserted (INS-POINT). 714 ;; determine where footnotes shall be inserted (INS-POINT).
702 (goto-char (point-min))
703 (cond 715 (cond
704 ((and org-footnote-section 716 ((and org-footnote-section (eq major-mode 'org-mode))
705 (eq major-mode 'org-mode) 717 (goto-char (point-min))
706 (re-search-forward 718 (if (re-search-forward
707 (concat "^\\*[ \t]+" (regexp-quote org-footnote-section) 719 (concat "^\\*[ \t]+" (regexp-quote org-footnote-section)
708 "[ \t]*$") 720 "[ \t]*$") nil t)
709 nil t)) 721 (delete-region (match-beginning 0) (org-end-of-subtree t t)))
710 (delete-region (match-beginning 0) (org-end-of-subtree t))) 722 ;; A new footnote section is inserted by default at the end of
711 ((eq major-mode 'org-mode) 723 ;; the buffer.
712 (goto-char (point-max)) 724 (goto-char (point-max))
725 (skip-chars-backward " \r\t\n")
726 (forward-line)
713 (unless (bolp) (newline))) 727 (unless (bolp) (newline)))
728 ;; No footnote section set: Footnotes will be added at the end
729 ;; of the section containing their first reference.
730 ((eq major-mode 'org-mode))
714 (t 731 (t
715 ;; Remove any left-over tag in the buffer, if one is set up. 732 ;; Remove any left-over tag in the buffer, if one is set up.
716 (when org-footnote-tag-for-non-org-mode-files 733 (when org-footnote-tag-for-non-org-mode-files
717 (let ((tag (concat "^" (regexp-quote 734 (let ((tag (concat "^" (regexp-quote
718 org-footnote-tag-for-non-org-mode-files) 735 org-footnote-tag-for-non-org-mode-files)
719 "[ \t]*$"))) 736 "[ \t]*$")))
737 (goto-char (point-min))
720 (while (re-search-forward tag nil t) 738 (while (re-search-forward tag nil t)
721 (replace-match "") 739 (replace-match "")
722 (delete-region (point) (progn (forward-line) (point)))))) 740 (delete-region (point) (progn (forward-line) (point))))))
@@ -742,18 +760,21 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
742 (lambda (x) 760 (lambda (x)
743 (cond 761 (cond
744 ;; When only sorting, ignore inline footnotes. 762 ;; When only sorting, ignore inline footnotes.
745 ((and sort-only (nth 3 x)) nil) 763 ;; Also clear position marker.
764 ((and sort-only (nth 3 x))
765 (set-marker (nth 4 x) nil) nil)
746 ;; No definition available: provide one. 766 ;; No definition available: provide one.
747 ((not (nth 2 x)) 767 ((not (nth 2 x))
748 (append (butlast x 2) 768 (append
749 (list (format "DEFINITION NOT FOUND: %s" (car x)) 769 (list (car x) (nth 1 x)
750 (nth 3 x)))) 770 (format "DEFINITION NOT FOUND: %s" (car x)))
771 (nthcdr 3 x)))
751 (t x))) 772 (t x)))
752 ref-table))) 773 ref-table)))
753 (setq ref-table (nreverse ref-table)) 774 (setq ref-table (nreverse ref-table))
754 ;; 4. Remove left-over definitions in the buffer. 775 ;; 4. Remove left-over definitions in the buffer.
755 (mapc (lambda (x) (unless (nth 3 x) 776 (mapc (lambda (x)
756 (org-footnote-delete-definitions (car x)))) 777 (unless (nth 3 x) (org-footnote-delete-definitions (car x))))
757 ref-table) 778 ref-table)
758 ;; 5. Insert the footnotes again in the buffer, at the 779 ;; 5. Insert the footnotes again in the buffer, at the
759 ;; appropriate spot. 780 ;; appropriate spot.
@@ -764,7 +785,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
764 ;; Cases when footnotes should be inserted in one place. 785 ;; Cases when footnotes should be inserted in one place.
765 ((or (not (eq major-mode 'org-mode)) 786 ((or (not (eq major-mode 'org-mode))
766 org-footnote-section 787 org-footnote-section
767 (not sort-only)) 788 export-props)
768 ;; Insert again the section title, if any. Ensure that title, 789 ;; Insert again the section title, if any. Ensure that title,
769 ;; or the subsequent footnotes, will be separated by a blank 790 ;; or the subsequent footnotes, will be separated by a blank
770 ;; lines from the rest of the document. In an Org buffer, 791 ;; lines from the rest of the document. In an Org buffer,
@@ -775,11 +796,6 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
775 (skip-chars-backward " \t\n\r") 796 (skip-chars-backward " \t\n\r")
776 (delete-region (point) ins-point) 797 (delete-region (point) ins-point)
777 (unless (bolp) (newline)) 798 (unless (bolp) (newline))
778 ;; Keep one blank line between footnotes and signature.
779 (when (and (derived-mode-p 'message-mode)
780 (save-excursion
781 (re-search-forward message-signature-separator nil t)))
782 (open-line 1))
783 (when org-footnote-tag-for-non-org-mode-files 799 (when org-footnote-tag-for-non-org-mode-files
784 (insert "\n" org-footnote-tag-for-non-org-mode-files "\n"))) 800 (insert "\n" org-footnote-tag-for-non-org-mode-files "\n")))
785 ((and org-footnote-section (not export-props)) 801 ((and org-footnote-section (not export-props))
@@ -789,31 +805,31 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
789 (insert "* " org-footnote-section "\n"))) 805 (insert "* " org-footnote-section "\n")))
790 (set-marker ins-point nil) 806 (set-marker ins-point nil)
791 ;; Insert the footnotes, separated by a blank line. 807 ;; Insert the footnotes, separated by a blank line.
792 (insert (mapconcat (lambda (x) (format "\n[%s] %s" 808 (insert
793 (nth (if sort-only 0 1) x) (nth 2 x))) 809 (mapconcat
794 ref-table "\n")) 810 (lambda (x)
795 (unless (eobp) (insert "\n")) 811 ;; Clean markers.
812 (set-marker (nth 4 x) nil)
813 (format "\n[%s] %s" (nth (if sort-only 0 1) x) (nth 2 x)))
814 ref-table "\n"))
815 (unless (eobp) (insert "\n\n"))
796 ;; When exporting, add newly inserted markers along with their 816 ;; When exporting, add newly inserted markers along with their
797 ;; associated definition to `org-export-footnotes-seen'. 817 ;; associated definition to `org-export-footnotes-seen'.
798 (when export-props 818 (when export-props (setq org-export-footnotes-seen ref-table)))
799 (setq org-export-footnotes-seen ref-table))) 819 ;; Each footnote definition has to be inserted at the end of
800 ;; Else, insert each definition at the end of the section 820 ;; the section where its first reference belongs.
801 ;; containing their first reference. Happens only in Org files 821 (t
802 ;; with no special footnote section, and only when doing 822 (mapc
803 ;; sorting. 823 (lambda (x)
804 (t (mapc 'org-insert-footnote-reference-near-definition 824 (let ((pos (nth 4 x)))
805 ref-table)))))) 825 (goto-char pos)
806 826 ;; Clean marker.
807(defun org-insert-footnote-reference-near-definition (entry) 827 (set-marker pos nil))
808 "Find first reference of footnote ENTRY and insert the definition there. 828 (org-footnote-goto-local-insertion-point)
809ENTRY is (fn-label num-mark definition)." 829 (insert (format "\n[%s] %s\n"
810 (when (car entry) 830 (if sort-only (car x) (nth 1 x))
811 (goto-char (point-min)) 831 (nth 2 x))))
812 (let ((ref (org-footnote-get-next-reference (car entry)))) 832 ref-table))))))
813 (when ref
814 (goto-char (nth 2 ref))
815 (org-footnote-goto-local-insertion-point)
816 (insert (format "\n[%s] %s\n" (car entry) (nth 2 entry)))))))
817 833
818(defun org-footnote-goto-local-insertion-point () 834(defun org-footnote-goto-local-insertion-point ()
819 "Find insertion point for footnote, just before next outline heading." 835 "Find insertion point for footnote, just before next outline heading."
@@ -848,8 +864,9 @@ Return the number of footnotes removed."
848 (ndef 0)) 864 (ndef 0))
849 (while (re-search-forward def-re nil t) 865 (while (re-search-forward def-re nil t)
850 (let ((full-def (org-footnote-at-definition-p))) 866 (let ((full-def (org-footnote-at-definition-p)))
851 (delete-region (nth 1 full-def) (nth 2 full-def))) 867 (when full-def
852 (incf ndef)) 868 (delete-region (nth 1 full-def) (nth 2 full-def))
869 (incf ndef))))
853 ndef))) 870 ndef)))
854 871
855(defun org-footnote-delete (&optional label) 872(defun org-footnote-delete (&optional label)
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 67f87797cb1..d019f3aeae6 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -334,7 +334,14 @@ current time."
334 (let ((inhibit-read-only t) l c 334 (let ((inhibit-read-only t) l c
335 (buffer-invisibility-spec '(org-link)) 335 (buffer-invisibility-spec '(org-link))
336 (moment (time-subtract (current-time) 336 (moment (time-subtract (current-time)
337 (list 0 (* 3600 org-extend-today-until) 0)))) 337 (list 0 (* 3600 org-extend-today-until) 0)))
338 disabled-overlays)
339 ;; Disable filters; this helps with alignment if there are links.
340 (mapc (lambda (ol)
341 (when (overlay-get ol 'invisible)
342 (overlay-put ol 'invisible nil)
343 (setq disabled-overlays (cons ol disabled-overlays))))
344 (overlays-in (point-min) (point-max)))
338 (save-excursion 345 (save-excursion
339 (goto-char (if line (point-at-bol) (point-min))) 346 (goto-char (if line (point-at-bol) (point-min)))
340 (while (not (eobp)) 347 (while (not (eobp))
@@ -344,14 +351,15 @@ current time."
344 (delete-char (min (+ 1 org-habit-preceding-days 351 (delete-char (min (+ 1 org-habit-preceding-days
345 org-habit-following-days) 352 org-habit-following-days)
346 (- (line-end-position) (point)))) 353 (- (line-end-position) (point))))
347 (insert (org-habit-build-graph 354 (insert-before-markers
348 habit 355 (org-habit-build-graph
349 (time-subtract moment 356 habit
350 (days-to-time org-habit-preceding-days)) 357 (time-subtract moment (days-to-time org-habit-preceding-days))
351 moment 358 moment
352 (time-add moment 359 (time-add moment (days-to-time org-habit-following-days))))))
353 (days-to-time org-habit-following-days)))))) 360 (forward-line)))
354 (forward-line))))) 361 (mapc (lambda (ol) (overlay-put ol 'invisible t))
362 disabled-overlays)))
355 363
356(defun org-habit-toggle-habits () 364(defun org-habit-toggle-habits ()
357 "Toggle display of habits in an agenda buffer." 365 "Toggle display of habits in an agenda buffer."
diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el
index 82fdd507b03..69d88fe7e76 100644
--- a/lisp/org/org-html.el
+++ b/lisp/org/org-html.el
@@ -1351,7 +1351,7 @@ PUB-DIR is set, use this as the publishing directory."
1351 ;; insert html preamble 1351 ;; insert html preamble
1352 (when (plist-get opt-plist :html-preamble) 1352 (when (plist-get opt-plist :html-preamble)
1353 (let ((html-pre (plist-get opt-plist :html-preamble)) 1353 (let ((html-pre (plist-get opt-plist :html-preamble))
1354 html-pre-real-contents) 1354 (html-pre-real-contents ""))
1355 (cond ((stringp html-pre) 1355 (cond ((stringp html-pre)
1356 (setq html-pre-real-contents 1356 (setq html-pre-real-contents
1357 (format-spec html-pre `((?t . ,title) (?a . ,author) 1357 (format-spec html-pre `((?t . ,title) (?a . ,author)
@@ -1422,7 +1422,7 @@ PUB-DIR is set, use this as the publishing directory."
1422 (if (string-match 1422 (if (string-match
1423 (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) 1423 (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt)
1424 (setq txt (replace-match 1424 (setq txt (replace-match
1425 "&nbsp;&nbsp;&nbsp;<span class=\"tag\"> \\1</span>" t nil txt))) 1425 "&nbsp;&nbsp;&nbsp;<span class=\"tag\">\\1</span>" t nil txt)))
1426 (if (string-match quote-re0 txt) 1426 (if (string-match quote-re0 txt)
1427 (setq txt (replace-match "" t t txt))) 1427 (setq txt (replace-match "" t t txt)))
1428 (setq snumber (org-section-number level)) 1428 (setq snumber (org-section-number level))
@@ -1630,7 +1630,7 @@ PUB-DIR is set, use this as the publishing directory."
1630 "done" "todo") 1630 "done" "todo")
1631 " " (org-export-html-get-todo-kwd-class-name 1631 " " (org-export-html-get-todo-kwd-class-name
1632 (match-string 2 line)) 1632 (match-string 2 line))
1633 "\"> " (match-string 2 line) 1633 "\">" (match-string 2 line)
1634 "</span>" (substring line (match-end 2))))) 1634 "</span>" (substring line (match-end 2)))))
1635 1635
1636 ;; Does this contain a reference to a footnote? 1636 ;; Does this contain a reference to a footnote?
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index ae0c91eaedf..99a75841dee 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -412,6 +412,7 @@ This function is meant to be called by `after-change-functions'."
412 (if (or org-indent-modified-headline-flag 412 (if (or org-indent-modified-headline-flag
413 (save-excursion 413 (save-excursion
414 (goto-char beg) 414 (goto-char beg)
415 (beginning-of-line)
415 (re-search-forward org-outline-regexp-bol end t))) 416 (re-search-forward org-outline-regexp-bol end t)))
416 (let ((end (save-excursion 417 (let ((end (save-excursion
417 (goto-char end) 418 (goto-char end)
diff --git a/lisp/org/org-latex.el b/lisp/org/org-latex.el
index ba7f8fd6259..4418dee73e8 100644
--- a/lisp/org/org-latex.el
+++ b/lisp/org/org-latex.el
@@ -218,6 +218,7 @@ For example, adding an entry
218will cause \\usepackage[utf8x]{inputenc} to be used for buffers that 218will cause \\usepackage[utf8x]{inputenc} to be used for buffers that
219are written as utf8 files." 219are written as utf8 files."
220 :group 'org-export-latex 220 :group 'org-export-latex
221 :version "24.1"
221 :type '(repeat 222 :type '(repeat
222 (cons 223 (cons
223 (string :tag "Derived from buffer") 224 (string :tag "Derived from buffer")
@@ -283,6 +284,7 @@ markup defined, the first one in the association list will be used."
283(defcustom org-export-latex-tag-markup "\\textbf{%s}" 284(defcustom org-export-latex-tag-markup "\\textbf{%s}"
284 "Markup for tags, as a printf format." 285 "Markup for tags, as a printf format."
285 :group 'org-export-latex 286 :group 'org-export-latex
287 :version "24.1"
286 :type 'string) 288 :type 'string)
287 289
288(defcustom org-export-latex-timestamp-markup "\\textit{%s}" 290(defcustom org-export-latex-timestamp-markup "\\textit{%s}"
@@ -293,6 +295,7 @@ markup defined, the first one in the association list will be used."
293(defcustom org-export-latex-timestamp-inactive-markup "\\textit{%s}" 295(defcustom org-export-latex-timestamp-inactive-markup "\\textit{%s}"
294 "A printf format string to be applied to inactive time stamps." 296 "A printf format string to be applied to inactive time stamps."
295 :group 'org-export-latex 297 :group 'org-export-latex
298 :version "24.1"
296 :type 'string) 299 :type 'string)
297 300
298(defcustom org-export-latex-timestamp-keyword-markup "\\texttt{%s}" 301(defcustom org-export-latex-timestamp-keyword-markup "\\texttt{%s}"
@@ -307,6 +310,7 @@ If it contains two %s instances, the first will be filled with
307the link, the second with the link description. If it contains 310the link, the second with the link description. If it contains
308only one, the %s will be filled with the link." 311only one, the %s will be filled with the link."
309 :group 'org-export-latex 312 :group 'org-export-latex
313 :version "24.1"
310 :type 'string) 314 :type 'string)
311 315
312(defcustom org-export-latex-hyperref-format "\\hyperref[%s]{%s}" 316(defcustom org-export-latex-hyperref-format "\\hyperref[%s]{%s}"
@@ -314,11 +318,13 @@ only one, the %s will be filled with the link."
314The format must contain one or two %s instances. The first one 318The format must contain one or two %s instances. The first one
315will be filled with the link, the second with its description." 319will be filled with the link, the second with its description."
316 :group 'org-export-latex 320 :group 'org-export-latex
321 :version "24.1"
317 :type 'string) 322 :type 'string)
318 323
319(defcustom org-export-latex-footnote-separator "\\textsuperscript{,}\\," 324(defcustom org-export-latex-footnote-separator "\\textsuperscript{,}\\,"
320 "Text used to separate footnotes." 325 "Text used to separate footnotes."
321 :group 'org-export-latex 326 :group 'org-export-latex
327 :version "24.1"
322 :type 'string) 328 :type 'string)
323 329
324(defcustom org-export-latex-quotes 330(defcustom org-export-latex-quotes
@@ -336,6 +342,7 @@ For each item in a CONS, the first string is a regexp
336for allowed characters before/after the quote, the second 342for allowed characters before/after the quote, the second
337string defines the replacement string for this quote." 343string defines the replacement string for this quote."
338 :group 'org-export-latex 344 :group 'org-export-latex
345 :version "24.1"
339 :type '(list 346 :type '(list
340 (cons :tag "Opening quote" 347 (cons :tag "Opening quote"
341 (string :tag "Regexp for char before") 348 (string :tag "Regexp for char before")
@@ -361,6 +368,7 @@ string defines the replacement string for this quote."
361 "When non-nil, the caption is set above the table. When nil, 368 "When non-nil, the caption is set above the table. When nil,
362the caption is set below the table." 369the caption is set below the table."
363 :group 'org-export-latex 370 :group 'org-export-latex
371 :version "24.1"
364 :type 'boolean) 372 :type 'boolean)
365 373
366(defcustom org-export-latex-tables-column-borders nil 374(defcustom org-export-latex-tables-column-borders nil
@@ -478,6 +486,7 @@ Code blocks exported with the listings package (controlled by the
478`org-export-latex-listings' variable) can be named in the style 486`org-export-latex-listings' variable) can be named in the style
479of noweb." 487of noweb."
480 :group 'org-export-latex 488 :group 'org-export-latex
489 :version "24.1"
481 :type 'boolean) 490 :type 'boolean)
482 491
483(defcustom org-export-latex-minted-langs 492(defcustom org-export-latex-minted-langs
@@ -499,6 +508,7 @@ with:
499pygmentize -L lexers 508pygmentize -L lexers
500" 509"
501 :group 'org-export-latex 510 :group 'org-export-latex
511 :version "24.1"
502 :type '(repeat 512 :type '(repeat
503 (list 513 (list
504 (symbol :tag "Major mode ") 514 (symbol :tag "Major mode ")
@@ -522,6 +532,7 @@ black keywords.
522Note that the same options will be applied to blocks of all 532Note that the same options will be applied to blocks of all
523languages." 533languages."
524 :group 'org-export-latex 534 :group 'org-export-latex
535 :version "24.1"
525 :type '(repeat 536 :type '(repeat
526 (list 537 (list
527 (string :tag "Listings option name ") 538 (string :tag "Listings option name ")
@@ -545,6 +556,7 @@ will result in src blocks being exported with
545as the start of the minted environment. Note that the same 556as the start of the minted environment. Note that the same
546options will be applied to blocks of all languages." 557options will be applied to blocks of all languages."
547 :group 'org-export-latex 558 :group 'org-export-latex
559 :version "24.1"
548 :type '(repeat 560 :type '(repeat
549 (list 561 (list
550 (string :tag "Minted option name ") 562 (string :tag "Minted option name ")
@@ -586,11 +598,13 @@ and `org-export-with-tags' instead."
586(defcustom org-latex-default-figure-position "htb" 598(defcustom org-latex-default-figure-position "htb"
587 "Default position for latex figures." 599 "Default position for latex figures."
588 :group 'org-export-latex 600 :group 'org-export-latex
601 :version "24.1"
589 :type 'string) 602 :type 'string)
590 603
591(defcustom org-export-latex-tabular-environment "tabular" 604(defcustom org-export-latex-tabular-environment "tabular"
592 "Default environment used to build tables." 605 "Default environment used to build tables."
593 :group 'org-export-latex 606 :group 'org-export-latex
607 :version "24.1"
594 :type 'string) 608 :type 'string)
595 609
596(defcustom org-export-latex-inline-image-extensions 610(defcustom org-export-latex-inline-image-extensions
@@ -657,6 +671,18 @@ This function should accept the file name as its single argument."
657 "bibtex %b" 671 "bibtex %b"
658 "pdflatex -interaction nonstopmode -output-directory %o %f" 672 "pdflatex -interaction nonstopmode -output-directory %o %f"
659 "pdflatex -interaction nonstopmode -output-directory %o %f")) 673 "pdflatex -interaction nonstopmode -output-directory %o %f"))
674 (const :tag "2 runs of xelatex"
675 ("xelatex -interaction nonstopmode -output-directory %o %f"
676 "xelatex -interaction nonstopmode -output-directory %o %f"))
677 (const :tag "3 runs of xelatex"
678 ("xelatex -interaction nonstopmode -output-directory %o %f"
679 "xelatex -interaction nonstopmode -output-directory %o %f"
680 "xelatex -interaction nonstopmode -output-directory %o %f"))
681 (const :tag "xelatex,bibtex,xelatex,xelatex"
682 ("xelatex -interaction nonstopmode -output-directory %o %f"
683 "bibtex %b"
684 "xelatex -interaction nonstopmode -output-directory %o %f"
685 "xelatex -interaction nonstopmode -output-directory %o %f"))
660 (const :tag "texi2dvi" 686 (const :tag "texi2dvi"
661 ("texi2dvi -p -b -c -V %f")) 687 ("texi2dvi -p -b -c -V %f"))
662 (const :tag "rubber" 688 (const :tag "rubber"
@@ -667,6 +693,7 @@ This function should accept the file name as its single argument."
667 '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb") 693 '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb")
668 "The list of file extensions to consider as LaTeX logfiles." 694 "The list of file extensions to consider as LaTeX logfiles."
669 :group 'org-export-pdf 695 :group 'org-export-pdf
696 :version "24.1"
670 :type '(repeat (string :tag "Extension"))) 697 :type '(repeat (string :tag "Extension")))
671 698
672(defcustom org-export-pdf-remove-logfiles t 699(defcustom org-export-pdf-remove-logfiles t
@@ -855,7 +882,7 @@ when PUB-DIR is set, use this as the publishing directory."
855 (concat 882 (concat
856 (file-name-as-directory 883 (file-name-as-directory
857 (or pub-dir 884 (or pub-dir
858 (org-export-directory :LaTeX ext-plist))) 885 (org-export-directory :LaTeX org-export-latex-options-plist)))
859 (file-name-sans-extension 886 (file-name-sans-extension
860 (or (and subtree-p 887 (or (and subtree-p
861 (org-entry-get rbeg "EXPORT_FILE_NAME" t)) 888 (org-entry-get rbeg "EXPORT_FILE_NAME" t))
@@ -870,7 +897,7 @@ when PUB-DIR is set, use this as the publishing directory."
870 (concat filename ".tex") 897 (concat filename ".tex")
871 filename))) 898 filename)))
872 (auto-insert nil); Avoid any auto-insert stuff for the new file 899 (auto-insert nil); Avoid any auto-insert stuff for the new file
873 (TeX-master t) ; Avoid the Query for TeX master from AUCTeX 900 (TeX-master (boundp 'TeX-master))
874 (buffer (if to-buffer 901 (buffer (if to-buffer
875 (cond 902 (cond
876 ((eq to-buffer 'string) (get-buffer-create 903 ((eq to-buffer 'string) (get-buffer-create
@@ -1224,7 +1251,7 @@ numbered sections and lower levels as unnumbered sections."
1224 org-export-target-aliases)))) 1251 org-export-target-aliases))))
1225 (sectioning org-export-latex-sectioning) 1252 (sectioning org-export-latex-sectioning)
1226 (depth org-export-latex-sectioning-depth) 1253 (depth org-export-latex-sectioning-depth)
1227 main-heading sub-heading) 1254 main-heading sub-heading ctnt)
1228 (when (symbolp (car sectioning)) 1255 (when (symbolp (car sectioning))
1229 (setq sectioning (funcall (car sectioning) level heading)) 1256 (setq sectioning (funcall (car sectioning) level heading))
1230 (when sectioning 1257 (when sectioning
@@ -1291,16 +1318,20 @@ numbered sections and lower levels as unnumbered sections."
1291 (delete-region (point-at-bol 0) (point)) 1318 (delete-region (point-at-bol 0) (point))
1292 (insert (format "\\begin{%s}\n" 1319 (insert (format "\\begin{%s}\n"
1293 (symbol-name org-export-latex-low-levels)))) 1320 (symbol-name org-export-latex-low-levels))))
1294 (insert (format "\n\\item %s\\\\\n%s%%" 1321 (let ((ctnt (org-export-latex-content content)))
1295 heading 1322 (insert (format (if (not (equal (replace-regexp-in-string "\n" "" ctnt) ""))
1296 (if label (format "\\label{%s}" label) ""))) 1323 "\n\\item %s\\\\\n%s%%"
1297 (insert (org-export-latex-content content)) 1324 "\n\\item %s\n%s%%")
1325 heading
1326 (if label (format "\\label{%s}" label) "")))
1327 (insert ctnt))
1298 (cond ((stringp subcontent) (insert subcontent)) 1328 (cond ((stringp subcontent) (insert subcontent))
1299 ((listp subcontent) (org-export-latex-sub subcontent))) 1329 ((listp subcontent) (org-export-latex-sub subcontent)))
1300 (insert (format "\\end{%s} %% ends low level\n" 1330 (insert (format "\\end{%s} %% ends low level\n"
1301 (symbol-name org-export-latex-low-levels)))) 1331 (symbol-name org-export-latex-low-levels))))
1302 1332
1303 ((listp org-export-latex-low-levels) 1333 ((and (listp org-export-latex-low-levels)
1334 org-export-latex-low-levels)
1304 (if (string-match "% ends low level$" 1335 (if (string-match "% ends low level$"
1305 (buffer-substring (point-at-bol 0) (point))) 1336 (buffer-substring (point-at-bol 0) (point)))
1306 (delete-region (point-at-bol 0) (point)) 1337 (delete-region (point-at-bol 0) (point))
@@ -1902,10 +1933,14 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1902 'org-label raw-table) 1933 'org-label raw-table)
1903 longtblp (and attr (stringp attr) 1934 longtblp (and attr (stringp attr)
1904 (string-match "\\<longtable\\>" attr)) 1935 (string-match "\\<longtable\\>" attr))
1905 tblenv (if (and attr (stringp attr) 1936 tblenv (if (and attr (stringp attr))
1906 (or (string-match (regexp-quote "table*") attr) 1937 (cond ((string-match "\\<sidewaystable\\>" attr)
1907 (string-match "\\<multicolumn\\>" attr))) 1938 "sidewaystable")
1908 "table*" "table") 1939 ((or (string-match (regexp-quote "table*") attr)
1940 (string-match "\\<multicolumn\\>" attr))
1941 "table*")
1942 (t "table"))
1943 "table")
1909 tabular-env 1944 tabular-env
1910 (if (and attr (stringp attr) 1945 (if (and attr (stringp attr)
1911 (string-match "\\(tabular.\\)" attr)) 1946 (string-match "\\(tabular.\\)" attr))
@@ -1988,7 +2023,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
1988 (if shortn (concat "[" shortn "]") "") 2023 (if shortn (concat "[" shortn "]") "")
1989 (or caption "") 2024 (or caption "")
1990 (if label (format "\\label{%s}" label) ""))) 2025 (if label (format "\\label{%s}" label) "")))
1991 (if (and longtblp caption) "\\\\\n" "\n") 2026 (if (and longtblp caption org-export-latex-table-caption-above)
2027 "\\\\\n" "\n")
1992 (if (and org-export-latex-tables-centered (not longtblp)) 2028 (if (and org-export-latex-tables-centered (not longtblp))
1993 "\\begin{center}\n") 2029 "\\begin{center}\n")
1994 (if (not longtblp) 2030 (if (not longtblp)
@@ -2572,9 +2608,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
2572 "Convert plain text lists in current buffer into LaTeX lists." 2608 "Convert plain text lists in current buffer into LaTeX lists."
2573 ;; `org-list-end-re' output has changed since preprocess from 2609 ;; `org-list-end-re' output has changed since preprocess from
2574 ;; org-exp.el. Make sure it is taken into account. 2610 ;; org-exp.el. Make sure it is taken into account.
2575 (let ((org-list-ending-method 2611 (let ((org-list-end-re "^ORG-LIST-END-MARKER\n"))
2576 (if (eq org-list-ending-method 'regexp) 'regexp 'both))
2577 (org-list-end-re "^ORG-LIST-END-MARKER\n"))
2578 (mapc 2612 (mapc
2579 (lambda (e) 2613 (lambda (e)
2580 ;; For each type of context allowed for list export (E), find 2614 ;; For each type of context allowed for list export (E), find
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index da8a810895c..2caecff275f 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -207,7 +207,7 @@ Valid values are ?. and ?\). To get both terminators, use t."
207 :group 'org-plain-lists 207 :group 'org-plain-lists
208 :type '(choice (const :tag "dot like in \"2.\"" ?.) 208 :type '(choice (const :tag "dot like in \"2.\"" ?.)
209 (const :tag "paren like in \"2)\"" ?\)) 209 (const :tag "paren like in \"2)\"" ?\))
210 (const :tab "both" t))) 210 (const :tag "both" t)))
211 211
212(defcustom org-alphabetical-lists nil 212(defcustom org-alphabetical-lists nil
213 "Non-nil means single character alphabetical bullets are allowed. 213 "Non-nil means single character alphabetical bullets are allowed.
@@ -229,42 +229,12 @@ spaces instead of one after the bullet in each item of the list."
229 (const :tag "never" nil) 229 (const :tag "never" nil)
230 (regexp))) 230 (regexp)))
231 231
232(defcustom org-list-ending-method 'both
233 "Determine where plain lists should end.
234Valid values are: `regexp', `indent' or `both'.
235
236When set to `regexp', Org will look into two variables,
237`org-empty-line-terminates-plain-lists' and the more general
238`org-list-end-regexp', to determine what will end lists.
239
240When set to `indent', a list will end whenever a line following
241an item, but not starting one, is less or equally indented than
242the first item of the list.
243
244When set to `both', each of the preceding methods is applied to
245determine lists endings. This is the default method."
246 :group 'org-plain-lists
247 :type '(choice
248 (const :tag "With a regexp defining ending" regexp)
249 (const :tag "With indentation of regular (no bullet) text" indent)
250 (const :tag "With both methods" both)))
251
252(defcustom org-empty-line-terminates-plain-lists nil 232(defcustom org-empty-line-terminates-plain-lists nil
253 "Non-nil means an empty line ends all plain list levels. 233 "Non-nil means an empty line ends all plain list levels.
254This variable only makes sense if `org-list-ending-method' is set 234Otherwise, two of them will be necessary."
255to `regexp' or `both'. This is then equivalent to set
256`org-list-end-regexp' to \"^[ \\t]*$\"."
257 :group 'org-plain-lists 235 :group 'org-plain-lists
258 :type 'boolean) 236 :type 'boolean)
259 237
260(defcustom org-list-end-regexp "^[ \t]*\n[ \t]*\n"
261 "Regexp matching the end of all plain list levels.
262It must start with \"^\" and end with \"\\n\". It defaults to 2
263blank lines. `org-empty-line-terminates-plain-lists' has
264precedence over it."
265 :group 'org-plain-lists
266 :type 'string)
267
268(defcustom org-list-automatic-rules '((bullet . t) 238(defcustom org-list-automatic-rules '((bullet . t)
269 (checkbox . t) 239 (checkbox . t)
270 (indent . t)) 240 (indent . t))
@@ -381,9 +351,8 @@ specifically, type `block' is determined by the variable
381 351
382;;; Predicates and regexps 352;;; Predicates and regexps
383 353
384(defconst org-list-end-re (if org-empty-line-terminates-plain-lists 354(defconst org-list-end-re (if org-empty-line-terminates-plain-lists "^[ \t]*\n"
385 "^[ \t]*\n" 355 "^[ \t]*\n[ \t]*\n")
386 org-list-end-regexp)
387 "Regex corresponding to the end of a list. 356 "Regex corresponding to the end of a list.
388It depends on `org-empty-line-terminates-plain-lists'.") 357It depends on `org-empty-line-terminates-plain-lists'.")
389 358
@@ -432,8 +401,7 @@ group 4: description tag")
432 (not (org-in-block-p org-list-forbidden-blocks))) 401 (not (org-in-block-p org-list-forbidden-blocks)))
433 402
434(defun org-in-item-p () 403(defun org-in-item-p ()
435 "Return item beginning position when in a plain list, nil otherwise. 404 "Return item beginning position when in a plain list, nil otherwise."
436This checks `org-list-ending-method'."
437 (save-excursion 405 (save-excursion
438 (beginning-of-line) 406 (beginning-of-line)
439 (let* ((case-fold-search t) 407 (let* ((case-fold-search t)
@@ -460,8 +428,7 @@ This checks `org-list-ending-method'."
460 ;; to compute its boundaries END-BOUNDS. When point is 428 ;; to compute its boundaries END-BOUNDS. When point is
461 ;; in-between, move cursor before regexp beginning. 429 ;; in-between, move cursor before regexp beginning.
462 (let ((hl 0) (i -1) end-bounds) 430 (let ((hl 0) (i -1) end-bounds)
463 (when (and (not (eq org-list-ending-method 'indent)) 431 (when (and (progn
464 (progn
465 (while (setq i (string-match 432 (while (setq i (string-match
466 "[\r\n]" org-list-end-re (1+ i))) 433 "[\r\n]" org-list-end-re (1+ i)))
467 (setq hl (1+ hl))) 434 (setq hl (1+ hl)))
@@ -470,23 +437,18 @@ This checks `org-list-ending-method'."
470 (< (point) (cdr end-bounds))) 437 (< (point) (cdr end-bounds)))
471 (goto-char (car end-bounds)) 438 (goto-char (car end-bounds))
472 (forward-line -1))) 439 (forward-line -1)))
473 ;; Look for an item, less indented that reference line if 440 ;; Look for an item, less indented that reference line.
474 ;; `org-list-ending-method' isn't `regexp'.
475 (catch 'exit 441 (catch 'exit
476 (while t 442 (while t
477 (let ((ind (org-get-indentation))) 443 (let ((ind (org-get-indentation)))
478 (cond 444 (cond
479 ;; This is exactly what we want. 445 ;; This is exactly what we want.
480 ((and (looking-at item-re) 446 ((and (looking-at item-re) (< ind ind-ref))
481 (or (< ind ind-ref)
482 (eq org-list-ending-method 'regexp)))
483 (throw 'exit (point))) 447 (throw 'exit (point)))
484 ;; At upper bound of search or looking at the end of a 448 ;; At upper bound of search or looking at the end of a
485 ;; previous list: search is over. 449 ;; previous list: search is over.
486 ((<= (point) lim-up) (throw 'exit nil)) 450 ((<= (point) lim-up) (throw 'exit nil))
487 ((and (not (eq org-list-ending-method 'indent)) 451 ((looking-at org-list-end-re) (throw 'exit nil))
488 (looking-at org-list-end-re))
489 (throw 'exit nil))
490 ;; Skip blocks, drawers, inline-tasks, blank lines 452 ;; Skip blocks, drawers, inline-tasks, blank lines
491 ((and (looking-at "^[ \t]*#\\+end_") 453 ((and (looking-at "^[ \t]*#\\+end_")
492 (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) 454 (re-search-backward "^[ \t]*#\\+begin_" lim-up t)))
@@ -703,8 +665,7 @@ Assume point is at an item."
703 (forward-line -1)) 665 (forward-line -1))
704 ;; Looking at a list ending regexp. Dismiss useless 666 ;; Looking at a list ending regexp. Dismiss useless
705 ;; data recorded above BEG-CELL. Jump to part 2. 667 ;; data recorded above BEG-CELL. Jump to part 2.
706 ((and (not (eq org-list-ending-method 'indent)) 668 ((looking-at org-list-end-re)
707 (looking-at org-list-end-re))
708 (throw 'exit 669 (throw 'exit
709 (setq itm-lst 670 (setq itm-lst
710 (memq (assq (car beg-cell) itm-lst) itm-lst)))) 671 (memq (assq (car beg-cell) itm-lst) itm-lst))))
@@ -716,10 +677,7 @@ Assume point is at an item."
716 ((looking-at item-re) 677 ((looking-at item-re)
717 (push (funcall assoc-at-point ind) itm-lst) 678 (push (funcall assoc-at-point ind) itm-lst)
718 (push (cons ind (point)) end-lst) 679 (push (cons ind (point)) end-lst)
719 (when (or (and (eq org-list-ending-method 'regexp) 680 (when (< ind text-min-ind) (setq beg-cell (cons (point) ind)))
720 (<= ind (cdr beg-cell)))
721 (< ind text-min-ind))
722 (setq beg-cell (cons (point) ind)))
723 (forward-line -1)) 681 (forward-line -1))
724 ;; Skip blocks, drawers, inline tasks, blank lines. 682 ;; Skip blocks, drawers, inline tasks, blank lines.
725 ((and (looking-at "^[ \t]*#\\+end_") 683 ((and (looking-at "^[ \t]*#\\+end_")
@@ -732,14 +690,13 @@ Assume point is at an item."
732 (forward-line -1)) 690 (forward-line -1))
733 ((looking-at "^[ \t]*$") 691 ((looking-at "^[ \t]*$")
734 (forward-line -1)) 692 (forward-line -1))
735 ;; From there, point is not at an item. Unless ending 693 ;; From there, point is not at an item. Interpret
736 ;; method is `regexp', interpret line's indentation: 694 ;; line's indentation:
737 ;; - text at column 0 is necessarily out of any list. 695 ;; - text at column 0 is necessarily out of any list.
738 ;; Dismiss data recorded above BEG-CELL. Jump to 696 ;; Dismiss data recorded above BEG-CELL. Jump to
739 ;; part 2. 697 ;; part 2.
740 ;; - any other case may be an ending position for an 698 ;; - any other case may be an ending position for an
741 ;; hypothetical item above. Store it and proceed. 699 ;; hypothetical item above. Store it and proceed.
742 ((eq org-list-ending-method 'regexp) (forward-line -1))
743 ((zerop ind) 700 ((zerop ind)
744 (throw 'exit 701 (throw 'exit
745 (setq itm-lst 702 (setq itm-lst
@@ -771,8 +728,7 @@ Assume point is at an item."
771 (next-single-property-change (point) 'org-example nil lim-down))) 728 (next-single-property-change (point) 'org-example nil lim-down)))
772 ;; Looking at a list ending regexp. Save point as an 729 ;; Looking at a list ending regexp. Save point as an
773 ;; ending position and jump to part 3. 730 ;; ending position and jump to part 3.
774 ((and (not (eq org-list-ending-method 'indent)) 731 ((looking-at org-list-end-re)
775 (looking-at org-list-end-re))
776 (throw 'exit (push (cons 0 (point)) end-lst-2))) 732 (throw 'exit (push (cons 0 (point)) end-lst-2)))
777 ((looking-at item-re) 733 ((looking-at item-re)
778 ;; Point is at an item. Add data to ITM-LST-2. It may 734 ;; Point is at an item. Add data to ITM-LST-2. It may
@@ -788,16 +744,14 @@ Assume point is at an item."
788 ;; Ind is lesser or equal than BEG-CELL's. The list is 744 ;; Ind is lesser or equal than BEG-CELL's. The list is
789 ;; over: store point as an ending position and jump to 745 ;; over: store point as an ending position and jump to
790 ;; part 3. 746 ;; part 3.
791 ((and (not (eq org-list-ending-method 'regexp)) 747 ((<= ind (cdr beg-cell))
792 (<= ind (cdr beg-cell)))
793 (throw 'exit 748 (throw 'exit
794 (push (cons 0 (funcall end-before-blank)) end-lst-2))) 749 (push (cons 0 (funcall end-before-blank)) end-lst-2)))
795 ;; Else, if ind is lesser or equal than previous item's, 750 ;; Else, if ind is lesser or equal than previous item's,
796 ;; this is an ending position: store it. In any case, 751 ;; this is an ending position: store it. In any case,
797 ;; skip block or drawer at point, and move to next line. 752 ;; skip block or drawer at point, and move to next line.
798 (t 753 (t
799 (when (and (not (eq org-list-ending-method 'regexp)) 754 (when (<= ind (nth 1 (car itm-lst-2)))
800 (<= ind (nth 1 (car itm-lst-2))))
801 (push (cons ind (point)) end-lst-2)) 755 (push (cons ind (point)) end-lst-2))
802 (cond 756 (cond
803 ((and (looking-at "^[ \t]*#\\+begin_") 757 ((and (looking-at "^[ \t]*#\\+begin_")
@@ -1192,9 +1146,7 @@ some heuristics to guess the result."
1192 (point)))))))) 1146 (point))))))))
1193 (cond 1147 (cond
1194 ;; Trivial cases where there should be none. 1148 ;; Trivial cases where there should be none.
1195 ((or (and (not (eq org-list-ending-method 'indent)) 1149 ((or org-empty-line-terminates-plain-lists (not insert-blank-p)) 0)
1196 org-empty-line-terminates-plain-lists)
1197 (not insert-blank-p)) 0)
1198 ;; When `org-blank-before-new-entry' says so, it is 1. 1150 ;; When `org-blank-before-new-entry' says so, it is 1.
1199 ((eq insert-blank-p t) 1) 1151 ((eq insert-blank-p t) 1)
1200 ;; `plain-list-item' is 'auto. Count blank lines separating 1152 ;; `plain-list-item' is 'auto. Count blank lines separating
@@ -2929,9 +2881,7 @@ Point is left at list end."
2929 (goto-char top) 2881 (goto-char top)
2930 (when delete 2882 (when delete
2931 (delete-region top bottom) 2883 (delete-region top bottom)
2932 (when (and (not (eq org-list-ending-method 'indent)) 2884 (when (and (not (looking-at "[ \t]*$")) (looking-at org-list-end-re))
2933 (not (looking-at "[ \t]*$"))
2934 (looking-at org-list-end-re))
2935 (replace-match ""))) 2885 (replace-match "")))
2936 out)) 2886 out))
2937 2887
diff --git a/lisp/org/org-lparse.el b/lisp/org/org-lparse.el
index 229135e9b50..c9669dd8ab4 100644
--- a/lisp/org/org-lparse.el
+++ b/lisp/org/org-lparse.el
@@ -484,37 +484,33 @@ This is a helper routine for interactive use."
484 (error "Cannot convert from %s format to %s format?" 484 (error "Cannot convert from %s format to %s format?"
485 in-fmt out-fmt))) 485 in-fmt out-fmt)))
486 (convert-process (car how)) 486 (convert-process (car how))
487 (program (car convert-process))
488 (dummy (and (or program (error "Converter not configured"))
489 (or (executable-find program)
490 (error "Cannot find converter %s" program))))
491 (out-file (concat (file-name-sans-extension in-file) "." 487 (out-file (concat (file-name-sans-extension in-file) "."
492 (nth 1 (or (cdr how) out-fmt)))) 488 (nth 1 (or (cdr how) out-fmt))))
489 (extra-options (or (nth 2 (cdr how)) ""))
493 (out-dir (file-name-directory in-file)) 490 (out-dir (file-name-directory in-file))
494 (arglist (mapcar (lambda (arg) 491 (cmd (format-spec convert-process
495 (format-spec 492 `((?i . ,(shell-quote-argument in-file))
496 arg `((?i . ,in-file) 493 (?I . ,(browse-url-file-url in-file))
497 (?I . ,(browse-url-file-url in-file)) 494 (?f . ,out-fmt)
498 (?f . ,out-fmt) 495 (?o . ,out-file)
499 (?o . ,out-file) 496 (?O . ,(browse-url-file-url out-file))
500 (?O . ,(browse-url-file-url out-file)) 497 (?d . , (shell-quote-argument out-dir))
501 (?d . ,out-dir) 498 (?D . ,(browse-url-file-url out-dir))
502 (?D . ,(browse-url-file-url out-dir))))) 499 (?x . ,extra-options)))))
503 (cdr convert-process))))
504 (when (file-exists-p out-file) 500 (when (file-exists-p out-file)
505 (delete-file out-file)) 501 (delete-file out-file))
506 502
507 (message "Executing %s %s" program (mapconcat 'identity arglist " ")) 503 (message "Executing %s" cmd)
508 (apply 'call-process program nil nil nil arglist) 504 (let ((cmd-output (shell-command-to-string cmd)))
505 (message "%s" cmd-output))
506
509 (cond 507 (cond
510 ((file-exists-p out-file) 508 ((file-exists-p out-file)
511 (message "Exported to %s using %s" out-file program) 509 (message "Exported to %s" out-file)
512 (when prefix-arg 510 (when prefix-arg
513 (message "Opening %s..." out-file) 511 (message "Opening %s..." out-file)
514 (org-open-file out-file)) 512 (org-open-file out-file))
515 out-file 513 out-file)
516 ;; (set-buffer (find-file-noselect out-file))
517 )
518 (t 514 (t
519 (message "Export to %s failed" out-file) 515 (message "Export to %s failed" out-file)
520 nil)))) 516 nil))))
@@ -598,11 +594,7 @@ version."
598 (org-lparse-par-open-stashed 0) 594 (org-lparse-par-open-stashed 0)
599 595
600 ;; list related vars 596 ;; list related vars
601 (org-lparse-list-level 0) ; list level starts at 1. A 597 (org-lparse-list-stack '())
602 ; value of 0 implies we are
603 ; outside of any list
604 (org-lparse-list-item-count 0)
605 org-lparse-list-stack
606 598
607 ;; list-table related vars 599 ;; list-table related vars
608 org-lparse-list-table-p 600 org-lparse-list-table-p
@@ -817,6 +809,8 @@ version."
817 (setq umax-toc (if (integerp org-export-with-toc) 809 (setq umax-toc (if (integerp org-export-with-toc)
818 (min org-export-with-toc umax) 810 (min org-export-with-toc umax)
819 umax)) 811 umax))
812 (setq org-lparse-opt-plist
813 (plist-put org-lparse-opt-plist :headline-levels umax))
820 814
821 (when (and org-export-with-toc (not body-only)) 815 (when (and org-export-with-toc (not body-only))
822 (setq lines (org-lparse-prepare-toc 816 (setq lines (org-lparse-prepare-toc
@@ -853,48 +847,6 @@ version."
853 (org-lparse-end-environment 'fixedwidth)) 847 (org-lparse-end-environment 'fixedwidth))
854 (throw 'nextline nil)) 848 (throw 'nextline nil))
855 849
856 ;; Notes: The baseline version of org-html.el (git commit
857 ;; 3d802e), while encountering a *line-long* protected text,
858 ;; does one of the following two things based on the state
859 ;; of the export buffer.
860
861 ;; 1. If a paragraph element has just been opened and
862 ;; contains only whitespace as content, insert the
863 ;; protected text as part of the previous paragraph.
864
865 ;; 2. If the paragraph element has already been opened and
866 ;; contains some valid content insert the protected text
867 ;; as part of the current paragraph.
868
869 ;; I think --->
870
871 ;; Scenario 1 mentioned above kicks in when a block of
872 ;; protected text has to be inserted en bloc. For example,
873 ;; this happens, when inserting an source or example block
874 ;; or preformatted content enclosed in #+backend,
875 ;; #+begin_backend ... #+end_backend)
876
877 ;; Scenario 2 mentioned above kicks in when the protected
878 ;; text is part of a running sentence. For example this
879 ;; happens in the case of an *multiline* LaTeX equation that
880 ;; needs to be inserted verbatim.
881
882 ;; org-html.el in the master branch seems to do some
883 ;; jugglery by moving paragraphs around. Inorder to make
884 ;; these changes backend-agnostic introduce a new text
885 ;; property org-native-text and impose the added semantics
886 ;; that these protected blocks appear outside of a
887 ;; conventional paragraph element.
888 ;;
889 ;; Extra Note: Check whether org-example and org-native-text
890 ;; are entirely equivalent.
891
892 ;; Fixes bug reported by Christian Moe concerning verbatim
893 ;; LaTeX fragments.
894 ;; on git commit 533ba3f90250a1f25f494c390d639ea6274f235c
895 ;; http://repo.or.cz/w/org-mode/org-jambu.git/shortlog/refs/heads/staging
896 ;; See http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01379.html
897
898 ;; Native Text 850 ;; Native Text
899 (when (and (get-text-property 0 'org-native-text line) 851 (when (and (get-text-property 0 'org-native-text line)
900 ;; Make sure it is the entire line that is protected 852 ;; Make sure it is the entire line that is protected
@@ -1081,10 +1033,11 @@ version."
1081 table-buffer (nreverse table-buffer) 1033 table-buffer (nreverse table-buffer)
1082 table-orig-buffer (nreverse table-orig-buffer)) 1034 table-orig-buffer (nreverse table-orig-buffer))
1083 (org-lparse-end-paragraph) 1035 (org-lparse-end-paragraph)
1036 (when org-lparse-list-table-p
1037 (error "Regular tables are not allowed in a list-table block"))
1084 (org-lparse-insert 'TABLE table-buffer table-orig-buffer))) 1038 (org-lparse-insert 'TABLE table-buffer table-orig-buffer)))
1085 1039
1086 ;; Normal lines 1040 ;; Normal lines
1087
1088 (t 1041 (t
1089 ;; This line either is list item or end a list. 1042 ;; This line either is list item or end a list.
1090 (when (get-text-property 0 'list-item line) 1043 (when (get-text-property 0 'list-item line)
@@ -1820,6 +1773,12 @@ Stripping happens only when the exported backend is not one of
1820 (org-lparse-end 'FOOTNOTE-DEFINITION n) 1773 (org-lparse-end 'FOOTNOTE-DEFINITION n)
1821 (setq org-lparse-insert-tag-with-newlines 'both) 1774 (setq org-lparse-insert-tag-with-newlines 'both)
1822 (let ((footnote-def (org-lparse-end-collect))) 1775 (let ((footnote-def (org-lparse-end-collect)))
1776 ;; Cleanup newlines in footnote definition. This ensures that a
1777 ;; transcoded line is never (wrongly) broken in to multiple lines.
1778 (let ((pos 0))
1779 (while (string-match "[\r\n]+" footnote-def pos)
1780 (setq pos (1+ (match-beginning 0)))
1781 (setq footnote-def (replace-match " " t t footnote-def))))
1823 (push (cons n footnote-def) org-lparse-footnote-definitions))) 1782 (push (cons n footnote-def) org-lparse-footnote-definitions)))
1824 1783
1825(defvar org-lparse-collect-buffer nil 1784(defvar org-lparse-collect-buffer nil
@@ -2104,8 +2063,6 @@ When TITLE is nil, just close all open levels."
2104 ("d" . description))))) 2063 ("d" . description)))))
2105 2064
2106;; following vars are bound during `org-do-lparse' 2065;; following vars are bound during `org-do-lparse'
2107(defvar org-lparse-list-level)
2108(defvar org-lparse-list-item-count)
2109(defvar org-lparse-list-stack) 2066(defvar org-lparse-list-stack)
2110(defvar org-lparse-list-table:table-row) 2067(defvar org-lparse-list-table:table-row)
2111(defvar org-lparse-list-table:lines) 2068(defvar org-lparse-list-table:lines)
@@ -2147,73 +2104,69 @@ When TITLE is nil, just close all open levels."
2147;; https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01101.html 2104;; https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01101.html
2148 2105
2149(defun org-lparse-begin-list (ltype) 2106(defun org-lparse-begin-list (ltype)
2150 (incf org-lparse-list-level) 2107 (push ltype org-lparse-list-stack)
2151 (push org-lparse-list-item-count org-lparse-list-stack) 2108 (let ((list-level (length org-lparse-list-stack)))
2152 (setq org-lparse-list-item-count 0) 2109 (cond
2153 (cond 2110 ((not org-lparse-list-table-p)
2154 ((not org-lparse-list-table-p) 2111 (org-lparse-begin 'LIST ltype))
2155 (org-lparse-begin 'LIST ltype)) 2112 ;; process LIST-TABLE
2156 ;; process LIST-TABLE 2113 ((= 1 list-level)
2157 ((= 1 org-lparse-list-level) 2114 ;; begin LIST-TABLE
2158 ;; begin LIST-TABLE 2115 (setq org-lparse-list-table:lines nil)
2159 (setq org-lparse-list-table:lines nil) 2116 (setq org-lparse-list-table:table-row nil))
2160 (setq org-lparse-list-table:table-row nil)) 2117 ((= 2 list-level)
2161 ((= 2 org-lparse-list-level) 2118 (ignore))
2162 (ignore)) 2119 (t
2163 (t 2120 (org-lparse-begin 'LIST ltype)))))
2164 (org-lparse-begin 'LIST ltype))))
2165 2121
2166(defun org-lparse-end-list (ltype) 2122(defun org-lparse-end-list (ltype)
2167 (setq org-lparse-list-item-count (pop org-lparse-list-stack)) 2123 (pop org-lparse-list-stack)
2168 (decf org-lparse-list-level) 2124 (let ((list-level (length org-lparse-list-stack)))
2169 (cond 2125 (cond
2170 ((not org-lparse-list-table-p) 2126 ((not org-lparse-list-table-p)
2171 (org-lparse-end 'LIST ltype)) 2127 (org-lparse-end 'LIST ltype))
2172 ;; process LIST-TABLE 2128 ;; process LIST-TABLE
2173 ((= 0 org-lparse-list-level) 2129 ((= 0 list-level)
2174 ;; end LIST-TABLE 2130 ;; end LIST-TABLE
2175 (insert (org-lparse-format-list-table 2131 (insert (org-lparse-format-list-table
2176 (nreverse org-lparse-list-table:lines)))) 2132 (nreverse org-lparse-list-table:lines))))
2177 ((= 1 org-lparse-list-level) 2133 ((= 1 list-level)
2178 (ignore)) 2134 (ignore))
2179 (t 2135 (t
2180 (org-lparse-end 'LIST ltype)))) 2136 (org-lparse-end 'LIST ltype)))))
2181 2137
2182(defun org-lparse-begin-list-item (ltype &optional arg headline) 2138(defun org-lparse-begin-list-item (ltype &optional arg headline)
2183 (incf org-lparse-list-item-count) 2139 (let ((list-level (length org-lparse-list-stack)))
2184 (cond 2140 (cond
2185 ((not org-lparse-list-table-p) 2141 ((not org-lparse-list-table-p)
2186 (org-lparse-begin 'LIST-ITEM ltype arg headline)) 2142 (org-lparse-begin 'LIST-ITEM ltype arg headline))
2187 ;; process LIST-TABLE 2143 ;; process LIST-TABLE
2188 ((and (= 1 org-lparse-list-level) 2144 ((= 1 list-level)
2189 (= 1 org-lparse-list-item-count)) 2145 ;; begin TABLE-ROW for LIST-TABLE
2190 ;; begin TABLE-ROW for LIST-TABLE 2146 (setq org-lparse-list-table:table-row nil)
2191 (setq org-lparse-list-table:table-row nil) 2147 (org-lparse-begin-list-table:table-cell))
2192 (org-lparse-begin-list-table:table-cell)) 2148 ((= 2 list-level)
2193 ((and (= 2 org-lparse-list-level) 2149 ;; begin TABLE-CELL for LIST-TABLE
2194 (= 1 org-lparse-list-item-count)) 2150 (org-lparse-begin-list-table:table-cell))
2195 ;; begin TABLE-CELL for LIST-TABLE 2151 (t
2196 (org-lparse-begin-list-table:table-cell)) 2152 (org-lparse-begin 'LIST-ITEM ltype arg headline)))))
2197 (t
2198 (org-lparse-begin 'LIST-ITEM ltype arg headline))))
2199 2153
2200(defun org-lparse-end-list-item (ltype) 2154(defun org-lparse-end-list-item (ltype)
2201 (decf org-lparse-list-item-count) 2155 (let ((list-level (length org-lparse-list-stack)))
2202 (cond 2156 (cond
2203 ((not org-lparse-list-table-p) 2157 ((not org-lparse-list-table-p)
2204 (org-lparse-end 'LIST-ITEM ltype)) 2158 (org-lparse-end 'LIST-ITEM ltype))
2205 ;; process LIST-TABLE 2159 ;; process LIST-TABLE
2206 ((and (= 1 org-lparse-list-level) 2160 ((= 1 list-level)
2207 (= 0 org-lparse-list-item-count)) 2161 ;; end TABLE-ROW for LIST-TABLE
2208 ;; end TABLE-ROW for LIST-TABLE 2162 (org-lparse-end-list-table:table-cell)
2209 (org-lparse-end-list-table:table-cell) 2163 (push (nreverse org-lparse-list-table:table-row)
2210 (push (nreverse org-lparse-list-table:table-row) 2164 org-lparse-list-table:lines))
2211 org-lparse-list-table:lines)) 2165 ((= 2 list-level)
2212 ((= 2 org-lparse-list-level) 2166 ;; end TABLE-CELL for LIST-TABLE
2213 ;; end TABLE-CELL for LIST-TABLE 2167 (org-lparse-end-list-table:table-cell))
2214 (org-lparse-end-list-table:table-cell)) 2168 (t
2215 (t 2169 (org-lparse-end 'LIST-ITEM ltype)))))
2216 (org-lparse-end 'LIST-ITEM ltype))))
2217 2170
2218(defvar org-lparse-list-table:table-cell-open) 2171(defvar org-lparse-list-table:table-cell-open)
2219(defun org-lparse-begin-list-table:table-cell () 2172(defun org-lparse-begin-list-table:table-cell ()
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index b1d9f22a4e0..5a87bd64697 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -315,11 +315,11 @@ nor a function, elements of KEYWORDS are used directly."
315 (replace-match "") 315 (replace-match "")
316 (just-one-space)) 316 (just-one-space))
317 317
318(defvar rest) 318(defvar org-mouse-rest)
319(defun org-mouse-replace-match-and-surround (newtext &optional fixedcase 319(defun org-mouse-replace-match-and-surround (newtext &optional fixedcase
320 literal string subexp) 320 literal string subexp)
321 "The same as `replace-match', but surrounds the replacement with spaces." 321 "The same as `replace-match', but surrounds the replacement with spaces."
322 (apply 'replace-match rest) 322 (apply 'replace-match org-mouse-rest)
323 (save-excursion 323 (save-excursion
324 (goto-char (match-beginning (or subexp 0))) 324 (goto-char (match-beginning (or subexp 0)))
325 (just-one-space) 325 (just-one-space)
@@ -990,7 +990,7 @@ This means, between the beginning of line and the point."
990 (replace-match replace-text)) 990 (replace-match replace-text))
991 (forward-line)))) 991 (forward-line))))
992 992
993(defvar _cmd) ;dynamically scoped from `org-with-remote-undo'. 993(defvar org-mouse-cmd) ;dynamically scoped from `org-with-remote-undo'.
994 994
995(defun org-mouse-do-remotely (command) 995(defun org-mouse-do-remotely (command)
996; (org-agenda-check-no-diary) 996; (org-agenda-check-no-diary)
@@ -1021,7 +1021,7 @@ This means, between the beginning of line and the point."
1021 (setq marker (copy-marker (point))) 1021 (setq marker (copy-marker (point)))
1022 (goto-char (max (point-at-bol) (- (point-at-eol) anticol))) 1022 (goto-char (max (point-at-bol) (- (point-at-eol) anticol)))
1023 (funcall command) 1023 (funcall command)
1024 (message "_cmd: %S" _cmd) 1024 (message "_cmd: %S" org-mouse-cmd)
1025 (message "this-command: %S" this-command) 1025 (message "this-command: %S" this-command)
1026 (unless (eq (marker-position marker) (marker-position endmarker)) 1026 (unless (eq (marker-position marker) (marker-position endmarker))
1027 (setq newhead (org-get-heading)))) 1027 (setq newhead (org-get-heading))))
diff --git a/lisp/org/org-odt.el b/lisp/org/org-odt.el
index c8fa7ea363b..234272a378d 100644
--- a/lisp/org/org-odt.el
+++ b/lisp/org/org-odt.el
@@ -1,4 +1,4 @@
1;;; org-odt.el --- OpenDocumentText export for Org-mode 1;;; org-odt.el --- OpenDocument Text exporter for Org-mode
2 2
3;; Copyright (C) 2010-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
4 4
@@ -31,9 +31,23 @@
31(defgroup org-export-odt nil 31(defgroup org-export-odt nil
32 "Options specific for ODT export of Org-mode files." 32 "Options specific for ODT export of Org-mode files."
33 :tag "Org Export ODT" 33 :tag "Org Export ODT"
34 :group 'org-export) 34 :group 'org-export
35 :version "24.1")
36
37(defvar org-lparse-dyn-first-heading-pos) ; let bound during org-do-lparse
38(defun org-odt-insert-toc ()
39 (goto-char (point-min))
40 (cond
41 ((re-search-forward
42 "\\(<text:p [^>]*>\\)?\\s-*\\[TABLE-OF-CONTENTS\\]\\s-*\\(</text:p>\\)?"
43 nil t)
44 (replace-match ""))
45 (t
46 (goto-char org-lparse-dyn-first-heading-pos)))
47 (insert (org-odt-format-toc)))
35 48
36(defun org-odt-end-export () 49(defun org-odt-end-export ()
50 (org-odt-insert-toc)
37 (org-odt-fixup-label-references) 51 (org-odt-fixup-label-references)
38 52
39 ;; remove empty paragraphs 53 ;; remove empty paragraphs
@@ -139,6 +153,7 @@ with GNU ELPA tar or standard Emacs distribution."
139 (const :tag "Not set" nil) 153 (const :tag "Not set" nil)
140 (directory :tag "Schema directory")) 154 (directory :tag "Schema directory"))
141 :group 'org-export-odt 155 :group 'org-export-odt
156 :version "24.1"
142 :set 157 :set
143 (lambda (var value) 158 (lambda (var value)
144 "Set `org-export-odt-schema-dir'. 159 "Set `org-export-odt-schema-dir'.
@@ -258,7 +273,8 @@ The exporter embeds the exported content just before
258If unspecified, the file named \"OrgOdtContentTemplate.xml\" 273If unspecified, the file named \"OrgOdtContentTemplate.xml\"
259under `org-odt-styles-dir' is used." 274under `org-odt-styles-dir' is used."
260 :type 'file 275 :type 'file
261 :group 'org-export-odt) 276 :group 'org-export-odt
277 :version "24.1")
262 278
263(defcustom org-export-odt-styles-file nil 279(defcustom org-export-odt-styles-file nil
264 "Default styles file for use with ODT export. 280 "Default styles file for use with ODT export.
@@ -292,6 +308,7 @@ a per-file basis. For example,
292#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or 308#+ODT_STYLES_FILE: \"/path/to/styles.xml\" or
293#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))." 309#+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))."
294 :group 'org-export-odt 310 :group 'org-export-odt
311 :version "24.1"
295 :type 312 :type
296 '(choice 313 '(choice
297 (const :tag "Factory settings" nil) 314 (const :tag "Factory settings" nil)
@@ -313,20 +330,21 @@ a per-file basis. For example,
313(defvar org-export-odt-embed-images t 330(defvar org-export-odt-embed-images t
314 "Should the images be copied in to the odt file or just linked?") 331 "Should the images be copied in to the odt file or just linked?")
315 332
316(defvar org-export-odt-inline-images 'maybe) ; counterpart of 333(defvar org-export-odt-inline-images 'maybe)
317 ; `org-export-html-inline-images'
318
319(defcustom org-export-odt-inline-image-extensions 334(defcustom org-export-odt-inline-image-extensions
320 '("png" "jpeg" "jpg" "gif") 335 '("png" "jpeg" "jpg" "gif")
321 "Extensions of image files that can be inlined into HTML." 336 "Extensions of image files that can be inlined into HTML."
322 :type '(repeat (string :tag "Extension")) 337 :type '(repeat (string :tag "Extension"))
323 :group 'org-export-odt) 338 :group 'org-export-odt
339 :version "24.1")
324 340
325(defcustom org-export-odt-pixels-per-inch display-pixels-per-inch 341(defcustom org-export-odt-pixels-per-inch display-pixels-per-inch
326 ;; FIXME add docstring 342 "Scaling factor for converting images pixels to inches.
327 "" 343Use this for sizing of embedded images. See Info node `(org)
344Images in ODT export' for more information."
328 :type 'float 345 :type 'float
329 :group 'org-export-odt) 346 :group 'org-export-odt
347 :version "24.1")
330 348
331(defcustom org-export-odt-create-custom-styles-for-srcblocks t 349(defcustom org-export-odt-create-custom-styles-for-srcblocks t
332 "Whether custom styles for colorized source blocks be automatically created. 350 "Whether custom styles for colorized source blocks be automatically created.
@@ -344,6 +362,7 @@ styles.xml already contains needed styles for colorizing to work.
344This variable is effective only if 362This variable is effective only if
345`org-export-odt-fontify-srcblocks' is turned on." 363`org-export-odt-fontify-srcblocks' is turned on."
346 :group 'org-export-odt 364 :group 'org-export-odt
365 :version "24.1"
347 :type 'boolean) 366 :type 'boolean)
348 367
349(defvar org-export-odt-default-org-styles-alist 368(defvar org-export-odt-default-org-styles-alist
@@ -396,6 +415,7 @@ resulting document to this format. During customization of this
396variable, the list of valid values are populated based on 415variable, the list of valid values are populated based on
397`org-export-odt-convert-capabilities'." 416`org-export-odt-convert-capabilities'."
398 :group 'org-export-odt 417 :group 'org-export-odt
418 :version "24.1"
399 :type '(choice :convert-widget 419 :type '(choice :convert-widget
400 (lambda (w) 420 (lambda (w)
401 (apply 'widget-convert (widget-type w) 421 (apply 'widget-convert (widget-type w)
@@ -425,40 +445,6 @@ emacs --batch
425 --visit=MyFile --funcall org-export-as-odt-batch" 445 --visit=MyFile --funcall org-export-as-odt-batch"
426 (org-lparse-batch "odt")) 446 (org-lparse-batch "odt"))
427 447
428;;;###autoload
429(defun org-export-as-odt-to-buffer (arg)
430 "Call `org-lparse-odt` with output to a temporary buffer.
431No file is created. The prefix ARG is passed through to `org-lparse-to-buffer'."
432 (interactive "P")
433 (org-lparse-to-buffer "odt" arg))
434
435;;;###autoload
436(defun org-replace-region-by-odt (beg end)
437 "Assume the current region has org-mode syntax, and convert it to ODT.
438This can be used in any buffer. For example, you could write an
439itemized list in org-mode syntax in an ODT buffer and then use this
440command to convert it."
441 (interactive "r")
442 (org-replace-region-by "odt" beg end))
443
444;;;###autoload
445(defun org-export-region-as-odt (beg end &optional body-only buffer)
446 "Convert region from BEG to END in org-mode buffer to ODT.
447If prefix arg BODY-ONLY is set, omit file header, footer, and table of
448contents, and only produce the region of converted text, useful for
449cut-and-paste operations.
450If BUFFER is a buffer or a string, use/create that buffer as a target
451of the converted ODT. If BUFFER is the symbol `string', return the
452produced ODT as a string and leave not buffer behind. For example,
453a Lisp program could call this function in the following way:
454
455 (setq odt (org-export-region-as-odt beg end t 'string))
456
457When called interactively, the output buffer is selected, and shown
458in a window. A non-interactive call will only return the buffer."
459 (interactive "r\nP")
460 (org-lparse-region "odt" beg end body-only buffer))
461
462;;; org-export-as-odt 448;;; org-export-as-odt
463;;;###autoload 449;;;###autoload
464(defun org-export-as-odt (arg &optional hidden ext-plist 450(defun org-export-as-odt (arg &optional hidden ext-plist
@@ -609,13 +595,12 @@ PUB-DIR is set, use this as the publishing directory."
609 '("<text:date style:data-style-name=\"%s\" text:date-value=\"%s\">" 595 '("<text:date style:data-style-name=\"%s\" text:date-value=\"%s\">"
610 . "</text:date>") date "N75" iso-date)) 596 . "</text:date>") date "N75" iso-date))
611 ;; separator 597 ;; separator
612 "<text:p text:style-name=\"OrgSubtitle\"/>")) 598 "<text:p text:style-name=\"OrgSubtitle\"/>")))))
613 ;; toc
614 (org-odt-format-toc))))
615 599
616(defun org-odt-begin-document-body (opt-plist) 600(defun org-odt-begin-document-body (opt-plist)
617 (org-odt-begin-office-body) 601 (org-odt-begin-office-body)
618 (insert (org-odt-format-preamble opt-plist))) 602 (insert (org-odt-format-preamble opt-plist))
603 (setq org-lparse-dyn-first-heading-pos (point)))
619 604
620(defvar org-lparse-body-only) ; let bound during org-do-lparse 605(defvar org-lparse-body-only) ; let bound during org-do-lparse
621(defvar org-lparse-to-buffer) ; let bound during org-do-lparse 606(defvar org-lparse-to-buffer) ; let bound during org-do-lparse
@@ -646,6 +631,15 @@ PUB-DIR is set, use this as the publishing directory."
646(defun org-odt-end-outline-text () 631(defun org-odt-end-outline-text ()
647 (ignore)) 632 (ignore))
648 633
634(defun org-odt-begin-section (style &optional name)
635 (let ((default-name (car (org-odt-add-automatic-style "Section"))))
636 (org-lparse-insert-tag
637 "<text:section text:style-name=\"%s\" text:name=\"%s\">"
638 style (or name default-name))))
639
640(defun org-odt-end-section ()
641 (org-lparse-insert-tag "</text:section>"))
642
649(defun org-odt-begin-paragraph (&optional style) 643(defun org-odt-begin-paragraph (&optional style)
650 (org-lparse-insert-tag 644 (org-lparse-insert-tag
651 "<text:p%s>" (org-odt-get-extra-attrs-for-paragraph-style style))) 645 "<text:p%s>" (org-odt-get-extra-attrs-for-paragraph-style style)))
@@ -729,13 +723,17 @@ PUB-DIR is set, use this as the publishing directory."
729 (list)) 723 (list))
730 (t (error "Unknown environment %s" style)))) 724 (t (error "Unknown environment %s" style))))
731 725
732(defvar org-lparse-list-level) ; dynamically bound in org-do-lparse 726(defvar org-lparse-list-stack) ; dynamically bound in org-do-lparse
727(defvar org-odt-list-stack-stashed)
733(defun org-odt-begin-list (ltype) 728(defun org-odt-begin-list (ltype)
734 (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) 729 (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype)
735 ltype)) 730 ltype))
736 (let* ((style-name (org-odt-get-style-name-for-entity 'list ltype)) 731 (let* ((style-name (org-odt-get-style-name-for-entity 'list ltype))
737 (extra (concat (when (= org-lparse-list-level 1) 732 (extra (concat (if (or org-lparse-list-table-p
738 " text:continue-numbering=\"false\"") 733 (and (= 1 (length org-lparse-list-stack))
734 (null org-odt-list-stack-stashed)))
735 " text:continue-numbering=\"false\""
736 " text:continue-numbering=\"true\"")
739 (when style-name 737 (when style-name
740 (format " text:style-name=\"%s\"" style-name))))) 738 (format " text:style-name=\"%s\"" style-name)))))
741 (case ltype 739 (case ltype
@@ -758,11 +756,15 @@ PUB-DIR is set, use this as the publishing directory."
758 (ordered 756 (ordered
759 (assert (not headline) t) 757 (assert (not headline) t)
760 (let* ((counter arg) (extra "")) 758 (let* ((counter arg) (extra ""))
761 (org-lparse-insert-tag "<text:list-item>") 759 (org-lparse-insert-tag (if (= (length org-lparse-list-stack)
760 (length org-odt-list-stack-stashed))
761 "<text:list-header>" "<text:list-item>"))
762 (org-lparse-begin-paragraph))) 762 (org-lparse-begin-paragraph)))
763 (unordered 763 (unordered
764 (let* ((id arg) (extra "")) 764 (let* ((id arg) (extra ""))
765 (org-lparse-insert-tag "<text:list-item>") 765 (org-lparse-insert-tag (if (= (length org-lparse-list-stack)
766 (length org-odt-list-stack-stashed))
767 "<text:list-header>" "<text:list-item>"))
766 (org-lparse-begin-paragraph) 768 (org-lparse-begin-paragraph)
767 (insert (if headline (org-odt-format-target headline id) 769 (insert (if headline (org-odt-format-target headline id)
768 (org-odt-format-bookmark "" id))))) 770 (org-odt-format-bookmark "" id)))))
@@ -783,13 +785,30 @@ PUB-DIR is set, use this as the publishing directory."
783 ltype)) 785 ltype))
784 (case ltype 786 (case ltype
785 ((ordered unordered) 787 ((ordered unordered)
786 (org-lparse-insert-tag "</text:list-item>")) 788 (org-lparse-insert-tag (if (= (length org-lparse-list-stack)
789 (length org-odt-list-stack-stashed))
790 (prog1 "</text:list-header>"
791 (setq org-odt-list-stack-stashed nil))
792 "</text:list-item>")))
787 (description 793 (description
788 (org-lparse-end-list-item-1) 794 (org-lparse-end-list-item-1)
789 (org-lparse-end-list 'description) 795 (org-lparse-end-list 'description)
790 (org-lparse-end-list-item-1)) 796 (org-lparse-end-list-item-1))
791 (t (error "Unknown list type")))) 797 (t (error "Unknown list type"))))
792 798
799(defun org-odt-discontinue-list ()
800 (let ((stashed-stack org-lparse-list-stack))
801 (loop for list-type in stashed-stack
802 do (org-lparse-end-list-item-1 list-type)
803 (org-lparse-end-list list-type))
804 (setq org-odt-list-stack-stashed stashed-stack)))
805
806(defun org-odt-continue-list ()
807 (setq org-odt-list-stack-stashed (nreverse org-odt-list-stack-stashed))
808 (loop for list-type in org-odt-list-stack-stashed
809 do (org-lparse-begin-list list-type)
810 (org-lparse-begin-list-item list-type)))
811
793;; Following variables are let bound when table emission is in 812;; Following variables are let bound when table emission is in
794;; progress. See org-lparse.el. 813;; progress. See org-lparse.el.
795(defvar org-lparse-table-begin-marker) 814(defvar org-lparse-table-begin-marker)
@@ -882,6 +901,7 @@ The TABLE-STYLE-NAME \"OrgEquation\" is used internally for
882formatting of numbered display equations. Do not delete this 901formatting of numbered display equations. Do not delete this
883style from the list." 902style from the list."
884 :group 'org-export-odt 903 :group 'org-export-odt
904 :version "24.1"
885 :type '(choice 905 :type '(choice
886 (const :tag "None" nil) 906 (const :tag "None" nil)
887 (repeat :tag "Table Styles" 907 (repeat :tag "Table Styles"
@@ -897,17 +917,100 @@ style from the list."
897 :key-type symbol 917 :key-type symbol
898 :value-type (const :tag "True" t)))))) 918 :value-type (const :tag "True" t))))))
899 919
920(defvar org-odt-table-style-format
921 "
922<style:style style:name=\"%s\" style:family=\"table\">
923 <style:table-properties style:rel-width=\"%d%%\" fo:margin-top=\"0cm\" fo:margin-bottom=\"0.20cm\" table:align=\"center\"/>
924</style:style>
925"
926 "Template for auto-generated Table styles.")
927
928(defvar org-odt-automatic-styles '()
929 "Registry of automatic styles for various OBJECT-TYPEs.
930The variable has the following form:
931\(\(OBJECT-TYPE-A
932 \(\(OBJECT-NAME-A.1 OBJECT-PROPS-A.1\)
933 \(OBJECT-NAME-A.2 OBJECT-PROPS-A.2\) ...\)\)
934 \(OBJECT-TYPE-B
935 \(\(OBJECT-NAME-B.1 OBJECT-PROPS-B.1\)
936 \(OBJECT-NAME-B.2 OBJECT-PROPS-B.2\) ...\)\)
937 ...\).
938
939OBJECT-TYPEs could be \"Section\", \"Table\", \"Figure\" etc.
940OBJECT-PROPS is (typically) a plist created by passing
941\"#+ATTR_ODT: \" option to `org-lparse-get-block-params'.
942
943Use `org-odt-add-automatic-style' to add update this variable.'")
944
945(defvar org-odt-object-counters nil
946 "Running counters for various OBJECT-TYPEs.
947Use this to generate automatic names and style-names. See
948`org-odt-add-automatic-style'.")
949
950(defun org-odt-write-automatic-styles ()
951 "Write automatic styles to \"content.xml\"."
952 (with-current-buffer
953 (find-file-noselect (expand-file-name "content.xml") t)
954 ;; position the cursor
955 (goto-char (point-min))
956 (re-search-forward " </office:automatic-styles>" nil t)
957 (goto-char (match-beginning 0))
958 ;; write automatic table styles
959 (loop for (style-name props) in
960 (plist-get org-odt-automatic-styles 'Table) do
961 (when (setq props (or (plist-get props :rel-width) 96))
962 (insert (format org-odt-table-style-format style-name props))))))
963
964(defun org-odt-add-automatic-style (object-type &optional object-props)
965 "Create an automatic style of type OBJECT-TYPE with param OBJECT-PROPS.
966OBJECT-PROPS is (typically) a plist created by passing
967\"#+ATTR_ODT: \" option of the object in question to
968`org-lparse-get-block-params'.
969
970Use `org-odt-object-counters' to generate an automatic
971OBJECT-NAME and STYLE-NAME. If OBJECT-PROPS is non-nil, add a
972new entry in `org-odt-automatic-styles'. Return (OBJECT-NAME
973. STYLE-NAME)."
974 (assert (stringp object-type))
975 (let* ((object (intern object-type))
976 (seqvar object)
977 (seqno (1+ (or (plist-get org-odt-object-counters seqvar) 0)))
978 (object-name (format "%s%d" object-type seqno)) style-name)
979 (setq org-odt-object-counters
980 (plist-put org-odt-object-counters seqvar seqno))
981 (when object-props
982 (setq style-name (format "Org%s" object-name))
983 (setq org-odt-automatic-styles
984 (plist-put org-odt-automatic-styles object
985 (append (list (list style-name object-props))
986 (plist-get org-odt-automatic-styles object)))))
987 (cons object-name style-name)))
988
989(defvar org-odt-table-indentedp nil)
900(defun org-odt-begin-table (caption label attributes) 990(defun org-odt-begin-table (caption label attributes)
901 (setq org-odt-table-style attributes) 991 (setq org-odt-table-indentedp (not (null org-lparse-list-stack)))
992 (when org-odt-table-indentedp
993 ;; Within the Org file, the table is appearing within a list item.
994 ;; OpenDocument doesn't allow table to appear within list items.
995 ;; Temporarily terminate the list, emit the table and then
996 ;; re-continue the list.
997 (org-odt-discontinue-list)
998 ;; Put the Table in an indented section.
999 (let ((level (length org-odt-list-stack-stashed)))
1000 (org-odt-begin-section (format "OrgIndentedSection-Level-%d" level))))
1001 (setq attributes (org-lparse-get-block-params attributes))
1002 (setq org-odt-table-style (plist-get attributes :style))
902 (setq org-odt-table-style-spec 1003 (setq org-odt-table-style-spec
903 (assoc org-odt-table-style org-export-odt-table-styles)) 1004 (assoc org-odt-table-style org-export-odt-table-styles))
904 (when label 1005 (when (or label caption)
905 (insert 1006 (insert
906 (org-odt-format-stylized-paragraph 1007 (org-odt-format-stylized-paragraph
907 'table (org-odt-format-entity-caption label caption "__Table__")))) 1008 'table (org-odt-format-entity-caption label caption "__Table__"))))
908 (org-lparse-insert-tag 1009 (let ((name-and-style (org-odt-add-automatic-style "Table" attributes)))
909 "<table:table table:name=\"%s\" table:style-name=\"%s\">" 1010 (org-lparse-insert-tag
910 (or label "") (or (nth 1 org-odt-table-style-spec) "OrgTable")) 1011 "<table:table table:name=\"%s\" table:style-name=\"%s\">"
1012 (car name-and-style) (or (nth 1 org-odt-table-style-spec)
1013 (cdr name-and-style) "OrgTable")))
911 (setq org-lparse-table-begin-marker (point))) 1014 (setq org-lparse-table-begin-marker (point)))
912 1015
913(defvar org-lparse-table-colalign-info) 1016(defvar org-lparse-table-colalign-info)
@@ -940,14 +1043,17 @@ style from the list."
940 ((equal spec "table-cell:style-name") 1043 ((equal spec "table-cell:style-name")
941 (replace-match table-cell-style t t)))))) 1044 (replace-match table-cell-style t t))))))
942 (goto-char (point-max)) 1045 (goto-char (point-max))
943 (org-lparse-insert-tag "</table:table>")) 1046 (org-lparse-insert-tag "</table:table>")
1047 (when org-odt-table-indentedp
1048 (org-odt-end-section)
1049 (org-odt-continue-list)))
944 1050
945(defun org-odt-begin-table-rowgroup (&optional is-header-row) 1051(defun org-odt-begin-table-rowgroup (&optional is-header-row)
946 (when org-lparse-table-rowgrp-open 1052 (when org-lparse-table-rowgrp-open
947 (org-lparse-end 'TABLE-ROWGROUP)) 1053 (org-lparse-end 'TABLE-ROWGROUP))
948 (org-lparse-insert-tag (if is-header-row 1054 (org-lparse-insert-tag (if is-header-row
949 "<table:table-header-rows>" 1055 "<table:table-header-rows>"
950 "<table:table-rows>")) 1056 "<table:table-rows>"))
951 (setq org-lparse-table-rowgrp-open t) 1057 (setq org-lparse-table-rowgrp-open t)
952 (setq org-lparse-table-cur-rowgrp-is-hdr is-header-row)) 1058 (setq org-lparse-table-cur-rowgrp-is-hdr is-header-row))
953 1059
@@ -1078,6 +1184,16 @@ styles congruent with the ODF-1.2 specification."
1078 (org-lparse-end-paragraph)) 1184 (org-lparse-end-paragraph))
1079 1185
1080(defun org-odt-begin-toc (lang-specific-heading max-level) 1186(defun org-odt-begin-toc (lang-specific-heading max-level)
1187 ;; Strings in `org-export-language-setup' can contain named html
1188 ;; entities. Replace those with utf-8 equivalents.
1189 (let ((i 0) entity rpl)
1190 (while (string-match "&\\([^#].*?\\);" lang-specific-heading i)
1191 (setq entity (match-string 1 lang-specific-heading))
1192 (if (not (setq rpl (org-entity-get-representation entity 'utf8)))
1193 (setq i (match-end 0))
1194 (setq i (+ (match-beginning 0) (length rpl)))
1195 (setq lang-specific-heading
1196 (replace-match rpl t t lang-specific-heading)))))
1081 (insert 1197 (insert
1082 (format " 1198 (format "
1083 <text:table-of-content text:style-name=\"Sect2\" text:protected=\"true\" text:name=\"Table of Contents1\"> 1199 <text:table-of-content text:style-name=\"Sect2\" text:protected=\"true\" text:name=\"Table of Contents1\">
@@ -1117,9 +1233,9 @@ styles congruent with the ODF-1.2 specification."
1117 (concat snumber ". ")) 1233 (concat snumber ". "))
1118 headline 1234 headline
1119 (and tags 1235 (and tags
1120 (concat 1236 (concat
1121 (org-lparse-format 'SPACES 3) 1237 (org-lparse-format 'SPACES 3)
1122 (org-lparse-format 'FONTIFY tags "tag"))))) 1238 (org-lparse-format 'FONTIFY tags "tag")))))
1123 (when todo 1239 (when todo
1124 (setq headline (org-lparse-format 'FONTIFY headline "todo"))) 1240 (setq headline (org-lparse-format 'FONTIFY headline "todo")))
1125 1241
@@ -1137,10 +1253,13 @@ styles congruent with the ODF-1.2 specification."
1137(defun org-odt-format-link (desc href &optional attr) 1253(defun org-odt-format-link (desc href &optional attr)
1138 (cond 1254 (cond
1139 ((and (= (string-to-char href) ?#) (not org-odt-suppress-xref)) 1255 ((and (= (string-to-char href) ?#) (not org-odt-suppress-xref))
1140 (setq href (concat org-export-odt-bookmark-prefix (substring href 1))) 1256 (setq href (substring href 1))
1141 (let ((xref-format "text")) 1257 (let ((xref-format "text"))
1142 (when (numberp desc) 1258 (when (numberp desc)
1143 (setq desc (format "%d" desc) xref-format "number")) 1259 (setq desc (format "%d" desc) xref-format "number"))
1260 (when (listp desc)
1261 (setq desc (mapconcat 'identity desc ".") xref-format "chapter"))
1262 (setq href (concat org-export-odt-bookmark-prefix href))
1144 (org-odt-format-tags 1263 (org-odt-format-tags
1145 '("<text:bookmark-ref text:reference-format=\"%s\" text:ref-name=\"%s\">" . 1264 '("<text:bookmark-ref text:reference-format=\"%s\" text:ref-name=\"%s\">" .
1146 "</text:bookmark-ref>") 1265 "</text:bookmark-ref>")
@@ -1204,7 +1323,8 @@ Turn this option on if you want to colorize the source code
1204blocks in the exported file. For colorization to work, you need 1323blocks in the exported file. For colorization to work, you need
1205to make available an enhanced version of `htmlfontify' library." 1324to make available an enhanced version of `htmlfontify' library."
1206 :type 'boolean 1325 :type 'boolean
1207 :group 'org-export-odt) 1326 :group 'org-export-odt
1327 :version "24.1")
1208 1328
1209(defun org-odt-format-source-line-with-line-number-and-label 1329(defun org-odt-format-source-line-with-line-number-and-label
1210 (line rpllbl num fontifier par-style) 1330 (line rpllbl num fontifier par-style)
@@ -1415,15 +1535,27 @@ value of `org-export-odt-fontify-srcblocks."
1415 (org-odt-copy-image-file thefile) thelink)))) 1535 (org-odt-copy-image-file thefile) thelink))))
1416 (org-export-odt-format-image thefile href))) 1536 (org-export-odt-format-image thefile href)))
1417 1537
1418(defun org-export-odt-format-formula (src href &optional embed-as) 1538(defvar org-odt-entity-labels-alist nil
1419 "Create image tag with source and attributes." 1539 "Associate Labels with the Labeled entities.
1540Each element of the alist is of the form (LABEL-NAME
1541CATEGORY-NAME SEQNO LABEL-STYLE-NAME). LABEL-NAME is same as
1542that specified by \"#+LABEL: ...\" line. CATEGORY-NAME is the
1543type of the entity that LABEL-NAME is attached to. CATEGORY-NAME
1544can be one of \"Table\", \"Figure\" or \"Equation\". SEQNO is
1545the unique number assigned to the referenced entity on a
1546per-CATEGORY basis. It is generated sequentially and is 1-based.
1547LABEL-STYLE-NAME is a key `org-odt-label-styles'.
1548
1549See `org-odt-add-label-definition' and
1550`org-odt-fixup-label-references'.")
1551
1552(defun org-export-odt-format-formula (src href)
1420 (save-match-data 1553 (save-match-data
1421 (let* ((caption (org-find-text-property-in-string 'org-caption src)) 1554 (let* ((caption (org-find-text-property-in-string 'org-caption src))
1422 (caption (and caption (org-xml-format-desc caption))) 1555 (caption (and caption (org-xml-format-desc caption)))
1423 (label (org-find-text-property-in-string 'org-label src)) 1556 (label (org-find-text-property-in-string 'org-label src))
1424 (latex-frag (org-find-text-property-in-string 'org-latex-src src)) 1557 (latex-frag (org-find-text-property-in-string 'org-latex-src src))
1425 (embed-as (or embed-as 1558 (embed-as (or (and latex-frag
1426 (and latex-frag
1427 (org-find-text-property-in-string 1559 (org-find-text-property-in-string
1428 'org-latex-src-embed-type src)) 1560 'org-latex-src-embed-type src))
1429 (if (or caption label) 'paragraph 'character))) 1561 (if (or caption label) 'paragraph 'character)))
@@ -1438,11 +1570,15 @@ value of `org-export-odt-fontify-srcblocks."
1438 (org-lparse-end-paragraph) 1570 (org-lparse-end-paragraph)
1439 (org-lparse-insert-list-table 1571 (org-lparse-insert-list-table
1440 `((,(org-odt-format-entity 1572 `((,(org-odt-format-entity
1441 (if caption "CaptionedDisplayFormula" "DisplayFormula") 1573 (if (not (or caption label)) "DisplayFormula"
1442 href width height :caption caption :label nil) 1574 "CaptionedDisplayFormula")
1443 ,(if (not label) "" 1575 href width height :caption caption :label label)
1444 (org-odt-format-entity-caption label nil "__MathFormula__")))) 1576 ,(if (not (or caption label)) ""
1445 nil nil nil "OrgEquation" nil '((1 "c" 8) (2 "c" 1))) 1577 (let* ((label-props (car org-odt-entity-labels-alist)))
1578 (setcar (last label-props) "math-label")
1579 (apply 'org-odt-format-label-definition
1580 caption label-props)))))
1581 nil nil nil ":style \"OrgEquation\"" nil '((1 "c" 8) (2 "c" 1)))
1446 (throw 'nextline nil)))))) 1582 (throw 'nextline nil))))))
1447 1583
1448(defvar org-odt-embedded-formulas-count 0) 1584(defvar org-odt-embedded-formulas-count 0)
@@ -1457,19 +1593,19 @@ value of `org-export-odt-fontify-srcblocks."
1457 (message "Embedding %s as %s ..." 1593 (message "Embedding %s as %s ..."
1458 (substring-no-properties path) target-file) 1594 (substring-no-properties path) target-file)
1459 1595
1460 (make-directory target-dir) 1596 (make-directory target-dir)
1461 (org-odt-create-manifest-file-entry 1597 (org-odt-create-manifest-file-entry
1462 "application/vnd.oasis.opendocument.formula" target-dir "1.2") 1598 "application/vnd.oasis.opendocument.formula" target-dir "1.2")
1463 1599
1464 (case (org-odt-is-formula-link-p src-file) 1600 (case (org-odt-is-formula-link-p src-file)
1465 (mathml 1601 (mathml
1466 (copy-file src-file target-file 'overwrite)) 1602 (copy-file src-file target-file 'overwrite))
1467 (odf 1603 (odf
1468 (org-odt-zip-extract-one src-file "content.xml" target-dir)) 1604 (org-odt-zip-extract-one src-file "content.xml" target-dir))
1469 (t 1605 (t
1470 (error "%s is not a formula file" src-file))) 1606 (error "%s is not a formula file" src-file)))
1471 1607
1472 (org-odt-create-manifest-file-entry "text/xml" target-file)) 1608 (org-odt-create-manifest-file-entry "text/xml" target-file))
1473 target-file)) 1609 target-file))
1474 1610
1475(defun org-odt-format-inline-formula (thefile) 1611(defun org-odt-format-inline-formula (thefile)
@@ -1508,7 +1644,8 @@ ATTR is a string of other attributes of the a element."
1508 (not fragment))) 1644 (not fragment)))
1509 (type (if (equal type-1 "id") "file" type-1)) 1645 (type (if (equal type-1 "id") "file" type-1))
1510 (filename path) 1646 (filename path)
1511 (thefile path)) 1647 (thefile path)
1648 sec-frag sec-nos)
1512 (cond 1649 (cond
1513 ;; check for inlined images 1650 ;; check for inlined images
1514 ((and (member type '("file")) 1651 ((and (member type '("file"))
@@ -1524,6 +1661,7 @@ ATTR is a string of other attributes of the a element."
1524 (org-odt-is-formula-link-p filename) 1661 (org-odt-is-formula-link-p filename)
1525 (or (not descp))) 1662 (or (not descp)))
1526 (org-odt-format-inline-formula thefile)) 1663 (org-odt-format-inline-formula thefile))
1664 ;; code references
1527 ((string= type "coderef") 1665 ((string= type "coderef")
1528 (let* ((ref fragment) 1666 (let* ((ref fragment)
1529 (lineno-or-ref (cdr (assoc ref org-export-code-refs))) 1667 (lineno-or-ref (cdr (assoc ref org-export-code-refs)))
@@ -1546,6 +1684,23 @@ ATTR is a string of other attributes of the a element."
1546 (or desc "%s")) 1684 (or desc "%s"))
1547 lineno-or-ref)) 1685 lineno-or-ref))
1548 (org-odt-format-link (org-xml-format-desc desc) href))))) 1686 (org-odt-format-link (org-xml-format-desc desc) href)))))
1687 ;; links to headlines
1688 ((and (string= type "")
1689 (or (not thefile) (string= thefile ""))
1690 (plist-get org-lparse-opt-plist :section-numbers)
1691 (setq sec-frag fragment)
1692 (org-find-text-property-in-string 'org-no-description fragment)
1693 (or (string-match "\\`sec\\(\\(-[0-9]+\\)+\\)" sec-frag)
1694 (and (setq sec-frag
1695 (loop for alias in org-export-target-aliases do
1696 (when (member fragment (cdr alias))
1697 (return (car alias)))))
1698 (string-match "\\`sec\\(\\(-[0-9]+\\)+\\)" sec-frag)))
1699 (setq sec-nos (org-split-string (match-string 1 sec-frag) "-"))
1700 (<= (length sec-nos) (plist-get org-lparse-opt-plist
1701 :headline-levels)))
1702 (let ((org-odt-suppress-xref nil))
1703 (org-odt-format-link sec-nos (concat "#" sec-frag) attr)))
1549 (t 1704 (t
1550 (when (string= type "file") 1705 (when (string= type "file")
1551 (setq thefile 1706 (setq thefile
@@ -1574,7 +1729,7 @@ ATTR is a string of other attributes of the a element."
1574 "</text:h>") text level level))) 1729 "</text:h>") text level level)))
1575 1730
1576(defun org-odt-format-headline (title extra-targets tags 1731(defun org-odt-format-headline (title extra-targets tags
1577 &optional snumber level) 1732 &optional snumber level)
1578 (concat 1733 (concat
1579 (org-lparse-format 'EXTRA-TARGETS extra-targets) 1734 (org-lparse-format 'EXTRA-TARGETS extra-targets)
1580 1735
@@ -1654,9 +1809,7 @@ ATTR is a string of other attributes of the a element."
1654 (attr-plist (org-lparse-get-block-params attr)) 1809 (attr-plist (org-lparse-get-block-params attr))
1655 (user-frame-anchor 1810 (user-frame-anchor
1656 (car (assoc-string (plist-get attr-plist :anchor) 1811 (car (assoc-string (plist-get attr-plist :anchor)
1657 (if (or caption label) 1812 '(("as-char") ("paragraph") ("page")) t)))
1658 '(("paragraph") ("page"))
1659 '(("character") ("paragraph") ("page"))) t)))
1660 (user-frame-style 1813 (user-frame-style
1661 (and user-frame-anchor (plist-get attr-plist :style))) 1814 (and user-frame-anchor (plist-get attr-plist :style)))
1662 (user-frame-attrs 1815 (user-frame-attrs
@@ -1666,8 +1819,10 @@ ATTR is a string of other attributes of the a element."
1666 (embed-as (cond 1819 (embed-as (cond
1667 (latex-frag 1820 (latex-frag
1668 (symbol-name 1821 (symbol-name
1669 (or (org-find-text-property-in-string 1822 (case (org-find-text-property-in-string
1670 'org-latex-src-embed-type src) 'character))) 1823 'org-latex-src-embed-type src)
1824 (paragraph 'paragraph)
1825 (t 'as-char))))
1671 (user-frame-anchor) 1826 (user-frame-anchor)
1672 (t "paragraph"))) 1827 (t "paragraph")))
1673 (size (org-odt-image-size-from-file 1828 (size (org-odt-image-size-from-file
@@ -1714,7 +1869,8 @@ ATTR is a string of other attributes of the a element."
1714 (org-odt-format-tags 1869 (org-odt-format-tags
1715 '("<draw:text-box %s>" . "</draw:text-box>") 1870 '("<draw:text-box %s>" . "</draw:text-box>")
1716 text (concat (format " fo:min-height=\"%0.2fcm\"" (or height .2)) 1871 text (concat (format " fo:min-height=\"%0.2fcm\"" (or height .2))
1717 (format " fo:min-width=\"%0.2fcm\"" (or width .2)))) 1872 (unless width
1873 (format " fo:min-width=\"%0.2fcm\"" (or width .2)))))
1718 width nil style extra anchor-type)) 1874 width nil style extra anchor-type))
1719 1875
1720(defun org-odt-format-inlinetask (heading content 1876(defun org-odt-format-inlinetask (heading content
@@ -1729,9 +1885,13 @@ ATTR is a string of other attributes of the a element."
1729 content) nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\""))) 1885 content) nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\"")))
1730 1886
1731(defvar org-odt-entity-frame-styles 1887(defvar org-odt-entity-frame-styles
1732 '(("CharacterImage" "__Figure__" ("OrgInlineImage" nil "as-char")) 1888 '(("As-CharImage" "__Figure__" ("OrgInlineImage" nil "as-char"))
1733 ("ParagraphImage" "__Figure__" ("OrgDisplayImage" nil "paragraph")) 1889 ("ParagraphImage" "__Figure__" ("OrgDisplayImage" nil "paragraph"))
1734 ("PageImage" "__Figure__" ("OrgPageImage" nil "page")) 1890 ("PageImage" "__Figure__" ("OrgPageImage" nil "page"))
1891 ("CaptionedAs-CharImage" "__Figure__"
1892 ("OrgCaptionedImage"
1893 " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
1894 ("OrgInlineImage" nil "as-char"))
1735 ("CaptionedParagraphImage" "__Figure__" 1895 ("CaptionedParagraphImage" "__Figure__"
1736 ("OrgCaptionedImage" 1896 ("OrgCaptionedImage"
1737 " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph") 1897 " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
@@ -1803,12 +1963,12 @@ ATTR is a string of other attributes of the a element."
1803 target-file)) 1963 target-file))
1804 1964
1805(defvar org-export-odt-image-size-probe-method 1965(defvar org-export-odt-image-size-probe-method
1806 '(emacs imagemagick force) 1966 (append (and (executable-find "identify") '(imagemagick)) ; See Bug#10675
1807 "Ordered list of methods by for determining size of an embedded 1967 '(emacs fixed))
1808 image.") 1968 "Ordered list of methods for determining image sizes.")
1809 1969
1810(defvar org-export-odt-default-image-sizes-alist 1970(defvar org-export-odt-default-image-sizes-alist
1811 '(("character" . (5 . 0.4)) 1971 '(("as-char" . (5 . 0.4))
1812 ("paragraph" . (5 . 5))) 1972 ("paragraph" . (5 . 5)))
1813 "Hardcoded image dimensions one for each of the anchor 1973 "Hardcoded image dimensions one for each of the anchor
1814 methods.") 1974 methods.")
@@ -1832,7 +1992,9 @@ ATTR is a string of other attributes of the a element."
1832 (pixels-to-cms (cdr size-in-pixels))))))) 1992 (pixels-to-cms (cdr size-in-pixels)))))))
1833 (case probe-method 1993 (case probe-method
1834 (emacs 1994 (emacs
1835 (size-in-cms (ignore-errors (image-size (create-image file) 'pixels)))) 1995 (size-in-cms (ignore-errors ; Emacs could be in batch mode
1996 (clear-image-cache)
1997 (image-size (create-image file) 'pixels))))
1836 (imagemagick 1998 (imagemagick
1837 (size-in-cms 1999 (size-in-cms
1838 (let ((dim (shell-command-to-string 2000 (let ((dim (shell-command-to-string
@@ -1877,27 +2039,15 @@ ATTR is a string of other attributes of the a element."
1877 (setq width (* scale width) height (* scale height))))) 2039 (setq width (* scale width) height (* scale height)))))
1878 (cons width height))) 2040 (cons width height)))
1879 2041
1880(defvar org-odt-entity-labels-alist nil
1881 "Associate Labels with the Labeled entities.
1882Each element of the alist is of the form (LABEL-NAME
1883CATEGORY-NAME SEQNO LABEL-STYLE-NAME). LABEL-NAME is same as
1884that specified by \"#+LABEL: ...\" line. CATEGORY-NAME is the
1885type of the entity that LABEL-NAME is attached to. CATEGORY-NAME
1886can be one of \"Table\", \"Figure\" or \"Equation\". SEQNO is
1887the unique number assigned to the referenced entity on a
1888per-CATEGORY basis. It is generated sequentially and is 1-based.
1889LABEL-STYLE-NAME is a key `org-odt-label-styles'.
1890
1891See `org-odt-add-label-definition' and
1892`org-odt-fixup-label-references'.")
1893
1894(defvar org-odt-entity-counts-plist nil 2042(defvar org-odt-entity-counts-plist nil
1895 "Plist of running counters of SEQNOs for each of the CATEGORY-NAMEs. 2043 "Plist of running counters of SEQNOs for each of the CATEGORY-NAMEs.
1896See `org-odt-entity-labels-alist' for known CATEGORY-NAMEs.") 2044See `org-odt-entity-labels-alist' for known CATEGORY-NAMEs.")
1897 2045
1898(defvar org-odt-label-styles 2046(defvar org-odt-label-styles
1899 '(("text" "(%n)" "text" "(%n)") 2047 '(("math-formula" "%c" "text" "(%n)")
1900 ("category-and-value" "%e %n%c" "category-and-value" "%e %n")) 2048 ("math-label" "(%n)" "text" "(%n)")
2049 ("category-and-value" "%e %n: %c" "category-and-value" "%e %n")
2050 ("value" "%e %n: %c" "value" "%n"))
1901 "Specify how labels are applied and referenced. 2051 "Specify how labels are applied and referenced.
1902This is an alist where each element is of the 2052This is an alist where each element is of the
1903form (LABEL-STYLE-NAME LABEL-ATTACH-FMT LABEL-REF-MODE 2053form (LABEL-STYLE-NAME LABEL-ATTACH-FMT LABEL-REF-MODE
@@ -1918,89 +2068,105 @@ specifiers - %e and %n. %e is replaced with the CATEGORY-NAME.
1918%n is replaced with SEQNO. See 2068%n is replaced with SEQNO. See
1919`org-odt-format-label-reference'.") 2069`org-odt-format-label-reference'.")
1920 2070
2071(defcustom org-export-odt-category-strings
2072 '(("en" "Table" "Figure" "Equation" "Equation"))
2073 "Specify category strings for various captionable entities.
2074Captionable entity can be one of a Table, an Embedded Image, a
2075LaTeX fragment (generated with dvipng) or a Math Formula.
2076
2077For example, when `org-export-default-language' is \"en\", an
2078embedded image will be captioned as \"Figure 1: Orgmode Logo\".
2079If you want the images to be captioned instead as \"Illustration
20801: Orgmode Logo\", then modify the entry for \"en\" as shown
2081below.
2082
2083 \(setq org-export-odt-category-strings
2084 '\(\(\"en\" \"Table\" \"Illustration\"
2085 \"Equation\" \"Equation\"\)\)\)"
2086 :group 'org-export-odt
2087 :version "24.1"
2088 :type '(repeat (list (string :tag "Language tag")
2089 (choice :tag "Table"
2090 (const :tag "Use Default" nil)
2091 (string :tag "Category string"))
2092 (choice :tag "Figure"
2093 (const :tag "Use Default" nil)
2094 (string :tag "Category string"))
2095 (choice :tag "Math Formula"
2096 (const :tag "Use Default" nil)
2097 (string :tag "Category string"))
2098 (choice :tag "Dvipng Image"
2099 (const :tag "Use Default" nil)
2100 (string :tag "Category string")))))
2101
1921(defvar org-odt-category-map-alist 2102(defvar org-odt-category-map-alist
1922 '(("__Table__" "Table" "category-and-value") 2103 '(("__Table__" "Table" "value")
1923 ("__Figure__" "Figure" "category-and-value") 2104 ("__Figure__" "Illustration" "value")
1924 ("__MathFormula__" "Equation" "text") 2105 ("__MathFormula__" "Text" "math-formula")
1925 ("__DvipngImage__" "Equation" "category-and-value")) 2106 ("__DvipngImage__" "Equation" "value")
1926 "Map a CATEGORY-HANDLE to CATEGORY-NAME and LABEL-STYLE. 2107 ;; ("__Table__" "Table" "category-and-value")
1927This is an alist where each element is of the form 2108 ;; ("__Figure__" "Figure" "category-and-value")
1928\\(CATEGORY-HANDLE CATEGORY-NAME LABEL-STYLE\\). CATEGORY_HANDLE 2109 ;; ("__DvipngImage__" "Equation" "category-and-value")
1929could either be one of the internal handles (as seen above) or be 2110 )
1930derived from the \"#+LABEL:<label-name>\" specification. See 2111 "Map a CATEGORY-HANDLE to OD-VARIABLE and LABEL-STYLE.
1931`org-export-odt-get-category-from-label'. CATEGORY-NAME and 2112This is a list where each entry is of the form \\(CATEGORY-HANDLE
1932LABEL-STYLE are used for generating ODT labels. See 2113OD-VARIABLE LABEL-STYLE\\). CATEGORY_HANDLE identifies the
1933`org-odt-label-styles'.") 2114captionable entity in question. OD-VARIABLE is the OpenDocument
1934 2115sequence counter associated with the entity. These counters are
1935(defvar org-export-odt-user-categories 2116declared within
1936 '("Illustration" "Table" "Text" "Drawing" "Equation" "Figure")) 2117\"<text:sequence-decls>...</text:sequence-decls>\" block of
1937 2118`org-export-odt-content-template-file'. LABEL-STYLE is a key
1938(defvar org-export-odt-get-category-from-label nil 2119into `org-odt-label-styles' and specifies how a given entity
1939 "Should category of label be inferred from label itself. 2120should be captioned and referenced.
1940When this option is non-nil, a label is parsed in to two 2121
1941component parts delimited by a \":\" (colon) as shown here - 2122The position of a CATEGORY-HANDLE in this list is used as an
1942#+LABEL:[CATEGORY-HANDLE:]EXTRA. The CATEGORY-HANDLE is mapped 2123index in to per-language entry for
1943to a CATEGORY-NAME and LABEL-STYLE using 2124`org-export-odt-category-strings' to retrieve a CATEGORY-NAME.
1944`org-odt-category-map-alist'. (If no such map is provided and 2125This CATEGORY-NAME is then used for qualifying the user-specified
1945CATEGORY-NAME is set to CATEGORY-HANDLE and LABEL-STYLE is set to 2126captions on export.")
1946\"category-and-value\"). If CATEGORY-NAME so obtained is listed
1947under `org-export-odt-user-categories' then the user specified
1948styles are used. Otherwise styles as determined by the internal
1949CATEGORY-HANDLE is used. See
1950`org-odt-get-label-category-and-style' for details.")
1951
1952(defun org-odt-get-label-category-and-style (label default-category)
1953 "See `org-export-odt-get-category-from-label'."
1954 (let ((default-category-map
1955 (assoc default-category org-odt-category-map-alist))
1956 user-category user-category-map category)
1957 (cond
1958 ((not org-export-odt-get-category-from-label)
1959 default-category-map)
1960 ((not (setq user-category
1961 (save-match-data
1962 (and (string-match "\\`\\(.*\\):.+" label)
1963 (match-string 1 label)))))
1964 default-category-map)
1965 (t
1966 (setq user-category-map
1967 (or (assoc user-category org-odt-category-map-alist)
1968 (list nil user-category "category-and-value"))
1969 category (nth 1 user-category-map))
1970 (if (member category org-export-odt-user-categories)
1971 user-category-map
1972 default-category-map)))))
1973 2127
1974(defun org-odt-add-label-definition (label default-category) 2128(defun org-odt-add-label-definition (label default-category)
1975 "Create an entry in `org-odt-entity-labels-alist' and return it." 2129 "Create an entry in `org-odt-entity-labels-alist' and return it."
1976 (setq label (substring-no-properties label)) 2130 (let* ((label-props (assoc default-category org-odt-category-map-alist))
1977 (let* ((label-props (org-odt-get-label-category-and-style 2131 ;; identify the sequence number
1978 label default-category)) 2132 (counter (nth 1 label-props))
1979 (category (nth 1 label-props)) 2133 (sequence-var (intern counter))
1980 (counter category)
1981 (label-style (nth 2 label-props))
1982 (sequence-var (intern (mapconcat
1983 'downcase
1984 (org-split-string counter) "-")))
1985 (seqno (1+ (or (plist-get org-odt-entity-counts-plist sequence-var) 2134 (seqno (1+ (or (plist-get org-odt-entity-counts-plist sequence-var)
1986 0))) 2135 0)))
1987 (label-props (list label category seqno label-style))) 2136 ;; assign an internal label, if user has not provided one
2137 (label (if label (substring-no-properties label)
2138 (format "%s-%s" default-category seqno)))
2139 ;; identify label style
2140 (label-style (nth 2 label-props))
2141 ;; grok language setting
2142 (en-strings (assoc-default "en" org-export-odt-category-strings))
2143 (lang (plist-get org-lparse-opt-plist :language))
2144 (lang-strings (assoc-default lang org-export-odt-category-strings))
2145 ;; retrieve localized category sting
2146 (pos (- (length org-odt-category-map-alist)
2147 (length (memq label-props org-odt-category-map-alist))))
2148 (category (or (nth pos lang-strings) (nth pos en-strings)))
2149 (label-props (list label category counter seqno label-style)))
2150 ;; synchronize internal counters
1988 (setq org-odt-entity-counts-plist 2151 (setq org-odt-entity-counts-plist
1989 (plist-put org-odt-entity-counts-plist sequence-var seqno)) 2152 (plist-put org-odt-entity-counts-plist sequence-var seqno))
2153 ;; stash label properties for later retrieval
1990 (push label-props org-odt-entity-labels-alist) 2154 (push label-props org-odt-entity-labels-alist)
1991 label-props)) 2155 label-props))
1992 2156
1993(defun org-odt-format-label-definition (caption label category seqno label-style) 2157(defun org-odt-format-label-definition (caption label category counter
2158 seqno label-style)
1994 (assert label) 2159 (assert label)
1995 (format-spec 2160 (format-spec
1996 (cadr (assoc-string label-style org-odt-label-styles t)) 2161 (cadr (assoc-string label-style org-odt-label-styles t))
1997 `((?e . ,category) 2162 `((?e . ,category)
1998 (?n . ,(org-odt-format-tags 2163 (?n . ,(org-odt-format-tags
1999 '("<text:sequence text:ref-name=\"%s\" text:name=\"%s\" text:formula=\"ooow:%s+1\" style:num-format=\"1\">" . "</text:sequence>") 2164 '("<text:sequence text:ref-name=\"%s\" text:name=\"%s\" text:formula=\"ooow:%s+1\" style:num-format=\"1\">" . "</text:sequence>")
2000 (format "%d" seqno) label category category)) 2165 (format "%d" seqno) label counter counter))
2001 (?c . ,(or (and caption (concat ": " caption)) ""))))) 2166 (?c . ,(or caption "")))))
2002 2167
2003(defun org-odt-format-label-reference (label category seqno label-style) 2168(defun org-odt-format-label-reference (label category counter
2169 seqno label-style)
2004 (assert label) 2170 (assert label)
2005 (save-match-data 2171 (save-match-data
2006 (let* ((fmt (cddr (assoc-string label-style org-odt-label-styles t))) 2172 (let* ((fmt (cddr (assoc-string label-style org-odt-label-styles t)))
@@ -2026,10 +2192,9 @@ CATEGORY-HANDLE is used. See
2026 (format "Unable to resolve reference to label \"%s\"" label)))))) 2192 (format "Unable to resolve reference to label \"%s\"" label))))))
2027 2193
2028(defun org-odt-format-entity-caption (label caption category) 2194(defun org-odt-format-entity-caption (label caption category)
2029 (or (and label 2195 (if (not (or label caption)) ""
2030 (apply 'org-odt-format-label-definition 2196 (apply 'org-odt-format-label-definition caption
2031 caption (org-odt-add-label-definition label category))) 2197 (org-odt-add-label-definition label category))))
2032 caption ""))
2033 2198
2034(defun org-odt-format-tags (tag text &rest args) 2199(defun org-odt-format-tags (tag text &rest args)
2035 (let ((prefix (when org-lparse-encode-pending "@")) 2200 (let ((prefix (when org-lparse-encode-pending "@"))
@@ -2054,6 +2219,9 @@ CATEGORY-HANDLE is used. See
2054 org-odt-embedded-images-count 0 2219 org-odt-embedded-images-count 0
2055 org-odt-embedded-formulas-count 0 2220 org-odt-embedded-formulas-count 0
2056 org-odt-entity-labels-alist nil 2221 org-odt-entity-labels-alist nil
2222 org-odt-list-stack-stashed nil
2223 org-odt-automatic-styles nil
2224 org-odt-object-counters nil
2057 org-odt-entity-counts-plist nil) 2225 org-odt-entity-counts-plist nil)
2058 content-file)) 2226 content-file))
2059 2227
@@ -2064,10 +2232,14 @@ component xml buffers before they are saved. Turn this off for
2064regular use. Turn this on if you need to examine the xml 2232regular use. Turn this on if you need to examine the xml
2065visually." 2233visually."
2066 :group 'org-export-odt 2234 :group 'org-export-odt
2235 :version "24.1"
2067 :type 'boolean) 2236 :type 'boolean)
2068 2237
2069(defvar hfy-user-sheet-assoc) ; bound during org-do-lparse 2238(defvar hfy-user-sheet-assoc) ; bound during org-do-lparse
2070(defun org-odt-save-as-outfile (target opt-plist) 2239(defun org-odt-save-as-outfile (target opt-plist)
2240 ;; write automatic styles
2241 (org-odt-write-automatic-styles)
2242
2071 ;; write meta file 2243 ;; write meta file
2072 (org-odt-update-meta-file opt-plist) 2244 (org-odt-update-meta-file opt-plist)
2073 2245
@@ -2183,21 +2355,21 @@ visually."
2183 xmlns:ooo=\"http://openoffice.org/2004/office\" 2355 xmlns:ooo=\"http://openoffice.org/2004/office\"
2184 office:version=\"1.2\"> 2356 office:version=\"1.2\">
2185 <office:meta>" "\n" 2357 <office:meta>" "\n"
2186 (org-odt-format-author) 2358 (org-odt-format-author)
2187 (org-odt-format-tags 2359 (org-odt-format-tags
2188 '("\n<meta:initial-creator>" . "</meta:initial-creator>") author) 2360 '("\n<meta:initial-creator>" . "</meta:initial-creator>") author)
2189 (org-odt-format-tags '("\n<dc:date>" . "</dc:date>") date) 2361 (org-odt-format-tags '("\n<dc:date>" . "</dc:date>") date)
2190 (org-odt-format-tags 2362 (org-odt-format-tags
2191 '("\n<meta:creation-date>" . "</meta:creation-date>") date) 2363 '("\n<meta:creation-date>" . "</meta:creation-date>") date)
2192 (org-odt-format-tags '("\n<meta:generator>" . "</meta:generator>") 2364 (org-odt-format-tags '("\n<meta:generator>" . "</meta:generator>")
2193 (when org-export-creator-info 2365 (when org-export-creator-info
2194 (format "Org-%s/Emacs-%s" 2366 (format "Org-%s/Emacs-%s"
2195 org-version emacs-version))) 2367 org-version emacs-version)))
2196 (org-odt-format-tags '("\n<meta:keyword>" . "</meta:keyword>") keywords) 2368 (org-odt-format-tags '("\n<meta:keyword>" . "</meta:keyword>") keywords)
2197 (org-odt-format-tags '("\n<dc:subject>" . "</dc:subject>") description) 2369 (org-odt-format-tags '("\n<dc:subject>" . "</dc:subject>") description)
2198 (org-odt-format-tags '("\n<dc:title>" . "</dc:title>") title) 2370 (org-odt-format-tags '("\n<dc:title>" . "</dc:title>") title)
2199 "\n" 2371 "\n"
2200 " </office:meta>" "</office:document-meta>") 2372 " </office:meta>" "</office:document-meta>")
2201 nil (expand-file-name "meta.xml"))) 2373 nil (expand-file-name "meta.xml")))
2202 2374
2203 ;; create a manifest entry for meta.xml 2375 ;; create a manifest entry for meta.xml
@@ -2256,23 +2428,19 @@ visually."
2256 (replace-match "")))) 2428 (replace-match ""))))
2257 2429
2258(defcustom org-export-odt-convert-processes 2430(defcustom org-export-odt-convert-processes
2259 '(("BasicODConverter" 2431 '(("LibreOffice"
2260 ("soffice" "-norestore" "-invisible" "-headless" 2432 "soffice --headless --convert-to %f%x --outdir %d %i")
2261 "\"macro:///BasicODConverter.Main.Convert(%I,%f,%O)\""))
2262 ("unoconv" 2433 ("unoconv"
2263 ("unoconv" "-f" "%f" "-o" "%d" "%i"))) 2434 "unoconv -f %f -o %d %i"))
2264 "Specify a list of document converters and their usage. 2435 "Specify a list of document converters and their usage.
2265The converters in this list are offered as choices while 2436The converters in this list are offered as choices while
2266customizing `org-export-odt-convert-process'. 2437customizing `org-export-odt-convert-process'.
2267 2438
2268This variable is an alist where each element is of the 2439This variable is a list where each element is of the
2269form (CONVERTER-NAME CONVERTER-PROCESS). CONVERTER-NAME is name 2440form (CONVERTER-NAME CONVERTER-CMD). CONVERTER-NAME is the name
2270of the converter. CONVERTER-PROCESS specifies the command-line 2441of the converter. CONVERTER-CMD is the shell command for the
2271syntax of the converter and is of the form (CONVERTER-PROGRAM 2442converter and can contain format specifiers. These format
2272ARG1 ARG2 ...). CONVERTER-PROGRAM is the name of the executable. 2443specifiers are interpreted as below:
2273ARG1, ARG2 etc are command line options that are passed to
2274CONVERTER-PROGRAM. Format specifiers can be used in the ARGs and
2275they are interpreted as below:
2276 2444
2277%i input file name in full 2445%i input file name in full
2278%I input file name as a URL 2446%I input file name as a URL
@@ -2280,21 +2448,23 @@ they are interpreted as below:
2280%o output file name in full 2448%o output file name in full
2281%O output file name as a URL 2449%O output file name as a URL
2282%d output dir in full 2450%d output dir in full
2283%D output dir as a URL." 2451%D output dir as a URL.
2452%x extra options as set in `org-export-odt-convert-capabilities'."
2284 :group 'org-export-odt 2453 :group 'org-export-odt
2454 :version "24.1"
2285 :type 2455 :type
2286 '(choice 2456 '(choice
2287 (const :tag "None" nil) 2457 (const :tag "None" nil)
2288 (alist :tag "Converters" 2458 (alist :tag "Converters"
2289 :key-type (string :tag "Converter Name") 2459 :key-type (string :tag "Converter Name")
2290 :value-type (group (cons (string :tag "Executable") 2460 :value-type (group (string :tag "Command line")))))
2291 (repeat (string :tag "Command line args")))))))
2292 2461
2293(defcustom org-export-odt-convert-process nil 2462(defcustom org-export-odt-convert-process "LibreOffice"
2294 "Use this converter to convert from \"odt\" format to other formats. 2463 "Use this converter to convert from \"odt\" format to other formats.
2295During customization, the list of converter names are populated 2464During customization, the list of converter names are populated
2296from `org-export-odt-convert-processes'." 2465from `org-export-odt-convert-processes'."
2297 :group 'org-export-odt 2466 :group 'org-export-odt
2467 :version "24.1"
2298 :type '(choice :convert-widget 2468 :type '(choice :convert-widget
2299 (lambda (w) 2469 (lambda (w)
2300 (apply 'widget-convert (widget-type w) 2470 (apply 'widget-convert (widget-type w)
@@ -2306,19 +2476,20 @@ from `org-export-odt-convert-processes'."
2306 2476
2307(defcustom org-export-odt-convert-capabilities 2477(defcustom org-export-odt-convert-capabilities
2308 '(("Text" 2478 '(("Text"
2309 ("odt" "ott" "doc" "rtf") 2479 ("odt" "ott" "doc" "rtf" "docx")
2310 (("pdf" "pdf") ("odt" "odt") ("xhtml" "html") ("rtf" "rtf") 2480 (("pdf" "pdf") ("odt" "odt") ("rtf" "rtf") ("ott" "ott")
2311 ("ott" "ott") ("doc" "doc") ("ooxml" "xml") ("html" "html"))) 2481 ("doc" "doc" ":\"MS Word 97\"") ("docx" "docx") ("html" "html")))
2312 ("Web" 2482 ("Web"
2313 ("html" "xhtml") (("pdf" "pdf") ("odt" "txt") ("html" "html"))) 2483 ("html")
2484 (("pdf" "pdf") ("odt" "odt") ("html" "html")))
2314 ("Spreadsheet" 2485 ("Spreadsheet"
2315 ("ods" "ots" "xls" "csv") 2486 ("ods" "ots" "xls" "csv" "xlsx")
2316 (("pdf" "pdf") ("ots" "ots") ("html" "html") ("csv" "csv") 2487 (("pdf" "pdf") ("ots" "ots") ("html" "html") ("csv" "csv") ("ods" "ods")
2317 ("ods" "ods") ("xls" "xls") ("xhtml" "xhtml") ("ooxml" "xml"))) 2488 ("xls" "xls") ("xlsx" "xlsx")))
2318 ("Presentation" 2489 ("Presentation"
2319 ("odp" "otp" "ppt") 2490 ("odp" "otp" "ppt" "pptx")
2320 (("pdf" "pdf") ("swf" "swf") ("odp" "odp") ("xhtml" "xml") 2491 (("pdf" "pdf") ("swf" "swf") ("odp" "odp") ("otp" "otp") ("ppt" "ppt")
2321 ("otp" "otp") ("ppt" "ppt") ("odg" "odg") ("html" "html")))) 2492 ("pptx" "pptx") ("odg" "odg"))))
2322 "Specify input and output formats of `org-export-odt-convert-process'. 2493 "Specify input and output formats of `org-export-odt-convert-process'.
2323More correctly, specify the set of input and output formats that 2494More correctly, specify the set of input and output formats that
2324the user is actually interested in. 2495the user is actually interested in.
@@ -2327,7 +2498,7 @@ This variable is an alist where each element is of the
2327form (DOCUMENT-CLASS INPUT-FMT-LIST OUTPUT-FMT-ALIST). 2498form (DOCUMENT-CLASS INPUT-FMT-LIST OUTPUT-FMT-ALIST).
2328INPUT-FMT-LIST is a list of INPUT-FMTs. OUTPUT-FMT-ALIST is an 2499INPUT-FMT-LIST is a list of INPUT-FMTs. OUTPUT-FMT-ALIST is an
2329alist where each element is of the form (OUTPUT-FMT 2500alist where each element is of the form (OUTPUT-FMT
2330OUTPUT-FILE-EXTENSION). 2501OUTPUT-FILE-EXTENSION EXTRA-OPTIONS).
2331 2502
2332The variable is interpreted as follows: 2503The variable is interpreted as follows:
2333`org-export-odt-convert-process' can take any document that is in 2504`org-export-odt-convert-process' can take any document that is in
@@ -2340,6 +2511,9 @@ serves dual purposes:
2340- It is used as the value of \"%f\" specifier in 2511- It is used as the value of \"%f\" specifier in
2341 `org-export-odt-convert-process'. 2512 `org-export-odt-convert-process'.
2342 2513
2514EXTRA-OPTIONS is used as the value of \"%x\" specifier in
2515`org-export-odt-convert-process'.
2516
2343DOCUMENT-CLASS is used to group a set of file formats in 2517DOCUMENT-CLASS is used to group a set of file formats in
2344INPUT-FMT-LIST in to a single class. 2518INPUT-FMT-LIST in to a single class.
2345 2519
@@ -2353,16 +2527,21 @@ with that class.
2353See default setting of this variable for an typical 2527See default setting of this variable for an typical
2354configuration." 2528configuration."
2355 :group 'org-export-odt 2529 :group 'org-export-odt
2530 :version "24.1"
2356 :type 2531 :type
2357 '(choice 2532 '(choice
2358 (const :tag "None" nil) 2533 (const :tag "None" nil)
2359 (alist :key-type (string :tag "Document Class") 2534 (alist :tag "Capabilities"
2535 :key-type (string :tag "Document Class")
2360 :value-type 2536 :value-type
2361 (group (repeat :tag "Input formats" (string :tag "Input format")) 2537 (group (repeat :tag "Input formats" (string :tag "Input format"))
2362 (alist :tag "Output formats" 2538 (alist :tag "Output formats"
2363 :key-type (string :tag "Output format") 2539 :key-type (string :tag "Output format")
2364 :value-type 2540 :value-type
2365 (group (string :tag "Output file extension"))))))) 2541 (group (string :tag "Output file extension")
2542 (choice
2543 (const :tag "None" nil)
2544 (string :tag "Extra options"))))))))
2366 2545
2367(declare-function org-create-math-formula "org" 2546(declare-function org-create-math-formula "org"
2368 (latex-frag &optional mathml-file)) 2547 (latex-frag &optional mathml-file))
@@ -2544,10 +2723,6 @@ Do this when translation to MathML fails."
2544 ;; create a manifest entry for styles.xml 2723 ;; create a manifest entry for styles.xml
2545 (org-odt-create-manifest-file-entry "text/xml" "styles.xml")) 2724 (org-odt-create-manifest-file-entry "text/xml" "styles.xml"))
2546 2725
2547(defvar org-export-odt-factory-settings
2548 "d4328fb9d1b6cb211d4320ff546829f26700dc5e"
2549 "SHA1 hash of OrgOdtStyles.xml.")
2550
2551(defun org-odt-configure-outline-numbering (level) 2726(defun org-odt-configure-outline-numbering (level)
2552 "Outline numbering is retained only upto LEVEL. 2727 "Outline numbering is retained only upto LEVEL.
2553To disable outline numbering pass a LEVEL of 0." 2728To disable outline numbering pass a LEVEL of 0."
@@ -2585,7 +2760,6 @@ non-nil."
2585 (or (file-name-nondirectory buffer-file-name))) 2760 (or (file-name-nondirectory buffer-file-name)))
2586 "." "odf") 2761 "." "odf")
2587 (file-name-directory buffer-file-name)))) 2762 (file-name-directory buffer-file-name))))
2588 (message "default val is %s" odf-filename)
2589 (read-file-name "ODF filename: " nil odf-filename nil 2763 (read-file-name "ODF filename: " nil odf-filename nil
2590 (file-name-nondirectory odf-filename))))) 2764 (file-name-nondirectory odf-filename)))))
2591 (let* ((org-lparse-backend 'odf) 2765 (let* ((org-lparse-backend 'odf)
@@ -2612,7 +2786,7 @@ non-nil."
2612 2786
2613;;;###autoload 2787;;;###autoload
2614(defun org-export-as-odf-and-open () 2788(defun org-export-as-odf-and-open ()
2615 "Export LaTeX fragment as OpenDocument formula and immediately open it. 2789 "Export LaTeX fragment as OpenDocument formula and immediately open it.
2616Use `org-export-as-odf' to read LaTeX fragment and OpenDocument 2790Use `org-export-as-odf' to read LaTeX fragment and OpenDocument
2617formula file." 2791formula file."
2618 (interactive) 2792 (interactive)
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index a79d4fcfbb2..6ffa86a1204 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -1,11 +1,12 @@
1;;; org-protocol.el --- Intercept calls from emacsclient to trigger custom actions. 1;;; org-protocol.el --- Intercept calls from emacsclient to trigger custom actions.
2 2;;
3;; Copyright (C) 2008-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2008-2012
4 4;; Free Software Foundation, Inc.
5;;
5;; Author: Bastien Guerry <bzg AT gnu DOT org> 6;; Author: Bastien Guerry <bzg AT gnu DOT org>
6;; Daniel M German <dmg AT uvic DOT org> 7;; Author: Daniel M German <dmg AT uvic DOT org>
7;; Sebastian Rose <sebastian_rose AT gmx DOT de> 8;; Author: Sebastian Rose <sebastian_rose AT gmx DOT de>
8;; Ross Patterson <me AT rpatterson DOT net> 9;; Author: Ross Patterson <me AT rpatterson DOT net>
9;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> 10;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de>
10;; Keywords: org, emacsclient, wp 11;; Keywords: org, emacsclient, wp
11 12
diff --git a/lisp/org/org-special-blocks.el b/lisp/org/org-special-blocks.el
index fc882a33396..d7dad8854ca 100644
--- a/lisp/org/org-special-blocks.el
+++ b/lisp/org/org-special-blocks.el
@@ -79,17 +79,17 @@ seen. This is run after a few special cases are taken care of."
79(add-hook 'org-export-latex-after-blockquotes-hook 79(add-hook 'org-export-latex-after-blockquotes-hook
80 'org-special-blocks-convert-latex-special-cookies) 80 'org-special-blocks-convert-latex-special-cookies)
81 81
82(defvar line) 82(defvar org-special-blocks-line)
83(defun org-special-blocks-convert-html-special-cookies () 83(defun org-special-blocks-convert-html-special-cookies ()
84 "Converts the special cookies into div blocks." 84 "Converts the special cookies into div blocks."
85 ;; Uses the dynamically-bound variable `line'. 85 ;; Uses the dynamically-bound variable `org-special-blocks-line'.
86 (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line) 86 (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" org-special-blocks-line)
87 (message "%s" (match-string 1)) 87 (message "%s" (match-string 1))
88 (when (equal (match-string 2 line) "START") 88 (when (equal (match-string 2 org-special-blocks-line) "START")
89 (org-close-par-maybe) 89 (org-close-par-maybe)
90 (insert "\n<div class=\"" (match-string 1 line) "\">") 90 (insert "\n<div class=\"" (match-string 1 org-special-blocks-line) "\">")
91 (org-open-par)) 91 (org-open-par))
92 (when (equal (match-string 2 line) "END") 92 (when (equal (match-string 2 org-special-blocks-line) "END")
93 (org-close-par-maybe) 93 (org-close-par-maybe)
94 (insert "\n</div>") 94 (insert "\n</div>")
95 (org-open-par)) 95 (org-open-par))
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index ac574ed4dd2..0a67d79f211 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -43,6 +43,8 @@
43(declare-function org-switch-to-buffer-other-window "org" (&rest args)) 43(declare-function org-switch-to-buffer-other-window "org" (&rest args))
44(declare-function org-pop-to-buffer-same-window 44(declare-function org-pop-to-buffer-same-window
45 "org-compat" (&optional buffer-or-name norecord label)) 45 "org-compat" (&optional buffer-or-name norecord label))
46(declare-function org-strip-protective-commas "org" (beg end))
47(declare-function org-base-buffer "org" (buffer))
46 48
47(defcustom org-edit-src-region-extra nil 49(defcustom org-edit-src-region-extra nil
48 "Additional regexps to identify regions for editing with `org-edit-src-code'. 50 "Additional regexps to identify regions for editing with `org-edit-src-code'.
@@ -153,7 +155,8 @@ but which mess up the display of a snippet in Org exported files.")
153(defcustom org-src-lang-modes 155(defcustom org-src-lang-modes
154 '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) 156 '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist)
155 ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql) 157 ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql)
156 ("calc" . fundamental) ("C" . c) ("cpp" . c++)) 158 ("calc" . fundamental) ("C" . c) ("cpp" . c++)
159 ("screen" . shell-script))
157 "Alist mapping languages to their major mode. 160 "Alist mapping languages to their major mode.
158The key is the language name, the value is the string that should 161The key is the language name, the value is the string that should
159be inserted as the name of the major mode. For many languages this is 162be inserted as the name of the major mode. For many languages this is
@@ -211,16 +214,16 @@ buffer."
211 (interactive) 214 (interactive)
212 (unless (eq context 'save) 215 (unless (eq context 'save)
213 (setq org-edit-src-saved-temp-window-config (current-window-configuration))) 216 (setq org-edit-src-saved-temp-window-config (current-window-configuration)))
214 (let ((mark (and (org-region-active-p) (mark))) 217 (let* ((mark (and (org-region-active-p) (mark)))
215 (case-fold-search t) 218 (case-fold-search t)
216 (info (org-edit-src-find-region-and-lang)) 219 (info (org-edit-src-find-region-and-lang))
217 (full-info (org-babel-get-src-block-info)) 220 (full-info (org-babel-get-src-block-info 'light))
218 (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive 221 (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive
219 (beg (make-marker)) 222 (beg (make-marker))
220 (end (make-marker)) 223 (end (make-marker))
221 (allow-write-back-p (null code)) 224 (allow-write-back-p (null code))
222 block-nindent total-nindent ovl lang lang-f single lfmt buffer msg 225 block-nindent total-nindent ovl lang lang-f single lfmt buffer msg
223 begline markline markcol line col transmitted-variables) 226 begline markline markcol line col transmitted-variables)
224 (if (not info) 227 (if (not info)
225 nil 228 nil
226 (setq beg (move-marker beg (nth 0 info)) 229 (setq beg (move-marker beg (nth 0 info))
@@ -306,11 +309,13 @@ buffer."
306 (error "Language mode `%s' fails with: %S" lang-f (nth 1 e))))) 309 (error "Language mode `%s' fails with: %S" lang-f (nth 1 e)))))
307 (dolist (pair transmitted-variables) 310 (dolist (pair transmitted-variables)
308 (org-set-local (car pair) (cadr pair))) 311 (org-set-local (car pair) (cadr pair)))
309 (when (eq major-mode 'org-mode) 312 (if (eq major-mode 'org-mode)
310 (goto-char (point-min)) 313 (progn
311 (while (re-search-forward "^," nil t) 314 (goto-char (point-min))
312 (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) 315 (while (re-search-forward "^," nil t)
313 (replace-match ""))) 316 (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent)))
317 (replace-match "")))
318 (org-strip-protective-commas (point-min) (point-max)))
314 (when markline 319 (when markline
315 (org-goto-line (1+ (- markline begline))) 320 (org-goto-line (1+ (- markline begline)))
316 (org-move-to-column 321 (org-move-to-column
@@ -369,6 +374,15 @@ buffer."
369 "Construct the buffer name for a source editing buffer." 374 "Construct the buffer name for a source editing buffer."
370 (concat "*Org Src " org-buffer-name "[ " lang " ]*")) 375 (concat "*Org Src " org-buffer-name "[ " lang " ]*"))
371 376
377(defun org-src-edit-buffer-p (&optional buffer)
378 "Test whether BUFFER (or the current buffer if BUFFER is nil)
379is a source block editing buffer."
380 (let ((buffer (org-base-buffer (or buffer (current-buffer)))))
381 (and (buffer-name buffer)
382 (string-match "\\`*Org Src " (buffer-name buffer))
383 (local-variable-p 'org-edit-src-beg-marker buffer)
384 (local-variable-p 'org-edit-src-end-marker buffer))))
385
372(defun org-edit-src-find-buffer (beg end) 386(defun org-edit-src-find-buffer (beg end)
373 "Find a source editing buffer that is already editing the region BEG to END." 387 "Find a source editing buffer that is already editing the region BEG to END."
374 (catch 'exit 388 (catch 'exit
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index 0d2a2e6a973..9018bb4043b 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -1299,7 +1299,7 @@ However, when FORCE is non-nil, create new columns if necessary."
1299(defun org-table-line-to-dline (line &optional above) 1299(defun org-table-line-to-dline (line &optional above)
1300 "Turn a buffer line number into a data line number. 1300 "Turn a buffer line number into a data line number.
1301If there is no data line in this line, return nil. 1301If there is no data line in this line, return nil.
1302If there is no matching dline (most likely the reference was a hline), the 1302If there is no matching dline (most likely te reference was a hline), the
1303first dline below it is used. When ABOVE is non-nil, the one above is used." 1303first dline below it is used. When ABOVE is non-nil, the one above is used."
1304 (catch 'exit 1304 (catch 'exit
1305 (let ((ll (length org-table-dlines)) 1305 (let ((ll (length org-table-dlines))
@@ -2364,7 +2364,7 @@ of the new mark."
2364 (looking-at org-table-auto-recalculate-regexp)) 2364 (looking-at org-table-auto-recalculate-regexp))
2365 (org-table-recalculate) t)) 2365 (org-table-recalculate) t))
2366 2366
2367(defvar modes) 2367(defvar org-table-modes)
2368(defsubst org-set-calc-mode (var &optional value) 2368(defsubst org-set-calc-mode (var &optional value)
2369 (if (stringp var) 2369 (if (stringp var)
2370 (setq var (assoc var '(("D" calc-angle-mode deg) 2370 (setq var (assoc var '(("D" calc-angle-mode deg)
@@ -2372,10 +2372,10 @@ of the new mark."
2372 ("F" calc-prefer-frac t) 2372 ("F" calc-prefer-frac t)
2373 ("S" calc-symbolic-mode t))) 2373 ("S" calc-symbolic-mode t)))
2374 value (nth 2 var) var (nth 1 var))) 2374 value (nth 2 var) var (nth 1 var)))
2375 (if (memq var modes) 2375 (if (memq var org-table-modes)
2376 (setcar (cdr (memq var modes)) value) 2376 (setcar (cdr (memq var org-table-modes)) value)
2377 (cons var (cons value modes))) 2377 (cons var (cons value org-table-modes)))
2378 modes) 2378 org-table-modes)
2379 2379
2380(defun org-table-eval-formula (&optional arg equation 2380(defun org-table-eval-formula (&optional arg equation
2381 suppress-align suppress-const 2381 suppress-align suppress-const
@@ -2931,7 +2931,7 @@ known that the table will be realigned a little later anyway."
2931 2931
2932(defun org-table-iterate (&optional arg) 2932(defun org-table-iterate (&optional arg)
2933 "Recalculate the table until it does not change anymore. 2933 "Recalculate the table until it does not change anymore.
2934The maximum number of iterations is 10, but you can choose a different value 2934The maximun number of iterations is 10, but you can choose a different value
2935with the prefix ARG." 2935with the prefix ARG."
2936 (interactive "P") 2936 (interactive "P")
2937 (let ((imax (if arg (prefix-numeric-value arg) 10)) 2937 (let ((imax (if arg (prefix-numeric-value arg) 10))
@@ -4154,7 +4154,7 @@ overwritten, and the table is not marked as requiring realignment."
4154 (looking-at "[^|\n]* +|")) 4154 (looking-at "[^|\n]* +|"))
4155 (let (org-table-may-need-update) 4155 (let (org-table-may-need-update)
4156 (goto-char (1- (match-end 0))) 4156 (goto-char (1- (match-end 0)))
4157 (delete-char -1) 4157 (backward-delete-char 1)
4158 (goto-char (match-beginning 0)) 4158 (goto-char (match-beginning 0))
4159 (self-insert-command N)) 4159 (self-insert-command N))
4160 (setq org-table-may-need-update t) 4160 (setq org-table-may-need-update t)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 57d2c96514e..85d8d1efb18 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -6,7 +6,7 @@
6;; Maintainer: Bastien Guerry <bzg at gnu dot org> 6;; Maintainer: Bastien Guerry <bzg at gnu dot org>
7;; Keywords: outlines, hypermedia, calendar, wp 7;; Keywords: outlines, hypermedia, calendar, wp
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9;; Version: 7.8.03 9;; Version: 7.8.07
10;; 10;;
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12;; 12;;
@@ -75,6 +75,7 @@
75 (require 'gnus-sum)) 75 (require 'gnus-sum))
76 76
77(require 'calendar) 77(require 'calendar)
78(require 'format-spec)
78 79
79;; Emacs 22 calendar compatibility: Make sure the new variables are available 80;; Emacs 22 calendar compatibility: Make sure the new variables are available
80(when (fboundp 'defvaralias) 81(when (fboundp 'defvaralias)
@@ -203,9 +204,10 @@ identifier."
203 204
204;;; Version 205;;; Version
205 206
206(defconst org-version "7.8.03" 207(defconst org-version "7.8.07"
207 "The version number of the file org.el.") 208 "The version number of the file org.el.")
208 209
210;;;###autoload
209(defun org-version (&optional here) 211(defun org-version (&optional here)
210 "Show the org-mode version in the echo area. 212 "Show the org-mode version in the echo area.
211With prefix arg HERE, insert it at point." 213With prefix arg HERE, insert it at point."
@@ -2246,10 +2248,7 @@ TODO state changes
2246Also, if a parent has an :ORDERED: property, switching an entry to DONE will 2248Also, if a parent has an :ORDERED: property, switching an entry to DONE will
2247be blocked if any prior sibling is not yet done. 2249be blocked if any prior sibling is not yet done.
2248Finally, if the parent is blocked because of ordered siblings of its own, 2250Finally, if the parent is blocked because of ordered siblings of its own,
2249the child will also be blocked. 2251the child will also be blocked."
2250This variable needs to be set before org.el is loaded, and you need to
2251restart Emacs after a change to make the change effective. The only way
2252to change is while Emacs is running is through the customize interface."
2253 :set (lambda (var val) 2252 :set (lambda (var val)
2254 (set var val) 2253 (set var val)
2255 (if val 2254 (if val
@@ -4446,12 +4445,13 @@ means to push this value onto the list in the variable.")
4446 4445
4447(defun org-update-property-plist (key val props) 4446(defun org-update-property-plist (key val props)
4448 "Update PROPS with KEY and VAL." 4447 "Update PROPS with KEY and VAL."
4449 (if (string= "+" (substring key (- (length key) 1))) 4448 (let* ((appending (string= "+" (substring key (- (length key) 1))))
4450 (let* ((key (substring key 0 (- (length key) 1))) 4449 (key (if appending (substring key 0 (- (length key) 1)) key))
4451 (previous (cdr (assoc key props)))) 4450 (remainder (org-remove-if (lambda (p) (string= (car p) key)) props))
4452 (cons (cons key (concat previous " " val)) 4451 (previous (cdr (assoc key props))))
4453 (org-remove-if (lambda (p) (string= (car p) key)) props))) 4452 (if appending
4454 (cons (cons key val) props))) 4453 (cons (cons key (if previous (concat previous " " val) val)) remainder)
4454 (cons (cons key val) remainder))))
4455 4455
4456(defconst org-block-regexp 4456(defconst org-block-regexp
4457 "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" 4457 "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$"
@@ -4841,8 +4841,8 @@ This is for getting out of special buffers like remember.")
4841 4841
4842;; FIXME: Occasionally check by commenting these, to make sure 4842;; FIXME: Occasionally check by commenting these, to make sure
4843;; no other functions uses these, forgetting to let-bind them. 4843;; no other functions uses these, forgetting to let-bind them.
4844(defvar entry) 4844(defvar org-entry)
4845(defvar last-state) 4845(defvar org-last-state)
4846(defvar date) 4846(defvar date)
4847 4847
4848;; Defined somewhere in this file, but used before definition. 4848;; Defined somewhere in this file, but used before definition.
@@ -4892,6 +4892,8 @@ sure that we are at the beginning of the line.")
4892 "Matches an headline, putting stars and text into groups. 4892 "Matches an headline, putting stars and text into groups.
4893Stars are put in group 1 and the trimmed body in group 2.") 4893Stars are put in group 1 and the trimmed body in group 2.")
4894 4894
4895(defvar buffer-face-mode-face)
4896
4895;;;###autoload 4897;;;###autoload
4896(define-derived-mode org-mode outline-mode "Org" 4898(define-derived-mode org-mode outline-mode "Org"
4897 "Outline-based notes management and organizer, alias 4899 "Outline-based notes management and organizer, alias
@@ -5025,8 +5027,9 @@ The following commands are available:
5025 (set (make-local-variable 'pcomplete-parse-arguments-function) 5027 (set (make-local-variable 'pcomplete-parse-arguments-function)
5026 'org-parse-arguments) 5028 'org-parse-arguments)
5027 (set (make-local-variable 'pcomplete-termination-string) "") 5029 (set (make-local-variable 'pcomplete-termination-string) "")
5028 (set (make-local-variable 'face-remapping-alist) 5030 (when (>= emacs-major-version 23)
5029 '((default org-default))) 5031 (set (make-local-variable 'buffer-face-mode-face) 'org-default)
5032 (buffer-face-mode))
5030 5033
5031 ;; If empty file that did not turn on org-mode automatically, make it to. 5034 ;; If empty file that did not turn on org-mode automatically, make it to.
5032 (if (and org-insert-mode-line-in-empty-file 5035 (if (and org-insert-mode-line-in-empty-file
@@ -5459,6 +5462,22 @@ will be prompted for."
5459 '(font-lock-fontified t face font-lock-comment-face))) 5462 '(font-lock-fontified t face font-lock-comment-face)))
5460 (t nil)))))) 5463 (t nil))))))
5461 5464
5465(defun org-strip-protective-commas (beg end)
5466 "Strip protective commas between BEG and END in the current buffer."
5467 (interactive "r")
5468 (save-excursion
5469 (save-match-data
5470 (goto-char beg)
5471 (let ((front-line (save-excursion
5472 (re-search-forward
5473 "[^[:space:]]" end t)
5474 (goto-char (match-beginning 0))
5475 (current-column))))
5476 (while (re-search-forward "^[ \t]*\\(,\\)\\([*]\\|#\\+\\)" end t)
5477 (goto-char (match-beginning 1))
5478 (when (= (current-column) front-line)
5479 (replace-match "" nil nil nil 1)))))))
5480
5462(defun org-activate-angle-links (limit) 5481(defun org-activate-angle-links (limit)
5463 "Run through the buffer and add overlays to links." 5482 "Run through the buffer and add overlays to links."
5464 (if (re-search-forward org-angle-link-re limit t) 5483 (if (re-search-forward org-angle-link-re limit t)
@@ -5791,7 +5810,7 @@ needs to be inserted at a specific position in the font-lock sequence.")
5791 (if org-fontify-done-headline 5810 (if org-fontify-done-headline
5792 (list (format org-heading-keyword-regexp-format 5811 (list (format org-heading-keyword-regexp-format
5793 (concat 5812 (concat
5794 "\\(" 5813 "\\(?:"
5795 (mapconcat 'regexp-quote org-done-keywords "\\|") 5814 (mapconcat 'regexp-quote org-done-keywords "\\|")
5796 "\\)")) 5815 "\\)"))
5797 '(2 'org-headline-done t)) 5816 '(2 'org-headline-done t))
@@ -6295,7 +6314,12 @@ in special contexts.
6295 (if (org-at-item-p) 6314 (if (org-at-item-p)
6296 (org-list-set-item-visibility (point-at-bol) struct 'children) 6315 (org-list-set-item-visibility (point-at-bol) struct 'children)
6297 (org-show-entry) 6316 (org-show-entry)
6298 (show-children) 6317 (org-with-limited-levels (show-children))
6318 ;; FIXME: This slows down the func way too much.
6319 ;; How keep drawers hidden in subtree anyway?
6320 ;; (when (memq 'org-cycle-hide-drawers org-cycle-hook)
6321 ;; (org-cycle-hide-drawers 'subtree))
6322
6299 ;; Fold every list in subtree to top-level items. 6323 ;; Fold every list in subtree to top-level items.
6300 (when (eq org-cycle-include-plain-lists 'integrate) 6324 (when (eq org-cycle-include-plain-lists 'integrate)
6301 (save-excursion 6325 (save-excursion
@@ -6786,7 +6810,7 @@ This command works around this by showing a copy of the current buffer
6786in an indirect buffer, in overview mode. You can dive into the tree in 6810in an indirect buffer, in overview mode. You can dive into the tree in
6787that copy, use org-occur and incremental search to find a location. 6811that copy, use org-occur and incremental search to find a location.
6788When pressing RET or `Q', the command returns to the original buffer in 6812When pressing RET or `Q', the command returns to the original buffer in
6789which the visibility is still unchanged. After RET is will also jump to 6813which the visibility is still unchanged. After RET it will also jump to
6790the location selected in the indirect buffer and expose the headline 6814the location selected in the indirect buffer and expose the headline
6791hierarchy above." 6815hierarchy above."
6792 (interactive "P") 6816 (interactive "P")
@@ -6803,7 +6827,7 @@ hierarchy above."
6803 (selected-point 6827 (selected-point
6804 (if (eq interface 'outline) 6828 (if (eq interface 'outline)
6805 (car (org-get-location (current-buffer) org-goto-help)) 6829 (car (org-get-location (current-buffer) org-goto-help))
6806 (let ((pa (org-refile-get-location "Goto"))) 6830 (let ((pa (org-refile-get-location "Goto" nil nil t)))
6807 (org-refile-check-position pa) 6831 (org-refile-check-position pa)
6808 (nth 3 pa))))) 6832 (nth 3 pa)))))
6809 (if selected-point 6833 (if selected-point
@@ -7890,7 +7914,7 @@ the following will happen:
7890 repeater intact. 7914 repeater intact.
7891- the start days in the repeater in the original entry will be shifted 7915- the start days in the repeater in the original entry will be shifted
7892 to past the last clone. 7916 to past the last clone.
7893I this way you can spell out a number of instances of a repeating task, 7917In this way you can spell out a number of instances of a repeating task,
7894and still retain the repeater to cover future instances of the task." 7918and still retain the repeater to cover future instances of the task."
7895 (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ") 7919 (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ")
7896 (let (beg end template task idprop 7920 (let (beg end template task idprop
@@ -7917,7 +7941,7 @@ and still retain the repeater to cover future instances of the task."
7917 (setq end (point)) 7941 (setq end (point))
7918 (setq template (buffer-substring beg end)) 7942 (setq template (buffer-substring beg end))
7919 (when (and doshift 7943 (when (and doshift
7920 (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) 7944 (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[dwmy][^<>\n]*>" template))
7921 (delete-region beg end) 7945 (delete-region beg end)
7922 (setq end beg) 7946 (setq end beg)
7923 (setq nmin 0 nmax (1+ nmax) n-no-remove nmax)) 7947 (setq nmin 0 nmax (1+ nmax) n-no-remove nmax))
@@ -7948,7 +7972,7 @@ and still retain the repeater to cover future instances of the task."
7948 (while (re-search-forward org-ts-regexp nil t) 7972 (while (re-search-forward org-ts-regexp nil t)
7949 (save-excursion 7973 (save-excursion
7950 (goto-char (match-beginning 0)) 7974 (goto-char (match-beginning 0))
7951 (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)") 7975 (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\)")
7952 (delete-region (match-beginning 1) (match-end 1))))))) 7976 (delete-region (match-beginning 1) (match-end 1)))))))
7953 (setq task (buffer-string))) 7977 (setq task (buffer-string)))
7954 (insert task)) 7978 (insert task))
@@ -7958,8 +7982,7 @@ and still retain the repeater to cover future instances of the task."
7958 7982
7959(defun org-sort (with-case) 7983(defun org-sort (with-case)
7960 "Call `org-sort-entries', `org-table-sort-lines' or `org-sort-list'. 7984 "Call `org-sort-entries', `org-table-sort-lines' or `org-sort-list'.
7961Optional argument WITH-CASE means sort case-sensitively. 7985Optional argument WITH-CASE means sort case-sensitively."
7962With a double prefix argument, also remove duplicate entries."
7963 (interactive "P") 7986 (interactive "P")
7964 (cond 7987 (cond
7965 ((org-at-table-p) (org-call-with-arg 'org-table-sort-lines with-case)) 7988 ((org-at-table-p) (org-call-with-arg 'org-table-sort-lines with-case))
@@ -8477,11 +8500,12 @@ call CMD."
8477 8500
8478(defun org-get-category (&optional pos force-refresh) 8501(defun org-get-category (&optional pos force-refresh)
8479 "Get the category applying to position POS." 8502 "Get the category applying to position POS."
8480 (if force-refresh (org-refresh-category-properties)) 8503 (save-match-data
8481 (let ((pos (or pos (point)))) 8504 (if force-refresh (org-refresh-category-properties))
8482 (or (get-text-property pos 'org-category) 8505 (let ((pos (or pos (point))))
8483 (progn (org-refresh-category-properties) 8506 (or (get-text-property pos 'org-category)
8484 (get-text-property pos 'org-category))))) 8507 (progn (org-refresh-category-properties)
8508 (get-text-property pos 'org-category))))))
8485 8509
8486(defun org-refresh-category-properties () 8510(defun org-refresh-category-properties ()
8487 "Refresh category text properties in the buffer." 8511 "Refresh category text properties in the buffer."
@@ -8625,7 +8649,7 @@ For file links, arg negates `org-context-in-file-links'."
8625 (setq link (plist-get org-store-link-plist :link) 8649 (setq link (plist-get org-store-link-plist :link)
8626 desc (or (plist-get org-store-link-plist :description) link))) 8650 desc (or (plist-get org-store-link-plist :description) link)))
8627 8651
8628 ((equal (buffer-name) "*Org Edit Src Example*") 8652 ((org-src-edit-buffer-p)
8629 (let (label gc) 8653 (let (label gc)
8630 (while (or (not label) 8654 (while (or (not label)
8631 (save-excursion 8655 (save-excursion
@@ -9439,7 +9463,7 @@ Org-mode syntax."
9439 (interactive "sLink: \nP") 9463 (interactive "sLink: \nP")
9440 (let ((reference-buffer (or reference-buffer (current-buffer)))) 9464 (let ((reference-buffer (or reference-buffer (current-buffer))))
9441 (with-temp-buffer 9465 (with-temp-buffer
9442 (let ((org-inhibit-startup t)) 9466 (let ((org-inhibit-startup (not reference-buffer)))
9443 (org-mode) 9467 (org-mode)
9444 (insert s) 9468 (insert s)
9445 (goto-char (point-min)) 9469 (goto-char (point-min))
@@ -10358,8 +10382,8 @@ on the system \"/user@host:\"."
10358 targets tgs txt re files f desc descre fast-path-p level pos0) 10382 targets tgs txt re files f desc descre fast-path-p level pos0)
10359 (message "Getting targets...") 10383 (message "Getting targets...")
10360 (with-current-buffer (or default-buffer (current-buffer)) 10384 (with-current-buffer (or default-buffer (current-buffer))
10361 (while (setq entry (pop entries)) 10385 (while (setq org-entry (pop entries))
10362 (setq files (car entry) desc (cdr entry)) 10386 (setq files (car org-entry) desc (cdr org-entry))
10363 (setq fast-path-p nil) 10387 (setq fast-path-p nil)
10364 (cond 10388 (cond
10365 ((null files) (setq files (list (current-buffer)))) 10389 ((null files) (setq files (list (current-buffer))))
@@ -10621,7 +10645,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
10621 (t (concat "Refile subtree \"" 10645 (t (concat "Refile subtree \""
10622 heading-text "\" to"))) 10646 heading-text "\" to")))
10623 default-buffer 10647 default-buffer
10624 org-refile-allow-creating-parent-nodes 10648 (and (not (equal '(4) goto))
10649 org-refile-allow-creating-parent-nodes)
10625 goto)))))) 10650 goto))))))
10626 (setq file (nth 1 it) 10651 (setq file (nth 1 it)
10627 re (nth 2 it) 10652 re (nth 2 it)
@@ -11028,11 +11053,11 @@ This function can be used in a hook."
11028 "<example>\n?\n</example>") 11053 "<example>\n?\n</example>")
11029 ("q" "#+begin_quote\n?\n#+end_quote" 11054 ("q" "#+begin_quote\n?\n#+end_quote"
11030 "<quote>\n?\n</quote>") 11055 "<quote>\n?\n</quote>")
11031 ("v" "#+begin_verse\n?\n#+end_verse" 11056 ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE"
11032 "<verse>\n?\n/verse>") 11057 "<verse>\n?\n</verse>")
11033 ("c" "#+begin_center\n?\n#+end_center" 11058 ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER"
11034 "<center>\n?\n/center>") 11059 "<center>\n?\n</center>")
11035 ("l" "#+begin_latex\n?\n#+end_latex" 11060 ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX"
11036 "<literal style=\"latex\">\n?\n</literal>") 11061 "<literal style=\"latex\">\n?\n</literal>")
11037 ("L" "#+latex: " 11062 ("L" "#+latex: "
11038 "<literal style=\"latex\">?</literal>") 11063 "<literal style=\"latex\">?</literal>")
@@ -11847,7 +11872,7 @@ of repeating deadline/scheduled time stamps to new date.
11847This function is run automatically after each state change to a DONE state." 11872This function is run automatically after each state change to a DONE state."
11848 ;; last-state is dynamically scoped into this function 11873 ;; last-state is dynamically scoped into this function
11849 (let* ((repeat (org-get-repeat)) 11874 (let* ((repeat (org-get-repeat))
11850 (aa (assoc last-state org-todo-kwd-alist)) 11875 (aa (assoc org-last-state org-todo-kwd-alist))
11851 (interpret (nth 1 aa)) 11876 (interpret (nth 1 aa))
11852 (head (nth 2 aa)) 11877 (head (nth 2 aa))
11853 (whata '(("d" . day) ("m" . month) ("y" . year))) 11878 (whata '(("d" . day) ("m" . month) ("y" . year)))
@@ -11860,7 +11885,7 @@ This function is run automatically after each state change to a DONE state."
11860 (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE") 11885 (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE")
11861 org-todo-repeat-to-state)) 11886 org-todo-repeat-to-state))
11862 (unless (and to-state (member to-state org-todo-keywords-1)) 11887 (unless (and to-state (member to-state org-todo-keywords-1))
11863 (setq to-state (if (eq interpret 'type) last-state head))) 11888 (setq to-state (if (eq interpret 'type) org-last-state head)))
11864 (org-todo to-state) 11889 (org-todo to-state)
11865 (when (or org-log-repeat (org-entry-get nil "CLOCK")) 11890 (when (or org-log-repeat (org-entry-get nil "CLOCK"))
11866 (org-entry-put nil "LAST_REPEAT" (format-time-string 11891 (org-entry-put nil "LAST_REPEAT" (format-time-string
@@ -11874,7 +11899,7 @@ This function is run automatically after each state change to a DONE state."
11874 (setq org-log-note-how 'note)) 11899 (setq org-log-note-how 'note))
11875 ;; Set up for taking a record 11900 ;; Set up for taking a record
11876 (org-add-log-setup 'state (or done-word (car org-done-keywords)) 11901 (org-add-log-setup 'state (or done-word (car org-done-keywords))
11877 last-state 11902 org-last-state
11878 'findpos org-log-repeat))) 11903 'findpos org-log-repeat)))
11879 (org-back-to-heading t) 11904 (org-back-to-heading t)
11880 (org-add-planning-info nil nil 'closed) 11905 (org-add-planning-info nil nil 'closed)
@@ -12742,7 +12767,7 @@ obtain a list of properties. Building the tags list for each entry in such
12742a file becomes an N^2 operation - but with this variable set, it scales 12767a file becomes an N^2 operation - but with this variable set, it scales
12743as N.") 12768as N.")
12744 12769
12745(defun org-scan-tags (action matcher &optional todo-only start-level) 12770(defun org-scan-tags (action matcher todo-only &optional start-level)
12746 "Scan headline tags with inheritance and produce output ACTION. 12771 "Scan headline tags with inheritance and produce output ACTION.
12747 12772
12748ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, 12773ACTION can be `sparse-tree' to produce a sparse tree in the current buffer,
@@ -12752,7 +12777,9 @@ this case the return value is a list of all return values from these calls.
12752 12777
12753MATCHER is a Lisp form to be evaluated, testing if a given set of tags 12778MATCHER is a Lisp form to be evaluated, testing if a given set of tags
12754qualifies a headline for inclusion. When TODO-ONLY is non-nil, 12779qualifies a headline for inclusion. When TODO-ONLY is non-nil,
12755only lines with a TODO keyword are included in the output. 12780only lines with a not-done TODO keyword are included in the output.
12781This should be the same variable that was scoped into
12782and set by `org-make-tags-matcher' when it constructed MATCHER.
12756 12783
12757START-LEVEL can be a string with asterisks, reducing the scope to 12784START-LEVEL can be a string with asterisks, reducing the scope to
12758headlines matching this string." 12785headlines matching this string."
@@ -12861,7 +12888,7 @@ headlines matching this string."
12861 (and org-highlight-sparse-tree-matches 12888 (and org-highlight-sparse-tree-matches
12862 (org-get-heading) (match-end 0) 12889 (org-get-heading) (match-end 0)
12863 (org-highlight-new-match 12890 (org-highlight-new-match
12864 (match-beginning 0) (match-beginning 1))) 12891 (match-beginning 1) (match-end 1)))
12865 (org-show-context 'tags-tree)) 12892 (org-show-context 'tags-tree))
12866 ((eq action 'agenda) 12893 ((eq action 'agenda)
12867 (setq txt (org-agenda-format-item 12894 (setq txt (org-agenda-format-item
@@ -12922,8 +12949,6 @@ headlines matching this string."
12922 (if (member x org-use-tag-inheritance) x nil)) 12949 (if (member x org-use-tag-inheritance) x nil))
12923 tags))))) 12950 tags)))))
12924 12951
12925(defvar todo-only) ;; dynamically scoped
12926
12927(defun org-match-sparse-tree (&optional todo-only match) 12952(defun org-match-sparse-tree (&optional todo-only match)
12928 "Create a sparse tree according to tags string MATCH. 12953 "Create a sparse tree according to tags string MATCH.
12929MATCH can contain positive and negative selection of tags, like 12954MATCH can contain positive and negative selection of tags, like
@@ -12970,9 +12995,29 @@ instead of the agenda files."
12970 (org-agenda-files)))))))) 12995 (org-agenda-files))))))))
12971 12996
12972(defun org-make-tags-matcher (match) 12997(defun org-make-tags-matcher (match)
12973 "Create the TAGS/TODO matcher form for the selection string MATCH." 12998 "Create the TAGS/TODO matcher form for the selection string MATCH.
12974 ;; todo-only is scoped dynamically into this function, and the function 12999
12975 ;; may change it if the matcher asks for it. 13000The variable `todo-only' is scoped dynamically into this function; it will be
13001set to t if the matcher restricts matching to TODO entries,
13002otherwise will not be touched.
13003
13004Returns a cons of the selection string MATCH and the constructed
13005lisp form implementing the matcher. The matcher is to be
13006evaluated at an Org entry, with point on the headline,
13007and returns t if the entry matches the
13008selection string MATCH. The returned lisp form references
13009two variables with information about the entry, which must be
13010bound around the form's evaluation: todo, the TODO keyword at the
13011entry (or nil of none); and tags-list, the list of all tags at the
13012entry including inherited ones. Additionally, the category
13013of the entry (if any) must be specified as the text property
13014'org-category on the headline.
13015
13016See also `org-scan-tags'.
13017"
13018 (declare (special todo-only))
13019 (unless (boundp 'todo-only)
13020 (error "org-make-tags-matcher expects todo-only to be scoped in"))
12976 (unless match 13021 (unless match
12977 ;; Get a new match request, with completion 13022 ;; Get a new match request, with completion
12978 (let ((org-last-tags-completion-table 13023 (let ((org-last-tags-completion-table
@@ -13089,6 +13134,9 @@ instead of the agenda files."
13089 (setq matcher (if todomatcher 13134 (setq matcher (if todomatcher
13090 (list 'and tagsmatcher todomatcher) 13135 (list 'and tagsmatcher todomatcher)
13091 tagsmatcher)) 13136 tagsmatcher))
13137 (when todo-only
13138 (setq matcher (list 'and '(member todo org-not-done-keywords)
13139 matcher)))
13092 (cons match0 matcher))) 13140 (cons match0 matcher)))
13093 13141
13094(defun org-op-to-function (op &optional stringp) 13142(defun org-op-to-function (op &optional stringp)
@@ -13344,7 +13392,8 @@ With prefix ARG, realign all tags in headings in the current buffer."
13344 ;; Get a new set of tags from the user 13392 ;; Get a new set of tags from the user
13345 (save-excursion 13393 (save-excursion
13346 (setq table (append org-tag-persistent-alist 13394 (setq table (append org-tag-persistent-alist
13347 (or org-tag-alist (org-get-buffer-tags)) 13395 org-tag-alist
13396 (org-get-buffer-tags)
13348 (and 13397 (and
13349 org-complete-tags-always-offer-all-agenda-tags 13398 org-complete-tags-always-offer-all-agenda-tags
13350 (org-global-tags-completion-table 13399 (org-global-tags-completion-table
@@ -13362,7 +13411,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
13362 current-tags inherited-tags table 13411 current-tags inherited-tags table
13363 (if org-fast-tag-selection-include-todo 13412 (if org-fast-tag-selection-include-todo
13364 org-todo-key-alist)) 13413 org-todo-key-alist))
13365 (let ((org-add-colon-after-tag-completion t)) 13414 (let ((org-add-colon-after-tag-completion (< 1 (length table))))
13366 (org-trim 13415 (org-trim
13367 (org-icompleting-read "Tags: " 13416 (org-icompleting-read "Tags: "
13368 'org-tags-completion-function 13417 'org-tags-completion-function
@@ -13646,9 +13695,11 @@ Returns the new tags string, or nil to not change the current settings."
13646 (condition-case nil 13695 (condition-case nil
13647 (setq tg (org-icompleting-read 13696 (setq tg (org-icompleting-read
13648 "Tag: " 13697 "Tag: "
13649 (or buffer-tags 13698 (delete-dups
13650 (with-current-buffer buf 13699 (append (or buffer-tags
13651 (org-get-buffer-tags))))) 13700 (with-current-buffer buf
13701 (mapcar 'car (org-get-buffer-tags))))
13702 (mapcar 'car table)))))
13652 (quit (setq tg ""))) 13703 (quit (setq tg "")))
13653 (when (string-match "\\S-" tg) 13704 (when (string-match "\\S-" tg)
13654 (add-to-list 'buffer-tags (list tg)) 13705 (add-to-list 'buffer-tags (list tg))
@@ -13802,7 +13853,8 @@ a *different* entry, you cannot use these techniques."
13802 org-done-keywords-for-agenda 13853 org-done-keywords-for-agenda
13803 org-todo-keyword-alist-for-agenda 13854 org-todo-keyword-alist-for-agenda
13804 org-drawers-for-agenda 13855 org-drawers-for-agenda
13805 org-tag-alist-for-agenda) 13856 org-tag-alist-for-agenda
13857 todo-only)
13806 13858
13807 (cond 13859 (cond
13808 ((eq match t) (setq matcher t)) 13860 ((eq match t) (setq matcher t))
@@ -13835,7 +13887,7 @@ a *different* entry, you cannot use these techniques."
13835 (progn 13887 (progn
13836 (org-prepare-agenda-buffers 13888 (org-prepare-agenda-buffers
13837 (list (buffer-file-name (current-buffer)))) 13889 (list (buffer-file-name (current-buffer))))
13838 (setq res (org-scan-tags func matcher nil start-level))) 13890 (setq res (org-scan-tags func matcher todo-only start-level)))
13839 ;; Get the right scope 13891 ;; Get the right scope
13840 (cond 13892 (cond
13841 ((and scope (listp scope) (symbolp (car scope))) 13893 ((and scope (listp scope) (symbolp (car scope)))
@@ -13856,7 +13908,7 @@ a *different* entry, you cannot use these techniques."
13856 (save-restriction 13908 (save-restriction
13857 (widen) 13909 (widen)
13858 (goto-char (point-min)) 13910 (goto-char (point-min))
13859 (setq res (append res (org-scan-tags func matcher)))))))))) 13911 (setq res (append res (org-scan-tags func matcher todo-only))))))))))
13860 res))) 13912 res)))
13861 13913
13862;;;; Properties 13914;;;; Properties
@@ -14137,24 +14189,26 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy."
14137 ;; retrieve it, but specify the wanted property 14189 ;; retrieve it, but specify the wanted property
14138 (cdr (assoc property (org-entry-properties nil 'special property))) 14190 (cdr (assoc property (org-entry-properties nil 'special property)))
14139 (let ((range (unless (org-before-first-heading-p) 14191 (let ((range (unless (org-before-first-heading-p)
14140 (org-get-property-block)))) 14192 (org-get-property-block)))
14141 (when (and range (goto-char (car range))) 14193 (props (list (or (assoc property org-file-properties)
14142 ((lambda (val) (when val (if literal-nil val (org-not-nil val)))) 14194 (assoc property org-global-properties)
14143 (cond 14195 (assoc property org-global-properties-fixed))))
14144 ((re-search-forward 14196 val)
14145 (org-re-property property) (cdr range) t) 14197 (flet ((ap (key)
14146 (if (match-end 1) (org-match-string-no-properties 1) "")) 14198 (when (re-search-forward
14147 ((re-search-forward 14199 (org-re-property key) (cdr range) t)
14148 (org-re-property (concat property "+")) (cdr range) t) 14200 (setq props
14149 (cdr (assoc 14201 (org-update-property-plist
14150 property 14202 key
14151 (org-update-property-plist 14203 (if (match-end 1)
14152 (concat property "+") 14204 (org-match-string-no-properties 1) "")
14153 (if (match-end 1) (org-match-string-no-properties 1) "") 14205 props)))))
14154 (list (or (assoc property org-file-properties) 14206 (when (and range (goto-char (car range)))
14155 (assoc property org-global-properties) 14207 (ap property)
14156 (assoc property org-global-properties-fixed) 14208 (goto-char (car range))
14157 )))))))))))))) 14209 (while (ap (concat property "+")))
14210 (setq val (cdr (assoc property props)))
14211 (when val (if literal-nil val (org-not-nil val))))))))))
14158 14212
14159(defun org-property-or-variable-value (var &optional inherit) 14213(defun org-property-or-variable-value (var &optional inherit)
14160 "Check if there is a property fixing the value of VAR. 14214 "Check if there is a property fixing the value of VAR.
@@ -14543,7 +14597,7 @@ in the current file."
14543 (org-re-property property) 14597 (org-re-property property)
14544 nil t) 14598 nil t)
14545 (setq cnt (1+ cnt)) 14599 (setq cnt (1+ cnt))
14546 (replace-match "")) 14600 (delete-region (match-beginning 0) (1+ (point-at-eol))))
14547 (message "Property \"%s\" removed from %d entries" property cnt))))) 14601 (message "Property \"%s\" removed from %d entries" property cnt)))))
14548 14602
14549(defvar org-columns-current-fmt-compiled) ; defined in org-colview.el 14603(defvar org-columns-current-fmt-compiled) ; defined in org-colview.el
@@ -14848,7 +14902,7 @@ So these are more for recording a certain time/date."
14848(defvar org-read-date-analyze-futurep nil) 14902(defvar org-read-date-analyze-futurep nil)
14849(defvar org-read-date-analyze-forced-year nil) 14903(defvar org-read-date-analyze-forced-year nil)
14850 14904
14851(defun org-read-date (&optional with-time to-time from-string prompt 14905(defun org-read-date (&optional org-with-time to-time from-string prompt
14852 default-time default-input) 14906 default-time default-input)
14853 "Read a date, possibly a time, and make things smooth for the user. 14907 "Read a date, possibly a time, and make things smooth for the user.
14854The prompt will suggest to enter an ISO date, but you can also enter anything 14908The prompt will suggest to enter an ISO date, but you can also enter anything
@@ -14881,9 +14935,7 @@ plus or minus, it is relative to the date in DEFAULT-TIME. E.g.
14881 +2w --> two weeks from today 14935 +2w --> two weeks from today
14882 ++5 --> five days from default date 14936 ++5 --> five days from default date
14883 14937
14884The function understands only English month and weekday abbreviations, 14938The function understands only English month and weekday abbreviations.
14885but this can be configured with the variables `parse-time-months' and
14886`parse-time-weekdays'.
14887 14939
14888While prompting, a calendar is popped up - you can also select the 14940While prompting, a calendar is popped up - you can also select the
14889date with the mouse (button 1). The calendar shows a period of three 14941date with the mouse (button 1). The calendar shows a period of three
@@ -14904,24 +14956,24 @@ the time/date that is used for everything that is not specified by the
14904user." 14956user."
14905 (require 'parse-time) 14957 (require 'parse-time)
14906 (let* ((org-time-stamp-rounding-minutes 14958 (let* ((org-time-stamp-rounding-minutes
14907 (if (equal with-time '(16)) '(0 0) org-time-stamp-rounding-minutes)) 14959 (if (equal org-with-time '(16)) '(0 0) org-time-stamp-rounding-minutes))
14908 (org-dcst org-display-custom-times) 14960 (org-dcst org-display-custom-times)
14909 (ct (org-current-time)) 14961 (ct (org-current-time))
14910 (def (or org-overriding-default-time default-time ct)) 14962 (org-def (or org-overriding-default-time default-time ct))
14911 (defdecode (decode-time def)) 14963 (org-defdecode (decode-time org-def))
14912 (dummy (progn 14964 (dummy (progn
14913 (when (< (nth 2 defdecode) org-extend-today-until) 14965 (when (< (nth 2 org-defdecode) org-extend-today-until)
14914 (setcar (nthcdr 2 defdecode) -1) 14966 (setcar (nthcdr 2 org-defdecode) -1)
14915 (setcar (nthcdr 1 defdecode) 59) 14967 (setcar (nthcdr 1 org-defdecode) 59)
14916 (setq def (apply 'encode-time defdecode) 14968 (setq org-def (apply 'encode-time org-defdecode)
14917 defdecode (decode-time def))))) 14969 org-defdecode (decode-time org-def)))))
14918 (calendar-frame-setup nil) 14970 (calendar-frame-setup nil)
14919 (calendar-setup nil) 14971 (calendar-setup nil)
14920 (calendar-move-hook nil) 14972 (calendar-move-hook nil)
14921 (calendar-view-diary-initially-flag nil) 14973 (calendar-view-diary-initially-flag nil)
14922 (calendar-view-holidays-initially-flag nil) 14974 (calendar-view-holidays-initially-flag nil)
14923 (timestr (format-time-string 14975 (timestr (format-time-string
14924 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def)) 14976 (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") org-def))
14925 (prompt (concat (if prompt (concat prompt " ") "") 14977 (prompt (concat (if prompt (concat prompt " ") "")
14926 (format "Date+time [%s]: " timestr))) 14978 (format "Date+time [%s]: " timestr)))
14927 ans (org-ans0 "") org-ans1 org-ans2 final) 14979 ans (org-ans0 "") org-ans1 org-ans2 final)
@@ -14934,7 +14986,7 @@ user."
14934 (calendar) 14986 (calendar)
14935 (unwind-protect 14987 (unwind-protect
14936 (progn 14988 (progn
14937 (calendar-forward-day (- (time-to-days def) 14989 (calendar-forward-day (- (time-to-days org-def)
14938 (calendar-absolute-from-gregorian 14990 (calendar-absolute-from-gregorian
14939 (calendar-current-date)))) 14991 (calendar-current-date))))
14940 (org-eval-in-calendar nil t) 14992 (org-eval-in-calendar nil t)
@@ -15020,7 +15072,7 @@ user."
15020 (delete-overlay org-read-date-overlay) 15072 (delete-overlay org-read-date-overlay)
15021 (setq org-read-date-overlay nil))))) 15073 (setq org-read-date-overlay nil)))))
15022 15074
15023 (setq final (org-read-date-analyze ans def defdecode)) 15075 (setq final (org-read-date-analyze ans org-def org-defdecode))
15024 15076
15025 (when org-read-date-analyze-forced-year 15077 (when org-read-date-analyze-forced-year
15026 (message "Year was forced into %s" 15078 (message "Year was forced into %s"
@@ -15042,9 +15094,9 @@ user."
15042 (nth 2 final) (nth 1 final)) 15094 (nth 2 final) (nth 1 final))
15043 (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) 15095 (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final))))))
15044 15096
15045(defvar def) 15097(defvar org-def)
15046(defvar defdecode) 15098(defvar org-defdecode)
15047(defvar with-time) 15099(defvar org-with-time)
15048(defun org-read-date-display () 15100(defun org-read-date-display ()
15049 "Display the current date prompt interpretation in the minibuffer." 15101 "Display the current date prompt interpretation in the minibuffer."
15050 (when org-read-date-display-live 15102 (when org-read-date-display-live
@@ -15060,11 +15112,11 @@ user."
15060 (let* ((ans (concat (buffer-substring (point-at-bol) (point-max)) 15112 (let* ((ans (concat (buffer-substring (point-at-bol) (point-max))
15061 " " (or org-ans1 org-ans2))) 15113 " " (or org-ans1 org-ans2)))
15062 (org-end-time-was-given nil) 15114 (org-end-time-was-given nil)
15063 (f (org-read-date-analyze ans def defdecode)) 15115 (f (org-read-date-analyze ans org-def org-defdecode))
15064 (fmts (if org-dcst 15116 (fmts (if org-dcst
15065 org-time-stamp-custom-formats 15117 org-time-stamp-custom-formats
15066 org-time-stamp-formats)) 15118 org-time-stamp-formats))
15067 (fmt (if (or with-time 15119 (fmt (if (or org-with-time
15068 (and (boundp 'org-time-was-given) org-time-was-given)) 15120 (and (boundp 'org-time-was-given) org-time-was-given))
15069 (cdr fmts) 15121 (cdr fmts)
15070 (car fmts))) 15122 (car fmts)))
@@ -15080,7 +15132,7 @@ user."
15080 (make-overlay (1- (point-at-eol)) (point-at-eol))) 15132 (make-overlay (1- (point-at-eol)) (point-at-eol)))
15081 (org-overlay-display org-read-date-overlay txt 'secondary-selection)))) 15133 (org-overlay-display org-read-date-overlay txt 'secondary-selection))))
15082 15134
15083(defun org-read-date-analyze (ans def defdecode) 15135(defun org-read-date-analyze (ans org-def org-defdecode)
15084 "Analyze the combined answer of the date prompt." 15136 "Analyze the combined answer of the date prompt."
15085 ;; FIXME: cleanup and comment 15137 ;; FIXME: cleanup and comment
15086 (let ((nowdecode (decode-time (current-time))) 15138 (let ((nowdecode (decode-time (current-time)))
@@ -15092,7 +15144,7 @@ user."
15092 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) 15144 (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
15093 (setq ans "+0")) 15145 (setq ans "+0"))
15094 15146
15095 (when (setq delta (org-read-date-get-relative ans (current-time) def)) 15147 (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
15096 (setq ans (replace-match "" t t ans) 15148 (setq ans (replace-match "" t t ans)
15097 deltan (car delta) 15149 deltan (car delta)
15098 deltaw (nth 1 delta) 15150 deltaw (nth 1 delta)
@@ -15186,19 +15238,19 @@ user."
15186 (substring ans (match-end 7)))))) 15238 (substring ans (match-end 7))))))
15187 15239
15188 (setq tl (parse-time-string ans) 15240 (setq tl (parse-time-string ans)
15189 day (or (nth 3 tl) (nth 3 defdecode)) 15241 day (or (nth 3 tl) (nth 3 org-defdecode))
15190 month (or (nth 4 tl) 15242 month (or (nth 4 tl)
15191 (if (and org-read-date-prefer-future 15243 (if (and org-read-date-prefer-future
15192 (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode))) 15244 (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode)))
15193 (prog1 (1+ (nth 4 nowdecode)) (setq futurep t)) 15245 (prog1 (1+ (nth 4 nowdecode)) (setq futurep t))
15194 (nth 4 defdecode))) 15246 (nth 4 org-defdecode)))
15195 year (or (and (not kill-year) (nth 5 tl)) 15247 year (or (and (not kill-year) (nth 5 tl))
15196 (if (and org-read-date-prefer-future 15248 (if (and org-read-date-prefer-future
15197 (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode))) 15249 (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode)))
15198 (prog1 (1+ (nth 5 nowdecode)) (setq futurep t)) 15250 (prog1 (1+ (nth 5 nowdecode)) (setq futurep t))
15199 (nth 5 defdecode))) 15251 (nth 5 org-defdecode)))
15200 hour (or (nth 2 tl) (nth 2 defdecode)) 15252 hour (or (nth 2 tl) (nth 2 org-defdecode))
15201 minute (or (nth 1 tl) (nth 1 defdecode)) 15253 minute (or (nth 1 tl) (nth 1 org-defdecode))
15202 second (or (nth 0 tl) 0) 15254 second (or (nth 0 tl) 0)
15203 wday (nth 6 tl)) 15255 wday (nth 6 tl))
15204 15256
@@ -15269,13 +15321,12 @@ user."
15269 (condition-case nil 15321 (condition-case nil
15270 (ignore (encode-time second minute hour day month year)) 15322 (ignore (encode-time second minute hour day month year))
15271 (error 15323 (error
15272 (setq year (nth 5 defdecode)) 15324 (setq year (nth 5 org-defdecode))
15273 (setq org-read-date-analyze-forced-year t)))) 15325 (setq org-read-date-analyze-forced-year t))))
15274 (setq org-read-date-analyze-futurep futurep) 15326 (setq org-read-date-analyze-futurep futurep)
15275 (list second minute hour day month year))) 15327 (list second minute hour day month year)))
15276 15328
15277(defvar parse-time-weekdays) 15329(defvar parse-time-weekdays)
15278
15279(defun org-read-date-get-relative (s today default) 15330(defun org-read-date-get-relative (s today default)
15280 "Check string S for special relative date string. 15331 "Check string S for special relative date string.
15281TODAY and DEFAULT are internal times, for today and for a default. 15332TODAY and DEFAULT are internal times, for today and for a default.
@@ -16072,14 +16123,12 @@ in the timestamp determines what will be changed."
16072 16123
16073(defun org-recenter-calendar (date) 16124(defun org-recenter-calendar (date)
16074 "If the calendar is visible, recenter it to DATE." 16125 "If the calendar is visible, recenter it to DATE."
16075 (let* ((win (selected-window)) 16126 (let ((cwin (get-buffer-window "*Calendar*" t)))
16076 (cwin (get-buffer-window "*Calendar*" t))
16077 (calendar-move-hook nil))
16078 (when cwin 16127 (when cwin
16079 (select-window cwin) 16128 (let ((calendar-move-hook nil))
16080 (calendar-goto-date (if (listp date) date 16129 (with-selected-window cwin
16081 (calendar-gregorian-from-absolute date))) 16130 (calendar-goto-date (if (listp date) date
16082 (select-window win)))) 16131 (calendar-gregorian-from-absolute date))))))))
16083 16132
16084(defun org-goto-calendar (&optional arg) 16133(defun org-goto-calendar (&optional arg)
16085 "Go to the Emacs calendar at the current date. 16134 "Go to the Emacs calendar at the current date.
@@ -16695,6 +16744,8 @@ the cursor is before the first headline,
16695display all fragments in the buffer. 16744display all fragments in the buffer.
16696The images can be removed again with \\[org-ctrl-c-ctrl-c]." 16745The images can be removed again with \\[org-ctrl-c-ctrl-c]."
16697 (interactive "P") 16746 (interactive "P")
16747 (unless buffer-file-name
16748 (error "Can't preview LaTeX fragment in a non-file buffer"))
16698 (org-remove-latex-fragment-image-overlays) 16749 (org-remove-latex-fragment-image-overlays)
16699 (save-excursion 16750 (save-excursion
16700 (save-restriction 16751 (save-restriction
@@ -16966,7 +17017,7 @@ inspection."
16966 (dvifile (concat texfilebase ".dvi")) 17017 (dvifile (concat texfilebase ".dvi"))
16967 (pngfile (concat texfilebase ".png")) 17018 (pngfile (concat texfilebase ".png"))
16968 (fnh (if (featurep 'xemacs) 17019 (fnh (if (featurep 'xemacs)
16969 (font-height (get-face-font 'default)) 17020 (font-height (face-font 'default))
16970 (face-attribute 'default :height nil))) 17021 (face-attribute 'default :height nil)))
16971 (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0)) 17022 (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
16972 (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.)))))) 17023 (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.))))))
@@ -16995,13 +17046,19 @@ inspection."
16995 (if (not (file-exists-p dvifile)) 17046 (if (not (file-exists-p dvifile))
16996 (progn (message "Failed to create dvi file from %s" texfile) nil) 17047 (progn (message "Failed to create dvi file from %s" texfile) nil)
16997 (condition-case nil 17048 (condition-case nil
16998 (call-process "dvipng" nil nil nil 17049 (if (featurep 'xemacs)
17050 (call-process "dvipng" nil nil nil
16999 "-fg" fg "-bg" bg 17051 "-fg" fg "-bg" bg
17000 "-D" dpi
17001 ;;"-x" scale "-y" scale
17002 "-T" "tight" 17052 "-T" "tight"
17003 "-o" pngfile 17053 "-o" pngfile
17004 dvifile) 17054 dvifile)
17055 (call-process "dvipng" nil nil nil
17056 "-fg" fg "-bg" bg
17057 "-D" dpi
17058 ;;"-x" scale "-y" scale
17059 "-T" "tight"
17060 "-o" pngfile
17061 dvifile))
17005 (error nil)) 17062 (error nil))
17006 (if (not (file-exists-p pngfile)) 17063 (if (not (file-exists-p pngfile))
17007 (if org-format-latex-signal-error 17064 (if org-format-latex-signal-error
@@ -17077,7 +17134,12 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML."
17077 "Return an rgb color specification for dvipng." 17134 "Return an rgb color specification for dvipng."
17078 (apply 'format "rgb %s %s %s" 17135 (apply 'format "rgb %s %s %s"
17079 (mapcar 'org-normalize-color 17136 (mapcar 'org-normalize-color
17080 (color-values (face-attribute 'default attr nil))))) 17137 (if (featurep 'xemacs)
17138 (color-rgb-components
17139 (face-property 'default
17140 (cond ((eq attr :foreground) 'foreground)
17141 ((eq attr :background) 'background))))
17142 (color-values (face-attribute 'default attr nil))))))
17081 17143
17082(defun org-normalize-color (value) 17144(defun org-normalize-color (value)
17083 "Return string to be used as color value for an RGB component." 17145 "Return string to be used as color value for an RGB component."
@@ -17121,7 +17183,7 @@ BEG and END default to the buffer boundaries."
17121 (save-restriction 17183 (save-restriction
17122 (widen) 17184 (widen)
17123 (setq beg (or beg (point-min)) end (or end (point-max))) 17185 (setq beg (or beg (point-min)) end (or end (point-max)))
17124 (goto-char (point-min)) 17186 (goto-char beg)
17125 (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?" 17187 (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?"
17126 (substring (org-image-file-name-regexp) 0 -2) 17188 (substring (org-image-file-name-regexp) 0 -2)
17127 "\\)\\]" (if include-linked "" "\\]"))) 17189 "\\)\\]" (if include-linked "" "\\]")))
@@ -17204,9 +17266,7 @@ BEG and END default to the buffer boundaries."
17204(org-defkey org-mode-map "\C-i" 'org-cycle) 17266(org-defkey org-mode-map "\C-i" 'org-cycle)
17205(org-defkey org-mode-map [(tab)] 'org-cycle) 17267(org-defkey org-mode-map [(tab)] 'org-cycle)
17206(org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived) 17268(org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived)
17207(org-defkey org-mode-map [(meta tab)] 'pcomplete)
17208(org-defkey org-mode-map "\M-\t" 'pcomplete) 17269(org-defkey org-mode-map "\M-\t" 'pcomplete)
17209(org-defkey org-mode-map "\M-\C-i" 'pcomplete)
17210;; The following line is necessary under Suse GNU/Linux 17270;; The following line is necessary under Suse GNU/Linux
17211(unless (featurep 'xemacs) 17271(unless (featurep 'xemacs)
17212 (org-defkey org-mode-map [S-iso-lefttab] 'org-shifttab)) 17272 (org-defkey org-mode-map [S-iso-lefttab] 'org-shifttab))
@@ -17570,7 +17630,7 @@ overwritten, and the table is not marked as requiring realignment."
17570 (looking-at "[^|\n]* |")) 17630 (looking-at "[^|\n]* |"))
17571 (let (org-table-may-need-update) 17631 (let (org-table-may-need-update)
17572 (goto-char (1- (match-end 0))) 17632 (goto-char (1- (match-end 0)))
17573 (delete-char -1) 17633 (backward-delete-char 1)
17574 (goto-char (match-beginning 0)) 17634 (goto-char (match-beginning 0))
17575 (self-insert-command N))) 17635 (self-insert-command N)))
17576 (t 17636 (t
@@ -18424,22 +18484,22 @@ This command does many different things, depending on context:
18424 ;; only if function was called with an argument. Send list only 18484 ;; only if function was called with an argument. Send list only
18425 ;; if at top item. 18485 ;; if at top item.
18426 (let* ((struct (org-list-struct)) 18486 (let* ((struct (org-list-struct))
18427 (new-struct struct) 18487 (firstp (= (org-list-get-top-point struct) (point-at-bol)))
18428 (firstp (= (org-list-get-top-point struct) (point-at-bol)))) 18488 old-struct)
18429 (when arg 18489 (when arg
18430 (setq new-struct (copy-tree struct)) 18490 (setq old-struct (copy-tree struct))
18431 (if firstp 18491 (if firstp
18432 ;; If at first item of sub-list, add check-box to every 18492 ;; If at first item of sub-list, add check-box to every
18433 ;; item at the same level. 18493 ;; item at the same level.
18434 (mapc 18494 (mapc
18435 (lambda (pos) 18495 (lambda (pos)
18436 (unless (org-list-get-checkbox pos new-struct) 18496 (unless (org-list-get-checkbox pos struct)
18437 (org-list-set-checkbox pos new-struct "[ ]"))) 18497 (org-list-set-checkbox pos struct "[ ]")))
18438 (org-list-get-all-items 18498 (org-list-get-all-items
18439 (point-at-bol) new-struct (org-list-prevs-alist new-struct))) 18499 (point-at-bol) struct (org-list-prevs-alist struct)))
18440 (org-list-set-checkbox (point-at-bol) new-struct "[ ]"))) 18500 (org-list-set-checkbox (point-at-bol) struct "[ ]")))
18441 (org-list-write-struct 18501 (org-list-write-struct
18442 new-struct (org-list-parents-alist new-struct) struct) 18502 struct (org-list-parents-alist struct) old-struct)
18443 (when arg (org-update-checkbox-count-maybe)) 18503 (when arg (org-update-checkbox-count-maybe))
18444 (when firstp (org-list-send-list 'maybe)))) 18504 (when firstp (org-list-send-list 'maybe))))
18445 ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) 18505 ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re))
@@ -19026,7 +19086,8 @@ See the individual commands for more information."
19026 (org-inside-LaTeX-fragment-p)] 19086 (org-inside-LaTeX-fragment-p)]
19027 ["Insert citation" org-reftex-citation t] 19087 ["Insert citation" org-reftex-citation t]
19028 "--" 19088 "--"
19029 ["Template for BEAMER" org-insert-beamer-options-template t]) 19089 ["Template for BEAMER" (progn (require 'org-beamer)
19090 (org-insert-beamer-options-template)) t])
19030 "--" 19091 "--"
19031 ("MobileOrg" 19092 ("MobileOrg"
19032 ["Push Files and Views" org-mobile-push t] 19093 ["Push Files and Views" org-mobile-push t]
@@ -19253,6 +19314,17 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
19253 (eval form) 19314 (eval form)
19254 (error (format "%%![Error: %s]" error)))) 19315 (error (format "%%![Error: %s]" error))))
19255 19316
19317(defun org-in-clocktable-p ()
19318 "Check if the cursor is in a clocktable."
19319 (let ((pos (point)) start)
19320 (save-excursion
19321 (end-of-line 1)
19322 (and (re-search-backward "^[ \t]*#\\+BEGIN:[ \t]+clocktable" nil t)
19323 (setq start (match-beginning 0))
19324 (re-search-forward "^[ \t]*#\\+END:.*" nil t)
19325 (>= (match-end 0) pos)
19326 start))))
19327
19256(defun org-in-commented-line () 19328(defun org-in-commented-line ()
19257 "Is point in a line starting with `#'?" 19329 "Is point in a line starting with `#'?"
19258 (equal (char-after (point-at-bol)) ?#)) 19330 (equal (char-after (point-at-bol)) ?#))
@@ -20404,14 +20476,28 @@ beyond the end of the headline."
20404 ((not (eq last-command this-command)) (point)) 20476 ((not (eq last-command this-command)) (point))
20405 (t refpos))))) 20477 (t refpos)))))
20406 ((org-at-item-p) 20478 ((org-at-item-p)
20407 (goto-char 20479 ;; Being at an item and not looking at an the item means point
20408 (if (eq special t) 20480 ;; was previously moved to beginning of a visual line, whiche
20409 (cond ((> pos (match-end 0)) (match-end 0)) 20481 ;; doesn't contain the item. Therefore, do nothing special,
20410 ((= pos (point)) (match-end 0)) 20482 ;; just stay here.
20411 (t (point))) 20483 (when (looking-at org-list-full-item-re)
20412 (cond ((> pos (point)) (point)) 20484 ;; Set special position at first white space character after
20413 ((not (eq last-command this-command)) (point)) 20485 ;; bullet, and check-box, if any.
20414 (t (match-end 0)))))))) 20486 (let ((after-bullet
20487 (let ((box (match-end 3)))
20488 (if (not box) (match-end 1)
20489 (let ((after (char-after box)))
20490 (if (and after (= after ? )) (1+ box) box))))))
20491 ;; Special case: Move point to special position when
20492 ;; currently after it or at beginning of line.
20493 (if (eq special t)
20494 (when (or (> pos after-bullet) (= (point) pos))
20495 (goto-char after-bullet))
20496 ;; Reversed case: Move point to special position when
20497 ;; point was already at beginning of line and command is
20498 ;; repeated.
20499 (when (and (= (point) pos) (eq last-command this-command))
20500 (goto-char after-bullet))))))))
20415 (org-no-warnings 20501 (org-no-warnings
20416 (and (featurep 'xemacs) (setq zmacs-region-stays t))))) 20502 (and (featurep 'xemacs) (setq zmacs-region-stays t)))))
20417 20503
@@ -20450,7 +20536,10 @@ beyond the end of the headline."
20450 (move-end-of-line 1) 20536 (move-end-of-line 1)
20451 (when (overlays-at (1- (point))) (backward-char 1))) 20537 (when (overlays-at (1- (point))) (backward-char 1)))
20452 ;; At an item: Move before any hidden text. 20538 ;; At an item: Move before any hidden text.
20453 (t (call-interactively 'end-of-line))) 20539 (t (call-interactively
20540 (cond ((org-bound-and-true-p line-move-visual) 'end-of-visual-line)
20541 ((fboundp 'move-end-of-line) 'move-end-of-line)
20542 (t 'end-of-line)))))
20454 (org-no-warnings 20543 (org-no-warnings
20455 (and (featurep 'xemacs) (setq zmacs-region-stays t))))) 20544 (and (featurep 'xemacs) (setq zmacs-region-stays t)))))
20456 20545
@@ -20899,6 +20988,7 @@ Stop at the first and last subheadings of a superior heading."
20899 20988
20900(defun org-show-subtree () 20989(defun org-show-subtree ()
20901 "Show everything after this heading at deeper levels." 20990 "Show everything after this heading at deeper levels."
20991 (interactive)
20902 (outline-flag-region 20992 (outline-flag-region
20903 (point) 20993 (point)
20904 (save-excursion 20994 (save-excursion
@@ -20987,8 +21077,8 @@ Show the heading too, if it is currently invisible."
20987 (goto-char (point-max)) 21077 (goto-char (point-max))
20988 (while (re-search-backward re nil t) 21078 (while (re-search-backward re nil t)
20989 (setq level (org-reduced-level (funcall outline-level))) 21079 (setq level (org-reduced-level (funcall outline-level)))
20990 (when (<= level n) 21080 (when (and (<= level n)
20991 (looking-at org-complex-heading-regexp) 21081 (looking-at org-complex-heading-regexp))
20992 (setq head (org-link-display-format 21082 (setq head (org-link-display-format
20993 (org-match-string-no-properties 4)) 21083 (org-match-string-no-properties 4))
20994 m (org-imenu-new-marker)) 21084 m (org-imenu-new-marker))