diff options
author | Bastien Guerry <bastien1@free.fr> | 2012-04-01 11:49:25 +0200 |
---|---|---|
committer | Bastien Guerry <bastien1@free.fr> | 2012-04-01 11:49:25 +0200 |
commit | 153ae947f845f6d4f31d3d239a1449899c3384f0 (patch) | |
tree | b7ef6c7f4b94f4a4ee19eecd079c36aff84bddc5 | |
parent | 42ee526b1adbe2ba7766203980a9d7089aae1a68 (diff) |
Update to Org version 7.8.07 (commit da0e6f in Org's repo)
51 files changed, 3471 insertions, 1279 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8d40ab5ab1..6c8a9d29c2 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,115 @@ +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org.texi (Customizing tables in ODT export): Correct few errors. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org.texi (Links in ODT export): Update. + (Labels and captions in ODT export): New node. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org.texi (Literal examples in ODT export): htmlfontify.el in + Emacs-24.1 now supports fontification. So ODT source blocks will + be fontified by default. + +2012-04-01 Julian Gehring <julian.gehring@googlemail.com> (tiny change) + + * org.texi (Refiling notes): Remove duplicated keybinding. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (noweb): Documentation of this new option to the :noweb + header argument. + +2012-04-01 Suvayu Ali <fatkasuvayu+linux@gmail.com> + + * org.texi (Header and sectioning): Add example demonstrating how + to use "LaTeX_CLASS_OPTIONS". + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (Noweb reference syntax): Describe the ability to + execute noweb references in the manual. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (cache): Improve cache documentation when session + evaluation is used. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.texi (Plain lists): Document removal. + +2012-04-01 Michael Brand <michael.ch.brand@gmail.com> + + * org.texi: Decapitalize file name in references to Calc manual. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.texi (Plain lists): Document removal. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org.texi (Top, OpenDocument Text export) + (ODT export commands, Extending ODT export) + (Images in ODT export, Tables in ODT export) + (Configuring a document converter): Add or Update. + +2012-04-01 Carsten Dominik <carsten.dominik@gmail.com> + + * org.texi (MobileOrg): Change the wording to reflect that the + Android Version is no longer just the little brother of the iOS + version. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (Key bindings and useful functions): Updated babel key + binding documentation in manual. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (noweb): Document new noweb header value. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (noweb-sep): Document new header argument. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (noweb-ref): Documentation of this new custom variable. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.texi (wrap): Update the new :wrap documentation to match the + current implementation. + +2012-04-01 Thomas Dye <dk@poto.myhome.westell.com> + + * org.texi: Added documentation for :wrap. + +2012-04-01 Thomas Dye <dk@poto.myhome.westell.com> + + * org.texi: #+RESULTS now user-configurable. + +2012-04-01 Thomas Dye <dk@poto.myhome.westell.com> + + * org.texi: Documented :noweb no-export. + +2012-04-01 Thomas Dye <dk@poto.local> + + * org.texi: Edit :noweb no header argument for correctness. + +2012-04-01 Bastien Guerry <bzg@altern.org> + + * org.texi (Customization): Update the approximate number of Org + variables. + +2012-04-01 Thomas Dye <dk@poto.local> + + * org.texi: The :results wrap produces a drawer instead of a + begin_results block. + 2012-03-22 Peder O. Klingenberg <peder@klingenberg.no> (tiny change) * gnus.texi (Archived Messages): Update `gnus-message-archive-group' to diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 2a41d6b930..ab9de71277 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -4,8 +4,8 @@ @setfilename ../../info/org @settitle The Org Manual -@set VERSION 7.8.03 -@set DATE January 2012 +@set VERSION 7.8.07 +@set DATE March 2012 @c Use proper quote and backtick for code sections in PDF output @c Cf. Texinfo manual 14.2 @@ -265,7 +265,7 @@ @copying This manual is for Org version @value{VERSION}. -Copyright @copyright{} 2004-2012 Free Software Foundation, Inc. +Copyright @copyright{} 2004-2011 Free Software Foundation, Inc. @quotation Permission is granted to copy, distribute and/or modify this document @@ -612,27 +612,29 @@ DocBook export OpenDocument Text export -* Pre-requisites for @acronym{ODT} export:: What packages @acronym{ODT} exporter relies on -* @acronym{ODT} export commands:: How to invoke @acronym{ODT} export +* Pre-requisites for ODT export:: What packages ODT exporter relies on +* ODT export commands:: How to invoke ODT export +* Extending ODT export:: How to produce @samp{doc}, @samp{pdf} files * Applying custom styles:: How to apply custom styles to the output -* Links in @acronym{ODT} export:: How links will be interpreted and formatted -* Tables in @acronym{ODT} export:: How Tables are exported -* Images in @acronym{ODT} export:: How to insert images -* Math formatting in @acronym{ODT} export:: How @LaTeX{} fragments are formatted -* Literal examples in @acronym{ODT} export:: How source and example blocks are formatted -* Advanced topics in @acronym{ODT} export:: Read this if you are a power user +* Links in ODT export:: How links will be interpreted and formatted +* Tables in ODT export:: How Tables are exported +* Images in ODT export:: How to insert images +* Math formatting in ODT export:: How @LaTeX{} fragments are formatted +* Labels and captions in ODT export:: How captions are rendered +* Literal examples in ODT export:: How source and example blocks are formatted +* Advanced topics in ODT export:: Read this if you are a power user -Math formatting in @acronym{ODT} export +Math formatting in ODT export * Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments * Working with MathML or OpenDocument formula files:: How to embed equations in native format -Advanced topics in @acronym{ODT} export +Advanced topics in ODT export -* Exporting and converting to other formats:: How to produce @samp{pdf} and other formats +* Configuring a document converter:: How to register a document converter * Working with OpenDocument style files:: Explore the internals * Creating one-off styles:: How to produce custom highlighting etc -* Customizing tables in @acronym{ODT} export:: How to define and use Table templates +* Customizing tables in ODT export:: How to define and use Table templates * Validating OpenDocument XML:: How to debug corrupt OpenDocument files Publishing @@ -708,6 +710,7 @@ Specific header arguments * session:: Preserve the state of code evaluation * noweb:: Toggle expansion of noweb references * noweb-ref:: Specify block's noweb reference resolution target +* noweb-sep:: String used to separate noweb references * cache:: Avoid re-evaluating unchanged code blocks * sep:: Delimiter for writing tabular results outside Org * hlines:: Handle horizontal lines in tables @@ -1004,7 +1007,7 @@ from within Emacs, please copy and paste the content into your Email program. Sometimes you might face a problem due to an error in your Emacs or Org mode setup. Before reporting a bug, it is very helpful to start Emacs with minimal -customizations and reproduce the problem. Doing so often helps you determine +customisations and reproduce the problem. Doing so often helps you determine if the problem is with your customization or with Org mode itself. You can start a typical minimal session with a command like the example below. @@ -1435,8 +1438,7 @@ creation time, scheduled time, deadline time), by priority, by TODO keyword (in the sequence the keywords have been defined in the setup) or by the value of a property. Reverse sorting is possible as well. You can also supply your own function to extract the sorting key. With a @kbd{C-u} prefix, -sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes, duplicate -entries will also be removed. +sorting will be case-sensitive. @orgcmd{C-x n s,org-narrow-to-subtree} Narrow buffer to current subtree. @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 list. An item ends before the next line that is less or equally indented than its bullet/number. -@vindex org-list-ending-method -@vindex org-list-end-regexp @vindex org-empty-line-terminates-plain-lists -Two methods@footnote{To disable either of them, configure -@code{org-list-ending-method}.} are provided to terminate lists. A list ends -whenever every item has ended, which means before any line less or equally -indented than items at top level. It also ends before two blank +A list ends whenever every item has ended, which means before any line less +or equally indented than items at top level. It also ends before two blank lines@footnote{See also @code{org-empty-line-terminates-plain-lists}.}. In -that case, all items are closed. For finer control, you can end lists with -any pattern set in @code{org-list-end-regexp}. Here is an example: +that case, all items are closed. Here is an example: @example @group @@ -1949,13 +1946,7 @@ item. Org comes with a fast and intuitive table editor. Spreadsheet-like calculations are supported using the Emacs @file{calc} package -@ifinfo -(@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}). -@end ifinfo -@ifnotinfo -(see the Emacs Calculator manual for more information about the Emacs -calculator). -@end ifnotinfo +(@pxref{Top, Calc, , calc, Gnu Emacs Calculator Manual}). @menu * Built-in table editor:: Simple tables @@ -2253,7 +2244,8 @@ of columns, much like horizontal lines can do for groups of rows. In order to specify column groups, you can use a special row where the first field contains only @samp{/}. The further fields can either contain @samp{<} to indicate that this column should start a group, -@samp{>} to indicate the end of a column, or @samp{<>} to make a column +@samp{>} to indicate the end of a column, or @samp{<>} (no space between @samp{<} +and @samp{>}) to make a column a group of its own. Boundaries between column groups will upon export be marked with vertical lines. Here is an example: @@ -2515,9 +2507,8 @@ A formula can be any algebraic expression understood by the Emacs non-standard convention that @samp{/} has lower precedence than @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before evaluation by @code{calc-eval} (@pxref{Calling Calc from -Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU +Your Programs, calc-eval, Calling Calc from Your Lisp Programs, calc, GNU Emacs Calc Manual}), -@c FIXME: The link to the Calc manual in HTML does not work. variable substitution takes place according to the rules described above. @cindex vectors, in table calculations The 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 can resort to special versions of these functions like @code{org-date} or @code{org-anniversary}. These work just like the corresponding @code{diary-} functions, but with stable ISO order of arguments (year, month, day) wherever -applicable, independent of the value of @code{calendar-date-style}.}. For example +applicable, independent of the value of @code{calendar-date-style}.}. For +example with optional time @example -* The nerd meeting on every 2nd Thursday of the month +* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month <%%(org-float t 4 2)> @end example @@ -6162,7 +6154,7 @@ applying it to another one. By customizing the variable @code{org-clock-idle-time} to some integer, such as 10 or 15, Emacs can alert you when you get back to your computer after being idle for that many minutes@footnote{On computers using Mac OS X, -idleness is based on actual user idleness, not just Emacs's idle time. For +idleness is based on actual user idleness, not just Emacs' idle time. For X11, you can install a utility program @file{x11idle.c}, available in the UTILITIES directory of the Org git distribution, to get the same general treatment 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. Jump to the location where @code{org-refile} last moved a tree to. @item C-2 C-c C-w Refile as the child of the item currently being clocked. -@item C-0 C-c C-w @ @r{or} @ C-u C-u C-u C-c C-w - @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} - Clear the target cache. Caching of refile targets can be turned on by setting @code{org-refile-use-cache}. To make the command see new possible targets, 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 broad range of other applications. @LaTeX{} export lets you use Org mode and its structured editing functions to easily create @LaTeX{} files. DocBook export makes it possible to convert Org files to many other formats using -DocBook tools. OpenDocument Text(@acronym{ODT}) export allows seamless +DocBook tools. OpenDocument Text(ODT) export allows seamless collaboration across organizational boundaries. For project management you can create gantt and resource charts by using TaskJuggler export. To incorporate entries with associated times like deadlines or appointments into @@ -10803,34 +10792,36 @@ special characters included in XHTML entities: @cindex org-modules Orgmode@footnote{Versions 7.8 or later} supports export to OpenDocument Text -(@acronym{ODT}) format using the @file{org-odt.el} module. Documents created +(ODT) format using the @file{org-odt.el} module. Documents created by this exporter use the @cite{OpenDocument-v1.2 specification}@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, Open Document Format for Office Applications (OpenDocument) Version 1.2}} and are compatible with LibreOffice 3.4. @menu -* Pre-requisites for @acronym{ODT} export:: What packages @acronym{ODT} exporter relies on -* @acronym{ODT} export commands:: How to invoke @acronym{ODT} export +* Pre-requisites for ODT export:: What packages ODT exporter relies on +* ODT export commands:: How to invoke ODT export +* Extending ODT export:: How to produce @samp{doc}, @samp{pdf} files * Applying custom styles:: How to apply custom styles to the output -* Links in @acronym{ODT} export:: How links will be interpreted and formatted -* Tables in @acronym{ODT} export:: How Tables are exported -* Images in @acronym{ODT} export:: How to insert images -* Math formatting in @acronym{ODT} export:: How @LaTeX{} fragments are formatted -* Literal examples in @acronym{ODT} export:: How source and example blocks are formatted -* Advanced topics in @acronym{ODT} export:: Read this if you are a power user +* Links in ODT export:: How links will be interpreted and formatted +* Tables in ODT export:: How Tables are exported +* Images in ODT export:: How to insert images +* Math formatting in ODT export:: How @LaTeX{} fragments are formatted +* Labels and captions in ODT export:: How captions are rendered +* Literal examples in ODT export:: How source and example blocks are formatted +* Advanced topics in ODT export:: Read this if you are a power user @end menu -@node Pre-requisites for @acronym{ODT} export, @acronym{ODT} export commands, OpenDocument Text export, OpenDocument Text export -@subsection Pre-requisites for @acronym{ODT} export +@node Pre-requisites for ODT export, ODT export commands, OpenDocument Text export, OpenDocument Text export +@subsection Pre-requisites for ODT export @cindex zip -The @acronym{ODT} exporter relies on the @file{zip} program to create the final +The ODT exporter relies on the @file{zip} program to create the final output. Check the availability of this program before proceeding further. -@node @acronym{ODT} export commands, Applying custom styles, Pre-requisites for @acronym{ODT} export, OpenDocument Text export -@subsection @acronym{ODT} export commands +@node ODT export commands, Extending ODT export, Pre-requisites for ODT export, OpenDocument Text export +@subsection ODT export commands -@subsubheading Exporting to @acronym{ODT} +@subsubheading Exporting to ODT @anchor{x-export-to-odt} @cindex region, active @@ -10841,12 +10832,13 @@ output. Check the availability of this program before proceeding further. @cindex property EXPORT_FILE_NAME Export as OpenDocument Text file. + @vindex org-export-odt-preferred-output-format If @code{org-export-odt-preferred-output-format} is specified, automatically -convert the exported file to that format. -@xref{x-export-to-other-formats,,Automatically exporting to other formats}. +convert the exported file to that format. @xref{x-export-to-other-formats, , +Automatically exporting to other formats}. -For an Org file @file{myfile.org}, the @acronym{ODT} file will be +For an Org file @file{myfile.org}, the ODT file will be @file{myfile.odt}. The file will be overwritten without warning. If there is an active region,@footnote{This requires @code{transient-mark-mode} to be turned on} only the region will be exported. If the selected region is a @@ -10857,30 +10849,66 @@ export. @orgcmd{C-c C-e O,org-export-as-odt-and-open} Export as OpenDocument Text file and open the resulting file. + @vindex org-export-odt-preferred-output-format If @code{org-export-odt-preferred-output-format} is specified, open the -converted file instead. -@xref{x-export-to-other-formats,,Automatically exporting to other formats}. +converted file instead. @xref{x-export-to-other-formats, , Automatically +exporting to other formats}. @end table -@subsubheading Automatically exporting to other formats +@node Extending ODT export, Applying custom styles, ODT export commands, OpenDocument Text export +@subsection Extending ODT export + +The ODT exporter can interface with a variety of document +converters and supports popular converters out of the box. As a result, you +can use it to export to formats like @samp{doc} or convert a document from +one format (say @samp{csv}) to another format (say @samp{ods} or @samp{xls}). + +@cindex @file{unoconv} +@cindex LibreOffice +If you have a working installation of LibreOffice, a document converter is +pre-configured for you and you can use it right away. If you would like to +use @file{unoconv} as your preferred converter, customize the variable +@code{org-export-odt-convert-process} to point to @code{unoconv}. If you +would like to use a converter of your own choosing or tweak the default +settings of the default @file{LibreOffice} and @samp{unoconv} converters +@xref{Configuring a document converter}. + +@subsubsection Automatically exporting to other formats @anchor{x-export-to-other-formats} + @vindex org-export-odt-preferred-output-format -Very often, you will find yourself exporting to @acronym{ODT} format, only to -immediately save the exported document to a different format like @samp{pdf}. -In such cases, you will find it convenient to configure a converter -(@pxref{Exporting and converting to other formats}) and specify your +Very often, you will find yourself exporting to ODT format, only to +immediately save the exported document to other formats like @samp{doc}, +@samp{docx}, @samp{rtf}, @samp{pdf} etc. In such cases, you can specify your preferred output format by customizing the variable @code{org-export-odt-preferred-output-format}. This way, the export commands -(@pxref{x-export-to-odt,,Exporting to ODT}) can be extended to also export to -the preferred format. +(@pxref{x-export-to-odt,,Exporting to ODT}) can be extended to export to a +format that is of immediate interest to you. + +@subsubsection Converting between document formats +@anchor{x-convert-to-other-formats} + +There are many document converters in the wild which support conversion to +and from various file formats, including, but not limited to the +ODT format. LibreOffice converter, mentioned above, is one such +converter. Once a converter is configured, you can interact with it using +the following command. -@node Applying custom styles, Links in @acronym{ODT} export, @acronym{ODT} export commands, OpenDocument Text export +@vindex org-export-odt-convert +@table @kbd + +@item M-x org-export-odt-convert +Convert an existing document from one format to another. With a prefix +argument, also open the newly produced file. +@end table + +@node Applying custom styles, Links in ODT export, Extending ODT export, OpenDocument Text export @subsection Applying custom styles @cindex styles, custom @cindex template, custom -The @acronym{ODT} exporter ships with a set of OpenDocument styles +The ODT exporter ships with a set of OpenDocument styles (@pxref{Working with OpenDocument style files}) that ensure a well-formatted output. These factory styles, however, may not cater to your specific tastes. To customize the output, you can either modify the above styles @@ -10893,7 +10921,7 @@ users alike, and is described here. @enumerate @item Create a sample @file{example.org} file with the below settings and export it -to @acronym{ODT} format. +to ODT format. @example #+OPTIONS: H:10 num:t @@ -10936,15 +10964,22 @@ met, the output is going to be less than satisfactory. So it is highly recommended that you only work with templates that are directly derived from the factory settings. -@node Links in @acronym{ODT} export, Tables in @acronym{ODT} export, Applying custom styles, OpenDocument Text export -@subsection Links in @acronym{ODT} export +@node Links in ODT export, Tables in ODT export, Applying custom styles, OpenDocument Text export +@subsection Links in ODT export @cindex tables, in DocBook export -The @acronym{ODT} exporter creates cross-references (aka bookmarks) for -internal links. It creates Internet-style links for all other links. +ODT exporter creates native cross-references for internal links. It creates +Internet-style links for all other links. + +A link with no description and destined to a regular (un-itemized) outline +heading is replaced with a cross-reference and section number of the heading. -@node Tables in @acronym{ODT} export, Images in @acronym{ODT} export, Links in @acronym{ODT} export, OpenDocument Text export -@subsection Tables in @acronym{ODT} export +A @samp{\ref@{label@}}-style reference to an image, table etc. is replaced +with a cross-reference and sequence number of the labelled entity. +@xref{Labels and captions in ODT export}. + +@node Tables in ODT export, Images in ODT export, Links in ODT export, OpenDocument Text export +@subsection Tables in ODT export @cindex tables, in DocBook export Export 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 - tables that have column or row spans - is not supported. Such tables are stripped from the exported document. -By default, a table is exported with top and bottom frames and with -rules separating row and column groups (@pxref{Column groups}). If the table -specifies alignment and relative width for its columns (@pxref{Column width -and alignment}) then these are honored on export.@footnote{The column widths -are interpreted as weighted ratios with the default weight being 1} +By default, a table is exported with top and bottom frames and with rules +separating row and column groups (@pxref{Column groups}). Furthermore, all +tables are typeset to occupy the same width. If the table specifies +alignment and relative width for its columns (@pxref{Column width and +alignment}) then these are honored on export.@footnote{The column widths are +interpreted as weighted ratios with the default weight being 1} @cindex #+ATTR_ODT -If you are not satisfied with the default formatting of tables, you can -create custom table styles and associate them with a table using -the @code{#+ATTR_ODT} line. @xref{Customizing tables in @acronym{ODT} export}. +You can control the width of the table by specifying @code{:rel-width} +property using an @code{#+ATTR_ODT} line. + +For example, consider the following table which makes use of all the rules +mentoned above. + +@example +#+ATTR_ODT: :rel-width 50 +| Area/Month | Jan | Feb | Mar | Sum | +|---------------+-------+-------+-------+-------| +| / | < | | | < | +| <l13> | <r5> | <r5> | <r5> | <r6> | +| North America | 1 | 21 | 926 | 948 | +| Middle East | 6 | 75 | 844 | 925 | +| Asia Pacific | 9 | 27 | 790 | 826 | +|---------------+-------+-------+-------+-------| +| Sum | 16 | 123 | 2560 | 2699 | +@end example + +On export, the table will occupy 50% of text area. The columns will be sized +(roughly) in the ratio of 13:5:5:5:6. The first column will be left-aligned +and rest of the columns will be right-aligned. There will be vertical rules +after separating the header and last columns from other columns. There will +be horizontal rules separating the header and last rows from other rows. + +If you are not satisfied with the above formatting options, you can create +custom table styles and associate them with a table using the +@code{#+ATTR_ODT} line. @xref{Customizing tables in ODT export}. -@node Images in @acronym{ODT} export, Math formatting in @acronym{ODT} export, Tables in @acronym{ODT} export, OpenDocument Text export -@subsection Images in @acronym{ODT} export -@cindex images, embedding in @acronym{ODT} -@cindex embedding images in @acronym{ODT} +@node Images in ODT export, Math formatting in ODT export, Tables in ODT export, OpenDocument Text export +@subsection Images in ODT export +@cindex images, embedding in ODT +@cindex embedding images in ODT @subsubheading Embedding images You 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 @subsubheading Sizing and scaling of embedded images +@cindex #+ATTR_ODT You can control the size and scale of the embedded images using the @code{#+ATTR_ODT} attribute. +@cindex identify, ImageMagick @vindex org-export-odt-pixels-per-inch -Note that the exporter specifies the desired size of the image in the final -document in units of centimeters. In order to scale the embedded images, the -exporter needs to compute the size of the image. This is done by retrieving -the image size in pixels and converting the pixel units to centimeters using +The exporter specifies the desired size of the image in the final document in +units of centimeters. In order to scale the embedded images, the exporter +queries for pixel dimensions of the images using one of a) ImageMagick's +@file{identify} program or b) Emacs `create-image' and `image-size' +APIs.@footnote{Use of @file{ImageMagick} is only desirable. However, if you +routinely produce documents that have large images or you export your Org +files that has images using a Emacs batch script, then the use of +@file{ImageMagick} is mandatory.} The pixel dimensions are subsequently +converted in to units of centimeters using @code{org-export-odt-pixels-per-inch}. The default value of this variable is set to @code{display-pixels-per-inch}. You can tweak this variable to achieve the best results. @@ -11008,7 +11076,6 @@ achieve the best results. The examples below illustrate the various possibilities. @table @asis - @item Explicitly size the image To embed @file{img.png} as a 10 cm x 10 cm image, do the following: @@ -11044,17 +11111,31 @@ height:width ratio, do the following @end example @end table -@node Math formatting in @acronym{ODT} export, Literal examples in @acronym{ODT} export, Images in @acronym{ODT} export, OpenDocument Text export -@subsection Math formatting in @acronym{ODT} export +@subsubheading Anchoring of images + +@cindex #+ATTR_ODT +You can control the manner in which an image is anchored by setting the +@code{:anchor} property of it's @code{#+ATTR_ODT} line. You can specify one +of the the following three values for the @code{:anchor} property - +@samp{"as-char"}, @samp{"paragraph"} and @samp{"page"}. + +To create an image that is anchored to a page, do the following: +@example +#+ATTR_ODT: :anchor "page" +[[./img.png]] +@end example + +@node Math formatting in ODT export, Labels and captions in ODT export, Images in ODT export, OpenDocument Text export +@subsection Math formatting in ODT export -The @acronym{ODT} exporter has special support for handling math. +The ODT exporter has special support for handling math. @menu * Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments * Working with MathML or OpenDocument formula files:: How to embed equations in native format @end menu -@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 +@node Working with @LaTeX{} math snippets, Working with MathML or OpenDocument formula files, Math formatting in ODT export, Math formatting in ODT export @subsubsection Working with @LaTeX{} math snippets @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 that the @file{dvipng} program be available on your system. @end enumerate -@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in @acronym{ODT} export +@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in ODT export @subsubsection Working with MathML or OpenDocument formula files For various reasons, you may find embedding @LaTeX{} math snippets in an -@acronym{ODT} document less than reliable. In that case, you can embed a +ODT document less than reliable. In that case, you can embed a math equation by linking to its MathML(@file{.mml}) source or its OpenDocument formula (@file{.odf}) file as shown below: @@ -11138,102 +11219,95 @@ or [[./equation.odf]] @end example -@node Literal examples in @acronym{ODT} export, Advanced topics in @acronym{ODT} export, Math formatting in @acronym{ODT} export, OpenDocument Text export -@subsection Literal examples in @acronym{ODT} export +@node Labels and captions in ODT export, Literal examples in ODT export, Math formatting in ODT export, OpenDocument Text export +@subsection Labels and captions in ODT export -Export of literal examples (@pxref{Literal examples}) with full fontification -is supported. This feature is enabled by default and is activated -automatically if an enhanced version of @file{htmlfontify.el} is available in -the @code{load-path}.@footnote{The @file{htmlfontify.el} that ships with -standard Emacs <= 24.1 has no support for @acronym{ODT} fontification. A -copy of the proposed version is available as an attachment to -@url{http://debbugs.gnu.org/cgi/bugreport.cgi?msg=5;filename=htmlfontify.el;att=9;bug=9914, -Emacs Bug #9914}.} +You can label and caption various category of objects - an inline image, a +table, a @LaTeX{} fragment or a Math formula - using @code{#+LABEL} and +@code{#+CAPTION} lines. @xref{Images and tables}. ODT exporter enumerates +each labelled or captioned object of a given category separately. As a +result, each such object is assigned a sequence number based on order of it's +appearance in the Org file. -@vindex org-export-odt-fontify-srcblocks +In the exported document, a user-provided caption is augmented with the +category and sequence number. Consider the following inline image in an Org +file. + +@example +#+CAPTION: Bell curve +#+LABEL: fig:SED-HR4049 +[[./img/a.png]] +@end example -The character styles used for fontification of the literal blocks are -auto-generated by the exporter in conjunction with @file{htmlfontify.el} -library and need not be included in the default @file{styles.xml} file. -These auto-generated styles have the @samp{OrgSrc} prefix and inherit their color -based on the face used by Emacs @code{font-lock} library. +It could be rendered as shown below in the exported document. -@vindex org-export-odt-create-custom-styles-for-srcblocks -If you prefer to use your own custom styles for fontification and disable -their auto-generation altogether, you can do so by customizing the variable -@code{org-export-odt-create-custom-styles-for-srcblocks}. +@example +Figure 2: Bell curve +@end example + +@vindex org-export-odt-category-strings +You can modify the category component of the caption by customizing the +variable @code{org-export-odt-category-strings}. For example, to tag all +embedded images with the string @samp{Illustration} (instead of the default +@samp{Figure}) use the following setting. + +@lisp +(setq org-export-odt-category-strings + '(("en" "Table" "Illustration" "Equation" "Equation"))) +@end lisp -You can turn off fontification support for literal examples by customizing -the variable @code{org-export-odt-fontify-srcblocks}. +With this, previous image will be captioned as below in the exported +document. +@example +Illustration 2: Bell curve +@end example + +@node Literal examples in ODT export, Advanced topics in ODT export, Labels and captions in ODT export, OpenDocument Text export +@subsection Literal examples in ODT export -@node Advanced topics in @acronym{ODT} export, , Literal examples in @acronym{ODT} export, OpenDocument Text export -@subsection Advanced topics in @acronym{ODT} export +Export of literal examples (@pxref{Literal examples}) with full fontification +is supported. Internally, the exporter relies on @file{htmlfontify.el} to +generate all style definitions needed for a fancy listing.@footnote{Your +@file{htmlfontify.el} library must atleast be at Emacs 24.1 levels for +fontification to be turned on.} The auto-generated styles have @samp{OrgSrc} +as prefix and inherit their color from the faces used by Emacs +@code{font-lock} library for the source language. -If you rely heavily on @acronym{ODT} export, you may want to exploit the full +@vindex org-export-odt-fontify-srcblocks +If you prefer to use your own custom styles for fontification, you can do so +by customizing the variable +@code{org-export-odt-create-custom-styles-for-srcblocks}. + +@vindex org-export-odt-create-custom-styles-for-srcblocks +You can turn off fontification of literal examples by customizing the +variable @code{org-export-odt-fontify-srcblocks}. + +@node Advanced topics in ODT export, , Literal examples in ODT export, OpenDocument Text export +@subsection Advanced topics in ODT export + +If you rely heavily on ODT export, you may want to exploit the full set of features that the exporter offers. This section describes features that would be of interest to power users. @menu -* Exporting and converting to other formats:: How to produce @samp{pdf} and other formats +* Configuring a document converter:: How to register a document converter * Working with OpenDocument style files:: Explore the internals * Creating one-off styles:: How to produce custom highlighting etc -* Customizing tables in @acronym{ODT} export:: How to define and use Table templates +* Customizing tables in ODT export:: How to define and use Table templates * Validating OpenDocument XML:: How to debug corrupt OpenDocument files @end menu -@node Exporting and converting to other formats, Working with OpenDocument style files, Advanced topics in @acronym{ODT} export, Advanced topics in @acronym{ODT} export -@subsubsection Exporting and converting to other formats +@node Configuring a document converter, Working with OpenDocument style files, Advanced topics in ODT export, Advanced topics in ODT export +@subsubsection Configuring a document converter @cindex convert -@cindex doc, docx - -The @acronym{ODT} exporter adds support for exporting Org outlines to formats -that are not supported natively by Org. It also adds support to convert -document from one format to another. To use these features, you need to -configure a command-line converter. Once a command-line converter is -configured you can use it to extend the list of formats to which Org can -export. @xref{x-export-to-other-formats,,Automatically exporting to other -formats}. You can also use it to perform one-off document conversion as -detailed below. - -@vindex org-export-odt-convert -@table @kbd - -@item M-x org-export-odt-convert -Convert an existing document from one format to another as determined by the -variable @code{org-export-odt-convert-capabilities} -(@pxref{x-odt-converter-capabilities,,Configure converter -capabilities}). @strong{Please note} that you can use this command to even -convert documents that are produced outside of Org and in other formats than -@acronym{ODT} format. -@end table - -@subsubheading Pre-configured converters - +@cindex doc, docx, rtf @cindex converter -The @acronym{ODT} exporter supports two converters out of the box: - -@enumerate - -@cindex @file{unoconv} -@item @file{unoconv} - -This converter is available as an installable package in your favorite -distribution. - -@cindex @file{BasicODConverter} -@item @file{BasicODConverter} -@vindex org-odt-data-dir -This converter is distributed as a LibreOffice extension and can be found in -your Org distribution. See the subdirectory pointed to by the variable -@code{org-odt-data-dir}. - -@end enumerate - -@subsubheading Installing a new converter -If you prefer to use a converter other than the two mentioned above, then you -may have to do additional configuration. You can proceed as follows: +The ODT exporter can work with popular converters with little or no +extra configuration from your side. @xref{Extending ODT export}. +If you are using a converter that is not supported by default or if you would +like to tweak the default converter settings, proceed as below. @enumerate @item Register the converter @@ -11262,12 +11336,12 @@ Select the newly added converter as the preferred one by customizing the variable @code{org-export-odt-convert-process}. @end enumerate -@node Working with OpenDocument style files, Creating one-off styles, Exporting and converting to other formats, Advanced topics in @acronym{ODT} export +@node Working with OpenDocument style files, Creating one-off styles, Configuring a document converter, Advanced topics in ODT export @subsubsection Working with OpenDocument style files @cindex styles, custom @cindex template, custom -This section explores the internals of the @acronym{ODT} exporter and the +This section explores the internals of the ODT exporter and the means by which it produces styled documents. Read this section if you are interested in exploring the automatic and custom OpenDocument styles used by the exporter. @@ -11275,7 +11349,7 @@ the exporter. @anchor{x-factory-styles} @subsubheading Factory styles -The @acronym{ODT} exporter relies on two files for generating its output. +The ODT exporter relies on two files for generating its output. These files are bundled with the distribution under the directory pointed to by the variable @code{org-odt-styles-dir}. The two files are: @@ -11321,7 +11395,7 @@ are numbered. @anchor{x-overriding-factory-styles} @subsubheading Overriding factory styles -The following two variables control the location from which the @acronym{ODT} +The following two variables control the location from which the ODT exporter picks up the custom styles and content template files. You can customize these variables to override the factory styles used by the exporter. @@ -11366,7 +11440,7 @@ Use this variable to specify the blank @file{content.xml} that will be used in the final output. @end itemize -@node Creating one-off styles, Customizing tables in @acronym{ODT} export, Working with OpenDocument style files, Advanced topics in @acronym{ODT} export +@node Creating one-off styles, Customizing tables in ODT export, Working with OpenDocument style files, Advanced topics in ODT export @subsubsection Creating one-off styles There 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. @end enumerate -@node Customizing tables in @acronym{ODT} export, Validating OpenDocument XML, Creating one-off styles, Advanced topics in @acronym{ODT} export -@subsubsection Customizing tables in @acronym{ODT} export +@node Customizing tables in ODT export, Validating OpenDocument XML, Creating one-off styles, Advanced topics in ODT export +@subsubsection Customizing tables in ODT export @cindex tables, in ODT export @cindex #+ATTR_ODT You can override the default formatting of the table by specifying a custom table style with the @code{#+ATTR_ODT} line. For a discussion on default -formatting of tables @pxref{Tables in @acronym{ODT} export}. +formatting of tables @pxref{Tables in ODT export}. This feature closely mimics the way table templates are defined in the OpenDocument-v1.2 @@ -11466,7 +11540,7 @@ the table that follows. @end lisp @example -#+ATTR_ODT: TableWithHeaderRowAndColumn +#+ATTR_ODT: :style "TableWithHeaderRowAndColumn" | Name | Phone | Age | | Peter | 1234 | 17 | | Anna | 4321 | 25 | @@ -11571,9 +11645,9 @@ To define a table style, create an entry for the style in the variable @end itemize For example, the entry below defines two different table styles -@samp{TableWithHeaderRowsAndColumns} and @samp{TableWithHeaderColumns} based -on the same template @samp{Custom}. The styles achieve their intended effect -by selectively activating the individual cell styles in that template. +@samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow} +based on the same template @samp{Custom}. The styles achieve their intended +effect by selectively activating the individual cell styles in that template. @lisp (setq org-export-odt-table-styles @@ -11593,18 +11667,18 @@ To do this, specify the table style created in step (2) as part of the @code{ATTR_ODT} line as shown below. @example -#+ATTR_ODT: TableWithHeaderRowAndColumn +#+ATTR_ODT: :style "TableWithHeaderRowAndColumn" | Name | Phone | Age | | Peter | 1234 | 17 | | Anna | 4321 | 25 | @end example @end enumerate -@node Validating OpenDocument XML, , Customizing tables in @acronym{ODT} export, Advanced topics in @acronym{ODT} export +@node Validating OpenDocument XML, , Customizing tables in ODT export, Advanced topics in ODT export @subsubsection Validating OpenDocument XML Occasionally, you will discover that the document created by the -@acronym{ODT} exporter cannot be opened by your favorite application. One of +ODT exporter cannot be opened by your favorite application. One of the common reasons for this is that the @file{.odt} file is corrupt. In such cases, you may want to validate the document against the OpenDocument RELAX NG Compact Syntax (RNC) schema. @@ -11618,7 +11692,7 @@ general help with validation (and schema-sensitive editing) of XML files: If you have ready access to OpenDocument @file{.rnc} files and the needed schema-locating rules in a single folder, you can customize the variable @code{org-export-odt-schema-dir} to point to that directory. The -@acronym{ODT} exporter will take care of updating the +ODT exporter will take care of updating the @code{rng-schema-locating-files} for you. @c end opendocument @@ -12622,17 +12696,24 @@ of tangled code files. @section Evaluating code blocks @cindex code block, evaluating @cindex source code, evaluating +@cindex #+RESULTS Code blocks can be evaluated@footnote{Whenever code is evaluated there is a potential for that code to do harm. Org mode provides safeguards to ensure that code is only evaluated after explicit confirmation from the user. For information on these safeguards (and on how to disable them) see @ref{Code evaluation security}.} and the results of evaluation optionally placed in the -Org mode buffer. By default, the evaluation facility is only enabled for -Lisp code blocks specified as @code{emacs-lisp}. However, source code blocks -in many languages can be evaluated within Org mode (see @ref{Languages} for a -list of supported languages and @ref{Structure of code blocks} for -information on the syntax used to define a code block). +Org mode buffer. The results of evaluation are placed following a line that +begins by default with @code{#+RESULTS} and optionally a cache identifier +and/or the name of the evaluated code block. The default value of +@code{#+RESULTS} can be changed with the customizable variable +@code{org-babel-results-keyword}. + +By default, the evaluation facility is only enabled for Lisp code blocks +specified as @code{emacs-lisp}. However, source code blocks in many languages +can be evaluated within Org mode (see @ref{Languages} for a list of supported +languages and @ref{Structure of code blocks} for information on the syntax +used to define a code block). @kindex C-c C-c There 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: * session:: Preserve the state of code evaluation * noweb:: Toggle expansion of noweb references * noweb-ref:: Specify block's noweb reference resolution target +* noweb-sep:: String used to separate noweb references * cache:: Avoid re-evaluating unchanged code blocks * sep:: Delimiter for writing tabular results outside Org * hlines:: Handle horizontal lines in tables @@ -13351,9 +13433,9 @@ The result is converted to pretty-printed code and is enclosed in a code block. This option currently supports Emacs Lisp, Python, and Ruby. E.g., @code{:results value pp}. @item @code{wrap} -The result is wrapped in a @code{begin_result} block. This can be useful for +The result is wrapped in a RESULTS drawer. This can be useful for inserting @code{raw} or @code{org} syntax results in such a way that their -extend is known and they can be automatically removed or replaced. +extent is known and they can be automatically removed or replaced. @end itemize @subsubheading Handling @@ -13583,9 +13665,8 @@ argument can have one of three values: @code{yes}, @code{no}, or @code{tangle}. All ``noweb'' syntax references in the body of the code block will be expanded before the block is evaluated, tangled or exported. @item @code{no} -The default. No ``noweb'' syntax specific action is taken on evaluating -code blocks, However, noweb references will still be expanded during -tangling. +The default. No ``noweb'' syntax specific action is taken when the code +block is evaluated, tangled or exported. @item @code{tangle} All ``noweb'' syntax references in the body of the code block will be expanded 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 be affected by this change, so it is still possible to use inline noweb references. -@node noweb-ref, cache, noweb, Specific header arguments +@node noweb-ref, noweb-sep, noweb, Specific header arguments @subsubsection @code{:noweb-ref} When expanding ``noweb'' style references the bodies of all code block with @emph{either} a block name matching the reference name @emph{or} a @@ -13661,13 +13742,27 @@ inheritance}).}. #+END_SRC @end example -@node cache, sep, noweb-ref, Specific header arguments +The @code{:noweb-sep} (see @ref{noweb-sep}) header argument holds the string +used to separate accumulate noweb references like those above. By default a +newline is used. + +@node noweb-sep, cache, noweb-ref, Specific header arguments +@subsubsection @code{:noweb-sep} + +The @code{:noweb-sep} header argument holds the string used to separate +accumulate noweb references (see @ref{noweb-ref}). By default a newline is +used. + +@node cache, sep, noweb-sep, Specific header arguments @subsubsection @code{:cache} The @code{:cache} header argument controls the use of in-buffer caching of the results of evaluating code blocks. It can be used to avoid re-evaluating -unchanged code blocks. This header argument can have one of two -values: @code{yes} or @code{no}. +unchanged code blocks. Note that the @code{:cache} header argument will not +attempt to cache results when the @code{:session} header argument is used, +because the results of the code block execution may be stored in the session +outside of the Org-mode buffer. The @code{:cache} header argument can have +one of two values: @code{yes} or @code{no}. @itemize @bullet @item @code{no} @@ -14004,6 +14099,14 @@ evaluation. If @code{:noweb no}, the default, then the reference is not expanded before evaluation. See the @ref{noweb-ref} header argument for a more flexible way to resolve noweb references. +It is possible to include the @emph{results} of a code block rather than the +body. This is done by appending parenthesis to the code block name which may +optionally contain arguments to the code block as shown below. + +@example +<<code-block-name(optional arguments)>> +@end example + Note: the default value, @code{:noweb no}, was chosen to ensure that correct code is not broken in a language, such as Ruby, where @code{<<arg>>} is a syntactically valid construct. If @code{<<arg>>} is not @@ -14040,34 +14143,72 @@ are active: In an Org mode buffer, the following key bindings are active: @multitable @columnfractions 0.45 0.55 -@kindex C-c C-v a -@kindex C-c C-v C-a -@item @kbd{C-c C-v a} @ @ @r{or} @ @ @kbd{C-c C-v C-a} @tab @code{org-babel-sha1-hash} +@kindex C-c C-v p +@kindex C-c C-v C-p +@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab @code{org-babel-previous-src-block} +@kindex C-c C-v n +@kindex C-c C-v C-n +@item @kbd{C-c C-v n} @ @ @r{or} @ @ @kbd{C-c C-v C-n} @tab @code{org-babel-next-src-block} +@kindex C-c C-v e +@kindex C-c C-v C-e +@item @kbd{C-c C-v e} @ @ @r{or} @ @ @kbd{C-c C-v C-e} @tab @code{org-babel-execute-maybe} +@kindex C-c C-v o +@kindex C-c C-v C-o +@item @kbd{C-c C-v o} @ @ @r{or} @ @ @kbd{C-c C-v C-o} @tab @code{org-babel-open-src-block-result} +@kindex C-c C-v v +@kindex C-c C-v C-v +@item @kbd{C-c C-v v} @ @ @r{or} @ @ @kbd{C-c C-v C-v} @tab @code{org-babel-expand-src-block} +@kindex C-c C-v u +@kindex C-c C-v C-u +@item @kbd{C-c C-v u} @ @ @r{or} @ @ @kbd{C-c C-v C-u} @tab @code{org-babel-goto-src-block-head} +@kindex C-c C-v g +@kindex C-c C-v C-g +@item @kbd{C-c C-v g} @ @ @r{or} @ @ @kbd{C-c C-v C-g} @tab @code{org-babel-goto-named-src-block} +@kindex C-c C-v r +@kindex C-c C-v C-r +@item @kbd{C-c C-v r} @ @ @r{or} @ @ @kbd{C-c C-v C-r} @tab @code{org-babel-goto-named-result} @kindex C-c C-v b @kindex C-c C-v C-b @item @kbd{C-c C-v b} @ @ @r{or} @ @ @kbd{C-c C-v C-b} @tab @code{org-babel-execute-buffer} -@kindex C-c C-v f -@kindex C-c C-v C-f -@item @kbd{C-c C-v f} @ @ @r{or} @ @ @kbd{C-c C-v C-f} @tab @code{org-babel-tangle-file} -@kindex C-c C-v g -@item @kbd{C-c C-v g} @tab @code{org-babel-goto-named-source-block} -@kindex C-c C-v h -@item @kbd{C-c C-v h} @tab @code{org-babel-describe-bindings} -@kindex C-c C-v l -@kindex C-c C-v C-l -@item @kbd{C-c C-v l} @ @ @r{or} @ @ @kbd{C-c C-v C-l} @tab @code{org-babel-lob-ingest} -@kindex C-c C-v p -@kindex C-c C-v C-p -@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab @code{org-babel-expand-src-block} @kindex C-c C-v s @kindex C-c C-v C-s @item @kbd{C-c C-v s} @ @ @r{or} @ @ @kbd{C-c C-v C-s} @tab @code{org-babel-execute-subtree} +@kindex C-c C-v d +@kindex C-c C-v C-d +@item @kbd{C-c C-v d} @ @ @r{or} @ @ @kbd{C-c C-v C-d} @tab @code{org-babel-demarcate-block} @kindex C-c C-v t @kindex C-c C-v C-t @item @kbd{C-c C-v t} @ @ @r{or} @ @ @kbd{C-c C-v C-t} @tab @code{org-babel-tangle} +@kindex C-c C-v f +@kindex C-c C-v C-f +@item @kbd{C-c C-v f} @ @ @r{or} @ @ @kbd{C-c C-v C-f} @tab @code{org-babel-tangle-file} +@kindex C-c C-v c +@kindex C-c C-v C-c +@item @kbd{C-c C-v c} @ @ @r{or} @ @ @kbd{C-c C-v C-c} @tab @code{org-babel-check-src-block} +@kindex C-c C-v j +@kindex C-c C-v C-j +@item @kbd{C-c C-v j} @ @ @r{or} @ @ @kbd{C-c C-v C-j} @tab @code{org-babel-insert-header-arg} +@kindex C-c C-v l +@kindex C-c C-v C-l +@item @kbd{C-c C-v l} @ @ @r{or} @ @ @kbd{C-c C-v C-l} @tab @code{org-babel-load-in-session} +@kindex C-c C-v i +@kindex C-c C-v C-i +@item @kbd{C-c C-v i} @ @ @r{or} @ @ @kbd{C-c C-v C-i} @tab @code{org-babel-lob-ingest} +@kindex C-c C-v I +@kindex C-c C-v C-I +@item @kbd{C-c C-v I} @ @ @r{or} @ @ @kbd{C-c C-v C-I} @tab @code{org-babel-view-src-block-info} @kindex C-c C-v z @kindex C-c C-v C-z -@item @kbd{C-c C-v z} @ @ @r{or} @ @ @kbd{C-c C-v C-z} @tab @code{org-babel-switch-to-session} +@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} +@kindex C-c C-v a +@kindex C-c C-v C-a +@item @kbd{C-c C-v a} @ @ @r{or} @ @ @kbd{C-c C-v C-a} @tab @code{org-babel-sha1-hash} +@kindex C-c C-v h +@kindex C-c C-v C-h +@item @kbd{C-c C-v h} @ @ @r{or} @ @ @kbd{C-c C-v C-h} @tab @code{org-babel-describe-bindings} +@kindex C-c C-v x +@kindex C-c C-v C-x +@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} @end multitable @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 been installed properly. As of Emacs 22, Calc is part of the Emacs distribution. Another possibility for interaction between the two packages is using Calc for embedded calculations. @xref{Embedded Mode, -, Embedded Mode, Calc, GNU Emacs Calc Manual}. +, Embedded Mode, calc, GNU Emacs Calc Manual}. @item @file{constants.el} by Carsten Dominik @cindex @file{constants.el} @cindex Dominik, Carsten @@ -15215,7 +15356,7 @@ not accept any arguments, and return the full link with prefix. @vindex org-ctrl-c-ctrl-c-hook Org has several commands that act differently depending on context. The most -important example it the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}). +important example is the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}). Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property. Add-ons can tap into this functionality by providing a function that detects @@ -16431,7 +16572,7 @@ with links transformation to Org syntax. @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual chapter about publishing. @item -@i{Jambunathan K} contributed the @acronym{ODT} exporter. +@i{Jambunathan K} contributed the ODT exporter. @item @i{Sebastien Vauban} reported many issues with @LaTeX{} and BEAMER export and enabled source code highlighting in Gnus. diff --git a/etc/ChangeLog b/etc/ChangeLog index 94a9ae6ed4..370f009a29 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,11 @@ +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org/OrgOdtContentTemplate.xml (OrgIndentedSection-Level-*): + New section styles. These sections are indented to the same + level as the corresponding list entries. These sections hold + tables that occur within a list. (OrgTable): Increased + relative width from 90% to 96% for aesthetic reasons. + 2012-03-16 Glenn Morris <rgm@gnu.org> * HELLO: Say that this is not a comprehensive list. diff --git a/etc/org/OrgOdtContentTemplate.xml b/etc/org/OrgOdtContentTemplate.xml index f50588b2ad..cd7ff0e156 100644 --- a/etc/org/OrgOdtContentTemplate.xml +++ b/etc/org/OrgOdtContentTemplate.xml @@ -46,8 +46,61 @@ <!-- automatic styles --> <office:automatic-styles> + <!-- Section styles --> + <style:style style:name="OrgIndentedSection-Level-1" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="1.281cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-2" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="1.905cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-3" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="2.54cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-4" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="3.175cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-5" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="3.81cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-6" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="4.445cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-7" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="5.08cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-8" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="5.715cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-9" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="6.35cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + <style:style style:name="OrgIndentedSection-Level-10" style:family="section"> + <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="6.985cm" fo:margin-right="0cm" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + </style:section-properties> + </style:style> + + <!-- Table styles --> <style:style style:name="OrgTable" style:family="table"> - <style:table-properties style:rel-width="90%" fo:margin-top="0cm" fo:margin-bottom="0.20cm" table:align="center"/> + <style:table-properties style:rel-width="96%" fo:margin-top="0cm" fo:margin-bottom="0.20cm" table:align="center"/> </style:style> <style:style style:name="OrgTableColumn" style:family="table-column"> diff --git a/etc/org/OrgOdtStyles.xml b/etc/org/OrgOdtStyles.xml index 4fb282064b..470b7b134a 100644 --- a/etc/org/OrgOdtStyles.xml +++ b/etc/org/OrgOdtStyles.xml @@ -718,15 +718,75 @@ <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> </office:styles> <office:automatic-styles> - <style:page-layout style:name="Mpm1"> + <style:style style:name="MP1" style:family="paragraph" style:parent-style-name="Footer"> + <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> + </style:style> + <style:page-layout style:name="Mpm1" style:page-usage="mirrored"> <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"> - <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"/> + <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"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style> + <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"/> + </style:footer-style> + </style:page-layout> + <style:page-layout style:name="Mpm2"> + <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"> + <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"/> </style:page-layout-properties> <style:header-style/> <style:footer-style/> </style:page-layout> + <style:page-layout style:name="Mpm3" style:page-usage="mirrored"> + <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"> + <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"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style> + <style:header-footer-properties fo:min-height="0cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.499cm"/> + </style:footer-style> + </style:page-layout> + <style:page-layout style:name="Mpm4" style:page-usage="right"> + <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"> + <style:background-image/> + <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"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style> + <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"/> + </style:footer-style> + </style:page-layout> + <style:page-layout style:name="Mpm5" style:page-usage="mirrored"> + <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"> + <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"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style> + <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"/> + </style:footer-style> + </style:page-layout> </office:automatic-styles> <office:master-styles> - <style:master-page style:name="Standard" style:page-layout-name="Mpm1"/> + <style:master-page style:name="Standard" style:page-layout-name="Mpm1"> + <style:footer> + <text:p text:style-name="MP1"><text:page-number text:select-page="current"></text:page-number></text:p> + </style:footer> + </style:master-page> + <style:master-page style:name="OrgTitlePage" style:page-layout-name="Mpm2" style:next-style-name="OrgFrontMatterPage"/> + <style:master-page style:name="OrgFrontMatterPage" style:page-layout-name="Mpm3"> + <style:footer> + <text:p text:style-name="MP1"><text:page-number text:select-page="current"/></text:p> + </style:footer> + </style:master-page> + <style:master-page style:name="OrgFirstPage" style:page-layout-name="Mpm4" style:next-style-name="OrgPage"> + <style:footer> + <text:p text:style-name="MP1"><text:page-number text:select-page="current"/></text:p> + </style:footer> + </style:master-page> + <style:master-page style:name="OrgPage" style:page-layout-name="Mpm5"> + <style:footer> + <text:p text:style-name="MP1"><text:page-number text:select-page="current"/></text:p> + </style:footer> + </style:master-page> </office:master-styles> </office:document-styles> diff --git a/etc/org/README b/etc/org/README index 206f3a26b5..bdebef3f30 100644 --- a/etc/org/README +++ b/etc/org/README @@ -1,7 +1,7 @@ The files OrgOdtContentTemplate.xml and OrgOdtStyles.xml have the following copyright information: -Copyright (C) 2010-2012 Free Software Foundation, Inc. +Copyright (C) 2010-2011 Free Software Foundation, Inc. These files are part of GNU Emacs. diff --git a/etc/refcards/orgcard.pdf b/etc/refcards/orgcard.pdf Binary files differindex 92df030d4d..201bb892dc 100644 --- a/etc/refcards/orgcard.pdf +++ b/etc/refcards/orgcard.pdf diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex index 64200742ae..d0f5d29d87 100644 --- a/etc/refcards/orgcard.tex +++ b/etc/refcards/orgcard.tex @@ -1,6 +1,6 @@ % Reference Card for Org Mode -\def\orgversionnumber{7.8.02} -\def\versionyear{2011} % latest update +\def\orgversionnumber{7.8.07} +\def\versionyear{2012} % latest update \def\year{2012} % latest copyright year %**start of header @@ -17,7 +17,7 @@ \pdflayout=(0l) % Nothing else needs to be changed below this line. -% Copyright (C) 1987, 1993, 1996-1997, 2001-2012 +% Copyright (C) 1987, 1993, 1996-1997, 2001-2011 % Free Software Foundation, Inc. % This file is part of GNU Emacs. diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 392fe25202..a5e33f1ea9 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,1442 @@ +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-C.el (org-babel-C-execute): Add .exe to the end of compiled + C files on windows. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-code): Escape all lines when exporting + Org-mode blocks. + + * ob.el (org-babel-parse-src-block-match): Make use of the new + language argument to org-babel-strip-protective-commas. + (org-babel-parse-inline-src-block-match): Make use of the new + language argument to org-babel-strip-protective-commas. + (org-babel-strip-protective-commas): Now accepts a language + argument. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-fast-tag-selection): Fix an bug when listing tags + for completion. + +2012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change) + + * org.el (org-delete-property-globally): Fixed a bug that left + blank line in place of the property, instead of removing the line. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * ob-maxima.el (org-babel-maxima-command): Add group information + to the defcustom. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-mode): Use `buffer-face-mode' to remap the 'default + face to 'org-default. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-ascii.el (org-export-as-ascii): Fix escaping of underscores + in links. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el: Prevent a bug while defining the menu by requiring + `org-beamer' when necessary. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-table.el (orgtbl-self-insert-command): Use + `backward-delete-char' instead of `delete-backward-char' as this + last command gets caught by the compiler which says to not use it + in programs. `backward-delete-char' is just an alias for + `delete-backward-char' which is internally remapped to + `org-delete-backward-char' for optimization purpose. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-latex.el (org-export-latex-subcontent): Bugfix: when + `org-export-latex-low-levels' is nil, do not export low levels. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-insert-result): Fix bug in indented wrapped + results insertion. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-tags): Include `org-tag-alist' in the list of + possible completions, even when there are tags defined in the + buffer. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-mime.el (org-mime-htmlize): Set + `org-export-with-LaTeX-fragments' correctly. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-tags): Don't add a column when there is only one + tag offered for completion. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-fast-tag-selection): Include tags from + `org-tag-alist' when completing with the TAB key. + +2012-04-01 Shoji Nishimura <nishimura.shoji@gmail.com> (tiny change) + + * org.el (org-display-inline-images): Honor the ̀beg' parameter. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-latex.el (org-export-latex-subcontent): Don't insert a + linebreak when itemizing a subtree that is just a headline. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-lob.el (org-babel-lob-get-info): Removed extra []s when + parsing inline call_foo lines. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-maxima.el (org-babel-maxima-command): The maxima command used + should be configurable (defaults to maxima-command if defined). + (org-babel-execute:maxima): The maxima command used should be + configurable (defaults to maxima-command if defined). + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-C.el (org-babel-C-execute): Add the local directory to the + library search path for C/C++ block compilation. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-where-is-src-block-result): Don't truncate + results name on call line execution. + +2012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change) + + * org-colview.el (org-columns-cleanup-item): Handle case of empty + headline + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-delete-definitions): Fix LaTeX + export error when a src block produces fake footnotes. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-read-date): Don't mention `parse-time-weekdays' and + `parse-time-months' in the docstring. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-agenda.el (org-agenda-filter-apply): Bugfix: Add let + binding. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-colview.el (org-columns-compute): Also consider inline tasks + when computing the sum. + +2012-04-01 Thomas Morgan <tlm@ziiuu.com> (tiny change) + + * org-habit.el (org-habit-insert-consistency-graphs): Fix + alignment of consistency graph in filtered agenda view. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-latex.el (org-export-as-latex): Fix bug in setting the + export directory according to the LaTeX options. + +2012-04-01 K.Nagashima <uni.naga@gmail.com> (tiny change) + + * org.el (org-show-subtree): Make interactive. + +2012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> + + * org-clock.el: (org-clock-get-table-data): Make sure todo-only + does not leak when it is set by make-org-tags-macher. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-cycle-internal-local): Don't try to hide drawers + within subtrees in this function, it slows cycling down. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-agenda.el (org-agenda-custom-commands-local-options): Fix + incorrect custom option definition. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-colview.el (org-columns-display-here): Bugfix: use the date + as the value for the ITEM column when displaying a summary. + +2012-04-01 Martyn Jago <martyn.jago@btinternet.com> + + * ob-lilypond.el: Re-direct homepage to Worg. + +2012-04-01 Martyn Jago <martyn.jago@btinternet.com> + + * ob-lilypond.el: Leave versioning to Org. + +2012-04-01 Martyn Jago <martyn.jago@btinternet.com> + + * ob-lilypond.el: Fix compiler warning. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-format-entity-caption): Enumerate entities + that have either a caption or a label. + (org-odt-label-styles, org-odt-category-map-alist): Add a + separator between sequence number and caption. Introduced two + new label styles for handling of math formula and math label. + (org-odt-format-label-definition) + (org-export-odt-format-formula): Propagate above changes. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-enforce-todo-dependencies): Fix docstring. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-export-odt-category-strings): New custom + variable. + (org-odt-category-map-alist): Modify interpretation. Don't + use the same field to double up as both a OpenDocument + variable and a category string. Entries in this list now + specify only the OpenDocument variable. Category strings are + obtained through an indirect lookup of + `org-export-odt-category-strings'. Use same OpenDocument + variables as what LibreOffice uses for various entities. Fix + docstring. + (org-odt-add-label-definition) + (org-odt-format-label-definition) + (org-odt-format-label-reference): Propagate above changes. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-latex.el (org-export-as-latex): Check TeX-master correctly. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-category-map-alist): Update docstring. + (org-export-odt-user-categories) + (org-export-odt-get-category-from-label) + (org-odt-get-label-category-and-style): Remove. + (org-odt-add-label-definition): Propagate above changes. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org.el (org-refile): Don't allow creation of parents when using + the refile command to go to a headline. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-format-org-link): Resolve links to headlines + as section numbers only if section numbering is on. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (format-spec): Require 'format-spec. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-latex.el (org-export-as-latex): Fix TeX-master declaration. + +2012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change) + + * org.el (org-imenu-get-tree): Check that looking-at succeeds + before using match results. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-exp-blocks.el (org-ditaa-jar-path): Make a defcustom. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-lparse.el (org-do-lparse): Make effective setting of + `org-export-headline-levels' available to the ODT exporter. Also + remove some stale comments. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-begin-toc): Handle named HTML entities in + per-language string for "Table Of Contents". + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-exp-blocks.el (org-ditaa-jar-path): Fix merge conflict. + +2012-04-01 Shaun Johnson <shaun@slugfest.demon.co.uk> (tiny change) + + * org-exp-blocks.el (org-ditaa-jar-path): Better heuristic to find + the libary name. + +2012-04-01 Suvayu Ali <fatkasuvayu+linux@gmail.com> + + * org-src.el (org-edit-src-code): Change let bind to let*, e.g. if + case-fold-search is bound to nil globally, the + (case-fold-search t) doesn't work until we get to the body. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-latex.el (org-export-latex-tables): Allow to use + sidewaystable. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-expand-noweb-references): Fix bug in src name + regexp when using *org-babel-use-quick-and-dirty-noweb-expansion*. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org.el (org-scan-tags): Require one or more spaces (+) between + keyword and headline. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-agenda.el (org-prepare-agenda): Don't reset + `org-done-keywords-for-agenda' when `org-agenda-multi'. + +2012-04-01 Thomas Morgan <tlm@ziiuu.com> (tiny change) + + * org-habit.el (org-habit-insert-consistency-graphs): Fix bug + while inserting habit graph in the agenda buffer. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-src.el (org-src-edit-buffer-p): New function. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-agenda.el (org-agenda-skip-if): Fix the order conditions are + being checked. Also enhance the docstring a bit. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org-agenda.el (org-agenda-tree-to-indirect-buffer): Fix the + display of indirect agenda window. + +2012-04-01 Bastien Guerry <bzg@gnu.org> (tiny change) + + * org.el (org-create-formula-image, org-dvipng-color): Fix XEmacs + compatibility bug. + +2012-04-01 Carsten Dominik <carsten.dominik@gmail.com> (tiny change) + + * org-clock.el (org-clock-get-table-data): Bind org-scanner-tags + to tags-list and org-trust-scanner-tags to t while evaluating the + matcher, since the matcher is always evaluated at the current + entry. + +2012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change) + + * org.el (org-scan-tags): Bind org-trust-scanner-tags to t while + evaluating the matcher, since the matcher is always evaluated at + the current entry. + +2012-04-01 Ilya Shlyakhter <ilya_shl@alum.mit.edu> (tiny change) + + * ob-lilypond.el (ly-compile-lilyfile): Fixed misplaced comma in a + quoting expression. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-merge-params): Add "eval" as acceptable noweb + argument. + (org-babel-noweb-p): The "eval" argument only expands during + evaluation. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-strip-protective-commas): Declared. + + * org-agenda.el (org-agenda-filtered-by-category): Declared. + (org-agenda-filter-apply): Capture free variable. + + * org-footnote.el (org-skip-whitespace): Declared. + + * org-mobile.el (org-agenda-filter): Declared. + + * org-src.el (org-strip-protective-commas): Declared. + +2012-04-01 Sebastien Vauban <sva@mygooglest.com> (tiny change) + + * org.el (org-version): Add autoload cookie. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-attach.el (org-attach-store-link-p): Remove spurious quote + in customization form choice. + +2012-04-01 Tassilo Horn <tassilo@member.fsf.org> + + * org-contacts.el (org-contacts-check-mail-address): Add missing + word to `y-or-n-p' question. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-sh.el (org-babel-execute:sh): Pass all params to subroutine. + (org-babel-sh-evaluate): Apply :shebang and :padline to shell script + execution. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-insert-result): Ensure correct order for empty + result wrapping blocks. + +2012-04-01 Martyn Jago <martyn.jago@btinternet.com> + + * ob-lilypond.el: Make auditioning of midi and pdf asynchronous, + and add easy pdf generation in the form of `ly-gen-pdf' variable. + +2012-04-01 Deech <deech@deech-ThinkPad-X200.none> (tiny change) + + * ob-tangle.el (org-babel-spec-to-string): The link generated by + org-store-link is escaped twice when tangling with ":comments yes" + flag. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-html.el (org-export-as-html): Remove another useless space + before tag. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-html.el (org-export-as-html): Remove another useless space + before tag. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-html.el (org-export-as-html): Remove useless space before + tag. + +2012-04-01 Sebastien Vauban <sva@mygooglest.com> (tiny change) + + * org.el (org-version): Add autoload cookie. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-get-category): Save match data. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-tangle.el (org-babel-tangle): Don't prompt for a file name if + :tangle is specified. + + * ob.el (org-babel-expand-noweb-references): Widen buffer when + expanding noweb references. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-table.el (sbe): Don't accidentally leave a `t' value when + variables are force interpreted as strings. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-bbdb.el (org-bbdb-open, org-bbdb-open-old) + (org-bbdb-open-new): Pass record name to avoid dynamic scoping. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-bbdb.el (bbdb-record-get-field, bbdb-search-name) + (bbdb-search-organization): Declare functions to silence byte + compiler. + +2012-04-01 Bernt Hansen <bernt@norang.ca> + + * org.el (org-clone-subtree-with-time-shift): Fix task cloning for + repeating tasks using .+n and ++n syntax + +2012-04-01 Karl Fogel <kfogel@red-bean.com> (tiny change) + + * org-agenda.el (org-agenda-highlight-todo): Handle the case of a + heading that has a date but no todo keyword. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-find-named-result): Fix code block replacement + with results. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-normalize): Do not normalize + labels when sort-only is non-nil. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-normalize): Remove an useless part + of the function. + (org-insert-footnote-reference-near-definition): Remove function. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-normalize): Fix normalization of + inline footnotes with no footnote section. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-bbdb.el (org-bbdb-old): Replace `defvar' after loading 'bbdb + to check for old or new version by a check for the required + function in `org-bbdb-open' and `org-bbdb-store-link'. + (org-bbdb-store-link, org-bbdb-open): Check which version of bbdb is + to be used. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-find-named-result): Don't miss a code block + when there are confounding spaces after the result name. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-lob.el (org-babel-block-lob-one-liner-regexp): Less greedy + regular expressions. + (org-babel-inline-lob-one-liner-regexp): Less greedy regular + expressions. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-examplize-region): Fixed bug in examplization. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-link-search): Search for #+name affiliated keywords + and invisible targets. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-lparse.el (org-lparse-end-footnote-definition): Cleanup + newlines in a transcoded footnote definition. This ensures that + the line that is currently being processed by `org-do-lparse' loop + doesn't get broken up into multiple lines. Fix for the following + bug - + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-footnote.el (org-footnote-normalize): Force a paragraph + break after the last footnote definition. This is an an implicit + assumption made by the org-lparse.el library. With this change, + footnote definitions can reliably be exported with ODT backend. + See http://lists.gnu.org/archive/html/emacs-orgmode/2012-02/msg01013.html. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-ditaa.el (org-ditaa-jar-path): Fix a recursive load error. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-list.el (org-list-struct): Fix small bug introduced by + commit 8b7a3f249803aba612f9ad3ae50c2fc986247da4 in Org's git repo. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-ditaa.el (org-ditaa-jar-path): Already defined in + org-exp-blocks.el. + + * org-exp-blocks.el (org-ditaa-jar-path): Declare appropriately + for the fact that this is really now a Babel thing -- even if it + is used here and the definition should remain here for reasons of + load dependencies. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-bbdb.el (org-bbdb-old): Wrap `defvar' so the variable gets + defined after bbdb was loaded. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org-latex.el (org-export-latex-tables): Don't add spurious + preceding newline if caption is not above a longtable. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-insert-toc): Remove this stray, + dysfunctional routine. This possibly has crept in because of the + broken merges between "maint" and "origin" branches. + (org-odt-begin-table): Don't emit an empty paragraph when a table is + neither labelled or captioned. + (org-odt-init-outfile): Remove reference to an unused variable. + +2012-04-01 Viktor Rosenfeld <listuser36@googlemail.com> + + * ob-sql.el (org-babel-execute:sql): Add support for MonetDB to + SQL code blocks. + +2012-04-01 Andreas Leha <andreas.leha@med.uni-goettingen.de> + + * ob.el (org-babel-goto-named-src-block): Pushing the point to the + org-mark-ring and guessing at the code block name to jump to. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-agenda.el (org-agenda-tree-to-indirect-buffer): Fix handling + of indirect buffer and window. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-forbidden-blocks): Allow footnotes + in verse blocks. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-forbidden-blocks): Allow footnotes + in verse blocks. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-exp.el (org-table-clean-before-export): Ignore table rows + defining parameters for formulas during export. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-list.el (org-list-get-item-number): New function. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-list.el (org-list-ending-method, org-list-end-regexp): + Removed variables. + (org-in-item-p, org-list-separating-blank-lines-number) + (org-list-parse-list, org-list-struct): Apply changes. + + * org-exp.el (org-export-mark-list-end) + (org-export-mark-list-properties): Apply changes. + + * org-latex.el (org-export-latex-lists): Apply changes. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-cycle-internal-local): Correctly unfold headlines + containing an inlinetask. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-structure-template-alist): Fix missing angle + brackets for muse export style. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org.el (org-recenter-calendar): Use `with-selected-window' to + select calendar window and save currently selected window and + current buffer. + +2012-04-01 Toby S. Cubitt <tsc25@cantab.net> (tiny change) + + * org.el (org-goto): call org-refile-get-location with NO-EXCLUDE + argument set, otherwise not only are headlines in the current + subtree excluded, but it throws an error if point happens not to + be within a subtree (e.g. at start of buffer). + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org.el (org-scan-tags): Fix highlighting in sparse-tree. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-clock.el (org-in-clocktable-p): Moved to org.el. + + * org.el (org-in-clocktable-p): New function. Moved from + org-clock.el + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-exp.el (org-export-get-title-from-subtree): Don't format + tags in title if title headline does not have tags. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-cycle-internal-local): Fix bug: hide drawers in + inline tasks too. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-format-preamble): Don't insert TOC here. + Delay it till the end of export. + (org-odt-begin-document-body): Make a note of the default + position of TOC in `org-lparse-dyn-first-heading-pos'. + (org-odt-insert-toc): Insert TOC as directed by + [TABLE-OF-CONTENTS] line or at the default position. + (org-odt-end-export): Call `org-odt-insert-toc'. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-preview-latex-fragment): Throw an error when called + from a non-file buffer. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-capture.el (org-capture-place-item): Don't search for + position in existing list if :exact-position was supplied. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-font-lock-defaults): Fix bug in done headline + fontification. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-format-textbox): Honor user-specified width + in captioned images. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.el (org-update-property-plist): Fix bug in property list + updates. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-balanced-split): Explicit checking if list + before calling member. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-sqlite.el (org-babel-execute:sqlite): Specify the use of "," + as the separator to `org-table-convert-region'. Fixes errors when + only one result per line of output. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-strip-protective-commas): Use + `org-strip-protective-commas'. + + * org-exp.el (org-export-select-backend-specific-text): Use + `org-strip-protective-commas'. + + * org-src.el (org-edit-src-code): Use + `org-strip-protective-commas'. + + * org.el (org-strip-protective-commas): Single definition for this + functionality. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-sql.el: Mention ob-sqlite in the comments of ob-sql. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-capture.el (org-capture-prepare-finalize-hook): New hook. + Run before the finalization process starts. + (org-capture-finalize): Run new hook. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.el (org-entry-get): Generalize to multiple "prop+" + properties. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org-src.el (org-src-mode-map): Rebinding `org-edit-src-save' in + the `org-src-mode-map'. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org.el (org-recenter-calendar): Use `with-selected-window' to + select calendar window and save currently selected window and + current buffer. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-list.el (org-list-ending-method, org-list-end-regexp): + Removed variables. + (org-in-item-p, org-list-separating-blank-lines-number) + (org-list-parse-list, org-list-struct): Apply changes. + + * org-exp.el (org-export-mark-list-end) + (org-export-mark-list-properties): Apply changes. + + * org-latex.el (org-export-latex-lists): Apply changes. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.el (org-entry-get): Accumulate properties from subtree + property drawers. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.el (org-entry-get): Accumulate properties from subtree + property drawers. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-export-odt-image-size-probe-method) + (org-odt-do-image-size): Use imagemagick preferentially to + determine image sizes. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-export-as-odt-to-buffer) + (org-replace-region-by-odt, org-export-region-as-odt): Remove + these interactive functions. They are of questionable value. + +2012-04-01 Toby S. Cubitt <tsc25@cantab.net> (tiny change) + + * org.el (org-goto): call org-refile-get-location with NO-EXCLUDE + argument set, otherwise not only are headlines in the current + subtree excluded, but it throws an error if point happens not to + be within a subtree (e.g. at start of buffer). + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-exp.el (org-export-kill-product-buffer-when-displayed) + (org-export-initial-scope, org-export-date-timestamp-format) + (org-export-with-tasks, org-export-email-info) + (org-export-table-remove-empty-lines): Add version tag. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-cycle-internal-local): Correctly unfold headlines + containing an inlinetask. + +2012-04-01 Bernt Hansen <bernt@norang.ca> + + * org-clock.el (org-clock-out): Do not delete the current clocking + task when org-clock-out-hook clocks in another task + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org.el (org-scan-tags): Fix highlighting in sparse-tree. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-export-odt-convert-processes): Re-define + (org-export-odt-convert-capabilities): Fix an accidental + regression. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-export-odt-convert-capabilities): Change the + default value. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-clock.el (org-in-clocktable-p): Moved to org.el. + + * org.el (org-in-clocktable-p): New function. Moved from org-clock.el + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-exp.el (org-export-get-title-from-subtree): Don't format + tags in title if title headline does not have tags. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-blank-before-new-entry) + (org-export-footnotes-seen, org-export-footnotes-data): Fix bogus + declarations. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-beginning-of-line, org-end-of-line): Fix special C-a + and C-e behaviour with visual lines. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org-exp-blocks.el (org-export-blocks): Changed the name of + exporting comment blocks given that it seems regular comment + blocks no longer export. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-get-export-buffer): Access current + export buffer. + (org-babel-exp-in-export-file): Access current export buffer. + (org-babel-exp-src-block): Access current export buffer. + (org-babel-exp-inline-src-blocks): Access current export buffer. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * ob-exp.el (org-babel-exp-in-export-file) + (org-babel-exp-src-block, org-babel-exp-inline-src-blocks): Allow + org-current-export-file to contain a buffer. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-lparse.el (org-lparse-do-convert): Replace `call-process' + with `shell-command-to-string'. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-create-definition): Fix space + insertion when creating a new footnote. This fixes newline + munching when `org-footnote-section' is nil and blank lines + stacking when it isn't nil. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-normalize): Make sure that + footnotes are moved to a single place during export. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-cycle-internal-global): Prevent the display of + messages when cycling from with a Gnus article buffer. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-normalize): Ensure footnote + definition will be inserted at the end of the section + corresponding to to its first reference. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-footnote.el (org-footnote-at-definition-p): Make sure to + move point at the beginning of the separator before skiping white + spaces. Refactor code. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-src-block): Strip noweb references on + export when "strip-export". + + * ob.el (org-babel-common-header-args-w-values): New noweb + header value. + (org-babel-merge-params): New noweb header value. + (org-babel-noweb-p): New noweb header value. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-tangle.el (org-babel-tangle-clean): Just use default value. + + * ob.el (org-babel-noweb-wrap): Add default value. + (org-babel-expand-noweb-references): Just use default value. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-exp.el (org-export-select-backend-specific-text): Always + preserve original indentation as a text property so that lists do + not get broken by indentation at column 0. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-expand-noweb-references): Don't allow newlines + in source names in noweb references. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-fill-line-break-nobreak-p): New function. + (org-set-autofill-regexps): Add previous function to + `fill-nobreak-predicate'. + +2012-04-01 Vitalie Spinu <spinuvit@gmail.com> + + * ob-R.el (org-babel-R-evaluate-session): Inhibit R evaluation + visibility regardless of local user customization. + +2012-04-01 Vitalie Spinu <spinuvit@gmail.com> + + * ob-R.el (org-babel-R-evaluate-session): Inhibit R evaluation + visibility regardless of local user customization. + +2012-04-01 Carsten Dominik <carsten.dominik@gmail.com> + + * org-inlinetask.el (org-inlinetask-show-first-star): New option. + (org-inlinetask-fontify): Honor `org-inlinetask-show-first-star'. + + * org-indent.el (org-indent-set-line-properties): Honor + `org-inlinetask-show-first-star'. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-regexps-and-options): Ensure `org-drawers' + doesn't contain duplicates. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-at-drawer-p): Normalize the docstring to match other + `org-at-*-p' docstrings. + (org-indent-block, org-indent-drawer, org-at-block-p): New + functions. + (org-metaright): Use the new functions to indent a drawer or a + block depending on the context. Also update the docstring. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-regexps-and-options): Set the value of + `org-drawers' by adding the value of the infile #+DRAWERS option + to that of the existing `org-drawers'. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-cycle-internal-local): Fix bug: hide drawers in + inline tasks too. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-inlinetask.el (org-inlinetask-toggle-visibility): Use + `org-show-entry' instead of `outline-flag-region' to keep the + drawers folded when unfolding an inline task. + +2012-04-01 Torsten Anders <torsten.anders@beds.ac.uk> (tiny change) + + * org-beamer.el (org-beamer-environments-default): Add support and + keybinding for the `exampleblock' environment. + +2012-04-01 Michael Brand <michael.ch.brand@gmail.com> + + * org.el (org-open-link-from-string): Regard `reference-buffer' + when setting `org-inhibit-startup'. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-non-block-elements): Don't insert extra + space between inline src block and results on export. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-get-inline-src-block-matches): Allow *any* + punctuation to proceed an inline src block. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-get-inline-src-block-matches): Add ( to the + list of characters allowed to proceed an inline src block. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-tangle.el (org-babel-tangle-clean): Use the customizable + noweb wrappers. + + * ob.el (org-babel-noweb-wrap-start): Begin a noweb reference. + (org-babel-noweb-wrap-end): End a noweb reference. + (org-babel-noweb-wrap): Apply the customizable noweb wrappers. + (org-babel-expand-noweb-references): Use the customizable noweb + wrappers. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-beginning-of-line): Handle case when there's no + character after box. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-format-preamble): Don't insert TOC here. + Delay it till the end of export. + (org-odt-begin-document-body): Make a note of the default + position of TOC in `org-lparse-dyn-first-heading-pos'. + (org-odt-insert-toc): Insert TOC as directed by + [TABLE-OF-CONTENTS] line or at the default position. + (org-odt-end-export): Call `org-odt-insert-toc'. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-preview-latex-fragment): Throw an error when called + from a non-file buffer. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-insert-property-drawer): Not an interactive + command anymore. + (org-insert-drawer): With a prefix argument, insert a property + drawer. Check for headline within the region before inserting the + drawer. Don't include special drawers in the completion table. + (org-mode-map): New keybinding `C-c C-x d' for + `org-insert-drawer'. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-insert-drawer): Support completion over known drawer + names and inserting a drawer around the current region. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-insert-drawer): New function. + (org-insert-property-drawer): Use it. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-list.el (org-mark-list): New function. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-pcomplete.el (pcomplete/org-mode/drawer): New function to + complete drawer at point. + (org-thing-at-point): Use it. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-meta-return): Use `newline-and-indent' when in a + property drawer. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-structure-template-alist): Fix docstring: the + feature is not experimental anymore. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-agenda.el (org-agenda-show-and-scroll-up): Allow `C-u' to + display the item without unfolding drawers and logbooks. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-src.el (org-edit-src-code): Make sure `buffer-file-name' is + always nil. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-structure-template-alist): Fix missing angle + brackets for muse export style. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-read-date): New parameter `inactive' when reading + for insertion of inactive timestamps. + (org-time-stamp, org-read-date-display): Use the new + parameter. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-expand-noweb-references): Only allow + reference names which start and end with non-whitespace characters. + Also, raise errors as appropriate given org-babel-noweb-error-langs. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-src.el (org-src-in-org-buffer): Save and restore + `buffer-undo-list' after editing. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-common-header-args-w-values): Add new header + argument. + (org-babel-expand-noweb-references): Use header argument rather than + customization variable. + +2012-04-01 David Maus <dmaus@ictsoc.de> + + * org-capture.el (org-capture-place-item): Don't search for + position in existing list if :exact-position was supplied. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-noweb-separator): Custom variable for + accumulated noweb references. + (org-babel-expand-noweb-references): Allow separator for noweb + references. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-beginning-of-line): In an item, special position + for C-a is after check-box, if any. + (org-special-ctrl-a/e): Modify doc-string accordingly. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-export-odt-format-formula): Use :style + property to specify custom table styles. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-call-line-template): Control export of + additional call line information. + (org-babel-exp-non-block-elements): Fancier call line export. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-entity-frame-styles): Add frame params + for images that are anchored as character. + (org-export-odt-format-image): Handle new anchor type + "as-char". + (org-export-odt-default-image-sizes-alist): Misc. change. + (org-export-odt-format-formula): Misc. change. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-check-src-block): Don't report valid header + arguments as suspicious. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-non-block-elements): Map over both + inline src blocks and call lines on export. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-label-styles): Add a new style. + (org-odt-category-map-alist): Use it. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-table-style-format): New. Template for + auto-generated table styles. + (org-odt-automatic-styles, org-odt-object-counters): New + variables. + (org-odt-add-automatic-style): New function. + (org-odt-write-automatic-styles): New function. Create + automatic styles for tables that have custom :rel-width. + (org-odt-begin-table): Parse attributes specified with + "#+ATTR_ODT: " option and use it to create an automatic table + style. + (org-odt-save-as-outfile): Call + `org-odt-add-write-automatic-styles'. + (org-odt-init-outfile): Init newly add variables. + (org-odt-section-count): Remove it. + (org-odt-begin-section): Use `org-odt-add-automatic-style' to + generate an automatic section name. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-map-executables): Correctly position point when + mapping hits an inline code block. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-execute-src-block): Ensure params are + incorporated *before* checking if evaluation is legal. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-lob-one-liners): Ensure `end' is a + marker so it is updated as required during export. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org-src.el (org-src-in-org-buffer): Run commands in the parent + buffer. + (org-edit-src-save): Use new macro. + (org-src-tangle): Tangle the parent buffer. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-font-lock-defaults): Fix bug in done + headline fontification. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-font-lock-defaults): Fix bug in done + headline fontification. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-return): Act normally when in code blocks. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-in-src-block-p): New function. + (org-context): Return new contexts :clocktable and :src-block. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-set-tags-command, org-set-tags): Make ̀C-u C-c + C-q' do the right thing even when point is before the first + heading. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-noweb-p): Disambiguate intersection name. + +2012-04-01 Jambunathan K <kjambunathan@gmail.com> + + * org-odt.el (org-odt-format-textbox): Honor user-specified + width in captioned images. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-map-src-blocks): Replace gensym with make-symbol. + (org-babel-map-inline-src-blocks): Replace gensym with make-symbol. + (org-babel-map-call-lines): Replace gensym with make-symbol. + (org-babel-map-executables): Replace gensym with make-symbol. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-results): Alter a copy of info. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-html.el (org-export-as-html): Initialize + `html-pre-real-contents' correctly. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-html.el (org-export-as-html): Initialize + `html-pre-real-contents' correctly. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-code): Ensure code block name is a + string on export. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-code-template): Customizable code + block export format string. + (org-babel-exp-code): Customizable code block export. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-clojure.el (org-babel-execute:clojure): Removed dependency + on deprecated swank-clojure. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-map-src-blocks): Don't pollute symbol space. + (org-babel-map-inline-src-blocks): Don't pollute symbol space. + (org-babel-map-call-lines): Don't pollute symbol space. + (org-babel-map-executables): Map over *all* executable Org-mode + elements. + (org-babel-execute-buffer): Execute elements in buffer order instead + of arbitrarily. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org.el (org-ctrl-c-ctrl-c): Fix a naive structure backup. + Those must be done with `copy-tree'. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org-src.el (org-edit-src-code): Referenced code block should + not be evaluated on code block edit. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org.el (org-structure-template-alist): Use uppercase for + keywords. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-insert-result): Capitalize RESULTS in :wrap'd + code block results. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-results-keyword): New user-configurable + results keyword. + (org-babel-where-is-src-block-result): Use new user-configurable + results keyword. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-indent.el (org-indent-refresh-maybe): Check for new + headlines from the beginning of the line to be sure to catch + any newly inserted headline there. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-exp.el (org-babel-exp-src-block): Use `org-babel-noweb-p'. + (org-babel-exp-inline-src-blocks): Use `org-babel-noweb-p'. + + * ob-tangle.el (org-babel-tangle-collect-blocks): Use + `org-babel-noweb-p'. + + * ob.el (org-babel-execute-src-block): Use `org-babel-noweb-p'. + (org-babel-expand-src-block): Use `org-babel-noweb-p'. + (org-babel-load-in-session): Use `org-babel-noweb-p'. + (org-babel-merge-params): Use `org-babel-noweb-p'. + (org-babel-noweb-p): New function used to determine if noweb + expansion should be carried out in a given context. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.el (org-update-property-plist): Fix bug in property list + updates. + +2012-04-01 François Pinard <pinard@iro.umontreal.ca> (tiny change) + + * org.el (org-kill-line): Use `kill-visual-line' in + `visual-line-mode'. + +2012-04-01 Bernt Hansen <bernt@norang.ca> + + * org-agenda.el (org-agenda-switch-to): Widen org buffer only if point is + outside the current restriction + +2012-04-01 Bernt Hansen <bernt@norang.ca> + + * org-agenda.el (org-agenda-clock-in): Save restriction when clocking in from the agenda + +2012-04-01 Bernt Hansen <bernt@norang.ca> + + * org.el: Honour existing restrictions when regenerating the agenda + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-agenda.el: New alias for `list-diary-entries-hook'. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-common-header-args-w-values): Add the new + header argument name. + (org-babel-insert-result): Respect the value of the :wrap header + argument when inserting results. + (org-babel-result-end): Find the end of arbitrarily named result + blocks. + +2012-04-01 Nicolas Goaziou <n.goaziou@gmail.com> + + * org-indent.el (org-indent-refresh-maybe): Check for new + headlines from the beginning of the line to be sure to catch + any newly inserted headline there. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * org.el (org-update-property-plist): Remove old instances of + property when adding a new value for property. + +2012-04-01 Martyn Jago <martyn.jago@btinternet.com> + + * ob-emacs-lisp.el: A comment on the last line of an emacs-lisp + code block would cause an error when the block is was executed. This + fix cures this behaviour. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-expand-noweb-references): Resurrect dropped + pieces of a previous patch. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-maxima.el (org-babel-execute:maxima): Fix compiler warning. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-expand-noweb-references): Resurrect dropped + pieces of a previous patch. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob-maxima.el (org-babel-execute:maxima): Fix compiler warning. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-eshell.el (org-eshell-open): Use (goto-char (point-max)) + instead of (end-of-buffer). + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-bbdb.el (name): Declare variable. + (bbdb-record-get-field, bbdb-search-name) + (bbdb-search-organization): Declare as part of ext:bbdb. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-mobile.el (org-mobile-push): Use `org-agenda-tag-filter' + instead of the obsolete `org-agenda-filter'. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * org-agenda.el: Add an alias for `org-agenda-filter'. + (diary-list-entries-hook): Use the non-obsolete hook. + (org-agenda-filter-apply): Silent compiler warning. + +2012-04-01 Bastien Guerry <bzg@gnu.org> + + * ob-ditaa.el (org-ditaa-jar-path): Make a defcustom. + (org-ditaa-jar-option): New option. + (org-babel-execute:ditaa): Use it. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-balanced-split): Explicit checking if list + before calling member. + +2012-04-01 Eric Schulte <eric.schulte@gmx.com> + + * ob.el (org-babel-balanced-split): Explicit checking if list + before calling member. + 2012-02-14 Chong Yidong <cyd@gnu.org> * org-footnote.el: Remove bogus defvar values (Bug#10745). diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index 4f33fc4531..5f6c1cb1dd 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el @@ -88,7 +88,9 @@ or `org-babel-execute:C++'." (cond ((equal org-babel-c-variant 'c) ".c") ((equal org-babel-c-variant 'cpp) ".cpp")))) - (tmp-bin-file (org-babel-temp-file "C-bin-")) + (tmp-bin-file (org-babel-temp-file + "C-bin-" + (if (equal system-type 'windows-nt) ".exe" ""))) (cmdline (cdr (assoc :cmdline params))) (flags (cdr (assoc :flags params))) (full-body (org-babel-C-expand body params)) diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el index e8400f494a..49a8a85cf6 100644 --- a/lisp/org/ob-R.el +++ b/lisp/org/ob-R.el @@ -279,7 +279,8 @@ last statement in BODY, as elisp." (with-temp-buffer (insert (org-babel-chomp body)) (let ((ess-local-process-name - (process-name (get-buffer-process session)))) + (process-name (get-buffer-process session))) + (ess-eval-visibly-p nil)) (ess-eval-buffer nil))) (let ((tmp-file (org-babel-temp-file "R-"))) (org-babel-comint-eval-invisibly-and-wait-for-file diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el index 1c0c37c1dd..69d3db86de 100644 --- a/lisp/org/ob-clojure.el +++ b/lisp/org/ob-clojure.el @@ -31,7 +31,6 @@ ;;; - clojure (at least 1.2.0) ;;; - clojure-mode ;;; - slime -;;; - swank-clojure ;;; By far, the best way to install these components is by following ;;; the directions as set out by Phil Hagelberg (Technomancy) on the @@ -75,7 +74,7 @@ (defun org-babel-execute:clojure (body params) "Execute a block of Clojure code with Babel." - (require 'slime) (require 'swank-clojure) + (require 'slime) (with-temp-buffer (insert (org-babel-expand-body:clojure body params)) ((lambda (result) @@ -86,7 +85,7 @@ (condition-case nil (org-babel-script-escape result) (error result))))) (slime-eval - `(swank:interactive-eval-region + `(swank:eval-and-grab-output ,(buffer-substring-no-properties (point-min) (point-max))) (cdr (assoc :package params)))))) diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el index 17e9d5d0cc..57ae4b9475 100644 --- a/lisp/org/ob-ditaa.el +++ b/lisp/org/ob-ditaa.el @@ -39,22 +39,10 @@ (require 'ob) (defvar org-babel-default-header-args:ditaa - '((:results . "file") - (:exports . "results") - (:java . "-Dfile.encoding=UTF-8")) + '((:results . "file") (:exports . "results") (:java . "-Dfile.encoding=UTF-8")) "Default arguments for evaluating a ditaa source block.") -(defcustom org-ditaa-jar-path nil - "Path for the ditaa jar file." - :group 'org-babel - :type 'string) - -(defcustom org-ditaa-jar-option "-jar" - "Option for the ditaa jar file. -Do not leave leading or trailing spaces in this string." - :group 'org-babel - :type 'string) - +(defvar org-ditaa-jar-path) (defun org-babel-execute:ditaa (body params) "Execute a block of Ditaa code with org-babel. This function is called by `org-babel-execute-src-block'." @@ -67,7 +55,7 @@ This function is called by `org-babel-execute-src-block'." (cmdline (cdr (assoc :cmdline params))) (java (cdr (assoc :java params))) (in-file (org-babel-temp-file "ditaa-")) - (cmd (concat "java " java " " org-ditaa-jar-option " " + (cmd (concat "java " java " -jar " (shell-quote-argument (expand-file-name org-ditaa-jar-path)) " " cmdline diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el index afbc20d5fc..c8af606200 100644 --- a/lisp/org/ob-emacs-lisp.el +++ b/lisp/org/ob-emacs-lisp.el @@ -41,13 +41,13 @@ (result-params (cdr (assoc :result-params params))) (print-level nil) (print-length nil) (body (if (> (length vars) 0) - (concat "(let (" - (mapconcat - (lambda (var) - (format "%S" (print `(,(car var) ',(cdr var))))) - vars "\n ") - ")\n" body ")") - body))) + (concat "(let (" + (mapconcat + (lambda (var) + (format "%S" (print `(,(car var) ',(cdr var))))) + vars "\n ") + ")\n" body "\n)") + (concat body "\n")))) (if (or (member "code" result-params) (member "pp" result-params)) (concat "(pp " body ")") body))) diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index bfb3aa85bc..ecfb91f083 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el @@ -34,8 +34,7 @@ (defvar org-babel-ref-split-regexp) (declare-function org-babel-lob-get-info "ob-lob" ()) (declare-function org-babel-eval-wipe-error-buffer "ob-eval" ()) -(add-to-list 'org-export-interblocks '(src org-babel-exp-inline-src-blocks)) -(add-to-list 'org-export-interblocks '(lob org-babel-exp-lob-one-liners)) +(add-to-list 'org-export-interblocks '(src org-babel-exp-non-block-elements)) (org-export-blocks-add-block '(src org-babel-exp-src-block nil)) @@ -117,33 +116,74 @@ none ----- do not display either code or results upon export" (nth 1 info))) (org-babel-exp-do-export info 'block hash))))) -(defun org-babel-exp-inline-src-blocks (start end) - "Process inline source blocks between START and END for export. -See `org-babel-exp-src-block' for export options, currently the -options and are taken from `org-babel-default-inline-header-args'." +(defvar org-babel-default-lob-header-args) +(defun org-babel-exp-non-block-elements (start end) + "Process inline source and call lines between START and END for export." (interactive) (save-excursion (goto-char start) - (while (and (< (point) end) - (re-search-forward org-babel-inline-src-block-regexp end t)) - (let* ((info (save-match-data (org-babel-parse-inline-src-block-match))) - (params (nth 2 info))) - (save-match-data - (goto-char (match-beginning 2)) + (unless (markerp end) + (let ((m (make-marker))) + (set-marker m end (current-buffer)) + (setq end m))) + (let ((rx (concat "\\(" org-babel-inline-src-block-regexp + "\\|" org-babel-lob-one-liner-regexp "\\)"))) + (while (and (< (point) (marker-position end)) + (re-search-forward rx end t)) + (if (save-excursion + (goto-char (match-beginning 0)) + (looking-at org-babel-inline-src-block-regexp)) + (progn + (forward-char 1) + (let* ((info (save-match-data + (org-babel-parse-inline-src-block-match))) + (params (nth 2 info))) + (save-match-data + (goto-char (match-beginning 2)) + (unless (org-babel-in-example-or-verbatim) + ;; expand noweb references in the original file + (setf (nth 1 info) + (if (and (cdr (assoc :noweb params)) + (string= "yes" (cdr (assoc :noweb params)))) + (org-babel-expand-noweb-references + info (get-file-buffer org-current-export-file)) + (nth 1 info))) + (let ((code-replacement (save-match-data + (org-babel-exp-do-export + info 'inline)))) + (if code-replacement + (progn (replace-match code-replacement nil nil nil 1) + (delete-char 1)) + (org-babel-examplize-region (match-beginning 1) + (match-end 1)) + (forward-char 2))))))) (unless (org-babel-in-example-or-verbatim) - ;; expand noweb references in the original file - (setf (nth 1 info) - (if (and (cdr (assoc :noweb params)) - (string= "yes" (cdr (assoc :noweb params)))) - (org-babel-expand-noweb-references - info (get-file-buffer org-current-export-file)) - (nth 1 info))) - (let ((code-replacement (save-match-data - (org-babel-exp-do-export info 'inline)))) - (if code-replacement - (replace-match code-replacement nil nil nil 1) - (org-babel-examplize-region (match-beginning 1) (match-end 1)) - (forward-char 2))))))))) + (let* ((lob-info (org-babel-lob-get-info)) + (inlinep (match-string 11)) + (inline-start (match-end 11)) + (inline-end (match-end 0)) + (rep (let ((lob-info (org-babel-lob-get-info))) + (save-match-data + (org-babel-exp-do-export + (list "emacs-lisp" "results" + (org-babel-merge-params + org-babel-default-header-args + org-babel-default-lob-header-args + (org-babel-params-from-properties) + (org-babel-parse-header-arguments + (org-babel-clean-text-properties + (concat ":var results=" + (mapconcat #'identity + (butlast lob-info) + " "))))) + "" nil (car (last lob-info))) + 'lob))))) + (if inlinep + (save-excursion + (goto-char inline-start) + (delete-region inline-start inline-end) + (insert rep)) + (replace-match rep t t))))))))) (defun org-babel-in-example-or-verbatim () "Return true if point is in example or verbatim code. @@ -158,46 +198,6 @@ org-mode text." (org-in-block-p org-list-forbidden-blocks) (org-between-regexps-p "^[ \t]*#\\+begin_src" "^[ \t]*#\\+end_src"))) -(defvar org-babel-default-lob-header-args) -(defun org-babel-exp-lob-one-liners (start end) - "Process Library of Babel calls between START and END for export. -See `org-babel-exp-src-block' for export options. Currently the -options are taken from `org-babel-default-header-args'." - (interactive) - (save-excursion - (goto-char start) - (while (and (< (point) end) - (re-search-forward org-babel-lob-one-liner-regexp end t)) - (unless (org-babel-in-example-or-verbatim) - (let* ((lob-info (org-babel-lob-get-info)) - (inlinep (match-string 11)) - (inline-start (match-end 11)) - (inline-end (match-end 0)) - (rep (let ((lob-info (org-babel-lob-get-info))) - (save-match-data - (org-babel-exp-do-export - (list "emacs-lisp" "results" - (org-babel-merge-params - org-babel-default-header-args - org-babel-default-lob-header-args - (org-babel-params-from-properties) - (org-babel-parse-header-arguments - (org-babel-clean-text-properties - (concat ":var results=" - (mapconcat #'identity - (butlast lob-info) " "))))) - "" nil (car (last lob-info))) - 'lob))))) - (setq end (+ end (- (length rep) - (- (length (match-string 0)) - (length (or (match-string 11) "")))))) - (if inlinep - (save-excursion - (goto-char inline-start) - (delete-region inline-start inline-end) - (insert rep)) - (replace-match rep t t))))))) - (defun org-babel-exp-do-export (info type &optional hash) "Return a string with the exported content of a code block. The function respects the value of the :exports header argument." @@ -218,7 +218,9 @@ The function respects the value of the :exports header argument." "#+BEGIN_SRC %lang%flags\n%body\n#+END_SRC" `(("lang" . ,(nth 0 info)) ("flags" . ,((lambda (f) (when f (concat " " f))) (nth 3 info))) - ("body" . ,(nth 1 info))))) + ("body" . ,(if (string= (nth 0 info) "org") + (replace-regexp-in-string "^" "," (nth 1 info)) + (nth 1 info)))))) (defun org-babel-exp-results (info type &optional silent hash) "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 46d2269a1d..e9ff78dcd3 100644 --- a/lisp/org/ob-fortran.el +++ b/lisp/org/ob-fortran.el @@ -1,32 +1,29 @@ ;;; ob-fortran.el --- org-babel functions for fortran -;; Copyright (C) 2011-2012 Free Software Foundation, Inc. +;; Copyright (C) 2011-2012 Sergey Litvinov, Eric Schulte -;; Authors: Sergey Litvinov -;; Eric Schulte +;; Authors: Sergey Litvinov (based on ob-C.el by Eric Schulte), Eric Schulte ;; Keywords: literate programming, reproducible research, fortran ;; Homepage: http://orgmode.org -;; Version: 7.8.02 -;; This file is part of GNU Emacs. - -;; GNU Emacs is free software: you can redistribute it and/or modify +;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. - -;; GNU Emacs is distributed in the hope that it will be useful, +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. - +;; ;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; Org-Babel support for evaluating fortran code. -;; Based on ob-C.el by Eric Schulte. ;;; Code: (require 'ob) diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el index 0dde0de9e4..a1e4c9f83e 100644 --- a/lisp/org/ob-lilypond.el +++ b/lisp/org/ob-lilypond.el @@ -4,7 +4,7 @@ ;; Author: Martyn Jago ;; Keywords: babel language, literate programming -;; Homepage: https://github.com/mjago/ob-lilypond +;; Homepage: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html ;; This file is part of GNU Emacs. @@ -30,18 +30,14 @@ (require 'ob) (require 'ob-eval) (require 'ob-tangle) +(require 'outline) (defalias 'lilypond-mode 'LilyPond-mode) -(declare-function show-all "outline" ()) - (add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly")) (defvar org-babel-default-header-args:lilypond '() "Default header arguments for js code blocks.") -(defconst ly-version "0.3" - "The version number of the file ob-lilypond.el.") - (defvar ly-compile-post-tangle t "Following the org-babel-tangle (C-c C-v t) command, ly-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" (message (concat "Arrange mode has been " (if ly-arrange-mode "ENABLED." "DISABLED.")))) -(defun ly-version (&optional insert-at-point) - (interactive) - (let ((version (format "ob-lilypond version %s" ly-version))) - (when insert-at-point (insert version)) - (message version))) - - (defun ly-switch-extension (file-name ext) +(defun ly-switch-extension (file-name ext) "Utility command to swap current FILE-NAME extension with EXT" (concat (file-name-sans-extension diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el index 8976427ab7..91ae075172 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." (defconst org-babel-block-lob-one-liner-regexp (concat - "^\\([ \t]*\\)#\\+call:[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" - "\(\\([^\n]*\\)\)\\(\\[.+\\]\\|\\)[ \t]*\\(\\([^\n]*\\)\\)?") + "^\\([ \t]*?\\)#\\+call:[ \t]+\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" + "\(\\([^\n]*?\\)\)\\(\\[.+\\]\\|\\)[ \t]*\\(\\([^\n]*\\)\\)?") "Regexp to match non-inline calls to predefined source block functions.") (defconst org-babel-inline-lob-one-liner-regexp (concat - "\\([^\n]*\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*\\)\\]\\|\\(\\)\\)" - "\(\\([^\n]*\\)\)\\(\\[\\(.*?\\)\\]\\)?") + "\\([^\n]*?\\)call_\\([^\(\)\n]+?\\)\\(\\[\\(.*?\\)\\]\\|\\(\\)\\)" + "\(\\([^\n]*?\\)\)\\(\\[\\(.*?\\)\\]\\)?") "Regexp to match inline calls to predefined source block functions.") (defconst org-babel-lob-one-liner-regexp @@ -108,8 +108,8 @@ if so then run the appropriate source block from the Library." (list (format "%s%s(%s)%s" (nonempty 3 12) - (if (not (= 0 (length (nonempty 5 13)))) - (concat "[" (nonempty 5 13) "]") "") + (if (not (= 0 (length (nonempty 5 14)))) + (concat "[" (nonempty 5 14) "]") "") (or (nonempty 7 16) "") (or (nonempty 8 19) "")) (nonempty 9 18))) diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el index 74bcb06943..8da20af74f 100644 --- a/lisp/org/ob-maxima.el +++ b/lisp/org/ob-maxima.el @@ -40,6 +40,11 @@ (defvar org-babel-default-header-args:maxima '()) +(defcustom org-babel-maxima-command + (if (boundp 'maxima-command) maxima-command "maxima") + "Command used to call maxima on the shell." + :group 'org-babel) + (defun org-babel-maxima-expand (body params) "Expand a block of Maxima code according to its header arguments." (let ((vars (mapcar #'cdr (org-babel-get-header params :var)))) @@ -67,8 +72,8 @@ called by `org-babel-execute-src-block'." (result (let* ((cmdline (cdr (assoc :cmdline params))) (in-file (org-babel-temp-file "maxima-" ".max")) - (cmd (format "maxima --very-quiet -r 'batchload(%S)$' %s" - in-file cmdline))) + (cmd (format "%s --very-quiet -r 'batchload(%S)$' %s" + org-babel-maxima-command in-file cmdline))) (with-temp-file in-file (insert (org-babel-maxima-expand body params))) (message cmd) ((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 3f7882c991..68bd95af9f 100644 --- a/lisp/org/ob-sql.el +++ b/lisp/org/ob-sql.el @@ -24,6 +24,7 @@ ;;; Commentary: ;; Org-Babel support for evaluating sql source code. +;; (see also ob-sqlite.el) ;; ;; SQL is somewhat unique in that there are many different engines for ;; 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 599113ca83..84d6bb26ba 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'." (member "code" result-params) (equal (point-min) (point-max))) (buffer-string) - (org-table-convert-region (point-min) (point-max)) + (org-table-convert-region (point-min) (point-max) + (if (or (member :csv others) + (member :column others) + (member :line others) + (member :list others) + (member :html others) separator) + nil + '(4))) (org-babel-sqlite-table-or-scalar (org-babel-sqlite-offset-colnames (org-table-to-lisp) headers-p)))))) diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el index 7b4920e1ec..f636415d98 100644 --- a/lisp/org/ob-table.el +++ b/lisp/org/ob-table.el @@ -75,9 +75,8 @@ results NOTE: by default string variable names are interpreted as references to source-code blocks, to force interpretation of a -cell's value as a string, prefix the identifier with two \"$\"s -rather than a single \"$\" (i.e. \"$$2\" instead of \"$2\" in the -example above. +cell's value as a string, prefix the identifier a \"$\" (e.g., +\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\"). NOTE: it is also possible to pass header arguments to the code block. In this case a table cell should hold the string value of @@ -97,7 +96,7 @@ as shown in the example below. (delq nil (mapcar (lambda (el) (if (eq '$ el) - (setq quote t) + (prog1 nil (setq quote t)) (prog1 (if quote (format "\"%s\"" el) (org-babel-clean-text-properties el)) diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 0b4eaf1faf..5e498ab6c0 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el @@ -185,9 +185,11 @@ exported source code blocks by language." (when only-this-block (unless (org-babel-where-is-src-block-head) (error "Point is not currently inside of a code block")) - (unless target-file - (setq target-file - (read-from-minibuffer "Tangle to: " (buffer-file-name)))) + (save-match-data + (unless (or (cdr (assoc :tangle (nth 2 (org-babel-get-src-block-info)))) + target-file) + (setq target-file + (read-from-minibuffer "Tangle to: " (buffer-file-name))))) (narrow-to-region (match-beginning 0) (match-end 0))) (save-excursion (let ((block-counter 0) @@ -393,7 +395,7 @@ form (start-line file link source-name params body comment)" (let* ((start-line (nth 0 spec)) (file (nth 1 spec)) - (link (org-link-escape (nth 2 spec))) + (link (nth 2 spec)) (source-name (nth 3 spec)) (body (nth 5 spec)) (comment (nth 6 spec)) diff --git a/lisp/org/ob.el b/lisp/org/ob.el index 0288eb357b..04c011c867 100644 --- a/lisp/org/ob.el +++ b/lisp/org/ob.el @@ -79,6 +79,7 @@ (declare-function org-list-struct "org-list" ()) (declare-function org-list-prevs-alist "org-list" (struct)) (declare-function org-list-get-list-end "org-list" (item struct prevs)) +(declare-function org-strip-protective-commas "org" (beg end)) (defgroup org-babel nil "Code block evaluation and management in `org-mode' documents." @@ -113,6 +114,13 @@ remove code block execution from the C-c C-c keybinding." :group 'org-babel :type 'boolean) +(defcustom org-babel-results-keyword "RESULTS" + "Keyword used to name results generated by code blocks. +Should be either RESULTS or NAME however any capitalization may +be used." + :group 'org-babel + :type 'string) + (defvar org-babel-src-name-regexp "^[ \t]*#\\+name:[ \t]*" "Regular expression used to match a source name line.") @@ -169,8 +177,8 @@ Returns non-nil if match-data set" (first-line-p (= 1 (line-number-at-pos))) (orig (point))) (let ((search-for (cond ((and src-at-0-p first-line-p "src_")) - (first-line-p "[ \t]src_") - (t "[ \f\t\n\r\v]src_"))) + (first-line-p "[[:punct:] \t]src_") + (t "[[:punct:] \f\t\n\r\v]src_"))) (lower-limit (if first-line-p nil (- (point-at-bol) 1)))) @@ -376,6 +384,7 @@ then run `org-babel-pop-to-session'." (noeval) (noweb . ((yes no tangle))) (noweb-ref . :any) + (noweb-sep . :any) (padline . ((yes no))) (results . ((file list vector table scalar verbatim) (raw org html latex code pp wrap) @@ -469,7 +478,10 @@ the header arguments specified at the front of the source code block." (interactive) (let ((info (or info (org-babel-get-src-block-info)))) - (when (org-babel-confirm-evaluate info) + (when (org-babel-confirm-evaluate + (let ((i info)) + (setf (nth 2 i) (org-babel-merge-params (nth 2 info) params)) + i)) (let* ((lang (nth 0 info)) (params (if params (org-babel-process-params @@ -597,15 +609,17 @@ arguments and pop open the results in a preview buffer." ;; TODO: report malformed code block ;; TODO: report incompatible combinations of header arguments ;; TODO: report uninitialized variables - (let ((too-close 2)) ;; <- control closeness to report potential match + (let ((too-close 2) ;; <- control closeness to report potential match + (names (mapcar #'symbol-name org-babel-header-arg-names))) (dolist (header (mapcar (lambda (arg) (substring (symbol-name (car arg)) 1)) (and (org-babel-where-is-src-block-head) (org-babel-parse-header-arguments (org-babel-clean-text-properties (match-string 4)))))) - (dolist (name (mapcar #'symbol-name org-babel-header-arg-names)) + (dolist (name names) (when (and (not (string= header name)) - (<= (org-babel-edit-distance header name) too-close)) + (<= (org-babel-edit-distance header name) too-close) + (not (member header names))) (error "supplied header \"%S\" is suspiciously close to \"%S\"" header name)))) (message "No suspicious header arguments found."))) @@ -885,6 +899,31 @@ buffer." (def-edebug-spec org-babel-map-call-lines (form body)) ;;;###autoload +(defmacro org-babel-map-executables (file &rest body) + (declare (indent 1)) + (let ((tempvar (make-symbol "file")) + (rx (make-symbol "rx"))) + `(let* ((,tempvar ,file) + (,rx (concat "\\(" org-babel-src-block-regexp + "\\|" org-babel-inline-src-block-regexp + "\\|" org-babel-lob-one-liner-regexp "\\)")) + (visited-p (or (null ,tempvar) + (get-file-buffer (expand-file-name ,tempvar)))) + (point (point)) to-be-removed) + (save-window-excursion + (when ,tempvar (find-file ,tempvar)) + (setq to-be-removed (current-buffer)) + (goto-char (point-min)) + (while (re-search-forward ,rx nil t) + (goto-char (match-beginning 1)) + (when (looking-at org-babel-inline-src-block-regexp)(forward-char 1)) + (save-match-data ,@body) + (goto-char (match-end 0)))) + (unless visited-p (kill-buffer to-be-removed)) + (goto-char point)))) +(def-edebug-spec org-babel-map-executables (form body)) + +;;;###autoload (defun org-babel-execute-buffer (&optional arg) "Execute source code blocks in a buffer. Call `org-babel-execute-src-block' on every source block in @@ -892,12 +931,10 @@ the current buffer." (interactive "P") (org-babel-eval-wipe-error-buffer) (org-save-outline-visibility t - (org-babel-map-src-blocks nil - (org-babel-execute-src-block arg)) - (org-babel-map-inline-src-blocks nil - (org-babel-execute-src-block arg)) - (org-babel-map-call-lines nil - (org-babel-lob-execute-maybe)))) + (org-babel-map-executables nil + (if (looking-at org-babel-lob-one-liner-regexp) + (org-babel-lob-execute-maybe) + (org-babel-execute-src-block arg))))) ;;;###autoload (defun org-babel-execute-subtree (&optional arg) @@ -999,6 +1036,89 @@ This can be called with C-c C-c." (when hash (kill-new hash) (message hash)))) (add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point) +(defun org-babel-result-hide-spec () + "Hide portions of results lines. +Add `org-babel-hide-result' as an invisibility spec for hiding +portions of results lines." + (add-to-invisibility-spec '(org-babel-hide-result . t))) +(add-hook 'org-mode-hook 'org-babel-result-hide-spec) + +(defvar org-babel-hide-result-overlays nil + "Overlays hiding results.") + +(defun org-babel-result-hide-all () + "Fold all results in the current buffer." + (interactive) + (org-babel-show-result-all) + (save-excursion + (while (re-search-forward org-babel-result-regexp nil t) + (save-excursion (goto-char (match-beginning 0)) + (org-babel-hide-result-toggle-maybe))))) + +(defun org-babel-show-result-all () + "Unfold all results in the current buffer." + (mapc 'delete-overlay org-babel-hide-result-overlays) + (setq org-babel-hide-result-overlays nil)) + +;;;###autoload +(defun org-babel-hide-result-toggle-maybe () + "Toggle visibility of result at point." + (interactive) + (let ((case-fold-search t)) + (if (save-excursion + (beginning-of-line 1) + (looking-at org-babel-result-regexp)) + (progn (org-babel-hide-result-toggle) + t) ;; to signal that we took action + nil))) ;; to signal that we did not + +(defun org-babel-hide-result-toggle (&optional force) + "Toggle the visibility of the current result." + (interactive) + (save-excursion + (beginning-of-line) + (if (re-search-forward org-babel-result-regexp nil t) + (let ((start (progn (beginning-of-line 2) (- (point) 1))) + (end (progn + (while (looking-at org-babel-multi-line-header-regexp) + (forward-line 1)) + (goto-char (- (org-babel-result-end) 1)) (point))) + ov) + (if (memq t (mapcar (lambda (overlay) + (eq (overlay-get overlay 'invisible) + 'org-babel-hide-result)) + (overlays-at start))) + (if (or (not force) (eq force 'off)) + (mapc (lambda (ov) + (when (member ov org-babel-hide-result-overlays) + (setq org-babel-hide-result-overlays + (delq ov org-babel-hide-result-overlays))) + (when (eq (overlay-get ov 'invisible) + 'org-babel-hide-result) + (delete-overlay ov))) + (overlays-at start))) + (setq ov (make-overlay start end)) + (overlay-put ov 'invisible 'org-babel-hide-result) + ;; make the block accessible to isearch + (overlay-put + ov 'isearch-open-invisible + (lambda (ov) + (when (member ov org-babel-hide-result-overlays) + (setq org-babel-hide-result-overlays + (delq ov org-babel-hide-result-overlays))) + (when (eq (overlay-get ov 'invisible) + 'org-babel-hide-result) + (delete-overlay ov)))) + (push ov org-babel-hide-result-overlays))) + (error "Not looking at a result line")))) + +;; org-tab-after-check-for-cycling-hook +(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe) +;; Remove overlays when changing major mode +(add-hook 'org-mode-hook + (lambda () (org-add-hook 'change-major-mode-hook + 'org-babel-show-result-all 'append 'local))) + (defvar org-file-properties) (defun org-babel-params-from-properties (&optional lang) "Retrieve parameters specified as properties. @@ -1042,7 +1162,7 @@ may be specified in the properties of the current outline entry." ;; get block body less properties, protective commas, and indentation (with-temp-buffer (save-match-data - (insert (org-babel-strip-protective-commas body)) + (insert (org-babel-strip-protective-commas body lang)) (unless preserve-indentation (org-do-remove-indentation)) (buffer-string))) (org-babel-merge-params @@ -1060,7 +1180,7 @@ may be specified in the properties of the current outline entry." (lang-headers (intern (concat "org-babel-default-header-args:" lang)))) (list lang (org-babel-strip-protective-commas - (org-babel-clean-text-properties (match-string 5))) + (org-babel-clean-text-properties (match-string 5)) lang) (org-babel-merge-params org-babel-default-inline-header-args (org-babel-params-from-properties lang) @@ -1376,9 +1496,10 @@ buffer or nil if no such result exists." (catch 'is-a-code-block (when (re-search-forward (concat org-babel-result-regexp - "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]") nil t) + "[ \t]" (regexp-quote name) "[ \t\n\f\v\r]+") nil t) (when (and (string= "name" (downcase (match-string 1))) - (or (looking-at org-babel-src-block-regexp) + (or (beginning-of-line 1) + (looking-at org-babel-src-block-regexp) (looking-at org-babel-multi-line-header-regexp))) (throw 'is-a-code-block (org-babel-find-named-result name (point)))) (beginning-of-line 0) (point))))) @@ -1491,7 +1612,7 @@ following the source block." (inlinep (when (org-babel-get-inline-src-block-matches) (match-end 0))) (name (if on-lob-line - (nth 0 (org-babel-lob-get-info)) + (mapconcat #'identity (butlast (org-babel-lob-get-info)) "") (nth 4 (or info (org-babel-get-src-block-info 'light))))) (head (unless on-lob-line (org-babel-where-is-src-block-head))) found beg end) @@ -1544,7 +1665,7 @@ following the source block." (lambda (el) " ") (org-number-sequence 1 indent) "") "") - "#+results" + "#+" org-babel-results-keyword (when hash (concat "["hash"]")) ":" (when name (concat " " name)) "\n")) @@ -1715,8 +1836,9 @@ code ---- the results are extracted in the syntax of the source (setq results-switches (if results-switches (concat " " results-switches) "")) (flet ((wrap (start finish) - (goto-char beg) (insert (concat start "\n")) (goto-char end) (insert (concat finish "\n")) + (goto-char beg) (insert (concat start "\n")) + (goto-char end) (goto-char (point-at-eol)) (setq end (point-marker))) (proper-list-p (it) (and (listp it) (null (cdr (last it)))))) ;; insert results based on type @@ -1802,7 +1924,8 @@ code ---- the results are extracted in the syntax of the source (prvs (org-list-prevs-alist struct))) (org-list-get-list-end (point-at-bol) struct prvs))) ((looking-at "^\\([ \t]*\\):RESULTS:") - (re-search-forward (concat "^" (match-string 1) ":END:"))) + (progn (re-search-forward (concat "^" (match-string 1) ":END:")) + (forward-char 1) (point))) (t (let ((case-fold-search t) (blocks-re (regexp-opt @@ -1835,7 +1958,8 @@ file's directory then expand relative links." (defun org-babel-examplize-region (beg end &optional results-switches) "Comment out region using the inline '==' or ': ' org example quote." (interactive "*r") - (flet ((chars-between (b e) (string-match "[\\S]" (buffer-substring b e)))) + (flet ((chars-between (b e) + (not (string-match "^[\\s]*$" (buffer-substring b e))))) (if (or (chars-between (save-excursion (goto-char beg) (point-at-bol)) beg) (chars-between end (save-excursion (goto-char end) (point-at-eol)))) (save-excursion @@ -2031,7 +2155,8 @@ block but are passed literally to the \"example-block\"." (with-temp-buffer (insert body) (goto-char (point-min)) (setq index (point)) - (while (and (re-search-forward "<<\\(.+?\\)>>" nil t)) + (while (and (re-search-forward "<<\\([^ \t\n].+?[^ \t\n]\\|[^ \t\n]\\)>>" + nil t)) (save-match-data (setf source-name (match-string 1))) (save-match-data (setq evaluate (string-match "\(.*\)" source-name))) (save-match-data @@ -2046,6 +2171,8 @@ block but are passed literally to the \"example-block\"." (setq index (point)) (nb-add (with-current-buffer parent-buffer + (save-restriction + (widen) (mapconcat ;; interpose PREFIX between every line #'identity (split-string @@ -2061,7 +2188,7 @@ block but are passed literally to the \"example-block\"." (when (org-babel-ref-goto-headline-id source-name) (org-babel-ref-headline-body))) ;; find the expansion of reference in this buffer - (let ((rx (concat rx-prefix source-name)) + (let ((rx (concat rx-prefix source-name "[ \t\n]")) expansion) (save-excursion (goto-char (point-min)) @@ -2069,6 +2196,8 @@ block but are passed literally to the \"example-block\"." (while (re-search-forward rx nil t) (let* ((i (org-babel-get-src-block-info 'light)) (body (org-babel-expand-noweb-references i)) + (sep (or (cdr (assoc :noweb-sep (nth 2 i))) + "\n")) (full (if comment ((lambda (cs) (concat (c-wrap (car cs)) "\n" @@ -2076,13 +2205,15 @@ block but are passed literally to the \"example-block\"." (c-wrap (cadr cs)))) (org-babel-tangle-comment-links i)) body))) - (setq expansion (concat expansion full)))) + (setq expansion (cons sep (cons full expansion))))) (org-babel-map-src-blocks nil (let ((i (org-babel-get-src-block-info 'light))) (when (equal (or (cdr (assoc :noweb-ref (nth 2 i))) (nth 4 i)) source-name) (let* ((body (org-babel-expand-noweb-references i)) + (sep (or (cdr (assoc :noweb-sep (nth 2 i))) + "\n")) (full (if comment ((lambda (cs) (concat (c-wrap (car cs)) "\n" @@ -2090,8 +2221,10 @@ block but are passed literally to the \"example-block\"." (c-wrap (cadr cs)))) (org-babel-tangle-comment-links i)) body))) - (setq expansion (concat expansion full)))))))) - expansion) + (setq expansion + (cons sep (cons full expansion))))))))) + (and expansion + (mapconcat #'identity (nreverse (cdr expansion)) ""))) ;; possibly raise an error if named block doesn't exist (if (member lang org-babel-noweb-error-langs) (error "%s" (concat @@ -2099,7 +2232,7 @@ block but are passed literally to the \"example-block\"." "could not be resolved (see " "`org-babel-noweb-error-langs')")) ""))) - "[\n\r]") (concat "\n" prefix))))) + "[\n\r]") (concat "\n" prefix)))))) (nb-add (buffer-substring index (point-max))))) new-body)) @@ -2108,10 +2241,16 @@ block but are passed literally to the \"example-block\"." (when text (set-text-properties 0 (length text) nil text) text)) -(defun org-babel-strip-protective-commas (body) +(defun org-babel-strip-protective-commas (body &optional lang) "Strip protective commas from bodies of source blocks." - (when body - (replace-regexp-in-string "^,#" "#" body))) + (with-temp-buffer + (insert body) + (if (and lang (string= lang "org")) + (progn (goto-char (point-min)) + (while (re-search-forward "^[ \t]*\\(,\\)" nil t) + (replace-match "" nil nil nil 1))) + (org-strip-protective-commas (point-min) (point-max))) + (buffer-string))) (defun org-babel-script-escape (str &optional force) "Safely convert tables into elisp lists." diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index bdf6881908..f70605069d 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -91,7 +91,7 @@ (defvar org-agenda-buffer-name) (defvar org-agenda-overriding-header) (defvar org-agenda-title-append nil) -(defvar entry) +(defvar org-entry) (defvar date) (defvar org-agenda-undo-list) (defvar org-agenda-pending-undo-list) @@ -247,9 +247,7 @@ you can \"misuse\" it to also add other text to the header. However, ;; Keep custom values for `org-agenda-filter-preset' compatible with ;; the new variable `org-agenda-tag-filter-preset'. -(if (fboundp 'defvaralias) - (defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset) - (defvaralias 'org-agenda-filter 'org-agenda-tag-filter)) +(defvaralias 'org-agenda-filter-preset 'org-agenda-tag-filter-preset) (defconst org-agenda-custom-commands-local-options `(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, (string :tag "+tag or -tag")))) (list :tag "Set daily/weekly entry types" (const org-agenda-entry-types) - (set :greedy t :value (:deadline :scheduled :timestamp :sexp) - (const :deadline) - (const :scheduled) - (const :timestamp) - (const :sexp))) + (list + (const :format "" quote) + (set :greedy t :value (:deadline :scheduled :timestamp :sexp) + (const :deadline) + (const :scheduled) + (const :timestamp) + (const :sexp)))) (list :tag "Standard skipping condition" :value (org-agenda-skip-function '(org-agenda-skip-entry-if)) (const org-agenda-skip-function) @@ -408,7 +408,7 @@ where desc A description string to be displayed in the dispatcher menu. cmd An agenda command, similar to the above. However, tree commands - are no allowed, but instead you can get agenda and global todo list. + are not allowed, but instead you can get agenda and global todo list. So valid commands for a set are: (agenda \"\" settings) (alltodo \"\" settings) @@ -1770,7 +1770,7 @@ works you probably want to add it to `org-agenda-custom-commands' for good." (setcdr ass (cdr entry)) (push entry org-agenda-custom-commands)))) -;;; Define the org-agenda-mode +;;; Define the Org-agenda-mode (defvar org-agenda-mode-map (make-sparse-keymap) "Keymap for `org-agenda-mode'.") @@ -3075,7 +3075,6 @@ the global options and expect it to be applied to the entire view.") (defun org-prepare-agenda (&optional name) (setq org-todo-keywords-for-agenda nil) - (setq org-done-keywords-for-agenda nil) (setq org-drawers-for-agenda nil) (unless org-agenda-persistent-filter (setq org-agenda-tag-filter nil @@ -3094,6 +3093,7 @@ the global options and expect it to be applied to the entire view.") (make-string (window-width) org-agenda-block-separator)) "\n")) (narrow-to-region (point) (point-max))) + (setq org-done-keywords-for-agenda nil) (org-agenda-reset-markers) (setq org-agenda-contributing-files nil) (setq org-agenda-columns-active nil) @@ -4221,7 +4221,7 @@ See `org-agenda-skip-if' for details." (defun org-agenda-skip-if (subtree conditions) "Checks current entity for CONDITIONS. If SUBTREE is non-nil, the entire subtree is checked. Otherwise, only -the entry, i.e. the text before the next heading is checked. +the entry (i.e. the text before the next heading) is checked. CONDITIONS is a list of symbols, boolean OR is used to combine the results from different tests. Valid conditions are: @@ -4247,12 +4247,12 @@ keywords, which may include \"*\" to match any todo keyword. would skip all entries with \"TODO\" or \"WAITING\" keywords. -Instead of a list a keyword class may be given +Instead of a list, a keyword class may be given. For example: (org-agenda-skip-entry-if 'nottodo 'done) would skip entries that haven't been marked with any of \"DONE\" -keywords. Possible classes are: `todo', `done', `any'. +keywords. Possible classes are: `todo', `done', `any'. If any of these conditions is met, this function returns the end point of the entity, causing the search to continue from there. This is a function @@ -4285,8 +4285,8 @@ that can be put into `org-agenda-skip-function' for the duration of a command." (stringp (nth 1 m)) (not (re-search-forward (nth 1 m) end t))) (and (or - (setq m (memq 'todo conditions)) - (setq m (memq 'nottodo conditions))) + (setq m (memq 'nottodo conditions)) + (setq m (memq 'todo conditions))) (org-agenda-skip-if-todo m end))) end))) @@ -4377,7 +4377,7 @@ of what a project is and how to check if it stuck, customize the variable ;;; Diary integration (defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param. -(defvar diary-list-entries-hook) +(defvar list-diary-entries-hook) (defvar diary-time-regexp) (defun org-get-entries-from-diary (date) "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 (diary-display-hook '(fancy-diary-display)) (diary-display-function 'fancy-diary-display) (pop-up-frames nil) - (diary-list-entries-hook - (cons 'org-diary-default-entry diary-list-entries-hook)) + (list-diary-entries-hook + (cons 'org-diary-default-entry list-diary-entries-hook)) (diary-file-name-prefix-function nil) ; turn this feature off (diary-modify-entry-list-string-function 'org-modify-diary-entry-string) entries @@ -4530,8 +4530,8 @@ function from a program - use `org-agenda-get-day-entries' instead." (org-compile-prefix-format 'agenda) (org-set-sorting-strategy 'agenda) (setq args (or args '(:deadline :scheduled :timestamp :sexp))) - (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) - (list entry) + (let* ((files (if (and org-entry (stringp org-entry) (string-match "\\S-" org-entry)) + (list org-entry) (org-agenda-files t))) (time (org-float-time)) file rtn results) @@ -4936,7 +4936,7 @@ holiday will also be skipped." (not (member (car (calendar-iso-from-absolute d)) skip-weeks)))) (not (and (memq 'holidays skip-weeks) (calendar-check-holidays date))) - entry))) + org-entry))) (defun org-diary-class (m1 d1 y1 m2 d2 y2 dayname &rest skip-weeks) "Like `org-class', but honor `calendar-date-style'. @@ -5870,8 +5870,18 @@ could bind the variable in the options section of a custom command.") (let ((pl (text-property-any 0 (length x) 'org-heading t x))) (setq re (get-text-property 0 'org-todo-regexp x)) (when (and re + ;; Test `pl' because if there's no heading content, + ;; there's no point matching to highlight. Note + ;; that if we didn't test `pl' first, and there + ;; happened to be no keyword from `org-todo-regexp' + ;; on this heading line, then the `equal' comparison + ;; afterwards would spuriously succeed in the case + ;; where `pl' is nil -- causing an args-out-of-range + ;; error when we try to add text properties to text + ;; that isn't there. + pl (equal (string-match (concat "\\(\\.*\\)" re "\\( +\\)") - x (or pl 0)) pl)) + x pl) pl)) (add-text-properties (or (match-end 1) (match-end 0)) (match-end 0) (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." (recenter window-line))) (defvar org-global-tags-completion-table nil) -(defvar org-agenda-filtered-by-category nil) (defvar org-agenda-filter-form nil) +(defvar org-agenda-filtered-by-category nil) (defun org-agenda-filter-by-category (strip) "Keep only those lines in the agenda buffer that have a specific category. @@ -7282,16 +7292,18 @@ use the dedicated frame)." (if (and current-prefix-arg (listp current-prefix-arg)) (org-agenda-do-tree-to-indirect-buffer) (let ((agenda-window (selected-window)) - (indirect-window (get-buffer-window org-last-indirect-buffer))) + (indirect-window + (and org-last-indirect-buffer + (get-buffer-window org-last-indirect-buffer)))) (save-window-excursion (org-agenda-do-tree-to-indirect-buffer)) (unwind-protect (progn - (unless indirect-window + (unless (and indirect-window (window-live-p indirect-window)) (setq indirect-window (split-window agenda-window))) (select-window indirect-window) (switch-to-buffer org-last-indirect-buffer :norecord) (fit-window-to-buffer indirect-window)) - (select-window agenda-window))))) + (select-window (get-buffer-window org-agenda-buffer-name)))))) (defun org-agenda-do-tree-to-indirect-buffer () "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 90f39fd3d8..b4c92cfe08 100644 --- a/lisp/org/org-ascii.el +++ b/lisp/org/org-ascii.el @@ -438,7 +438,9 @@ publishing directory." link (concat (match-string 1 line) path) type (match-string 2 line) desc0 (match-string 5 line) - desc (or desc0 link)) + desc0 (replace-regexp-in-string "\\\\_" "_" desc0) + desc (or desc0 link) + desc (replace-regexp-in-string "\\\\_" "_" desc)) (if (and (> (length link) 8) (equal (substring link 0 8) "coderef:")) (setq line (replace-match diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index 6f7476c6ba..73d0fa4205 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 :type '(choice (const :tag "Don't store link" nil) (const :tag "Link to origin location" t) - (const :tag "Link to the attach-dir location" 'attached))) + (const :tag "Link to the attach-dir location" attached))) ;;;###autoload (defun org-attach () diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index 3df4c2044e..49b9cf7746 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el @@ -112,20 +112,14 @@ (&optional dont-check-disk already-in-db-buffer)) (declare-function bbdb-split "ext:bbdb" (string separators)) (declare-function bbdb-string-trim "ext:bbdb" (string)) -(declare-function bbdb-record-get-field "ext:bbdb" - (fn file &optional arglist fileonly)) -;; These two functions below are part of BBDB3: -(declare-function bbdb-search-name "ext:bbdb" (regexp &optional layout)) -(declare-function bbdb-search-organization "ext:bbdb" (regexp &optional layout)) +(declare-function bbdb-record-get-field "ext:bbdb" (record field)) +(declare-function bbdb-search-name "ext:bbdb-com" (regexp &optional layout)) +(declare-function bbdb-search-organization "ext:bbdb-com" (regexp &optional layout)) (declare-function calendar-leap-year-p "calendar" (year)) (declare-function diary-ordinal-suffix "diary-lib" (n)) (defvar date) ;; dynamically scoped from Org -(defvar name) ;; dynamically scoped from Org - -;; Support for version 2.35 -(defvar org-bbdb-old (fboundp 'bbdb-record-get-field-internal)) ;; Customization @@ -206,7 +200,7 @@ date year)." ;; This is BBDB, we make this link! (let* ((rec (bbdb-current-record)) (name (bbdb-record-name rec)) - (company (if org-bbdb-old + (company (if (fboundp 'bbdb-record-getprop) (bbdb-record-getprop rec 'company) (car (bbdb-record-get-field rec 'organization)))) (link (org-make-link "bbdb:" name))) @@ -227,14 +221,14 @@ italicized, in all other cases it is left unchanged." (defun org-bbdb-open (name) "Follow a BBDB link to NAME." - (require 'bbdb) + (require 'bbdb-com) (let ((inhibit-redisplay (not debug-on-error)) (bbdb-electric-p nil)) - (if org-bbdb-old - (org-bbdb-open-old) - (org-bbdb-open-new)))) + (if (fboundp 'bbdb-name) + (org-bbdb-open-old name) + (org-bbdb-open-new name)))) -(defun org-bbdb-open-old () +(defun org-bbdb-open-old (name) (catch 'exit ;; Exact match on name (bbdb-name (concat "\\`" name "\\'") nil) @@ -254,7 +248,7 @@ italicized, in all other cases it is left unchanged." (delete-window (get-buffer-window "*BBDB*")) (error "No matching BBDB record")))) -(defun org-bbdb-open-new () +(defun org-bbdb-open-new (name) (catch 'exit ;; Exact match on name (bbdb-search-name (concat "\\`" name "\\'") nil) diff --git a/lisp/org/org-beamer.el b/lisp/org/org-beamer.el index 28b79a03df..7882b27be7 100644 --- a/lisp/org/org-beamer.el +++ b/lisp/org/org-beamer.el @@ -235,7 +235,7 @@ in org-export-latex-classes." (envs (append org-beamer-environments-extra org-beamer-environments-default)) (props (org-get-text-property-any 0 'org-props text)) - (in "") (out "") option action defaction environment extra + (in "") (out "") org-beamer-option org-beamer-action org-beamer-defaction org-beamer-environment org-beamer-extra columns-option column-option env have-text ass tmp) (if (= frame-level 0) (setq frame-level nil)) @@ -266,10 +266,10 @@ in org-export-latex-classes." (setq in (org-fill-template "\\begin{frame}%a%A%o%T%S%x" - (list (cons "a" (or action "")) - (cons "A" (or defaction "")) - (cons "o" (or option org-beamer-frame-default-options "")) - (cons "x" (if extra (concat "\n" extra) "")) + (list (cons "a" (or org-beamer-action "")) + (cons "A" (or org-beamer-defaction "")) + (cons "o" (or org-beamer-option org-beamer-frame-default-options "")) + (cons "x" (if org-beamer-extra (concat "\n" org-beamer-extra) "")) (cons "h" "%s") (cons "T" (if (string-match "\\S-" text) "\n\\frametitle{%s}" "")) @@ -294,10 +294,10 @@ in org-export-latex-classes." (setq have-text (string-match "\\S-" text)) (setq in (org-fill-template (nth 2 ass) - (list (cons "a" (or action "")) - (cons "A" (or defaction "")) - (cons "o" (or option "")) - (cons "x" (if extra (concat "\n" extra) "")) + (list (cons "a" (or org-beamer-action "")) + (cons "A" (or org-beamer-defaction "")) + (cons "o" (or org-beamer-option "")) + (cons "x" (if org-beamer-extra (concat "\n" org-beamer-extra) "")) (cons "h" "%s") (cons "H" (if have-text (concat "{" text "}") "")) (cons "U" (if have-text (concat "[" text "]") "")))) @@ -321,31 +321,31 @@ in org-export-latex-classes." (cons text (cdr (assoc level default)))) (t nil)))) -(defvar extra) -(defvar option) -(defvar action) -(defvar defaction) -(defvar environment) +(defvar org-beamer-extra) +(defvar org-beamer-option) +(defvar org-beamer-action) +(defvar org-beamer-defaction) +(defvar org-beamer-environment) (defun org-beamer-get-special (props) "Extract an option, action, and default action string from text. -The variables option, action, defaction, extra are all scoped into -this function dynamically." +The variables org-beamer-option, org-beamer-action, org-beamer-defaction, +org-beamer-extra are all scoped into this function dynamically." (let (tmp) - (setq environment (org-beamer-assoc-not-empty "BEAMER_env" props)) - (setq extra (org-beamer-assoc-not-empty "BEAMER_extra" props)) - (when extra - (setq extra (replace-regexp-in-string "\\\\n" "\n" extra))) + (setq org-beamer-environment (org-beamer-assoc-not-empty "BEAMER_env" props)) + (setq org-beamer-extra (org-beamer-assoc-not-empty "BEAMER_extra" props)) + (when org-beamer-extra + (setq org-beamer-extra (replace-regexp-in-string "\\\\n" "\n" org-beamer-extra))) (setq tmp (org-beamer-assoc-not-empty "BEAMER_envargs" props)) (when tmp (setq tmp (copy-sequence tmp)) (if (string-match "\\[<[^][<>]*>\\]" tmp) - (setq defaction (match-string 0 tmp) + (setq org-beamer-defaction (match-string 0 tmp) tmp (replace-match "" t t tmp))) (if (string-match "\\[[^][]*\\]" tmp) - (setq option (match-string 0 tmp) + (setq org-beamer-option (match-string 0 tmp) tmp (replace-match "" t t tmp))) (if (string-match "<[^<>]*>" tmp) - (setq action (match-string 0 tmp) + (setq org-beamer-action (match-string 0 tmp) tmp (replace-match "" t t tmp)))))) (defun org-beamer-assoc-not-empty (elt list) @@ -579,7 +579,7 @@ include square brackets." (add-hook 'org-export-preprocess-before-selecting-backend-code-hook 'org-beamer-select-beamer-code) -(defun org-insert-beamer-options-template (kind) +(defun org-insert-beamer-options-template (&optional kind) "Insert a settings template, to make sure users do this right." (interactive (progn (message "Current [s]ubtree or [g]lobal?") diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index 17cdbc27f2..c1788b4bb5 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el @@ -112,7 +112,7 @@ (eval-when-compile (require 'cl)) -(defvar description nil) ; dynamically scoped from org.el +(defvar org-bibtex-description nil) ; dynamically scoped from org.el (defvar org-id-locations) (declare-function bibtex-beginning-of-entry "bibtex" ()) @@ -467,7 +467,7 @@ With optional argument OPTIONAL, also prompt for optional fields." :btype (or (cdr (assoc "=type=" entry)) "[no type]") :type "bibtex" :link link - :description description)))) + :description org-bibtex-description)))) (defun org-create-file-search-in-bibtex () "Create the search string and description for a BibTeX database entry." @@ -485,7 +485,7 @@ With optional argument OPTIONAL, also prompt for optional fields." (bibtex-autokey-titleword-case-convert-function 'identity) (bibtex-autokey-titleword-length 'infty) (bibtex-autokey-year-title-separator ": ")) - (setq description (bibtex-generate-autokey))) + (setq org-bibtex-description (bibtex-generate-autokey))) ;; Now parse the entry, get the key and return it. (save-excursion (bibtex-beginning-of-entry) diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 31694d47bc..01ec85d6d7 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." (target-entry-p (org-capture-get :target-entry-p)) (ind 0) beg end) - (cond - ((org-capture-get :exact-position) - (goto-char (org-capture-get :exact-position))) - ((not target-entry-p) - ;; Insert as top-level entry, either at beginning or at end of file - (setq beg (point-min) end (point-max))) - (t - (setq beg (1+ (point-at-eol)) - end (save-excursion (outline-next-heading) (point))))) - (if (org-capture-get :prepend) - (progn - (goto-char beg) - (if (org-list-search-forward (org-item-beginning-re) end t) - (progn - (goto-char (match-beginning 0)) - (setq ind (org-get-indentation))) - (goto-char end) - (setq ind 0))) - (goto-char end) - (if (org-list-search-backward (org-item-beginning-re) beg t) + (if (org-capture-get :exact-position) + (goto-char (org-capture-get :exact-position)) + (cond + ((not target-entry-p) + ;; Insert as top-level entry, either at beginning or at end of file + (setq beg (point-min) end (point-max))) + (t + (setq beg (1+ (point-at-eol)) + end (save-excursion (outline-next-heading) (point))))) + (if (org-capture-get :prepend) (progn - (setq ind (org-get-indentation)) - (org-end-of-item)) - (setq ind 0))) + (goto-char beg) + (if (org-list-search-forward (org-item-beginning-re) end t) + (progn + (goto-char (match-beginning 0)) + (setq ind (org-get-indentation))) + (goto-char end) + (setq ind 0))) + (goto-char end) + (if (org-list-search-backward (org-item-beginning-re) beg t) + (progn + (setq ind (org-get-indentation)) + (org-end-of-item)) + (setq ind 0)))) ;; Remove common indentation (setq txt (org-remove-indentation txt)) ;; Make sure this is indeed an item diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 6211ae45b1..b1133024b3 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." (remove-hook 'before-change-functions 'org-clock-remove-overlays 'local)))) -(defvar state) ;; dynamically scoped into this function +(defvar org-clock-state) ;; dynamically scoped into this function (defun org-clock-out-if-current () "Clock out if the current entry contains the running clock. This is used to stop the clock after a TODO entry is marked DONE, @@ -1700,9 +1700,9 @@ and is only done if the variable `org-clock-out-when-done' is not nil." org-clock-out-when-done (marker-buffer org-clock-marker) (or (and (eq t org-clock-out-when-done) - (member state org-done-keywords)) + (member org-clock-state org-done-keywords)) (and (listp org-clock-out-when-done) - (member state org-clock-out-when-done))) + (member org-clock-state org-clock-out-when-done))) (equal (or (buffer-base-buffer (org-clocking-buffer)) (org-clocking-buffer)) (or (buffer-base-buffer (current-buffer)) @@ -1763,17 +1763,6 @@ buffer and update it." (org-combine-plists org-clock-clocktable-default-properties props)))) (org-update-dblock)) -(defun org-in-clocktable-p () - "Check if the cursor is in a clocktable." - (let ((pos (point)) start) - (save-excursion - (end-of-line 1) - (and (re-search-backward "^[ \t]*#\\+BEGIN:[ \t]+clocktable" nil t) - (setq start (match-beginning 0)) - (re-search-forward "^[ \t]*#\\+END:.*" nil t) - (>= (match-end 0) pos) - start)))) - (defun org-day-of-week (day month year) "Returns the day of the week as an integer." (nth 6 @@ -2445,6 +2434,7 @@ TIME: The sum of all time spend in this tree, in minutes. This time (tags (plist-get params :tags)) (properties (plist-get params :properties)) (inherit-property-p (plist-get params :inherit-props)) + todo-only (matcher (if tags (cdr (org-make-tags-matcher tags)))) cc range-text st p time level hdl props tsp tbl) diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 04d2b626f9..fb158800ce 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.") (point-at-bol) (point-at-eol))))) ;; In agenda, just get the `txt' property (org-no-properties - (org-get-at-bol 'txt)))) + (or (org-get-at-bol 'txt) + (buffer-substring + (point) (progn (end-of-line) (point))))))) (assoc property props)) width (or (cdr (assoc property org-columns-current-maxwidths)) (nth 2 column) @@ -355,7 +357,7 @@ CPHR is the complex heading regexp to use for parsing ITEM." 'org-whitespace (* 2 (1- (org-reduced-level (- (match-end 1) (match-beginning 1)))))) (and (match-end 2) (not (assoc "TODO" fmt)) (concat " " (match-string 2 item))) (and (match-end 3) (not (assoc "PRIORITY" fmt)) (concat " " (match-string 3 item))) - " " (save-match-data (org-columns-compact-links (match-string 4 item))) + " " (save-match-data (org-columns-compact-links (or (match-string 4 item) ""))) (and (match-end 5) (not (assoc "TAGS" fmt)) (concat " " (match-string 5 item))))) (add-text-properties 0 (1+ (match-end 1)) @@ -928,6 +930,8 @@ Don't set this, this is meant for dynamic scoping.") (overlay-put ov 'display (format fmt val))))) org-columns-overlays)))) +(defvar org-inlinetask-min-level + (if (featurep 'org-inlinetask) org-inlinetask-min-level 15)) (defun org-columns-compute (property) "Sum the values of property PROPERTY hierarchically, for the entire buffer." (interactive) @@ -942,7 +946,9 @@ Don't set this, this is meant for dynamic scoping.") (fun (nth 6 ass)) (calc (or (nth 7 ass) 'identity)) (beg org-columns-top-level-marker) - last-level val valflag flag end sumpos sum-alist sum str str1 useval) + (inminlevel org-inlinetask-min-level) + (last-level org-inlinetask-min-level) + val valflag flag end sumpos sum-alist sum str str1 useval) (save-excursion ;; Find the region to compute (goto-char beg) @@ -951,16 +957,21 @@ Don't set this, this is meant for dynamic scoping.") ;; Walk the tree from the back and do the computations (while (re-search-backward re beg t) (setq sumpos (match-beginning 0) - last-level level + last-level (if (not (or (zerop level) (eq level inminlevel))) + level last-level) level (org-outline-level) val (org-entry-get nil property) valflag (and val (string-match "\\S-" val))) (cond ((< level last-level) ;; put the sum of lower levels here as a property - (setq sum (when (aref lvals last-level) - (apply fun (aref lvals last-level))) - flag (aref lflag last-level) ; any valid entries from children? + (setq sum (+ (if (and (/= last-level inminlevel) + (aref lvals last-level)) + (apply fun (aref lvals last-level)) 0) + (if (aref lvals inminlevel) + (apply fun (aref lvals inminlevel)) 0)) + flag (or (aref lflag last-level) ; any valid entries from children? + (aref lflag inminlevel)) ; or inline tasks? str (org-columns-number-to-string sum format printf) str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold) useval (if flag str1 (if valflag val "")) diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el index a128b04603..c613ba20e4 100644 --- a/lisp/org/org-crypt.el +++ b/lisp/org/org-crypt.el @@ -236,16 +236,20 @@ See `org-crypt-disable-auto-save'." (defun org-encrypt-entries () "Encrypt all top-level entries in the current buffer." (interactive) - (org-scan-tags - 'org-encrypt-entry - (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) + (let (todo-only) + (org-scan-tags + 'org-encrypt-entry + (cdr (org-make-tags-matcher org-crypt-tag-matcher)) + todo-only))) (defun org-decrypt-entries () "Decrypt all entries in the current buffer." (interactive) - (org-scan-tags - 'org-decrypt-entry - (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) + (let (todo-only) + (org-scan-tags + 'org-decrypt-entry + (cdr (org-make-tags-matcher org-crypt-tag-matcher)) + todo-only))) (defun org-crypt-use-before-save-magic () "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 16b19e26d0..f572095d81 100644 --- a/lisp/org/org-eshell.el +++ b/lisp/org/org-eshell.el @@ -3,7 +3,6 @@ ;; Copyright (C) 2011-2012 Free Software Foundation, Inc. ;; Author: Konrad Hinsen <konrad.hinsen AT fastmail.net> -;; Version: 0.1 ;; This file is part of GNU Emacs. diff --git a/lisp/org/org-exp-blocks.el b/lisp/org/org-exp-blocks.el index e5ff5c59ee..438a580d8b 100644 --- a/lisp/org/org-exp-blocks.el +++ b/lisp/org/org-exp-blocks.el @@ -57,9 +57,9 @@ ;; using the dot utility. For information on dot see ;; http://www.graphviz.org/ ;; -;; comment :: Wrap comments with titles and author information, in -;; their own divs with author-specific ids allowing for css -;; coloring of comments based on the author. +;; export-comment :: Wrap comments with titles and author information, +;; in their own divs with author-specific ids allowing for +;; css coloring of comments based on the author. ;; ;;; Adding new blocks ;; @@ -73,6 +73,7 @@ (eval-when-compile (require 'cl)) (require 'org) +(require 'find-func) (defun org-export-blocks-set (var value) "Set the value of `org-export-blocks' and install fontification." @@ -87,7 +88,7 @@ value)) (defcustom org-export-blocks - '((comment org-export-blocks-format-comment t) + '((export-comment org-export-blocks-format-comment t) (ditaa org-export-blocks-format-ditaa nil) (dot org-export-blocks-format-dot nil)) "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'." ;;-------------------------------------------------------------------------------- ;; ditaa: create images from ASCII art using the ditaa utility -(defvar org-ditaa-jar-path (expand-file-name +(defcustom org-ditaa-jar-path (expand-file-name "ditaa.jar" (file-name-as-directory (expand-file-name @@ -232,8 +233,10 @@ which defaults to the value of `org-export-blocks-witheld'." (file-name-as-directory (expand-file-name "../contrib" - (file-name-directory (or load-file-name buffer-file-name))))))) - "Path to the ditaa jar executable.") + (file-name-directory (find-library-name "org"))))))) + "Path to the ditaa jar executable." + :group 'org-babel + :type 'string) (defvar org-export-current-backend) ; dynamically bound in org-exp.el (defun org-export-blocks-format-ditaa (body &rest headers) diff --git a/lisp/org/org-exp.el b/lisp/org/org-exp.el index c7e1a94216..b5901a54bc 100644 --- a/lisp/org/org-exp.el +++ b/lisp/org/org-exp.el @@ -1730,10 +1730,11 @@ from the buffer." ":[ \t]*\\(.*\\)") nil t) (if (not (eq backend org-export-current-backend)) (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max))) - (replace-match "\\1\\2" t) - (add-text-properties - (point-at-bol) (min (1+ (point-at-eol)) (point-max)) - `(org-protected t original-indentation ,ind org-native-text t)))) + (let ((ind (get-text-property (point-at-bol) 'original-indentation))) + (replace-match "\\1\\2" t) + (add-text-properties + (point-at-bol) (min (1+ (point-at-eol)) (point-max)) + `(org-protected t original-indentation ,ind org-native-text t))))) ;; Delete #+ATTR_BACKEND: stuff of another backend. Those ;; matching the current backend will be taken care of by ;; `org-export-attach-captions-and-attributes' @@ -1748,7 +1749,8 @@ from the buffer." (while (re-search-forward (concat "^[ \t]*#\\+BEGIN_" backend-name "\\>.*\n?") nil t) (setq beg (match-beginning 0) beg-content (match-end 0)) - (setq ind (save-excursion (goto-char beg) (org-get-indentation))) + (setq ind (or (get-text-property beg 'original-indentation) + (save-excursion (goto-char beg) (org-get-indentation)))) (when (re-search-forward (concat "^[ \t]*#\\+END_" backend-name "\\>.*\n?") nil t) (setq end (match-end 0) end-content (match-beginning 0)) @@ -1759,17 +1761,7 @@ from the buffer." beg-content end-content `(org-protected t original-indentation ,ind org-native-text t)) ;; strip protective commas - (save-excursion - (save-match-data - (goto-char beg-content) - (let ((front-line (save-excursion - (re-search-forward - "[^[:space:]]" end-content t) - (goto-char (match-beginning 0)) - (current-column)))) - (while (re-search-forward "^[ \t]*\\(,\\)" end-content t) - (when (= (current-column) front-line) - (replace-match "" nil nil nil 1)))))) + (org-strip-protective-commas beg-content end-content) (delete-region (match-beginning 0) (match-end 0)) (save-excursion (goto-char beg) @@ -1816,8 +1808,7 @@ These special cookies will later be interpreted by the backend." (top (point-at-bol)) (top-ind (org-list-get-ind top struct))) (goto-char bottom) - (when (and (not (eq org-list-ending-method 'indent)) - (not (looking-at "[ \t]*$")) + (when (and (not (looking-at "[ \t]*$")) (looking-at org-list-end-re)) (replace-match "")) (unless (bolp) (insert "\n")) @@ -1875,8 +1866,7 @@ These special properties will later be interpreted by the backend." ;; useful to line processing exporters. (goto-char bottom) (when (or (looking-at "^ORG-LIST-END-MARKER\n") - (and (not (eq org-list-ending-method 'indent)) - (not (looking-at "[ \t]*$")) + (and (not (looking-at "[ \t]*$")) (looking-at org-list-end-re))) (replace-match "")) (unless (bolp) (insert "\n")) @@ -2203,7 +2193,7 @@ can work correctly." ;; This is a subtree, we take the title from the first heading (goto-char rbeg) (looking-at org-todo-line-tags-regexp) - (setq title (if (eq tags t) + (setq title (if (and (eq tags t) (match-string 4)) (format "%s\t%s" (match-string 3) (match-string 4)) (match-string 3))) (org-unmodified @@ -3277,7 +3267,7 @@ If yes remove the column and the special lines." ((org-table-cookie-line-p x) ;; This line contains formatting cookies, discard it nil) - ((string-match "^[ \t]*| *[!_^/] *|" x) + ((string-match "^[ \t]*| *\\([!_^/$]\\|\\\\\\$\\) *|" x) ;; ignore this line nil) ((or (string-match "^\\([ \t]*\\)|-+\\+" x) diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el index 573bd64895..34fc31f39d 100644 --- a/lisp/org/org-footnote.el +++ b/lisp/org/org-footnote.el @@ -58,6 +58,7 @@ (declare-function org-show-context "org" (&optional key)) (declare-function org-trim "org" (s)) (declare-function outline-next-heading "outline") +(declare-function org-skip-whitespace "org" ()) (defvar org-outline-regexp-bol) ; defined in org.el (defvar org-odd-levels-only) ; defined in org.el @@ -84,8 +85,8 @@ (org-re "^\\[\\([0-9]+\\|fn:[-_[:word:]]+\\)\\]") "Regular expression matching the definition of a footnote.") -(defvar org-footnote-forbidden-blocks '("example" "verse" "src" "ascii" "beamer" - "docbook" "html" "latex" "odt") +(defconst org-footnote-forbidden-blocks + '("ascii" "beamer" "comment" "docbook" "example" "html" "latex" "odt" "src") "Names of blocks where footnotes are not allowed.") (defgroup org-footnote nil @@ -242,40 +243,46 @@ positions, and the definition, when inlined." (match-end 0) (1- end))))))))) (defun org-footnote-at-definition-p () - "Is the cursor at a footnote definition? + "Is point within a footnote definition? -This matches only pure definitions like [1] or [fn:name] at the beginning -of a line. It does not match references like [fn:name:definition], where the -footnote text is included and defined locally. +This matches only pure definitions like [1] or [fn:name] at the +beginning of a line. It does not match references like +\[fn:name:definition], where the footnote text is included and +defined locally. -The return value will be nil if not at a footnote definition, and a list with -label, start, end and definition of the footnote otherwise." +The return value will be nil if not at a footnote definition, and +a list with label, start, end and definition of the footnote +otherwise." (when (save-excursion (beginning-of-line) (org-footnote-in-valid-context-p)) (save-excursion (end-of-line) + ;; Footnotes definitions are separated by new headlines or blank + ;; lines. (let ((lim (save-excursion (re-search-backward (concat org-outline-regexp-bol "\\|^[ \t]*$") nil t)))) (when (re-search-backward org-footnote-definition-re lim t) - (end-of-line) - (list (org-match-string-no-properties 1) - (match-beginning 0) - (save-match-data - ;; In a message, limit search to signature. - (let ((bound (and (derived-mode-p 'message-mode) - (save-excursion - (goto-char (point-max)) - (re-search-backward - message-signature-separator nil t))))) - (or (and (re-search-forward + (let ((label (org-match-string-no-properties 1)) + (beg (match-beginning 0)) + (beg-def (match-end 0)) + ;; In message-mode, do not search after signature. + (end (let ((bound (and (derived-mode-p 'message-mode) + (save-excursion + (goto-char (point-max)) + (re-search-backward + message-signature-separator nil t))))) + (if (progn + (end-of-line) + (re-search-forward (concat org-outline-regexp-bol "\\|" org-footnote-definition-re "\\|" - "^[ \t]*$") - bound 'move) - (progn (skip-chars-forward " \t\n") (point-at-bol))) - (point)))) - (org-trim (buffer-substring-no-properties - (match-end 0) (point))))))))) + "^[ \t]*$") bound 'move)) + (progn (goto-char (match-beginning 0)) + (org-skip-whitespace) + (point-at-bol)) + (point))))) + (list label beg end + (org-trim (buffer-substring-no-properties beg-def end))))))))) (defun org-footnote-get-next-reference (&optional label backward limit) "Return complete reference of the next footnote. @@ -541,7 +548,9 @@ or new, let the user edit the definition of the footnote." (unless (bolp) (newline)) (set-marker max nil)))) ;; Insert footnote label. - (insert "\n[" label "] ") + (when (zerop (org-back-over-empty-lines)) (newline)) + (insert "[" label "] \n") + (backward-char) ;; Only notify user about next possible action when in an Org ;; buffer, as the bindings may have different meanings otherwise. (when (eq major-mode 'org-mode) @@ -651,6 +660,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': (goto-char (point-min)) (while (setq ref (org-footnote-get-next-reference)) (let* ((lbl (car ref)) + (pos (nth 1 ref)) ;; When footnote isn't anonymous, check if it's label ;; (REF) is already stored in REF-TABLE. In that case, ;; extract number used to identify it (MARKER). If @@ -667,8 +677,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': ;; If EXPORT-PROPS isn't nil, also add `org-footnote' ;; property to it, so it can be easily recognized by ;; exporters. - (if sort-only - (goto-char (nth 2 ref)) + (if sort-only (goto-char (nth 2 ref)) (delete-region (nth 1 ref) (nth 2 ref)) (goto-char (nth 1 ref)) (let ((new-ref (format "[%d]" marker))) @@ -678,7 +687,8 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': org-footnote-fill-after-inline-note-extraction (org-fill-paragraph))) ;; Add label (REF), identifier (MARKER), definition (DEF) - ;; and type (INLINEP) to REF-TABLE if data was unknown. + ;; type (INLINEP) and position (POS) to REF-TABLE if data + ;; was unknown. (unless a (let ((def (or (nth 3 ref) ; inline (and export-props @@ -696,27 +706,35 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': '(:todo-keywords t :tags t :priority t)))) (org-export-preprocess-string def parameters)) def) - inlinep) ref-table))))) + ;; Reference beginning position is a marker + ;; to preserve it during further buffer + ;; modifications. + inlinep (copy-marker pos)) ref-table))))) ;; 2. Find and remove the footnote section, if any. Also ;; determine where footnotes shall be inserted (INS-POINT). - (goto-char (point-min)) (cond - ((and org-footnote-section - (eq major-mode 'org-mode) - (re-search-forward + ((and org-footnote-section (eq major-mode 'org-mode)) + (goto-char (point-min)) + (if (re-search-forward (concat "^\\*[ \t]+" (regexp-quote org-footnote-section) - "[ \t]*$") - nil t)) - (delete-region (match-beginning 0) (org-end-of-subtree t))) - ((eq major-mode 'org-mode) + "[ \t]*$") nil t) + (delete-region (match-beginning 0) (org-end-of-subtree t t))) + ;; A new footnote section is inserted by default at the end of + ;; the buffer. (goto-char (point-max)) + (skip-chars-backward " \r\t\n") + (forward-line) (unless (bolp) (newline))) + ;; No footnote section set: Footnotes will be added at the end + ;; of the section containing their first reference. + ((eq major-mode 'org-mode)) (t ;; Remove any left-over tag in the buffer, if one is set up. (when org-footnote-tag-for-non-org-mode-files (let ((tag (concat "^" (regexp-quote org-footnote-tag-for-non-org-mode-files) "[ \t]*$"))) + (goto-char (point-min)) (while (re-search-forward tag nil t) (replace-match "") (delete-region (point) (progn (forward-line) (point)))))) @@ -742,18 +760,21 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': (lambda (x) (cond ;; When only sorting, ignore inline footnotes. - ((and sort-only (nth 3 x)) nil) + ;; Also clear position marker. + ((and sort-only (nth 3 x)) + (set-marker (nth 4 x) nil) nil) ;; No definition available: provide one. ((not (nth 2 x)) - (append (butlast x 2) - (list (format "DEFINITION NOT FOUND: %s" (car x)) - (nth 3 x)))) + (append + (list (car x) (nth 1 x) + (format "DEFINITION NOT FOUND: %s" (car x))) + (nthcdr 3 x))) (t x))) ref-table))) (setq ref-table (nreverse ref-table)) ;; 4. Remove left-over definitions in the buffer. - (mapc (lambda (x) (unless (nth 3 x) - (org-footnote-delete-definitions (car x)))) + (mapc (lambda (x) + (unless (nth 3 x) (org-footnote-delete-definitions (car x)))) ref-table) ;; 5. Insert the footnotes again in the buffer, at the ;; appropriate spot. @@ -764,7 +785,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': ;; Cases when footnotes should be inserted in one place. ((or (not (eq major-mode 'org-mode)) org-footnote-section - (not sort-only)) + export-props) ;; Insert again the section title, if any. Ensure that title, ;; or the subsequent footnotes, will be separated by a blank ;; lines from the rest of the document. In an Org buffer, @@ -775,11 +796,6 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': (skip-chars-backward " \t\n\r") (delete-region (point) ins-point) (unless (bolp) (newline)) - ;; Keep one blank line between footnotes and signature. - (when (and (derived-mode-p 'message-mode) - (save-excursion - (re-search-forward message-signature-separator nil t))) - (open-line 1)) (when org-footnote-tag-for-non-org-mode-files (insert "\n" org-footnote-tag-for-non-org-mode-files "\n"))) ((and org-footnote-section (not export-props)) @@ -789,31 +805,31 @@ Additional note on `org-footnote-insert-pos-for-preprocessor': (insert "* " org-footnote-section "\n"))) (set-marker ins-point nil) ;; Insert the footnotes, separated by a blank line. - (insert (mapconcat (lambda (x) (format "\n[%s] %s" - (nth (if sort-only 0 1) x) (nth 2 x))) - ref-table "\n")) - (unless (eobp) (insert "\n")) + (insert + (mapconcat + (lambda (x) + ;; Clean markers. + (set-marker (nth 4 x) nil) + (format "\n[%s] %s" (nth (if sort-only 0 1) x) (nth 2 x))) + ref-table "\n")) + (unless (eobp) (insert "\n\n")) ;; When exporting, add newly inserted markers along with their ;; associated definition to `org-export-footnotes-seen'. - (when export-props - (setq org-export-footnotes-seen ref-table))) - ;; Else, insert each definition at the end of the section - ;; containing their first reference. Happens only in Org files - ;; with no special footnote section, and only when doing - ;; sorting. - (t (mapc 'org-insert-footnote-reference-near-definition - ref-table)))))) - -(defun org-insert-footnote-reference-near-definition (entry) - "Find first reference of footnote ENTRY and insert the definition there. -ENTRY is (fn-label num-mark definition)." - (when (car entry) - (goto-char (point-min)) - (let ((ref (org-footnote-get-next-reference (car entry)))) - (when ref - (goto-char (nth 2 ref)) - (org-footnote-goto-local-insertion-point) - (insert (format "\n[%s] %s\n" (car entry) (nth 2 entry))))))) + (when export-props (setq org-export-footnotes-seen ref-table))) + ;; Each footnote definition has to be inserted at the end of + ;; the section where its first reference belongs. + (t + (mapc + (lambda (x) + (let ((pos (nth 4 x))) + (goto-char pos) + ;; Clean marker. + (set-marker pos nil)) + (org-footnote-goto-local-insertion-point) + (insert (format "\n[%s] %s\n" + (if sort-only (car x) (nth 1 x)) + (nth 2 x)))) + ref-table)))))) (defun org-footnote-goto-local-insertion-point () "Find insertion point for footnote, just before next outline heading." @@ -848,8 +864,9 @@ Return the number of footnotes removed." (ndef 0)) (while (re-search-forward def-re nil t) (let ((full-def (org-footnote-at-definition-p))) - (delete-region (nth 1 full-def) (nth 2 full-def))) - (incf ndef)) + (when full-def + (delete-region (nth 1 full-def) (nth 2 full-def)) + (incf ndef)))) ndef))) (defun org-footnote-delete (&optional label) diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 67f87797cb..d019f3aeae 100644 --- a/lisp/org/org-habit.el +++ b/lisp/org/org-habit.el @@ -334,7 +334,14 @@ current time." (let ((inhibit-read-only t) l c (buffer-invisibility-spec '(org-link)) (moment (time-subtract (current-time) - (list 0 (* 3600 org-extend-today-until) 0)))) + (list 0 (* 3600 org-extend-today-until) 0))) + disabled-overlays) + ;; Disable filters; this helps with alignment if there are links. + (mapc (lambda (ol) + (when (overlay-get ol 'invisible) + (overlay-put ol 'invisible nil) + (setq disabled-overlays (cons ol disabled-overlays)))) + (overlays-in (point-min) (point-max))) (save-excursion (goto-char (if line (point-at-bol) (point-min))) (while (not (eobp)) @@ -344,14 +351,15 @@ current time." (delete-char (min (+ 1 org-habit-preceding-days org-habit-following-days) (- (line-end-position) (point)))) - (insert (org-habit-build-graph - habit - (time-subtract moment - (days-to-time org-habit-preceding-days)) - moment - (time-add moment - (days-to-time org-habit-following-days)))))) - (forward-line))))) + (insert-before-markers + (org-habit-build-graph + habit + (time-subtract moment (days-to-time org-habit-preceding-days)) + moment + (time-add moment (days-to-time org-habit-following-days)))))) + (forward-line))) + (mapc (lambda (ol) (overlay-put ol 'invisible t)) + disabled-overlays))) (defun org-habit-toggle-habits () "Toggle display of habits in an agenda buffer." diff --git a/lisp/org/org-html.el b/lisp/org/org-html.el index 82fdd507b0..69d88fe7e7 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." ;; insert html preamble (when (plist-get opt-plist :html-preamble) (let ((html-pre (plist-get opt-plist :html-preamble)) - html-pre-real-contents) + (html-pre-real-contents "")) (cond ((stringp html-pre) (setq html-pre-real-contents (format-spec html-pre `((?t . ,title) (?a . ,author) @@ -1422,7 +1422,7 @@ PUB-DIR is set, use this as the publishing directory." (if (string-match (org-re "[ \t]+:\\([[:alnum:]_@:]+\\):[ \t]*$") txt) (setq txt (replace-match - " <span class=\"tag\"> \\1</span>" t nil txt))) + " <span class=\"tag\">\\1</span>" t nil txt))) (if (string-match quote-re0 txt) (setq txt (replace-match "" t t txt))) (setq snumber (org-section-number level)) @@ -1630,7 +1630,7 @@ PUB-DIR is set, use this as the publishing directory." "done" "todo") " " (org-export-html-get-todo-kwd-class-name (match-string 2 line)) - "\"> " (match-string 2 line) + "\">" (match-string 2 line) "</span>" (substring line (match-end 2))))) ;; Does this contain a reference to a footnote? diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index ae0c91eaed..99a75841de 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'." (if (or org-indent-modified-headline-flag (save-excursion (goto-char beg) + (beginning-of-line) (re-search-forward org-outline-regexp-bol end t))) (let ((end (save-excursion (goto-char end) diff --git a/lisp/org/org-latex.el b/lisp/org/org-latex.el index ba7f8fd625..4418dee73e 100644 --- a/lisp/org/org-latex.el +++ b/lisp/org/org-latex.el @@ -218,6 +218,7 @@ For example, adding an entry will cause \\usepackage[utf8x]{inputenc} to be used for buffers that are written as utf8 files." :group 'org-export-latex + :version "24.1" :type '(repeat (cons (string :tag "Derived from buffer") @@ -283,6 +284,7 @@ markup defined, the first one in the association list will be used." (defcustom org-export-latex-tag-markup "\\textbf{%s}" "Markup for tags, as a printf format." :group 'org-export-latex + :version "24.1" :type 'string) (defcustom org-export-latex-timestamp-markup "\\textit{%s}" @@ -293,6 +295,7 @@ markup defined, the first one in the association list will be used." (defcustom org-export-latex-timestamp-inactive-markup "\\textit{%s}" "A printf format string to be applied to inactive time stamps." :group 'org-export-latex + :version "24.1" :type 'string) (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 the link, the second with the link description. If it contains only one, the %s will be filled with the link." :group 'org-export-latex + :version "24.1" :type 'string) (defcustom org-export-latex-hyperref-format "\\hyperref[%s]{%s}" @@ -314,11 +318,13 @@ only one, the %s will be filled with the link." The format must contain one or two %s instances. The first one will be filled with the link, the second with its description." :group 'org-export-latex + :version "24.1" :type 'string) (defcustom org-export-latex-footnote-separator "\\textsuperscript{,}\\," "Text used to separate footnotes." :group 'org-export-latex + :version "24.1" :type 'string) (defcustom org-export-latex-quotes @@ -336,6 +342,7 @@ For each item in a CONS, the first string is a regexp for allowed characters before/after the quote, the second string defines the replacement string for this quote." :group 'org-export-latex + :version "24.1" :type '(list (cons :tag "Opening quote" (string :tag "Regexp for char before") @@ -361,6 +368,7 @@ string defines the replacement string for this quote." "When non-nil, the caption is set above the table. When nil, the caption is set below the table." :group 'org-export-latex + :version "24.1" :type 'boolean) (defcustom org-export-latex-tables-column-borders nil @@ -478,6 +486,7 @@ Code blocks exported with the listings package (controlled by the `org-export-latex-listings' variable) can be named in the style of noweb." :group 'org-export-latex + :version "24.1" :type 'boolean) (defcustom org-export-latex-minted-langs @@ -499,6 +508,7 @@ with: pygmentize -L lexers " :group 'org-export-latex + :version "24.1" :type '(repeat (list (symbol :tag "Major mode ") @@ -522,6 +532,7 @@ black keywords. Note that the same options will be applied to blocks of all languages." :group 'org-export-latex + :version "24.1" :type '(repeat (list (string :tag "Listings option name ") @@ -545,6 +556,7 @@ will result in src blocks being exported with as the start of the minted environment. Note that the same options will be applied to blocks of all languages." :group 'org-export-latex + :version "24.1" :type '(repeat (list (string :tag "Minted option name ") @@ -586,11 +598,13 @@ and `org-export-with-tags' instead." (defcustom org-latex-default-figure-position "htb" "Default position for latex figures." :group 'org-export-latex + :version "24.1" :type 'string) (defcustom org-export-latex-tabular-environment "tabular" "Default environment used to build tables." :group 'org-export-latex + :version "24.1" :type 'string) (defcustom org-export-latex-inline-image-extensions @@ -657,6 +671,18 @@ This function should accept the file name as its single argument." "bibtex %b" "pdflatex -interaction nonstopmode -output-directory %o %f" "pdflatex -interaction nonstopmode -output-directory %o %f")) + (const :tag "2 runs of xelatex" + ("xelatex -interaction nonstopmode -output-directory %o %f" + "xelatex -interaction nonstopmode -output-directory %o %f")) + (const :tag "3 runs of xelatex" + ("xelatex -interaction nonstopmode -output-directory %o %f" + "xelatex -interaction nonstopmode -output-directory %o %f" + "xelatex -interaction nonstopmode -output-directory %o %f")) + (const :tag "xelatex,bibtex,xelatex,xelatex" + ("xelatex -interaction nonstopmode -output-directory %o %f" + "bibtex %b" + "xelatex -interaction nonstopmode -output-directory %o %f" + "xelatex -interaction nonstopmode -output-directory %o %f")) (const :tag "texi2dvi" ("texi2dvi -p -b -c -V %f")) (const :tag "rubber" @@ -667,6 +693,7 @@ This function should accept the file name as its single argument." '("aux" "idx" "log" "out" "toc" "nav" "snm" "vrb") "The list of file extensions to consider as LaTeX logfiles." :group 'org-export-pdf + :version "24.1" :type '(repeat (string :tag "Extension"))) (defcustom org-export-pdf-remove-logfiles t @@ -855,7 +882,7 @@ when PUB-DIR is set, use this as the publishing directory." (concat (file-name-as-directory (or pub-dir - (org-export-directory :LaTeX ext-plist))) + (org-export-directory :LaTeX org-export-latex-options-plist))) (file-name-sans-extension (or (and subtree-p (org-entry-get rbeg "EXPORT_FILE_NAME" t)) @@ -870,7 +897,7 @@ when PUB-DIR is set, use this as the publishing directory." (concat filename ".tex") filename))) (auto-insert nil); Avoid any auto-insert stuff for the new file - (TeX-master t) ; Avoid the Query for TeX master from AUCTeX + (TeX-master (boundp 'TeX-master)) (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create @@ -1224,7 +1251,7 @@ numbered sections and lower levels as unnumbered sections." org-export-target-aliases)))) (sectioning org-export-latex-sectioning) (depth org-export-latex-sectioning-depth) - main-heading sub-heading) + main-heading sub-heading ctnt) (when (symbolp (car sectioning)) (setq sectioning (funcall (car sectioning) level heading)) (when sectioning @@ -1291,16 +1318,20 @@ numbered sections and lower levels as unnumbered sections." (delete-region (point-at-bol 0) (point)) (insert (format "\\begin{%s}\n" (symbol-name org-export-latex-low-levels)))) - (insert (format "\n\\item %s\\\\\n%s%%" - heading - (if label (format "\\label{%s}" label) ""))) - (insert (org-export-latex-content content)) + (let ((ctnt (org-export-latex-content content))) + (insert (format (if (not (equal (replace-regexp-in-string "\n" "" ctnt) "")) + "\n\\item %s\\\\\n%s%%" + "\n\\item %s\n%s%%") + heading + (if label (format "\\label{%s}" label) ""))) + (insert ctnt)) (cond ((stringp subcontent) (insert subcontent)) ((listp subcontent) (org-export-latex-sub subcontent))) (insert (format "\\end{%s} %% ends low level\n" (symbol-name org-export-latex-low-levels)))) - ((listp org-export-latex-low-levels) + ((and (listp org-export-latex-low-levels) + org-export-latex-low-levels) (if (string-match "% ends low level$" (buffer-substring (point-at-bol 0) (point))) (delete-region (point-at-bol 0) (point)) @@ -1902,10 +1933,14 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." 'org-label raw-table) longtblp (and attr (stringp attr) (string-match "\\<longtable\\>" attr)) - tblenv (if (and attr (stringp attr) - (or (string-match (regexp-quote "table*") attr) - (string-match "\\<multicolumn\\>" attr))) - "table*" "table") + tblenv (if (and attr (stringp attr)) + (cond ((string-match "\\<sidewaystable\\>" attr) + "sidewaystable") + ((or (string-match (regexp-quote "table*") attr) + (string-match "\\<multicolumn\\>" attr)) + "table*") + (t "table")) + "table") tabular-env (if (and attr (stringp attr) (string-match "\\(tabular.\\)" attr)) @@ -1988,7 +2023,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (if shortn (concat "[" shortn "]") "") (or caption "") (if label (format "\\label{%s}" label) ""))) - (if (and longtblp caption) "\\\\\n" "\n") + (if (and longtblp caption org-export-latex-table-caption-above) + "\\\\\n" "\n") (if (and org-export-latex-tables-centered (not longtblp)) "\\begin{center}\n") (if (not longtblp) @@ -2572,9 +2608,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "Convert plain text lists in current buffer into LaTeX lists." ;; `org-list-end-re' output has changed since preprocess from ;; org-exp.el. Make sure it is taken into account. - (let ((org-list-ending-method - (if (eq org-list-ending-method 'regexp) 'regexp 'both)) - (org-list-end-re "^ORG-LIST-END-MARKER\n")) + (let ((org-list-end-re "^ORG-LIST-END-MARKER\n")) (mapc (lambda (e) ;; 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 da8a810895..2caecff275 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." :group 'org-plain-lists :type '(choice (const :tag "dot like in \"2.\"" ?.) (const :tag "paren like in \"2)\"" ?\)) - (const :tab "both" t))) + (const :tag "both" t))) (defcustom org-alphabetical-lists nil "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." (const :tag "never" nil) (regexp))) -(defcustom org-list-ending-method 'both - "Determine where plain lists should end. -Valid values are: `regexp', `indent' or `both'. - -When set to `regexp', Org will look into two variables, -`org-empty-line-terminates-plain-lists' and the more general -`org-list-end-regexp', to determine what will end lists. - -When set to `indent', a list will end whenever a line following -an item, but not starting one, is less or equally indented than -the first item of the list. - -When set to `both', each of the preceding methods is applied to -determine lists endings. This is the default method." - :group 'org-plain-lists - :type '(choice - (const :tag "With a regexp defining ending" regexp) - (const :tag "With indentation of regular (no bullet) text" indent) - (const :tag "With both methods" both))) - (defcustom org-empty-line-terminates-plain-lists nil "Non-nil means an empty line ends all plain list levels. -This variable only makes sense if `org-list-ending-method' is set -to `regexp' or `both'. This is then equivalent to set -`org-list-end-regexp' to \"^[ \\t]*$\"." +Otherwise, two of them will be necessary." :group 'org-plain-lists :type 'boolean) -(defcustom org-list-end-regexp "^[ \t]*\n[ \t]*\n" - "Regexp matching the end of all plain list levels. -It must start with \"^\" and end with \"\\n\". It defaults to 2 -blank lines. `org-empty-line-terminates-plain-lists' has -precedence over it." - :group 'org-plain-lists - :type 'string) - (defcustom org-list-automatic-rules '((bullet . t) (checkbox . t) (indent . t)) @@ -381,9 +351,8 @@ specifically, type `block' is determined by the variable ;;; Predicates and regexps -(defconst org-list-end-re (if org-empty-line-terminates-plain-lists - "^[ \t]*\n" - org-list-end-regexp) +(defconst org-list-end-re (if org-empty-line-terminates-plain-lists "^[ \t]*\n" + "^[ \t]*\n[ \t]*\n") "Regex corresponding to the end of a list. It depends on `org-empty-line-terminates-plain-lists'.") @@ -432,8 +401,7 @@ group 4: description tag") (not (org-in-block-p org-list-forbidden-blocks))) (defun org-in-item-p () - "Return item beginning position when in a plain list, nil otherwise. -This checks `org-list-ending-method'." + "Return item beginning position when in a plain list, nil otherwise." (save-excursion (beginning-of-line) (let* ((case-fold-search t) @@ -460,8 +428,7 @@ This checks `org-list-ending-method'." ;; to compute its boundaries END-BOUNDS. When point is ;; in-between, move cursor before regexp beginning. (let ((hl 0) (i -1) end-bounds) - (when (and (not (eq org-list-ending-method 'indent)) - (progn + (when (and (progn (while (setq i (string-match "[\r\n]" org-list-end-re (1+ i))) (setq hl (1+ hl))) @@ -470,23 +437,18 @@ This checks `org-list-ending-method'." (< (point) (cdr end-bounds))) (goto-char (car end-bounds)) (forward-line -1))) - ;; Look for an item, less indented that reference line if - ;; `org-list-ending-method' isn't `regexp'. + ;; Look for an item, less indented that reference line. (catch 'exit (while t (let ((ind (org-get-indentation))) (cond ;; This is exactly what we want. - ((and (looking-at item-re) - (or (< ind ind-ref) - (eq org-list-ending-method 'regexp))) + ((and (looking-at item-re) (< ind ind-ref)) (throw 'exit (point))) ;; At upper bound of search or looking at the end of a ;; previous list: search is over. ((<= (point) lim-up) (throw 'exit nil)) - ((and (not (eq org-list-ending-method 'indent)) - (looking-at org-list-end-re)) - (throw 'exit nil)) + ((looking-at org-list-end-re) (throw 'exit nil)) ;; Skip blocks, drawers, inline-tasks, blank lines ((and (looking-at "^[ \t]*#\\+end_") (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) @@ -703,8 +665,7 @@ Assume point is at an item." (forward-line -1)) ;; Looking at a list ending regexp. Dismiss useless ;; data recorded above BEG-CELL. Jump to part 2. - ((and (not (eq org-list-ending-method 'indent)) - (looking-at org-list-end-re)) + ((looking-at org-list-end-re) (throw 'exit (setq itm-lst (memq (assq (car beg-cell) itm-lst) itm-lst)))) @@ -716,10 +677,7 @@ Assume point is at an item." ((looking-at item-re) (push (funcall assoc-at-point ind) itm-lst) (push (cons ind (point)) end-lst) - (when (or (and (eq org-list-ending-method 'regexp) - (<= ind (cdr beg-cell))) - (< ind text-min-ind)) - (setq beg-cell (cons (point) ind))) + (when (< ind text-min-ind) (setq beg-cell (cons (point) ind))) (forward-line -1)) ;; Skip blocks, drawers, inline tasks, blank lines. ((and (looking-at "^[ \t]*#\\+end_") @@ -732,14 +690,13 @@ Assume point is at an item." (forward-line -1)) ((looking-at "^[ \t]*$") (forward-line -1)) - ;; From there, point is not at an item. Unless ending - ;; method is `regexp', interpret line's indentation: + ;; From there, point is not at an item. Interpret + ;; line's indentation: ;; - text at column 0 is necessarily out of any list. ;; Dismiss data recorded above BEG-CELL. Jump to ;; part 2. ;; - any other case may be an ending position for an ;; hypothetical item above. Store it and proceed. - ((eq org-list-ending-method 'regexp) (forward-line -1)) ((zerop ind) (throw 'exit (setq itm-lst @@ -771,8 +728,7 @@ Assume point is at an item." (next-single-property-change (point) 'org-example nil lim-down))) ;; Looking at a list ending regexp. Save point as an ;; ending position and jump to part 3. - ((and (not (eq org-list-ending-method 'indent)) - (looking-at org-list-end-re)) + ((looking-at org-list-end-re) (throw 'exit (push (cons 0 (point)) end-lst-2))) ((looking-at item-re) ;; Point is at an item. Add data to ITM-LST-2. It may @@ -788,16 +744,14 @@ Assume point is at an item." ;; Ind is lesser or equal than BEG-CELL's. The list is ;; over: store point as an ending position and jump to ;; part 3. - ((and (not (eq org-list-ending-method 'regexp)) - (<= ind (cdr beg-cell))) + ((<= ind (cdr beg-cell)) (throw 'exit (push (cons 0 (funcall end-before-blank)) end-lst-2))) ;; Else, if ind is lesser or equal than previous item's, ;; this is an ending position: store it. In any case, ;; skip block or drawer at point, and move to next line. (t - (when (and (not (eq org-list-ending-method 'regexp)) - (<= ind (nth 1 (car itm-lst-2)))) + (when (<= ind (nth 1 (car itm-lst-2))) (push (cons ind (point)) end-lst-2)) (cond ((and (looking-at "^[ \t]*#\\+begin_") @@ -1192,9 +1146,7 @@ some heuristics to guess the result." (point)))))))) (cond ;; Trivial cases where there should be none. - ((or (and (not (eq org-list-ending-method 'indent)) - org-empty-line-terminates-plain-lists) - (not insert-blank-p)) 0) + ((or org-empty-line-terminates-plain-lists (not insert-blank-p)) 0) ;; When `org-blank-before-new-entry' says so, it is 1. ((eq insert-blank-p t) 1) ;; `plain-list-item' is 'auto. Count blank lines separating @@ -2929,9 +2881,7 @@ Point is left at list end." (goto-char top) (when delete (delete-region top bottom) - (when (and (not (eq org-list-ending-method 'indent)) - (not (looking-at "[ \t]*$")) - (looking-at org-list-end-re)) + (when (and (not (looking-at "[ \t]*$")) (looking-at org-list-end-re)) (replace-match ""))) out)) diff --git a/lisp/org/org-lparse.el b/lisp/org/org-lparse.el index 229135e9b5..c9669dd8ab 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." (error "Cannot convert from %s format to %s format?" in-fmt out-fmt))) (convert-process (car how)) - (program (car convert-process)) - (dummy (and (or program (error "Converter not configured")) - (or (executable-find program) - (error "Cannot find converter %s" program)))) (out-file (concat (file-name-sans-extension in-file) "." (nth 1 (or (cdr how) out-fmt)))) + (extra-options (or (nth 2 (cdr how)) "")) (out-dir (file-name-directory in-file)) - (arglist (mapcar (lambda (arg) - (format-spec - arg `((?i . ,in-file) - (?I . ,(browse-url-file-url in-file)) - (?f . ,out-fmt) - (?o . ,out-file) - (?O . ,(browse-url-file-url out-file)) - (?d . ,out-dir) - (?D . ,(browse-url-file-url out-dir))))) - (cdr convert-process)))) + (cmd (format-spec convert-process + `((?i . ,(shell-quote-argument in-file)) + (?I . ,(browse-url-file-url in-file)) + (?f . ,out-fmt) + (?o . ,out-file) + (?O . ,(browse-url-file-url out-file)) + (?d . , (shell-quote-argument out-dir)) + (?D . ,(browse-url-file-url out-dir)) + (?x . ,extra-options))))) (when (file-exists-p out-file) (delete-file out-file)) - (message "Executing %s %s" program (mapconcat 'identity arglist " ")) - (apply 'call-process program nil nil nil arglist) + (message "Executing %s" cmd) + (let ((cmd-output (shell-command-to-string cmd))) + (message "%s" cmd-output)) + (cond ((file-exists-p out-file) - (message "Exported to %s using %s" out-file program) + (message "Exported to %s" out-file) (when prefix-arg (message "Opening %s..." out-file) (org-open-file out-file)) - out-file - ;; (set-buffer (find-file-noselect out-file)) - ) + out-file) (t (message "Export to %s failed" out-file) nil)))) @@ -598,11 +594,7 @@ version." (org-lparse-par-open-stashed 0) ;; list related vars - (org-lparse-list-level 0) ; list level starts at 1. A - ; value of 0 implies we are - ; outside of any list - (org-lparse-list-item-count 0) - org-lparse-list-stack + (org-lparse-list-stack '()) ;; list-table related vars org-lparse-list-table-p @@ -817,6 +809,8 @@ version." (setq umax-toc (if (integerp org-export-with-toc) (min org-export-with-toc umax) umax)) + (setq org-lparse-opt-plist + (plist-put org-lparse-opt-plist :headline-levels umax)) (when (and org-export-with-toc (not body-only)) (setq lines (org-lparse-prepare-toc @@ -853,48 +847,6 @@ version." (org-lparse-end-environment 'fixedwidth)) (throw 'nextline nil)) - ;; Notes: The baseline version of org-html.el (git commit - ;; 3d802e), while encountering a *line-long* protected text, - ;; does one of the following two things based on the state - ;; of the export buffer. - - ;; 1. If a paragraph element has just been opened and - ;; contains only whitespace as content, insert the - ;; protected text as part of the previous paragraph. - - ;; 2. If the paragraph element has already been opened and - ;; contains some valid content insert the protected text - ;; as part of the current paragraph. - - ;; I think ---> - - ;; Scenario 1 mentioned above kicks in when a block of - ;; protected text has to be inserted en bloc. For example, - ;; this happens, when inserting an source or example block - ;; or preformatted content enclosed in #+backend, - ;; #+begin_backend ... #+end_backend) - - ;; Scenario 2 mentioned above kicks in when the protected - ;; text is part of a running sentence. For example this - ;; happens in the case of an *multiline* LaTeX equation that - ;; needs to be inserted verbatim. - - ;; org-html.el in the master branch seems to do some - ;; jugglery by moving paragraphs around. Inorder to make - ;; these changes backend-agnostic introduce a new text - ;; property org-native-text and impose the added semantics - ;; that these protected blocks appear outside of a - ;; conventional paragraph element. - ;; - ;; Extra Note: Check whether org-example and org-native-text - ;; are entirely equivalent. - - ;; Fixes bug reported by Christian Moe concerning verbatim - ;; LaTeX fragments. - ;; on git commit 533ba3f90250a1f25f494c390d639ea6274f235c - ;; http://repo.or.cz/w/org-mode/org-jambu.git/shortlog/refs/heads/staging - ;; See http://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01379.html - ;; Native Text (when (and (get-text-property 0 'org-native-text line) ;; Make sure it is the entire line that is protected @@ -1081,10 +1033,11 @@ version." table-buffer (nreverse table-buffer) table-orig-buffer (nreverse table-orig-buffer)) (org-lparse-end-paragraph) + (when org-lparse-list-table-p + (error "Regular tables are not allowed in a list-table block")) (org-lparse-insert 'TABLE table-buffer table-orig-buffer))) ;; Normal lines - (t ;; This line either is list item or end a list. (when (get-text-property 0 'list-item line) @@ -1820,6 +1773,12 @@ Stripping happens only when the exported backend is not one of (org-lparse-end 'FOOTNOTE-DEFINITION n) (setq org-lparse-insert-tag-with-newlines 'both) (let ((footnote-def (org-lparse-end-collect))) + ;; Cleanup newlines in footnote definition. This ensures that a + ;; transcoded line is never (wrongly) broken in to multiple lines. + (let ((pos 0)) + (while (string-match "[\r\n]+" footnote-def pos) + (setq pos (1+ (match-beginning 0))) + (setq footnote-def (replace-match " " t t footnote-def)))) (push (cons n footnote-def) org-lparse-footnote-definitions))) (defvar org-lparse-collect-buffer nil @@ -2104,8 +2063,6 @@ When TITLE is nil, just close all open levels." ("d" . description))))) ;; following vars are bound during `org-do-lparse' -(defvar org-lparse-list-level) -(defvar org-lparse-list-item-count) (defvar org-lparse-list-stack) (defvar org-lparse-list-table:table-row) (defvar org-lparse-list-table:lines) @@ -2147,73 +2104,69 @@ When TITLE is nil, just close all open levels." ;; https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg01101.html (defun org-lparse-begin-list (ltype) - (incf org-lparse-list-level) - (push org-lparse-list-item-count org-lparse-list-stack) - (setq org-lparse-list-item-count 0) - (cond - ((not org-lparse-list-table-p) - (org-lparse-begin 'LIST ltype)) - ;; process LIST-TABLE - ((= 1 org-lparse-list-level) - ;; begin LIST-TABLE - (setq org-lparse-list-table:lines nil) - (setq org-lparse-list-table:table-row nil)) - ((= 2 org-lparse-list-level) - (ignore)) - (t - (org-lparse-begin 'LIST ltype)))) + (push ltype org-lparse-list-stack) + (let ((list-level (length org-lparse-list-stack))) + (cond + ((not org-lparse-list-table-p) + (org-lparse-begin 'LIST ltype)) + ;; process LIST-TABLE + ((= 1 list-level) + ;; begin LIST-TABLE + (setq org-lparse-list-table:lines nil) + (setq org-lparse-list-table:table-row nil)) + ((= 2 list-level) + (ignore)) + (t + (org-lparse-begin 'LIST ltype))))) (defun org-lparse-end-list (ltype) - (setq org-lparse-list-item-count (pop org-lparse-list-stack)) - (decf org-lparse-list-level) - (cond - ((not org-lparse-list-table-p) - (org-lparse-end 'LIST ltype)) - ;; process LIST-TABLE - ((= 0 org-lparse-list-level) - ;; end LIST-TABLE - (insert (org-lparse-format-list-table - (nreverse org-lparse-list-table:lines)))) - ((= 1 org-lparse-list-level) - (ignore)) - (t - (org-lparse-end 'LIST ltype)))) + (pop org-lparse-list-stack) + (let ((list-level (length org-lparse-list-stack))) + (cond + ((not org-lparse-list-table-p) + (org-lparse-end 'LIST ltype)) + ;; process LIST-TABLE + ((= 0 list-level) + ;; end LIST-TABLE + (insert (org-lparse-format-list-table + (nreverse org-lparse-list-table:lines)))) + ((= 1 list-level) + (ignore)) + (t + (org-lparse-end 'LIST ltype))))) (defun org-lparse-begin-list-item (ltype &optional arg headline) - (incf org-lparse-list-item-count) - (cond - ((not org-lparse-list-table-p) - (org-lparse-begin 'LIST-ITEM ltype arg headline)) - ;; process LIST-TABLE - ((and (= 1 org-lparse-list-level) - (= 1 org-lparse-list-item-count)) - ;; begin TABLE-ROW for LIST-TABLE - (setq org-lparse-list-table:table-row nil) - (org-lparse-begin-list-table:table-cell)) - ((and (= 2 org-lparse-list-level) - (= 1 org-lparse-list-item-count)) - ;; begin TABLE-CELL for LIST-TABLE - (org-lparse-begin-list-table:table-cell)) - (t - (org-lparse-begin 'LIST-ITEM ltype arg headline)))) + (let ((list-level (length org-lparse-list-stack))) + (cond + ((not org-lparse-list-table-p) + (org-lparse-begin 'LIST-ITEM ltype arg headline)) + ;; process LIST-TABLE + ((= 1 list-level) + ;; begin TABLE-ROW for LIST-TABLE + (setq org-lparse-list-table:table-row nil) + (org-lparse-begin-list-table:table-cell)) + ((= 2 list-level) + ;; begin TABLE-CELL for LIST-TABLE + (org-lparse-begin-list-table:table-cell)) + (t + (org-lparse-begin 'LIST-ITEM ltype arg headline))))) (defun org-lparse-end-list-item (ltype) - (decf org-lparse-list-item-count) - (cond - ((not org-lparse-list-table-p) - (org-lparse-end 'LIST-ITEM ltype)) - ;; process LIST-TABLE - ((and (= 1 org-lparse-list-level) - (= 0 org-lparse-list-item-count)) - ;; end TABLE-ROW for LIST-TABLE - (org-lparse-end-list-table:table-cell) - (push (nreverse org-lparse-list-table:table-row) - org-lparse-list-table:lines)) - ((= 2 org-lparse-list-level) - ;; end TABLE-CELL for LIST-TABLE - (org-lparse-end-list-table:table-cell)) - (t - (org-lparse-end 'LIST-ITEM ltype)))) + (let ((list-level (length org-lparse-list-stack))) + (cond + ((not org-lparse-list-table-p) + (org-lparse-end 'LIST-ITEM ltype)) + ;; process LIST-TABLE + ((= 1 list-level) + ;; end TABLE-ROW for LIST-TABLE + (org-lparse-end-list-table:table-cell) + (push (nreverse org-lparse-list-table:table-row) + org-lparse-list-table:lines)) + ((= 2 list-level) + ;; end TABLE-CELL for LIST-TABLE + (org-lparse-end-list-table:table-cell)) + (t + (org-lparse-end 'LIST-ITEM ltype))))) (defvar org-lparse-list-table:table-cell-open) (defun org-lparse-begin-list-table:table-cell () diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index b1d9f22a4e..5a87bd6469 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." (replace-match "") (just-one-space)) -(defvar rest) +(defvar org-mouse-rest) (defun org-mouse-replace-match-and-surround (newtext &optional fixedcase literal string subexp) "The same as `replace-match', but surrounds the replacement with spaces." - (apply 'replace-match rest) + (apply 'replace-match org-mouse-rest) (save-excursion (goto-char (match-beginning (or subexp 0))) (just-one-space) @@ -990,7 +990,7 @@ This means, between the beginning of line and the point." (replace-match replace-text)) (forward-line)))) -(defvar _cmd) ;dynamically scoped from `org-with-remote-undo'. +(defvar org-mouse-cmd) ;dynamically scoped from `org-with-remote-undo'. (defun org-mouse-do-remotely (command) ; (org-agenda-check-no-diary) @@ -1021,7 +1021,7 @@ This means, between the beginning of line and the point." (setq marker (copy-marker (point))) (goto-char (max (point-at-bol) (- (point-at-eol) anticol))) (funcall command) - (message "_cmd: %S" _cmd) + (message "_cmd: %S" org-mouse-cmd) (message "this-command: %S" this-command) (unless (eq (marker-position marker) (marker-position endmarker)) (setq newhead (org-get-heading)))) diff --git a/lisp/org/org-odt.el b/lisp/org/org-odt.el index c8fa7ea363..234272a378 100644 --- a/lisp/org/org-odt.el +++ b/lisp/org/org-odt.el @@ -1,4 +1,4 @@ -;;; org-odt.el --- OpenDocumentText export for Org-mode +;;; org-odt.el --- OpenDocument Text exporter for Org-mode ;; Copyright (C) 2010-2012 Free Software Foundation, Inc. @@ -31,9 +31,23 @@ (defgroup org-export-odt nil "Options specific for ODT export of Org-mode files." :tag "Org Export ODT" - :group 'org-export) + :group 'org-export + :version "24.1") + +(defvar org-lparse-dyn-first-heading-pos) ; let bound during org-do-lparse +(defun org-odt-insert-toc () + (goto-char (point-min)) + (cond + ((re-search-forward + "\\(<text:p [^>]*>\\)?\\s-*\\[TABLE-OF-CONTENTS\\]\\s-*\\(</text:p>\\)?" + nil t) + (replace-match "")) + (t + (goto-char org-lparse-dyn-first-heading-pos))) + (insert (org-odt-format-toc))) (defun org-odt-end-export () + (org-odt-insert-toc) (org-odt-fixup-label-references) ;; remove empty paragraphs @@ -139,6 +153,7 @@ with GNU ELPA tar or standard Emacs distribution." (const :tag "Not set" nil) (directory :tag "Schema directory")) :group 'org-export-odt + :version "24.1" :set (lambda (var value) "Set `org-export-odt-schema-dir'. @@ -258,7 +273,8 @@ The exporter embeds the exported content just before If unspecified, the file named \"OrgOdtContentTemplate.xml\" under `org-odt-styles-dir' is used." :type 'file - :group 'org-export-odt) + :group 'org-export-odt + :version "24.1") (defcustom org-export-odt-styles-file nil "Default styles file for use with ODT export. @@ -292,6 +308,7 @@ a per-file basis. For example, #+ODT_STYLES_FILE: \"/path/to/styles.xml\" or #+ODT_STYLES_FILE: (\"/path/to/file.ott\" (\"styles.xml\" \"image/hdr.png\"))." :group 'org-export-odt + :version "24.1" :type '(choice (const :tag "Factory settings" nil) @@ -313,20 +330,21 @@ a per-file basis. For example, (defvar org-export-odt-embed-images t "Should the images be copied in to the odt file or just linked?") -(defvar org-export-odt-inline-images 'maybe) ; counterpart of - ; `org-export-html-inline-images' - +(defvar org-export-odt-inline-images 'maybe) (defcustom org-export-odt-inline-image-extensions '("png" "jpeg" "jpg" "gif") "Extensions of image files that can be inlined into HTML." :type '(repeat (string :tag "Extension")) - :group 'org-export-odt) + :group 'org-export-odt + :version "24.1") (defcustom org-export-odt-pixels-per-inch display-pixels-per-inch - ;; FIXME add docstring - "" + "Scaling factor for converting images pixels to inches. +Use this for sizing of embedded images. See Info node `(org) +Images in ODT export' for more information." :type 'float - :group 'org-export-odt) + :group 'org-export-odt + :version "24.1") (defcustom org-export-odt-create-custom-styles-for-srcblocks t "Whether custom styles for colorized source blocks be automatically created. @@ -344,6 +362,7 @@ styles.xml already contains needed styles for colorizing to work. This variable is effective only if `org-export-odt-fontify-srcblocks' is turned on." :group 'org-export-odt + :version "24.1" :type 'boolean) (defvar org-export-odt-default-org-styles-alist @@ -396,6 +415,7 @@ resulting document to this format. During customization of this variable, the list of valid values are populated based on `org-export-odt-convert-capabilities'." :group 'org-export-odt + :version "24.1" :type '(choice :convert-widget (lambda (w) (apply 'widget-convert (widget-type w) @@ -425,40 +445,6 @@ emacs --batch --visit=MyFile --funcall org-export-as-odt-batch" (org-lparse-batch "odt")) -;;;###autoload -(defun org-export-as-odt-to-buffer (arg) - "Call `org-lparse-odt` with output to a temporary buffer. -No file is created. The prefix ARG is passed through to `org-lparse-to-buffer'." - (interactive "P") - (org-lparse-to-buffer "odt" arg)) - -;;;###autoload -(defun org-replace-region-by-odt (beg end) - "Assume the current region has org-mode syntax, and convert it to ODT. -This can be used in any buffer. For example, you could write an -itemized list in org-mode syntax in an ODT buffer and then use this -command to convert it." - (interactive "r") - (org-replace-region-by "odt" beg end)) - -;;;###autoload -(defun org-export-region-as-odt (beg end &optional body-only buffer) - "Convert region from BEG to END in org-mode buffer to ODT. -If prefix arg BODY-ONLY is set, omit file header, footer, and table of -contents, and only produce the region of converted text, useful for -cut-and-paste operations. -If BUFFER is a buffer or a string, use/create that buffer as a target -of the converted ODT. If BUFFER is the symbol `string', return the -produced ODT as a string and leave not buffer behind. For example, -a Lisp program could call this function in the following way: - - (setq odt (org-export-region-as-odt beg end t 'string)) - -When called interactively, the output buffer is selected, and shown -in a window. A non-interactive call will only return the buffer." - (interactive "r\nP") - (org-lparse-region "odt" beg end body-only buffer)) - ;;; org-export-as-odt ;;;###autoload (defun org-export-as-odt (arg &optional hidden ext-plist @@ -609,13 +595,12 @@ PUB-DIR is set, use this as the publishing directory." '("<text:date style:data-style-name=\"%s\" text:date-value=\"%s\">" . "</text:date>") date "N75" iso-date)) ;; separator - "<text:p text:style-name=\"OrgSubtitle\"/>")) - ;; toc - (org-odt-format-toc)))) + "<text:p text:style-name=\"OrgSubtitle\"/>"))))) (defun org-odt-begin-document-body (opt-plist) (org-odt-begin-office-body) - (insert (org-odt-format-preamble opt-plist))) + (insert (org-odt-format-preamble opt-plist)) + (setq org-lparse-dyn-first-heading-pos (point))) (defvar org-lparse-body-only) ; let bound during org-do-lparse (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." (defun org-odt-end-outline-text () (ignore)) +(defun org-odt-begin-section (style &optional name) + (let ((default-name (car (org-odt-add-automatic-style "Section")))) + (org-lparse-insert-tag + "<text:section text:style-name=\"%s\" text:name=\"%s\">" + style (or name default-name)))) + +(defun org-odt-end-section () + (org-lparse-insert-tag "</text:section>")) + (defun org-odt-begin-paragraph (&optional style) (org-lparse-insert-tag "<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." (list)) (t (error "Unknown environment %s" style)))) -(defvar org-lparse-list-level) ; dynamically bound in org-do-lparse +(defvar org-lparse-list-stack) ; dynamically bound in org-do-lparse +(defvar org-odt-list-stack-stashed) (defun org-odt-begin-list (ltype) (setq ltype (or (org-lparse-html-list-type-to-canonical-list-type ltype) ltype)) (let* ((style-name (org-odt-get-style-name-for-entity 'list ltype)) - (extra (concat (when (= org-lparse-list-level 1) - " text:continue-numbering=\"false\"") + (extra (concat (if (or org-lparse-list-table-p + (and (= 1 (length org-lparse-list-stack)) + (null org-odt-list-stack-stashed))) + " text:continue-numbering=\"false\"" + " text:continue-numbering=\"true\"") (when style-name (format " text:style-name=\"%s\"" style-name))))) (case ltype @@ -758,11 +756,15 @@ PUB-DIR is set, use this as the publishing directory." (ordered (assert (not headline) t) (let* ((counter arg) (extra "")) - (org-lparse-insert-tag "<text:list-item>") + (org-lparse-insert-tag (if (= (length org-lparse-list-stack) + (length org-odt-list-stack-stashed)) + "<text:list-header>" "<text:list-item>")) (org-lparse-begin-paragraph))) (unordered (let* ((id arg) (extra "")) - (org-lparse-insert-tag "<text:list-item>") + (org-lparse-insert-tag (if (= (length org-lparse-list-stack) + (length org-odt-list-stack-stashed)) + "<text:list-header>" "<text:list-item>")) (org-lparse-begin-paragraph) (insert (if headline (org-odt-format-target headline id) (org-odt-format-bookmark "" id))))) @@ -783,13 +785,30 @@ PUB-DIR is set, use this as the publishing directory." ltype)) (case ltype ((ordered unordered) - (org-lparse-insert-tag "</text:list-item>")) + (org-lparse-insert-tag (if (= (length org-lparse-list-stack) + (length org-odt-list-stack-stashed)) + (prog1 "</text:list-header>" + (setq org-odt-list-stack-stashed nil)) + "</text:list-item>"))) (description (org-lparse-end-list-item-1) (org-lparse-end-list 'description) (org-lparse-end-list-item-1)) (t (error "Unknown list type")))) +(defun org-odt-discontinue-list () + (let ((stashed-stack org-lparse-list-stack)) + (loop for list-type in stashed-stack + do (org-lparse-end-list-item-1 list-type) + (org-lparse-end-list list-type)) + (setq org-odt-list-stack-stashed stashed-stack))) + +(defun org-odt-continue-list () + (setq org-odt-list-stack-stashed (nreverse org-odt-list-stack-stashed)) + (loop for list-type in org-odt-list-stack-stashed + do (org-lparse-begin-list list-type) + (org-lparse-begin-list-item list-type))) + ;; Following variables are let bound when table emission is in ;; progress. See org-lparse.el. (defvar org-lparse-table-begin-marker) @@ -882,6 +901,7 @@ The TABLE-STYLE-NAME \"OrgEquation\" is used internally for formatting of numbered display equations. Do not delete this style from the list." :group 'org-export-odt + :version "24.1" :type '(choice (const :tag "None" nil) (repeat :tag "Table Styles" @@ -897,17 +917,100 @@ style from the list." :key-type symbol :value-type (const :tag "True" t)))))) +(defvar org-odt-table-style-format + " +<style:style style:name=\"%s\" style:family=\"table\"> + <style:table-properties style:rel-width=\"%d%%\" fo:margin-top=\"0cm\" fo:margin-bottom=\"0.20cm\" table:align=\"center\"/> +</style:style> +" + "Template for auto-generated Table styles.") + +(defvar org-odt-automatic-styles '() + "Registry of automatic styles for various OBJECT-TYPEs. +The variable has the following form: +\(\(OBJECT-TYPE-A + \(\(OBJECT-NAME-A.1 OBJECT-PROPS-A.1\) + \(OBJECT-NAME-A.2 OBJECT-PROPS-A.2\) ...\)\) + \(OBJECT-TYPE-B + \(\(OBJECT-NAME-B.1 OBJECT-PROPS-B.1\) + \(OBJECT-NAME-B.2 OBJECT-PROPS-B.2\) ...\)\) + ...\). + +OBJECT-TYPEs could be \"Section\", \"Table\", \"Figure\" etc. +OBJECT-PROPS is (typically) a plist created by passing +\"#+ATTR_ODT: \" option to `org-lparse-get-block-params'. + +Use `org-odt-add-automatic-style' to add update this variable.'") + +(defvar org-odt-object-counters nil + "Running counters for various OBJECT-TYPEs. +Use this to generate automatic names and style-names. See +`org-odt-add-automatic-style'.") + +(defun org-odt-write-automatic-styles () + "Write automatic styles to \"content.xml\"." + (with-current-buffer + (find-file-noselect (expand-file-name "content.xml") t) + ;; position the cursor + (goto-char (point-min)) + (re-search-forward " </office:automatic-styles>" nil t) + (goto-char (match-beginning 0)) + ;; write automatic table styles + (loop for (style-name props) in + (plist-get org-odt-automatic-styles 'Table) do + (when (setq props (or (plist-get props :rel-width) 96)) + (insert (format org-odt-table-style-format style-name props)))))) + +(defun org-odt-add-automatic-style (object-type &optional object-props) + "Create an automatic style of type OBJECT-TYPE with param OBJECT-PROPS. +OBJECT-PROPS is (typically) a plist created by passing +\"#+ATTR_ODT: \" option of the object in question to +`org-lparse-get-block-params'. + +Use `org-odt-object-counters' to generate an automatic +OBJECT-NAME and STYLE-NAME. If OBJECT-PROPS is non-nil, add a +new entry in `org-odt-automatic-styles'. Return (OBJECT-NAME +. STYLE-NAME)." + (assert (stringp object-type)) + (let* ((object (intern object-type)) + (seqvar object) + (seqno (1+ (or (plist-get org-odt-object-counters seqvar) 0))) + (object-name (format "%s%d" object-type seqno)) style-name) + (setq org-odt-object-counters + (plist-put org-odt-object-counters seqvar seqno)) + (when object-props + (setq style-name (format "Org%s" object-name)) + (setq org-odt-automatic-styles + (plist-put org-odt-automatic-styles object + (append (list (list style-name object-props)) + (plist-get org-odt-automatic-styles object))))) + (cons object-name style-name))) + +(defvar org-odt-table-indentedp nil) (defun org-odt-begin-table (caption label attributes) - (setq org-odt-table-style attributes) + (setq org-odt-table-indentedp (not (null org-lparse-list-stack))) + (when org-odt-table-indentedp + ;; Within the Org file, the table is appearing within a list item. + ;; OpenDocument doesn't allow table to appear within list items. + ;; Temporarily terminate the list, emit the table and then + ;; re-continue the list. + (org-odt-discontinue-list) + ;; Put the Table in an indented section. + (let ((level (length org-odt-list-stack-stashed))) + (org-odt-begin-section (format "OrgIndentedSection-Level-%d" level)))) + (setq attributes (org-lparse-get-block-params attributes)) + (setq org-odt-table-style (plist-get attributes :style)) (setq org-odt-table-style-spec (assoc org-odt-table-style org-export-odt-table-styles)) - (when label + (when (or label caption) (insert (org-odt-format-stylized-paragraph 'table (org-odt-format-entity-caption label caption "__Table__")))) - (org-lparse-insert-tag - "<table:table table:name=\"%s\" table:style-name=\"%s\">" - (or label "") (or (nth 1 org-odt-table-style-spec) "OrgTable")) + (let ((name-and-style (org-odt-add-automatic-style "Table" attributes))) + (org-lparse-insert-tag + "<table:table table:name=\"%s\" table:style-name=\"%s\">" + (car name-and-style) (or (nth 1 org-odt-table-style-spec) + (cdr name-and-style) "OrgTable"))) (setq org-lparse-table-begin-marker (point))) (defvar org-lparse-table-colalign-info) @@ -940,14 +1043,17 @@ style from the list." ((equal spec "table-cell:style-name") (replace-match table-cell-style t t)))))) (goto-char (point-max)) - (org-lparse-insert-tag "</table:table>")) + (org-lparse-insert-tag "</table:table>") + (when org-odt-table-indentedp + (org-odt-end-section) + (org-odt-continue-list))) (defun org-odt-begin-table-rowgroup (&optional is-header-row) (when org-lparse-table-rowgrp-open (org-lparse-end 'TABLE-ROWGROUP)) (org-lparse-insert-tag (if is-header-row - "<table:table-header-rows>" - "<table:table-rows>")) + "<table:table-header-rows>" + "<table:table-rows>")) (setq org-lparse-table-rowgrp-open t) (setq org-lparse-table-cur-rowgrp-is-hdr is-header-row)) @@ -1078,6 +1184,16 @@ styles congruent with the ODF-1.2 specification." (org-lparse-end-paragraph)) (defun org-odt-begin-toc (lang-specific-heading max-level) + ;; Strings in `org-export-language-setup' can contain named html + ;; entities. Replace those with utf-8 equivalents. + (let ((i 0) entity rpl) + (while (string-match "&\\([^#].*?\\);" lang-specific-heading i) + (setq entity (match-string 1 lang-specific-heading)) + (if (not (setq rpl (org-entity-get-representation entity 'utf8))) + (setq i (match-end 0)) + (setq i (+ (match-beginning 0) (length rpl))) + (setq lang-specific-heading + (replace-match rpl t t lang-specific-heading))))) (insert (format " <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." (concat snumber ". ")) headline (and tags - (concat - (org-lparse-format 'SPACES 3) - (org-lparse-format 'FONTIFY tags "tag"))))) + (concat + (org-lparse-format 'SPACES 3) + (org-lparse-format 'FONTIFY tags "tag"))))) (when todo (setq headline (org-lparse-format 'FONTIFY headline "todo"))) @@ -1137,10 +1253,13 @@ styles congruent with the ODF-1.2 specification." (defun org-odt-format-link (desc href &optional attr) (cond ((and (= (string-to-char href) ?#) (not org-odt-suppress-xref)) - (setq href (concat org-export-odt-bookmark-prefix (substring href 1))) + (setq href (substring href 1)) (let ((xref-format "text")) (when (numberp desc) (setq desc (format "%d" desc) xref-format "number")) + (when (listp desc) + (setq desc (mapconcat 'identity desc ".") xref-format "chapter")) + (setq href (concat org-export-odt-bookmark-prefix href)) (org-odt-format-tags '("<text:bookmark-ref text:reference-format=\"%s\" text:ref-name=\"%s\">" . "</text:bookmark-ref>") @@ -1204,7 +1323,8 @@ Turn this option on if you want to colorize the source code blocks in the exported file. For colorization to work, you need to make available an enhanced version of `htmlfontify' library." :type 'boolean - :group 'org-export-odt) + :group 'org-export-odt + :version "24.1") (defun org-odt-format-source-line-with-line-number-and-label (line rpllbl num fontifier par-style) @@ -1415,15 +1535,27 @@ value of `org-export-odt-fontify-srcblocks." (org-odt-copy-image-file thefile) thelink)))) (org-export-odt-format-image thefile href))) -(defun org-export-odt-format-formula (src href &optional embed-as) - "Create image tag with source and attributes." +(defvar org-odt-entity-labels-alist nil + "Associate Labels with the Labeled entities. +Each element of the alist is of the form (LABEL-NAME +CATEGORY-NAME SEQNO LABEL-STYLE-NAME). LABEL-NAME is same as +that specified by \"#+LABEL: ...\" line. CATEGORY-NAME is the +type of the entity that LABEL-NAME is attached to. CATEGORY-NAME +can be one of \"Table\", \"Figure\" or \"Equation\". SEQNO is +the unique number assigned to the referenced entity on a +per-CATEGORY basis. It is generated sequentially and is 1-based. +LABEL-STYLE-NAME is a key `org-odt-label-styles'. + +See `org-odt-add-label-definition' and +`org-odt-fixup-label-references'.") + +(defun org-export-odt-format-formula (src href) (save-match-data (let* ((caption (org-find-text-property-in-string 'org-caption src)) (caption (and caption (org-xml-format-desc caption))) (label (org-find-text-property-in-string 'org-label src)) (latex-frag (org-find-text-property-in-string 'org-latex-src src)) - (embed-as (or embed-as - (and latex-frag + (embed-as (or (and latex-frag (org-find-text-property-in-string 'org-latex-src-embed-type src)) (if (or caption label) 'paragraph 'character))) @@ -1438,11 +1570,15 @@ value of `org-export-odt-fontify-srcblocks." (org-lparse-end-paragraph) (org-lparse-insert-list-table `((,(org-odt-format-entity - (if caption "CaptionedDisplayFormula" "DisplayFormula") - href width height :caption caption :label nil) - ,(if (not label) "" - (org-odt-format-entity-caption label nil "__MathFormula__")))) - nil nil nil "OrgEquation" nil '((1 "c" 8) (2 "c" 1))) + (if (not (or caption label)) "DisplayFormula" + "CaptionedDisplayFormula") + href width height :caption caption :label label) + ,(if (not (or caption label)) "" + (let* ((label-props (car org-odt-entity-labels-alist))) + (setcar (last label-props) "math-label") + (apply 'org-odt-format-label-definition + caption label-props))))) + nil nil nil ":style \"OrgEquation\"" nil '((1 "c" 8) (2 "c" 1))) (throw 'nextline nil)))))) (defvar org-odt-embedded-formulas-count 0) @@ -1457,19 +1593,19 @@ value of `org-export-odt-fontify-srcblocks." (message "Embedding %s as %s ..." (substring-no-properties path) target-file) - (make-directory target-dir) - (org-odt-create-manifest-file-entry - "application/vnd.oasis.opendocument.formula" target-dir "1.2") - - (case (org-odt-is-formula-link-p src-file) - (mathml - (copy-file src-file target-file 'overwrite)) - (odf - (org-odt-zip-extract-one src-file "content.xml" target-dir)) - (t - (error "%s is not a formula file" src-file))) - - (org-odt-create-manifest-file-entry "text/xml" target-file)) + (make-directory target-dir) + (org-odt-create-manifest-file-entry + "application/vnd.oasis.opendocument.formula" target-dir "1.2") + + (case (org-odt-is-formula-link-p src-file) + (mathml + (copy-file src-file target-file 'overwrite)) + (odf + (org-odt-zip-extract-one src-file "content.xml" target-dir)) + (t + (error "%s is not a formula file" src-file))) + + (org-odt-create-manifest-file-entry "text/xml" target-file)) target-file)) (defun org-odt-format-inline-formula (thefile) @@ -1508,7 +1644,8 @@ ATTR is a string of other attributes of the a element." (not fragment))) (type (if (equal type-1 "id") "file" type-1)) (filename path) - (thefile path)) + (thefile path) + sec-frag sec-nos) (cond ;; check for inlined images ((and (member type '("file")) @@ -1524,6 +1661,7 @@ ATTR is a string of other attributes of the a element." (org-odt-is-formula-link-p filename) (or (not descp))) (org-odt-format-inline-formula thefile)) + ;; code references ((string= type "coderef") (let* ((ref fragment) (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." (or desc "%s")) lineno-or-ref)) (org-odt-format-link (org-xml-format-desc desc) href))))) + ;; links to headlines + ((and (string= type "") + (or (not thefile) (string= thefile "")) + (plist-get org-lparse-opt-plist :section-numbers) + (setq sec-frag fragment) + (org-find-text-property-in-string 'org-no-description fragment) + (or (string-match "\\`sec\\(\\(-[0-9]+\\)+\\)" sec-frag) + (and (setq sec-frag + (loop for alias in org-export-target-aliases do + (when (member fragment (cdr alias)) + (return (car alias))))) + (string-match "\\`sec\\(\\(-[0-9]+\\)+\\)" sec-frag))) + (setq sec-nos (org-split-string (match-string 1 sec-frag) "-")) + (<= (length sec-nos) (plist-get org-lparse-opt-plist + :headline-levels))) + (let ((org-odt-suppress-xref nil)) + (org-odt-format-link sec-nos (concat "#" sec-frag) attr))) (t (when (string= type "file") (setq thefile @@ -1574,7 +1729,7 @@ ATTR is a string of other attributes of the a element." "</text:h>") text level level))) (defun org-odt-format-headline (title extra-targets tags - &optional snumber level) + &optional snumber level) (concat (org-lparse-format 'EXTRA-TARGETS extra-targets) @@ -1654,9 +1809,7 @@ ATTR is a string of other attributes of the a element." (attr-plist (org-lparse-get-block-params attr)) (user-frame-anchor (car (assoc-string (plist-get attr-plist :anchor) - (if (or caption label) - '(("paragraph") ("page")) - '(("character") ("paragraph") ("page"))) t))) + '(("as-char") ("paragraph") ("page")) t))) (user-frame-style (and user-frame-anchor (plist-get attr-plist :style))) (user-frame-attrs @@ -1666,8 +1819,10 @@ ATTR is a string of other attributes of the a element." (embed-as (cond (latex-frag (symbol-name - (or (org-find-text-property-in-string - 'org-latex-src-embed-type src) 'character))) + (case (org-find-text-property-in-string + 'org-latex-src-embed-type src) + (paragraph 'paragraph) + (t 'as-char)))) (user-frame-anchor) (t "paragraph"))) (size (org-odt-image-size-from-file @@ -1714,7 +1869,8 @@ ATTR is a string of other attributes of the a element." (org-odt-format-tags '("<draw:text-box %s>" . "</draw:text-box>") text (concat (format " fo:min-height=\"%0.2fcm\"" (or height .2)) - (format " fo:min-width=\"%0.2fcm\"" (or width .2)))) + (unless width + (format " fo:min-width=\"%0.2fcm\"" (or width .2))))) width nil style extra anchor-type)) (defun org-odt-format-inlinetask (heading content @@ -1729,9 +1885,13 @@ ATTR is a string of other attributes of the a element." content) nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\""))) (defvar org-odt-entity-frame-styles - '(("CharacterImage" "__Figure__" ("OrgInlineImage" nil "as-char")) + '(("As-CharImage" "__Figure__" ("OrgInlineImage" nil "as-char")) ("ParagraphImage" "__Figure__" ("OrgDisplayImage" nil "paragraph")) ("PageImage" "__Figure__" ("OrgPageImage" nil "page")) + ("CaptionedAs-CharImage" "__Figure__" + ("OrgCaptionedImage" + " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph") + ("OrgInlineImage" nil "as-char")) ("CaptionedParagraphImage" "__Figure__" ("OrgCaptionedImage" " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph") @@ -1803,12 +1963,12 @@ ATTR is a string of other attributes of the a element." target-file)) (defvar org-export-odt-image-size-probe-method - '(emacs imagemagick force) - "Ordered list of methods by for determining size of an embedded - image.") + (append (and (executable-find "identify") '(imagemagick)) ; See Bug#10675 + '(emacs fixed)) + "Ordered list of methods for determining image sizes.") (defvar org-export-odt-default-image-sizes-alist - '(("character" . (5 . 0.4)) + '(("as-char" . (5 . 0.4)) ("paragraph" . (5 . 5))) "Hardcoded image dimensions one for each of the anchor methods.") @@ -1832,7 +1992,9 @@ ATTR is a string of other attributes of the a element." (pixels-to-cms (cdr size-in-pixels))))))) (case probe-method (emacs - (size-in-cms (ignore-errors (image-size (create-image file) 'pixels)))) + (size-in-cms (ignore-errors ; Emacs could be in batch mode + (clear-image-cache) + (image-size (create-image file) 'pixels)))) (imagemagick (size-in-cms (let ((dim (shell-command-to-string @@ -1877,27 +2039,15 @@ ATTR is a string of other attributes of the a element." (setq width (* scale width) height (* scale height))))) (cons width height))) -(defvar org-odt-entity-labels-alist nil - "Associate Labels with the Labeled entities. -Each element of the alist is of the form (LABEL-NAME -CATEGORY-NAME SEQNO LABEL-STYLE-NAME). LABEL-NAME is same as -that specified by \"#+LABEL: ...\" line. CATEGORY-NAME is the -type of the entity that LABEL-NAME is attached to. CATEGORY-NAME -can be one of \"Table\", \"Figure\" or \"Equation\". SEQNO is -the unique number assigned to the referenced entity on a -per-CATEGORY basis. It is generated sequentially and is 1-based. -LABEL-STYLE-NAME is a key `org-odt-label-styles'. - -See `org-odt-add-label-definition' and -`org-odt-fixup-label-references'.") - (defvar org-odt-entity-counts-plist nil "Plist of running counters of SEQNOs for each of the CATEGORY-NAMEs. See `org-odt-entity-labels-alist' for known CATEGORY-NAMEs.") (defvar org-odt-label-styles - '(("text" "(%n)" "text" "(%n)") - ("category-and-value" "%e %n%c" "category-and-value" "%e %n")) + '(("math-formula" "%c" "text" "(%n)") + ("math-label" "(%n)" "text" "(%n)") + ("category-and-value" "%e %n: %c" "category-and-value" "%e %n") + ("value" "%e %n: %c" "value" "%n")) "Specify how labels are applied and referenced. This is an alist where each element is of the form (LABEL-STYLE-NAME LABEL-ATTACH-FMT LABEL-REF-MODE @@ -1918,89 +2068,105 @@ specifiers - %e and %n. %e is replaced with the CATEGORY-NAME. %n is replaced with SEQNO. See `org-odt-format-label-reference'.") +(defcustom org-export-odt-category-strings + '(("en" "Table" "Figure" "Equation" "Equation")) + "Specify category strings for various captionable entities. +Captionable entity can be one of a Table, an Embedded Image, a +LaTeX fragment (generated with dvipng) or a Math Formula. + +For example, when `org-export-default-language' is \"en\", an +embedded image will be captioned as \"Figure 1: Orgmode Logo\". +If you want the images to be captioned instead as \"Illustration +1: Orgmode Logo\", then modify the entry for \"en\" as shown +below. + + \(setq org-export-odt-category-strings + '\(\(\"en\" \"Table\" \"Illustration\" + \"Equation\" \"Equation\"\)\)\)" + :group 'org-export-odt + :version "24.1" + :type '(repeat (list (string :tag "Language tag") + (choice :tag "Table" + (const :tag "Use Default" nil) + (string :tag "Category string")) + (choice :tag "Figure" + (const :tag "Use Default" nil) + (string :tag "Category string")) + (choice :tag "Math Formula" + (const :tag "Use Default" nil) + (string :tag "Category string")) + (choice :tag "Dvipng Image" + (const :tag "Use Default" nil) + (string :tag "Category string"))))) + (defvar org-odt-category-map-alist - '(("__Table__" "Table" "category-and-value") - ("__Figure__" "Figure" "category-and-value") - ("__MathFormula__" "Equation" "text") - ("__DvipngImage__" "Equation" "category-and-value")) - "Map a CATEGORY-HANDLE to CATEGORY-NAME and LABEL-STYLE. -This is an alist where each element is of the form -\\(CATEGORY-HANDLE CATEGORY-NAME LABEL-STYLE\\). CATEGORY_HANDLE -could either be one of the internal handles (as seen above) or be -derived from the \"#+LABEL:<label-name>\" specification. See -`org-export-odt-get-category-from-label'. CATEGORY-NAME and -LABEL-STYLE are used for generating ODT labels. See -`org-odt-label-styles'.") - -(defvar org-export-odt-user-categories - '("Illustration" "Table" "Text" "Drawing" "Equation" "Figure")) - -(defvar org-export-odt-get-category-from-label nil - "Should category of label be inferred from label itself. -When this option is non-nil, a label is parsed in to two -component parts delimited by a \":\" (colon) as shown here - -#+LABEL:[CATEGORY-HANDLE:]EXTRA. The CATEGORY-HANDLE is mapped -to a CATEGORY-NAME and LABEL-STYLE using -`org-odt-category-map-alist'. (If no such map is provided and -CATEGORY-NAME is set to CATEGORY-HANDLE and LABEL-STYLE is set to -\"category-and-value\"). If CATEGORY-NAME so obtained is listed -under `org-export-odt-user-categories' then the user specified -styles are used. Otherwise styles as determined by the internal -CATEGORY-HANDLE is used. See -`org-odt-get-label-category-and-style' for details.") - -(defun org-odt-get-label-category-and-style (label default-category) - "See `org-export-odt-get-category-from-label'." - (let ((default-category-map - (assoc default-category org-odt-category-map-alist)) - user-category user-category-map category) - (cond - ((not org-export-odt-get-category-from-label) - default-category-map) - ((not (setq user-category - (save-match-data - (and (string-match "\\`\\(.*\\):.+" label) - (match-string 1 label))))) - default-category-map) - (t - (setq user-category-map - (or (assoc user-category org-odt-category-map-alist) - (list nil user-category "category-and-value")) - category (nth 1 user-category-map)) - (if (member category org-export-odt-user-categories) - user-category-map - default-category-map))))) + '(("__Table__" "Table" "value") + ("__Figure__" "Illustration" "value") + ("__MathFormula__" "Text" "math-formula") + ("__DvipngImage__" "Equation" "value") + ;; ("__Table__" "Table" "category-and-value") + ;; ("__Figure__" "Figure" "category-and-value") + ;; ("__DvipngImage__" "Equation" "category-and-value") + ) + "Map a CATEGORY-HANDLE to OD-VARIABLE and LABEL-STYLE. +This is a list where each entry is of the form \\(CATEGORY-HANDLE +OD-VARIABLE LABEL-STYLE\\). CATEGORY_HANDLE identifies the +captionable entity in question. OD-VARIABLE is the OpenDocument +sequence counter associated with the entity. These counters are +declared within +\"<text:sequence-decls>...</text:sequence-decls>\" block of +`org-export-odt-content-template-file'. LABEL-STYLE is a key +into `org-odt-label-styles' and specifies how a given entity +should be captioned and referenced. + +The position of a CATEGORY-HANDLE in this list is used as an +index in to per-language entry for +`org-export-odt-category-strings' to retrieve a CATEGORY-NAME. +This CATEGORY-NAME is then used for qualifying the user-specified +captions on export.") (defun org-odt-add-label-definition (label default-category) "Create an entry in `org-odt-entity-labels-alist' and return it." - (setq label (substring-no-properties label)) - (let* ((label-props (org-odt-get-label-category-and-style - label default-category)) - (category (nth 1 label-props)) - (counter category) - (label-style (nth 2 label-props)) - (sequence-var (intern (mapconcat - 'downcase - (org-split-string counter) "-"))) + (let* ((label-props (assoc default-category org-odt-category-map-alist)) + ;; identify the sequence number + (counter (nth 1 label-props)) + (sequence-var (intern counter)) (seqno (1+ (or (plist-get org-odt-entity-counts-plist sequence-var) 0))) - (label-props (list label category seqno label-style))) + ;; assign an internal label, if user has not provided one + (label (if label (substring-no-properties label) + (format "%s-%s" default-category seqno))) + ;; identify label style + (label-style (nth 2 label-props)) + ;; grok language setting + (en-strings (assoc-default "en" org-export-odt-category-strings)) + (lang (plist-get org-lparse-opt-plist :language)) + (lang-strings (assoc-default lang org-export-odt-category-strings)) + ;; retrieve localized category sting + (pos (- (length org-odt-category-map-alist) + (length (memq label-props org-odt-category-map-alist)))) + (category (or (nth pos lang-strings) (nth pos en-strings))) + (label-props (list label category counter seqno label-style))) + ;; synchronize internal counters (setq org-odt-entity-counts-plist (plist-put org-odt-entity-counts-plist sequence-var seqno)) + ;; stash label properties for later retrieval (push label-props org-odt-entity-labels-alist) label-props)) -(defun org-odt-format-label-definition (caption label category seqno label-style) +(defun org-odt-format-label-definition (caption label category counter + seqno label-style) (assert label) (format-spec (cadr (assoc-string label-style org-odt-label-styles t)) `((?e . ,category) (?n . ,(org-odt-format-tags '("<text:sequence text:ref-name=\"%s\" text:name=\"%s\" text:formula=\"ooow:%s+1\" style:num-format=\"1\">" . "</text:sequence>") - (format "%d" seqno) label category category)) - (?c . ,(or (and caption (concat ": " caption)) ""))))) + (format "%d" seqno) label counter counter)) + (?c . ,(or caption ""))))) -(defun org-odt-format-label-reference (label category seqno label-style) +(defun org-odt-format-label-reference (label category counter + seqno label-style) (assert label) (save-match-data (let* ((fmt (cddr (assoc-string label-style org-odt-label-styles t))) @@ -2026,10 +2192,9 @@ CATEGORY-HANDLE is used. See (format "Unable to resolve reference to label \"%s\"" label)))))) (defun org-odt-format-entity-caption (label caption category) - (or (and label - (apply 'org-odt-format-label-definition - caption (org-odt-add-label-definition label category))) - caption "")) + (if (not (or label caption)) "" + (apply 'org-odt-format-label-definition caption + (org-odt-add-label-definition label category)))) (defun org-odt-format-tags (tag text &rest args) (let ((prefix (when org-lparse-encode-pending "@")) @@ -2054,6 +2219,9 @@ CATEGORY-HANDLE is used. See org-odt-embedded-images-count 0 org-odt-embedded-formulas-count 0 org-odt-entity-labels-alist nil + org-odt-list-stack-stashed nil + org-odt-automatic-styles nil + org-odt-object-counters nil org-odt-entity-counts-plist nil) content-file)) @@ -2064,10 +2232,14 @@ component xml buffers before they are saved. Turn this off for regular use. Turn this on if you need to examine the xml visually." :group 'org-export-odt + :version "24.1" :type 'boolean) (defvar hfy-user-sheet-assoc) ; bound during org-do-lparse (defun org-odt-save-as-outfile (target opt-plist) + ;; write automatic styles + (org-odt-write-automatic-styles) + ;; write meta file (org-odt-update-meta-file opt-plist) @@ -2183,21 +2355,21 @@ visually." xmlns:ooo=\"http://openoffice.org/2004/office\" office:version=\"1.2\"> <office:meta>" "\n" - (org-odt-format-author) - (org-odt-format-tags - '("\n<meta:initial-creator>" . "</meta:initial-creator>") author) - (org-odt-format-tags '("\n<dc:date>" . "</dc:date>") date) - (org-odt-format-tags - '("\n<meta:creation-date>" . "</meta:creation-date>") date) - (org-odt-format-tags '("\n<meta:generator>" . "</meta:generator>") - (when org-export-creator-info - (format "Org-%s/Emacs-%s" - org-version emacs-version))) - (org-odt-format-tags '("\n<meta:keyword>" . "</meta:keyword>") keywords) - (org-odt-format-tags '("\n<dc:subject>" . "</dc:subject>") description) - (org-odt-format-tags '("\n<dc:title>" . "</dc:title>") title) - "\n" - " </office:meta>" "</office:document-meta>") + (org-odt-format-author) + (org-odt-format-tags + '("\n<meta:initial-creator>" . "</meta:initial-creator>") author) + (org-odt-format-tags '("\n<dc:date>" . "</dc:date>") date) + (org-odt-format-tags + '("\n<meta:creation-date>" . "</meta:creation-date>") date) + (org-odt-format-tags '("\n<meta:generator>" . "</meta:generator>") + (when org-export-creator-info + (format "Org-%s/Emacs-%s" + org-version emacs-version))) + (org-odt-format-tags '("\n<meta:keyword>" . "</meta:keyword>") keywords) + (org-odt-format-tags '("\n<dc:subject>" . "</dc:subject>") description) + (org-odt-format-tags '("\n<dc:title>" . "</dc:title>") title) + "\n" + " </office:meta>" "</office:document-meta>") nil (expand-file-name "meta.xml"))) ;; create a manifest entry for meta.xml @@ -2256,23 +2428,19 @@ visually." (replace-match "")))) (defcustom org-export-odt-convert-processes - '(("BasicODConverter" - ("soffice" "-norestore" "-invisible" "-headless" - "\"macro:///BasicODConverter.Main.Convert(%I,%f,%O)\"")) + '(("LibreOffice" + "soffice --headless --convert-to %f%x --outdir %d %i") ("unoconv" - ("unoconv" "-f" "%f" "-o" "%d" "%i"))) + "unoconv -f %f -o %d %i")) "Specify a list of document converters and their usage. The converters in this list are offered as choices while customizing `org-export-odt-convert-process'. -This variable is an alist where each element is of the -form (CONVERTER-NAME CONVERTER-PROCESS). CONVERTER-NAME is name -of the converter. CONVERTER-PROCESS specifies the command-line -syntax of the converter and is of the form (CONVERTER-PROGRAM -ARG1 ARG2 ...). CONVERTER-PROGRAM is the name of the executable. -ARG1, ARG2 etc are command line options that are passed to -CONVERTER-PROGRAM. Format specifiers can be used in the ARGs and -they are interpreted as below: +This variable is a list where each element is of the +form (CONVERTER-NAME CONVERTER-CMD). CONVERTER-NAME is the name +of the converter. CONVERTER-CMD is the shell command for the +converter and can contain format specifiers. These format +specifiers are interpreted as below: %i input file name in full %I input file name as a URL @@ -2280,21 +2448,23 @@ they are interpreted as below: %o output file name in full %O output file name as a URL %d output dir in full -%D output dir as a URL." +%D output dir as a URL. +%x extra options as set in `org-export-odt-convert-capabilities'." :group 'org-export-odt + :version "24.1" :type '(choice (const :tag "None" nil) (alist :tag "Converters" :key-type (string :tag "Converter Name") - :value-type (group (cons (string :tag "Executable") - (repeat (string :tag "Command line args"))))))) + :value-type (group (string :tag "Command line"))))) -(defcustom org-export-odt-convert-process nil +(defcustom org-export-odt-convert-process "LibreOffice" "Use this converter to convert from \"odt\" format to other formats. During customization, the list of converter names are populated from `org-export-odt-convert-processes'." :group 'org-export-odt + :version "24.1" :type '(choice :convert-widget (lambda (w) (apply 'widget-convert (widget-type w) @@ -2306,19 +2476,20 @@ from `org-export-odt-convert-processes'." (defcustom org-export-odt-convert-capabilities '(("Text" - ("odt" "ott" "doc" "rtf") - (("pdf" "pdf") ("odt" "odt") ("xhtml" "html") ("rtf" "rtf") - ("ott" "ott") ("doc" "doc") ("ooxml" "xml") ("html" "html"))) + ("odt" "ott" "doc" "rtf" "docx") + (("pdf" "pdf") ("odt" "odt") ("rtf" "rtf") ("ott" "ott") + ("doc" "doc" ":\"MS Word 97\"") ("docx" "docx") ("html" "html"))) ("Web" - ("html" "xhtml") (("pdf" "pdf") ("odt" "txt") ("html" "html"))) + ("html") + (("pdf" "pdf") ("odt" "odt") ("html" "html"))) ("Spreadsheet" - ("ods" "ots" "xls" "csv") - (("pdf" "pdf") ("ots" "ots") ("html" "html") ("csv" "csv") - ("ods" "ods") ("xls" "xls") ("xhtml" "xhtml") ("ooxml" "xml"))) + ("ods" "ots" "xls" "csv" "xlsx") + (("pdf" "pdf") ("ots" "ots") ("html" "html") ("csv" "csv") ("ods" "ods") + ("xls" "xls") ("xlsx" "xlsx"))) ("Presentation" - ("odp" "otp" "ppt") - (("pdf" "pdf") ("swf" "swf") ("odp" "odp") ("xhtml" "xml") - ("otp" "otp") ("ppt" "ppt") ("odg" "odg") ("html" "html")))) + ("odp" "otp" "ppt" "pptx") + (("pdf" "pdf") ("swf" "swf") ("odp" "odp") ("otp" "otp") ("ppt" "ppt") + ("pptx" "pptx") ("odg" "odg")))) "Specify input and output formats of `org-export-odt-convert-process'. More correctly, specify the set of input and output formats that the user is actually interested in. @@ -2327,7 +2498,7 @@ This variable is an alist where each element is of the form (DOCUMENT-CLASS INPUT-FMT-LIST OUTPUT-FMT-ALIST). INPUT-FMT-LIST is a list of INPUT-FMTs. OUTPUT-FMT-ALIST is an alist where each element is of the form (OUTPUT-FMT -OUTPUT-FILE-EXTENSION). +OUTPUT-FILE-EXTENSION EXTRA-OPTIONS). The variable is interpreted as follows: `org-export-odt-convert-process' can take any document that is in @@ -2340,6 +2511,9 @@ serves dual purposes: - It is used as the value of \"%f\" specifier in `org-export-odt-convert-process'. +EXTRA-OPTIONS is used as the value of \"%x\" specifier in +`org-export-odt-convert-process'. + DOCUMENT-CLASS is used to group a set of file formats in INPUT-FMT-LIST in to a single class. @@ -2353,16 +2527,21 @@ with that class. See default setting of this variable for an typical configuration." :group 'org-export-odt + :version "24.1" :type '(choice (const :tag "None" nil) - (alist :key-type (string :tag "Document Class") + (alist :tag "Capabilities" + :key-type (string :tag "Document Class") :value-type (group (repeat :tag "Input formats" (string :tag "Input format")) (alist :tag "Output formats" :key-type (string :tag "Output format") :value-type - (group (string :tag "Output file extension"))))))) + (group (string :tag "Output file extension") + (choice + (const :tag "None" nil) + (string :tag "Extra options")))))))) (declare-function org-create-math-formula "org" (latex-frag &optional mathml-file)) @@ -2544,10 +2723,6 @@ Do this when translation to MathML fails." ;; create a manifest entry for styles.xml (org-odt-create-manifest-file-entry "text/xml" "styles.xml")) -(defvar org-export-odt-factory-settings - "d4328fb9d1b6cb211d4320ff546829f26700dc5e" - "SHA1 hash of OrgOdtStyles.xml.") - (defun org-odt-configure-outline-numbering (level) "Outline numbering is retained only upto LEVEL. To disable outline numbering pass a LEVEL of 0." @@ -2585,7 +2760,6 @@ non-nil." (or (file-name-nondirectory buffer-file-name))) "." "odf") (file-name-directory buffer-file-name)))) - (message "default val is %s" odf-filename) (read-file-name "ODF filename: " nil odf-filename nil (file-name-nondirectory odf-filename))))) (let* ((org-lparse-backend 'odf) @@ -2612,7 +2786,7 @@ non-nil." ;;;###autoload (defun org-export-as-odf-and-open () - "Export LaTeX fragment as OpenDocument formula and immediately open it. + "Export LaTeX fragment as OpenDocument formula and immediately open it. Use `org-export-as-odf' to read LaTeX fragment and OpenDocument formula file." (interactive) diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el index a79d4fcfbb..6ffa86a120 100644 --- a/lisp/org/org-protocol.el +++ b/lisp/org/org-protocol.el @@ -1,11 +1,12 @@ ;;; org-protocol.el --- Intercept calls from emacsclient to trigger custom actions. - -;; Copyright (C) 2008-2012 Free Software Foundation, Inc. - +;; +;; Copyright (C) 2008-2012 +;; Free Software Foundation, Inc. +;; ;; Author: Bastien Guerry <bzg AT gnu DOT org> -;; Daniel M German <dmg AT uvic DOT org> -;; Sebastian Rose <sebastian_rose AT gmx DOT de> -;; Ross Patterson <me AT rpatterson DOT net> +;; Author: Daniel M German <dmg AT uvic DOT org> +;; Author: Sebastian Rose <sebastian_rose AT gmx DOT de> +;; Author: Ross Patterson <me AT rpatterson DOT net> ;; Maintainer: Sebastian Rose <sebastian_rose AT gmx DOT de> ;; Keywords: org, emacsclient, wp diff --git a/lisp/org/org-special-blocks.el b/lisp/org/org-special-blocks.el index fc882a3339..d7dad8854c 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." (add-hook 'org-export-latex-after-blockquotes-hook 'org-special-blocks-convert-latex-special-cookies) -(defvar line) +(defvar org-special-blocks-line) (defun org-special-blocks-convert-html-special-cookies () "Converts the special cookies into div blocks." - ;; Uses the dynamically-bound variable `line'. - (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" line) + ;; Uses the dynamically-bound variable `org-special-blocks-line'. + (when (string-match "^ORG-\\(.*\\)-\\(START\\|END\\)$" org-special-blocks-line) (message "%s" (match-string 1)) - (when (equal (match-string 2 line) "START") + (when (equal (match-string 2 org-special-blocks-line) "START") (org-close-par-maybe) - (insert "\n<div class=\"" (match-string 1 line) "\">") + (insert "\n<div class=\"" (match-string 1 org-special-blocks-line) "\">") (org-open-par)) - (when (equal (match-string 2 line) "END") + (when (equal (match-string 2 org-special-blocks-line) "END") (org-close-par-maybe) (insert "\n</div>") (org-open-par)) diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index ac574ed4dd..0a67d79f21 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el @@ -43,6 +43,8 @@ (declare-function org-switch-to-buffer-other-window "org" (&rest args)) (declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) +(declare-function org-strip-protective-commas "org" (beg end)) +(declare-function org-base-buffer "org" (buffer)) (defcustom org-edit-src-region-extra nil "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.") (defcustom org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . artist) ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql) - ("calc" . fundamental) ("C" . c) ("cpp" . c++)) + ("calc" . fundamental) ("C" . c) ("cpp" . c++) + ("screen" . shell-script)) "Alist mapping languages to their major mode. The key is the language name, the value is the string that should be inserted as the name of the major mode. For many languages this is @@ -211,16 +214,16 @@ buffer." (interactive) (unless (eq context 'save) (setq org-edit-src-saved-temp-window-config (current-window-configuration))) - (let ((mark (and (org-region-active-p) (mark))) - (case-fold-search t) - (info (org-edit-src-find-region-and-lang)) - (full-info (org-babel-get-src-block-info)) - (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive - (beg (make-marker)) - (end (make-marker)) - (allow-write-back-p (null code)) - block-nindent total-nindent ovl lang lang-f single lfmt buffer msg - begline markline markcol line col transmitted-variables) + (let* ((mark (and (org-region-active-p) (mark))) + (case-fold-search t) + (info (org-edit-src-find-region-and-lang)) + (full-info (org-babel-get-src-block-info 'light)) + (org-mode-p (derived-mode-p 'org-mode)) ;; derived-mode-p is reflexive + (beg (make-marker)) + (end (make-marker)) + (allow-write-back-p (null code)) + block-nindent total-nindent ovl lang lang-f single lfmt buffer msg + begline markline markcol line col transmitted-variables) (if (not info) nil (setq beg (move-marker beg (nth 0 info)) @@ -306,11 +309,13 @@ buffer." (error "Language mode `%s' fails with: %S" lang-f (nth 1 e))))) (dolist (pair transmitted-variables) (org-set-local (car pair) (cadr pair))) - (when (eq major-mode 'org-mode) - (goto-char (point-min)) - (while (re-search-forward "^," nil t) - (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) - (replace-match ""))) + (if (eq major-mode 'org-mode) + (progn + (goto-char (point-min)) + (while (re-search-forward "^," nil t) + (if (eq (org-current-line) line) (setq total-nindent (1+ total-nindent))) + (replace-match ""))) + (org-strip-protective-commas (point-min) (point-max))) (when markline (org-goto-line (1+ (- markline begline))) (org-move-to-column @@ -369,6 +374,15 @@ buffer." "Construct the buffer name for a source editing buffer." (concat "*Org Src " org-buffer-name "[ " lang " ]*")) +(defun org-src-edit-buffer-p (&optional buffer) + "Test whether BUFFER (or the current buffer if BUFFER is nil) +is a source block editing buffer." + (let ((buffer (org-base-buffer (or buffer (current-buffer))))) + (and (buffer-name buffer) + (string-match "\\`*Org Src " (buffer-name buffer)) + (local-variable-p 'org-edit-src-beg-marker buffer) + (local-variable-p 'org-edit-src-end-marker buffer)))) + (defun org-edit-src-find-buffer (beg end) "Find a source editing buffer that is already editing the region BEG to END." (catch 'exit diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index 0d2a2e6a97..9018bb4043 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." (defun org-table-line-to-dline (line &optional above) "Turn a buffer line number into a data line number. If there is no data line in this line, return nil. -If there is no matching dline (most likely the reference was a hline), the +If there is no matching dline (most likely te reference was a hline), the first dline below it is used. When ABOVE is non-nil, the one above is used." (catch 'exit (let ((ll (length org-table-dlines)) @@ -2364,7 +2364,7 @@ of the new mark." (looking-at org-table-auto-recalculate-regexp)) (org-table-recalculate) t)) -(defvar modes) +(defvar org-table-modes) (defsubst org-set-calc-mode (var &optional value) (if (stringp var) (setq var (assoc var '(("D" calc-angle-mode deg) @@ -2372,10 +2372,10 @@ of the new mark." ("F" calc-prefer-frac t) ("S" calc-symbolic-mode t))) value (nth 2 var) var (nth 1 var))) - (if (memq var modes) - (setcar (cdr (memq var modes)) value) - (cons var (cons value modes))) - modes) + (if (memq var org-table-modes) + (setcar (cdr (memq var org-table-modes)) value) + (cons var (cons value org-table-modes))) + org-table-modes) (defun org-table-eval-formula (&optional arg equation suppress-align suppress-const @@ -2931,7 +2931,7 @@ known that the table will be realigned a little later anyway." (defun org-table-iterate (&optional arg) "Recalculate the table until it does not change anymore. -The maximum number of iterations is 10, but you can choose a different value +The maximun number of iterations is 10, but you can choose a different value with the prefix ARG." (interactive "P") (let ((imax (if arg (prefix-numeric-value arg) 10)) @@ -4154,7 +4154,7 @@ overwritten, and the table is not marked as requiring realignment." (looking-at "[^|\n]* +|")) (let (org-table-may-need-update) (goto-char (1- (match-end 0))) - (delete-char -1) + (backward-delete-char 1) (goto-char (match-beginning 0)) (self-insert-command N)) (setq org-table-may-need-update t) diff --git a/lisp/org/org.el b/lisp/org/org.el index 57d2c96514..85d8d1efb1 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -6,7 +6,7 @@ ;; Maintainer: Bastien Guerry <bzg at gnu dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 7.8.03 +;; Version: 7.8.07 ;; ;; This file is part of GNU Emacs. ;; @@ -75,6 +75,7 @@ (require 'gnus-sum)) (require 'calendar) +(require 'format-spec) ;; Emacs 22 calendar compatibility: Make sure the new variables are available (when (fboundp 'defvaralias) @@ -203,9 +204,10 @@ identifier." ;;; Version -(defconst org-version "7.8.03" +(defconst org-version "7.8.07" "The version number of the file org.el.") +;;;###autoload (defun org-version (&optional here) "Show the org-mode version in the echo area. With prefix arg HERE, insert it at point." @@ -2246,10 +2248,7 @@ TODO state changes Also, if a parent has an :ORDERED: property, switching an entry to DONE will be blocked if any prior sibling is not yet done. Finally, if the parent is blocked because of ordered siblings of its own, -the child will also be blocked. -This variable needs to be set before org.el is loaded, and you need to -restart Emacs after a change to make the change effective. The only way -to change is while Emacs is running is through the customize interface." +the child will also be blocked." :set (lambda (var val) (set var val) (if val @@ -4446,12 +4445,13 @@ means to push this value onto the list in the variable.") (defun org-update-property-plist (key val props) "Update PROPS with KEY and VAL." - (if (string= "+" (substring key (- (length key) 1))) - (let* ((key (substring key 0 (- (length key) 1))) - (previous (cdr (assoc key props)))) - (cons (cons key (concat previous " " val)) - (org-remove-if (lambda (p) (string= (car p) key)) props))) - (cons (cons key val) props))) + (let* ((appending (string= "+" (substring key (- (length key) 1)))) + (key (if appending (substring key 0 (- (length key) 1)) key)) + (remainder (org-remove-if (lambda (p) (string= (car p) key)) props)) + (previous (cdr (assoc key props)))) + (if appending + (cons (cons key (if previous (concat previous " " val) val)) remainder) + (cons (cons key val) remainder)))) (defconst org-block-regexp "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" @@ -4841,8 +4841,8 @@ This is for getting out of special buffers like remember.") ;; FIXME: Occasionally check by commenting these, to make sure ;; no other functions uses these, forgetting to let-bind them. -(defvar entry) -(defvar last-state) +(defvar org-entry) +(defvar org-last-state) (defvar date) ;; Defined somewhere in this file, but used before definition. @@ -4892,6 +4892,8 @@ sure that we are at the beginning of the line.") "Matches an headline, putting stars and text into groups. Stars are put in group 1 and the trimmed body in group 2.") +(defvar buffer-face-mode-face) + ;;;###autoload (define-derived-mode org-mode outline-mode "Org" "Outline-based notes management and organizer, alias @@ -5025,8 +5027,9 @@ The following commands are available: (set (make-local-variable 'pcomplete-parse-arguments-function) 'org-parse-arguments) (set (make-local-variable 'pcomplete-termination-string) "") - (set (make-local-variable 'face-remapping-alist) - '((default org-default))) + (when (>= emacs-major-version 23) + (set (make-local-variable 'buffer-face-mode-face) 'org-default) + (buffer-face-mode)) ;; If empty file that did not turn on org-mode automatically, make it to. (if (and org-insert-mode-line-in-empty-file @@ -5459,6 +5462,22 @@ will be prompted for." '(font-lock-fontified t face font-lock-comment-face))) (t nil)))))) +(defun org-strip-protective-commas (beg end) + "Strip protective commas between BEG and END in the current buffer." + (interactive "r") + (save-excursion + (save-match-data + (goto-char beg) + (let ((front-line (save-excursion + (re-search-forward + "[^[:space:]]" end t) + (goto-char (match-beginning 0)) + (current-column)))) + (while (re-search-forward "^[ \t]*\\(,\\)\\([*]\\|#\\+\\)" end t) + (goto-char (match-beginning 1)) + (when (= (current-column) front-line) + (replace-match "" nil nil nil 1))))))) + (defun org-activate-angle-links (limit) "Run through the buffer and add overlays to links." (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.") (if org-fontify-done-headline (list (format org-heading-keyword-regexp-format (concat - "\\(" + "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)")) '(2 'org-headline-done t)) @@ -6295,7 +6314,12 @@ in special contexts. (if (org-at-item-p) (org-list-set-item-visibility (point-at-bol) struct 'children) (org-show-entry) - (show-children) + (org-with-limited-levels (show-children)) + ;; FIXME: This slows down the func way too much. + ;; How keep drawers hidden in subtree anyway? + ;; (when (memq 'org-cycle-hide-drawers org-cycle-hook) + ;; (org-cycle-hide-drawers 'subtree)) + ;; Fold every list in subtree to top-level items. (when (eq org-cycle-include-plain-lists 'integrate) (save-excursion @@ -6786,7 +6810,7 @@ This command works around this by showing a copy of the current buffer in an indirect buffer, in overview mode. You can dive into the tree in that copy, use org-occur and incremental search to find a location. When pressing RET or `Q', the command returns to the original buffer in -which the visibility is still unchanged. After RET is will also jump to +which the visibility is still unchanged. After RET it will also jump to the location selected in the indirect buffer and expose the headline hierarchy above." (interactive "P") @@ -6803,7 +6827,7 @@ hierarchy above." (selected-point (if (eq interface 'outline) (car (org-get-location (current-buffer) org-goto-help)) - (let ((pa (org-refile-get-location "Goto"))) + (let ((pa (org-refile-get-location "Goto" nil nil t))) (org-refile-check-position pa) (nth 3 pa))))) (if selected-point @@ -7890,7 +7914,7 @@ the following will happen: repeater intact. - the start days in the repeater in the original entry will be shifted to past the last clone. -I this way you can spell out a number of instances of a repeating task, +In this way you can spell out a number of instances of a repeating task, and still retain the repeater to cover future instances of the task." (interactive "nNumber of clones to produce: \nsDate shift per clone (e.g. +1w, empty to copy unchanged): ") (let (beg end template task idprop @@ -7917,7 +7941,7 @@ and still retain the repeater to cover future instances of the task." (setq end (point)) (setq template (buffer-substring beg end)) (when (and doshift - (string-match "<[^<>\n]+ \\+[0-9]+[dwmy][^<>\n]*>" template)) + (string-match "<[^<>\n]+ [.+]?\\+[0-9]+[dwmy][^<>\n]*>" template)) (delete-region beg end) (setq end beg) (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." (while (re-search-forward org-ts-regexp nil t) (save-excursion (goto-char (match-beginning 0)) - (if (looking-at "<[^<>\n]+\\( +\\+[0-9]+[dwmy]\\)") + (if (looking-at "<[^<>\n]+\\( +[.+]?\\+[0-9]+[dwmy]\\)") (delete-region (match-beginning 1) (match-end 1))))))) (setq task (buffer-string))) (insert task)) @@ -7958,8 +7982,7 @@ and still retain the repeater to cover future instances of the task." (defun org-sort (with-case) "Call `org-sort-entries', `org-table-sort-lines' or `org-sort-list'. -Optional argument WITH-CASE means sort case-sensitively. -With a double prefix argument, also remove duplicate entries." +Optional argument WITH-CASE means sort case-sensitively." (interactive "P") (cond ((org-at-table-p) (org-call-with-arg 'org-table-sort-lines with-case)) @@ -8477,11 +8500,12 @@ call CMD." (defun org-get-category (&optional pos force-refresh) "Get the category applying to position POS." - (if force-refresh (org-refresh-category-properties)) - (let ((pos (or pos (point)))) - (or (get-text-property pos 'org-category) - (progn (org-refresh-category-properties) - (get-text-property pos 'org-category))))) + (save-match-data + (if force-refresh (org-refresh-category-properties)) + (let ((pos (or pos (point)))) + (or (get-text-property pos 'org-category) + (progn (org-refresh-category-properties) + (get-text-property pos 'org-category)))))) (defun org-refresh-category-properties () "Refresh category text properties in the buffer." @@ -8625,7 +8649,7 @@ For file links, arg negates `org-context-in-file-links'." (setq link (plist-get org-store-link-plist :link) desc (or (plist-get org-store-link-plist :description) link))) - ((equal (buffer-name) "*Org Edit Src Example*") + ((org-src-edit-buffer-p) (let (label gc) (while (or (not label) (save-excursion @@ -9439,7 +9463,7 @@ Org-mode syntax." (interactive "sLink: \nP") (let ((reference-buffer (or reference-buffer (current-buffer)))) (with-temp-buffer - (let ((org-inhibit-startup t)) + (let ((org-inhibit-startup (not reference-buffer))) (org-mode) (insert s) (goto-char (point-min)) @@ -10358,8 +10382,8 @@ on the system \"/user@host:\"." targets tgs txt re files f desc descre fast-path-p level pos0) (message "Getting targets...") (with-current-buffer (or default-buffer (current-buffer)) - (while (setq entry (pop entries)) - (setq files (car entry) desc (cdr entry)) + (while (setq org-entry (pop entries)) + (setq files (car org-entry) desc (cdr org-entry)) (setq fast-path-p nil) (cond ((null files) (setq files (list (current-buffer)))) @@ -10621,7 +10645,8 @@ prefix argument (`C-u C-u C-u C-c C-w')." (t (concat "Refile subtree \"" heading-text "\" to"))) default-buffer - org-refile-allow-creating-parent-nodes + (and (not (equal '(4) goto)) + org-refile-allow-creating-parent-nodes) goto)))))) (setq file (nth 1 it) re (nth 2 it) @@ -11028,11 +11053,11 @@ This function can be used in a hook." "<example>\n?\n</example>") ("q" "#+begin_quote\n?\n#+end_quote" "<quote>\n?\n</quote>") - ("v" "#+begin_verse\n?\n#+end_verse" - "<verse>\n?\n/verse>") - ("c" "#+begin_center\n?\n#+end_center" - "<center>\n?\n/center>") - ("l" "#+begin_latex\n?\n#+end_latex" + ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE" + "<verse>\n?\n</verse>") + ("c" "#+BEGIN_CENTER\n?\n#+END_CENTER" + "<center>\n?\n</center>") + ("l" "#+BEGIN_LaTeX\n?\n#+END_LaTeX" "<literal style=\"latex\">\n?\n</literal>") ("L" "#+latex: " "<literal style=\"latex\">?</literal>") @@ -11847,7 +11872,7 @@ of repeating deadline/scheduled time stamps to new date. This function is run automatically after each state change to a DONE state." ;; last-state is dynamically scoped into this function (let* ((repeat (org-get-repeat)) - (aa (assoc last-state org-todo-kwd-alist)) + (aa (assoc org-last-state org-todo-kwd-alist)) (interpret (nth 1 aa)) (head (nth 2 aa)) (whata '(("d" . day) ("m" . month) ("y" . year))) @@ -11860,7 +11885,7 @@ This function is run automatically after each state change to a DONE state." (setq to-state (or (org-entry-get nil "REPEAT_TO_STATE") org-todo-repeat-to-state)) (unless (and to-state (member to-state org-todo-keywords-1)) - (setq to-state (if (eq interpret 'type) last-state head))) + (setq to-state (if (eq interpret 'type) org-last-state head))) (org-todo to-state) (when (or org-log-repeat (org-entry-get nil "CLOCK")) (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." (setq org-log-note-how 'note)) ;; Set up for taking a record (org-add-log-setup 'state (or done-word (car org-done-keywords)) - last-state + org-last-state 'findpos org-log-repeat))) (org-back-to-heading t) (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 a file becomes an N^2 operation - but with this variable set, it scales as N.") -(defun org-scan-tags (action matcher &optional todo-only start-level) +(defun org-scan-tags (action matcher todo-only &optional start-level) "Scan headline tags with inheritance and produce output ACTION. ACTION 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. MATCHER is a Lisp form to be evaluated, testing if a given set of tags qualifies a headline for inclusion. When TODO-ONLY is non-nil, -only lines with a TODO keyword are included in the output. +only lines with a not-done TODO keyword are included in the output. +This should be the same variable that was scoped into +and set by `org-make-tags-matcher' when it constructed MATCHER. START-LEVEL can be a string with asterisks, reducing the scope to headlines matching this string." @@ -12861,7 +12888,7 @@ headlines matching this string." (and org-highlight-sparse-tree-matches (org-get-heading) (match-end 0) (org-highlight-new-match - (match-beginning 0) (match-beginning 1))) + (match-beginning 1) (match-end 1))) (org-show-context 'tags-tree)) ((eq action 'agenda) (setq txt (org-agenda-format-item @@ -12922,8 +12949,6 @@ headlines matching this string." (if (member x org-use-tag-inheritance) x nil)) tags))))) -(defvar todo-only) ;; dynamically scoped - (defun org-match-sparse-tree (&optional todo-only match) "Create a sparse tree according to tags string MATCH. MATCH can contain positive and negative selection of tags, like @@ -12970,9 +12995,29 @@ instead of the agenda files." (org-agenda-files)))))))) (defun org-make-tags-matcher (match) - "Create the TAGS/TODO matcher form for the selection string MATCH." - ;; todo-only is scoped dynamically into this function, and the function - ;; may change it if the matcher asks for it. + "Create the TAGS/TODO matcher form for the selection string MATCH. + +The variable `todo-only' is scoped dynamically into this function; it will be +set to t if the matcher restricts matching to TODO entries, +otherwise will not be touched. + +Returns a cons of the selection string MATCH and the constructed +lisp form implementing the matcher. The matcher is to be +evaluated at an Org entry, with point on the headline, +and returns t if the entry matches the +selection string MATCH. The returned lisp form references +two variables with information about the entry, which must be +bound around the form's evaluation: todo, the TODO keyword at the +entry (or nil of none); and tags-list, the list of all tags at the +entry including inherited ones. Additionally, the category +of the entry (if any) must be specified as the text property +'org-category on the headline. + +See also `org-scan-tags'. +" + (declare (special todo-only)) + (unless (boundp 'todo-only) + (error "org-make-tags-matcher expects todo-only to be scoped in")) (unless match ;; Get a new match request, with completion (let ((org-last-tags-completion-table @@ -13089,6 +13134,9 @@ instead of the agenda files." (setq matcher (if todomatcher (list 'and tagsmatcher todomatcher) tagsmatcher)) + (when todo-only + (setq matcher (list 'and '(member todo org-not-done-keywords) + matcher))) (cons match0 matcher))) (defun org-op-to-function (op &optional stringp) @@ -13344,7 +13392,8 @@ With prefix ARG, realign all tags in headings in the current buffer." ;; Get a new set of tags from the user (save-excursion (setq table (append org-tag-persistent-alist - (or org-tag-alist (org-get-buffer-tags)) + org-tag-alist + (org-get-buffer-tags) (and org-complete-tags-always-offer-all-agenda-tags (org-global-tags-completion-table @@ -13362,7 +13411,7 @@ With prefix ARG, realign all tags in headings in the current buffer." current-tags inherited-tags table (if org-fast-tag-selection-include-todo org-todo-key-alist)) - (let ((org-add-colon-after-tag-completion t)) + (let ((org-add-colon-after-tag-completion (< 1 (length table)))) (org-trim (org-icompleting-read "Tags: " 'org-tags-completion-function @@ -13646,9 +13695,11 @@ Returns the new tags string, or nil to not change the current settings." (condition-case nil (setq tg (org-icompleting-read "Tag: " - (or buffer-tags - (with-current-buffer buf - (org-get-buffer-tags))))) + (delete-dups + (append (or buffer-tags + (with-current-buffer buf + (mapcar 'car (org-get-buffer-tags)))) + (mapcar 'car table))))) (quit (setq tg ""))) (when (string-match "\\S-" tg) (add-to-list 'buffer-tags (list tg)) @@ -13802,7 +13853,8 @@ a *different* entry, you cannot use these techniques." org-done-keywords-for-agenda org-todo-keyword-alist-for-agenda org-drawers-for-agenda - org-tag-alist-for-agenda) + org-tag-alist-for-agenda + todo-only) (cond ((eq match t) (setq matcher t)) @@ -13835,7 +13887,7 @@ a *different* entry, you cannot use these techniques." (progn (org-prepare-agenda-buffers (list (buffer-file-name (current-buffer)))) - (setq res (org-scan-tags func matcher nil start-level))) + (setq res (org-scan-tags func matcher todo-only start-level))) ;; Get the right scope (cond ((and scope (listp scope) (symbolp (car scope))) @@ -13856,7 +13908,7 @@ a *different* entry, you cannot use these techniques." (save-restriction (widen) (goto-char (point-min)) - (setq res (append res (org-scan-tags func matcher)))))))))) + (setq res (append res (org-scan-tags func matcher todo-only)))))))))) res))) ;;;; Properties @@ -14137,24 +14189,26 @@ when a \"nil\" value can supersede a non-nil value higher up the hierarchy." ;; retrieve it, but specify the wanted property (cdr (assoc property (org-entry-properties nil 'special property))) (let ((range (unless (org-before-first-heading-p) - (org-get-property-block)))) - (when (and range (goto-char (car range))) - ((lambda (val) (when val (if literal-nil val (org-not-nil val)))) - (cond - ((re-search-forward - (org-re-property property) (cdr range) t) - (if (match-end 1) (org-match-string-no-properties 1) "")) - ((re-search-forward - (org-re-property (concat property "+")) (cdr range) t) - (cdr (assoc - property - (org-update-property-plist - (concat property "+") - (if (match-end 1) (org-match-string-no-properties 1) "") - (list (or (assoc property org-file-properties) - (assoc property org-global-properties) - (assoc property org-global-properties-fixed) - )))))))))))))) + (org-get-property-block))) + (props (list (or (assoc property org-file-properties) + (assoc property org-global-properties) + (assoc property org-global-properties-fixed)))) + val) + (flet ((ap (key) + (when (re-search-forward + (org-re-property key) (cdr range) t) + (setq props + (org-update-property-plist + key + (if (match-end 1) + (org-match-string-no-properties 1) "") + props))))) + (when (and range (goto-char (car range))) + (ap property) + (goto-char (car range)) + (while (ap (concat property "+"))) + (setq val (cdr (assoc property props))) + (when val (if literal-nil val (org-not-nil val)))))))))) (defun org-property-or-variable-value (var &optional inherit) "Check if there is a property fixing the value of VAR. @@ -14543,7 +14597,7 @@ in the current file." (org-re-property property) nil t) (setq cnt (1+ cnt)) - (replace-match "")) + (delete-region (match-beginning 0) (1+ (point-at-eol)))) (message "Property \"%s\" removed from %d entries" property cnt))))) (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." (defvar org-read-date-analyze-futurep nil) (defvar org-read-date-analyze-forced-year nil) -(defun org-read-date (&optional with-time to-time from-string prompt +(defun org-read-date (&optional org-with-time to-time from-string prompt default-time default-input) "Read a date, possibly a time, and make things smooth for the user. The 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. +2w --> two weeks from today ++5 --> five days from default date -The function understands only English month and weekday abbreviations, -but this can be configured with the variables `parse-time-months' and -`parse-time-weekdays'. +The function understands only English month and weekday abbreviations. While prompting, a calendar is popped up - you can also select the date 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 user." (require 'parse-time) (let* ((org-time-stamp-rounding-minutes - (if (equal with-time '(16)) '(0 0) org-time-stamp-rounding-minutes)) + (if (equal org-with-time '(16)) '(0 0) org-time-stamp-rounding-minutes)) (org-dcst org-display-custom-times) (ct (org-current-time)) - (def (or org-overriding-default-time default-time ct)) - (defdecode (decode-time def)) + (org-def (or org-overriding-default-time default-time ct)) + (org-defdecode (decode-time org-def)) (dummy (progn - (when (< (nth 2 defdecode) org-extend-today-until) - (setcar (nthcdr 2 defdecode) -1) - (setcar (nthcdr 1 defdecode) 59) - (setq def (apply 'encode-time defdecode) - defdecode (decode-time def))))) + (when (< (nth 2 org-defdecode) org-extend-today-until) + (setcar (nthcdr 2 org-defdecode) -1) + (setcar (nthcdr 1 org-defdecode) 59) + (setq org-def (apply 'encode-time org-defdecode) + org-defdecode (decode-time org-def))))) (calendar-frame-setup nil) (calendar-setup nil) (calendar-move-hook nil) (calendar-view-diary-initially-flag nil) (calendar-view-holidays-initially-flag nil) (timestr (format-time-string - (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def)) + (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") org-def)) (prompt (concat (if prompt (concat prompt " ") "") (format "Date+time [%s]: " timestr))) ans (org-ans0 "") org-ans1 org-ans2 final) @@ -14934,7 +14986,7 @@ user." (calendar) (unwind-protect (progn - (calendar-forward-day (- (time-to-days def) + (calendar-forward-day (- (time-to-days org-def) (calendar-absolute-from-gregorian (calendar-current-date)))) (org-eval-in-calendar nil t) @@ -15020,7 +15072,7 @@ user." (delete-overlay org-read-date-overlay) (setq org-read-date-overlay nil))))) - (setq final (org-read-date-analyze ans def defdecode)) + (setq final (org-read-date-analyze ans org-def org-defdecode)) (when org-read-date-analyze-forced-year (message "Year was forced into %s" @@ -15042,9 +15094,9 @@ user." (nth 2 final) (nth 1 final)) (format "%04d-%02d-%02d" (nth 5 final) (nth 4 final) (nth 3 final)))))) -(defvar def) -(defvar defdecode) -(defvar with-time) +(defvar org-def) +(defvar org-defdecode) +(defvar org-with-time) (defun org-read-date-display () "Display the current date prompt interpretation in the minibuffer." (when org-read-date-display-live @@ -15060,11 +15112,11 @@ user." (let* ((ans (concat (buffer-substring (point-at-bol) (point-max)) " " (or org-ans1 org-ans2))) (org-end-time-was-given nil) - (f (org-read-date-analyze ans def defdecode)) + (f (org-read-date-analyze ans org-def org-defdecode)) (fmts (if org-dcst org-time-stamp-custom-formats org-time-stamp-formats)) - (fmt (if (or with-time + (fmt (if (or org-with-time (and (boundp 'org-time-was-given) org-time-was-given)) (cdr fmts) (car fmts))) @@ -15080,7 +15132,7 @@ user." (make-overlay (1- (point-at-eol)) (point-at-eol))) (org-overlay-display org-read-date-overlay txt 'secondary-selection)))) -(defun org-read-date-analyze (ans def defdecode) +(defun org-read-date-analyze (ans org-def org-defdecode) "Analyze the combined answer of the date prompt." ;; FIXME: cleanup and comment (let ((nowdecode (decode-time (current-time))) @@ -15092,7 +15144,7 @@ user." (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans) (setq ans "+0")) - (when (setq delta (org-read-date-get-relative ans (current-time) def)) + (when (setq delta (org-read-date-get-relative ans (current-time) org-def)) (setq ans (replace-match "" t t ans) deltan (car delta) deltaw (nth 1 delta) @@ -15186,19 +15238,19 @@ user." (substring ans (match-end 7)))))) (setq tl (parse-time-string ans) - day (or (nth 3 tl) (nth 3 defdecode)) + day (or (nth 3 tl) (nth 3 org-defdecode)) month (or (nth 4 tl) (if (and org-read-date-prefer-future (nth 3 tl) (< (nth 3 tl) (nth 3 nowdecode))) (prog1 (1+ (nth 4 nowdecode)) (setq futurep t)) - (nth 4 defdecode))) + (nth 4 org-defdecode))) year (or (and (not kill-year) (nth 5 tl)) (if (and org-read-date-prefer-future (nth 4 tl) (< (nth 4 tl) (nth 4 nowdecode))) (prog1 (1+ (nth 5 nowdecode)) (setq futurep t)) - (nth 5 defdecode))) - hour (or (nth 2 tl) (nth 2 defdecode)) - minute (or (nth 1 tl) (nth 1 defdecode)) + (nth 5 org-defdecode))) + hour (or (nth 2 tl) (nth 2 org-defdecode)) + minute (or (nth 1 tl) (nth 1 org-defdecode)) second (or (nth 0 tl) 0) wday (nth 6 tl)) @@ -15269,13 +15321,12 @@ user." (condition-case nil (ignore (encode-time second minute hour day month year)) (error - (setq year (nth 5 defdecode)) + (setq year (nth 5 org-defdecode)) (setq org-read-date-analyze-forced-year t)))) (setq org-read-date-analyze-futurep futurep) (list second minute hour day month year))) (defvar parse-time-weekdays) - (defun org-read-date-get-relative (s today default) "Check string S for special relative date string. TODAY and DEFAULT are internal times, for today and for a default. @@ -16072,14 +16123,12 @@ in the timestamp determines what will be changed." (defun org-recenter-calendar (date) "If the calendar is visible, recenter it to DATE." - (let* ((win (selected-window)) - (cwin (get-buffer-window "*Calendar*" t)) - (calendar-move-hook nil)) + (let ((cwin (get-buffer-window "*Calendar*" t))) (when cwin - (select-window cwin) - (calendar-goto-date (if (listp date) date - (calendar-gregorian-from-absolute date))) - (select-window win)))) + (let ((calendar-move-hook nil)) + (with-selected-window cwin + (calendar-goto-date (if (listp date) date + (calendar-gregorian-from-absolute date)))))))) (defun org-goto-calendar (&optional arg) "Go to the Emacs calendar at the current date. @@ -16695,6 +16744,8 @@ the cursor is before the first headline, display all fragments in the buffer. The images can be removed again with \\[org-ctrl-c-ctrl-c]." (interactive "P") + (unless buffer-file-name + (error "Can't preview LaTeX fragment in a non-file buffer")) (org-remove-latex-fragment-image-overlays) (save-excursion (save-restriction @@ -16966,7 +17017,7 @@ inspection." (dvifile (concat texfilebase ".dvi")) (pngfile (concat texfilebase ".png")) (fnh (if (featurep 'xemacs) - (font-height (get-face-font 'default)) + (font-height (face-font 'default)) (face-attribute 'default :height nil))) (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0)) (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.)))))) @@ -16995,13 +17046,19 @@ inspection." (if (not (file-exists-p dvifile)) (progn (message "Failed to create dvi file from %s" texfile) nil) (condition-case nil - (call-process "dvipng" nil nil nil + (if (featurep 'xemacs) + (call-process "dvipng" nil nil nil "-fg" fg "-bg" bg - "-D" dpi - ;;"-x" scale "-y" scale "-T" "tight" "-o" pngfile dvifile) + (call-process "dvipng" nil nil nil + "-fg" fg "-bg" bg + "-D" dpi + ;;"-x" scale "-y" scale + "-T" "tight" + "-o" pngfile + dvifile)) (error nil)) (if (not (file-exists-p pngfile)) (if org-format-latex-signal-error @@ -17077,7 +17134,12 @@ SNIPPETS-P indicates if this is run to create snippet images for HTML." "Return an rgb color specification for dvipng." (apply 'format "rgb %s %s %s" (mapcar 'org-normalize-color - (color-values (face-attribute 'default attr nil))))) + (if (featurep 'xemacs) + (color-rgb-components + (face-property 'default + (cond ((eq attr :foreground) 'foreground) + ((eq attr :background) 'background)))) + (color-values (face-attribute 'default attr nil)))))) (defun org-normalize-color (value) "Return string to be used as color value for an RGB component." @@ -17121,7 +17183,7 @@ BEG and END default to the buffer boundaries." (save-restriction (widen) (setq beg (or beg (point-min)) end (or end (point-max))) - (goto-char (point-min)) + (goto-char beg) (let ((re (concat "\\[\\[\\(\\(file:\\)\\|\\([./~]\\)\\)\\([^]\n]+?" (substring (org-image-file-name-regexp) 0 -2) "\\)\\]" (if include-linked "" "\\]"))) @@ -17204,9 +17266,7 @@ BEG and END default to the buffer boundaries." (org-defkey org-mode-map "\C-i" 'org-cycle) (org-defkey org-mode-map [(tab)] 'org-cycle) (org-defkey org-mode-map [(control tab)] 'org-force-cycle-archived) -(org-defkey org-mode-map [(meta tab)] 'pcomplete) (org-defkey org-mode-map "\M-\t" 'pcomplete) -(org-defkey org-mode-map "\M-\C-i" 'pcomplete) ;; The following line is necessary under Suse GNU/Linux (unless (featurep 'xemacs) (org-defkey org-mode-map [S-iso-lefttab] 'org-shifttab)) @@ -17570,7 +17630,7 @@ overwritten, and the table is not marked as requiring realignment." (looking-at "[^|\n]* |")) (let (org-table-may-need-update) (goto-char (1- (match-end 0))) - (delete-char -1) + (backward-delete-char 1) (goto-char (match-beginning 0)) (self-insert-command N))) (t @@ -18424,22 +18484,22 @@ This command does many different things, depending on context: ;; only if function was called with an argument. Send list only ;; if at top item. (let* ((struct (org-list-struct)) - (new-struct struct) - (firstp (= (org-list-get-top-point struct) (point-at-bol)))) + (firstp (= (org-list-get-top-point struct) (point-at-bol))) + old-struct) (when arg - (setq new-struct (copy-tree struct)) + (setq old-struct (copy-tree struct)) (if firstp ;; If at first item of sub-list, add check-box to every ;; item at the same level. (mapc (lambda (pos) - (unless (org-list-get-checkbox pos new-struct) - (org-list-set-checkbox pos new-struct "[ ]"))) + (unless (org-list-get-checkbox pos struct) + (org-list-set-checkbox pos struct "[ ]"))) (org-list-get-all-items - (point-at-bol) new-struct (org-list-prevs-alist new-struct))) - (org-list-set-checkbox (point-at-bol) new-struct "[ ]"))) + (point-at-bol) struct (org-list-prevs-alist struct))) + (org-list-set-checkbox (point-at-bol) struct "[ ]"))) (org-list-write-struct - new-struct (org-list-parents-alist new-struct) struct) + struct (org-list-parents-alist struct) old-struct) (when arg (org-update-checkbox-count-maybe)) (when firstp (org-list-send-list 'maybe)))) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) @@ -19026,7 +19086,8 @@ See the individual commands for more information." (org-inside-LaTeX-fragment-p)] ["Insert citation" org-reftex-citation t] "--" - ["Template for BEAMER" org-insert-beamer-options-template t]) + ["Template for BEAMER" (progn (require 'org-beamer) + (org-insert-beamer-options-template)) t]) "--" ("MobileOrg" ["Push Files and Views" org-mobile-push t] @@ -19253,6 +19314,17 @@ With prefix arg UNCOMPILED, load the uncompiled versions." (eval form) (error (format "%%![Error: %s]" error)))) +(defun org-in-clocktable-p () + "Check if the cursor is in a clocktable." + (let ((pos (point)) start) + (save-excursion + (end-of-line 1) + (and (re-search-backward "^[ \t]*#\\+BEGIN:[ \t]+clocktable" nil t) + (setq start (match-beginning 0)) + (re-search-forward "^[ \t]*#\\+END:.*" nil t) + (>= (match-end 0) pos) + start)))) + (defun org-in-commented-line () "Is point in a line starting with `#'?" (equal (char-after (point-at-bol)) ?#)) @@ -20404,14 +20476,28 @@ beyond the end of the headline." ((not (eq last-command this-command)) (point)) (t refpos))))) ((org-at-item-p) - (goto-char - (if (eq special t) - (cond ((> pos (match-end 0)) (match-end 0)) - ((= pos (point)) (match-end 0)) - (t (point))) - (cond ((> pos (point)) (point)) - ((not (eq last-command this-command)) (point)) - (t (match-end 0)))))))) + ;; Being at an item and not looking at an the item means point + ;; was previously moved to beginning of a visual line, whiche + ;; doesn't contain the item. Therefore, do nothing special, + ;; just stay here. + (when (looking-at org-list-full-item-re) + ;; Set special position at first white space character after + ;; bullet, and check-box, if any. + (let ((after-bullet + (let ((box (match-end 3))) + (if (not box) (match-end 1) + (let ((after (char-after box))) + (if (and after (= after ? )) (1+ box) box)))))) + ;; Special case: Move point to special position when + ;; currently after it or at beginning of line. + (if (eq special t) + (when (or (> pos after-bullet) (= (point) pos)) + (goto-char after-bullet)) + ;; Reversed case: Move point to special position when + ;; point was already at beginning of line and command is + ;; repeated. + (when (and (= (point) pos) (eq last-command this-command)) + (goto-char after-bullet)))))))) (org-no-warnings (and (featurep 'xemacs) (setq zmacs-region-stays t))))) @@ -20450,7 +20536,10 @@ beyond the end of the headline." (move-end-of-line 1) (when (overlays-at (1- (point))) (backward-char 1))) ;; At an item: Move before any hidden text. - (t (call-interactively 'end-of-line))) + (t (call-interactively + (cond ((org-bound-and-true-p line-move-visual) 'end-of-visual-line) + ((fboundp 'move-end-of-line) 'move-end-of-line) + (t 'end-of-line))))) (org-no-warnings (and (featurep 'xemacs) (setq zmacs-region-stays t))))) @@ -20899,6 +20988,7 @@ Stop at the first and last subheadings of a superior heading." (defun org-show-subtree () "Show everything after this heading at deeper levels." + (interactive) (outline-flag-region (point) (save-excursion @@ -20987,8 +21077,8 @@ Show the heading too, if it is currently invisible." (goto-char (point-max)) (while (re-search-backward re nil t) (setq level (org-reduced-level (funcall outline-level))) - (when (<= level n) - (looking-at org-complex-heading-regexp) + (when (and (<= level n) + (looking-at org-complex-heading-regexp)) (setq head (org-link-display-format (org-match-string-no-properties 4)) m (org-imenu-new-marker)) |