diff options
| author | Bastien Guerry | 2014-10-03 10:13:51 +0200 |
|---|---|---|
| committer | Bastien Guerry | 2014-10-03 10:13:51 +0200 |
| commit | a81e5de3a34d27cea43d49ffdfd9755f0eddb262 (patch) | |
| tree | 94d0e2b93f054d2cc9f7f7dc5423561ea3c00a2c | |
| parent | e197284d4789d7caa613fc406516f58fbec02547 (diff) | |
| download | emacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.tar.gz emacs-a81e5de3a34d27cea43d49ffdfd9755f0eddb262.zip | |
Sync with Org 8.2.8.
44 files changed, 2598 insertions, 1823 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 0ad35d3803a..6e0b164b72b 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2014-10-02 Bastien Guerry <bzg@gnu.org> | ||
| 2 | |||
| 3 | * org.texi (Key bindings and useful functions): Fix typo. Use the | ||
| 4 | correct function's name. | ||
| 5 | |||
| 6 | 2014-10-02 Michael Brand <michael.ch.brand@gmail.com> | ||
| 7 | |||
| 8 | * org.texi (Formula syntax for Calc): Add `f-1' to TBLFM example | ||
| 9 | about `nan'. | ||
| 10 | |||
| 11 | 2014-10-02 Nicolas Goaziou <mail@nicolasgoaziou.fr> | ||
| 12 | |||
| 13 | * org.texi (Export settings): Be more explicit about how output | ||
| 14 | file name is built. | ||
| 15 | |||
| 16 | * org.texi (Headings and sectioning structure): Document menus. | ||
| 17 | |||
| 18 | 2014-10-02 Nicolas Goaziou <n.goaziou@gmail.com> | ||
| 19 | |||
| 20 | * org.texi (Include files, Publishing options): Remove reference | ||
| 21 | to inexistent variable. | ||
| 22 | |||
| 1 | 2014-07-25 Stephen Berman <stephen.berman@gmx.net> | 23 | 2014-07-25 Stephen Berman <stephen.berman@gmx.net> |
| 2 | 24 | ||
| 3 | * todo-mode.texi (Marked Items): Correct omission of item deletion | 25 | * todo-mode.texi (Marked Items): Correct omission of item deletion |
diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 3800a41d239..d8a83fc18a4 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | @c %**start of header | 2 | @c %**start of header |
| 3 | @setfilename ../../info/org | 3 | @setfilename ../../info/org |
| 4 | @settitle The Org Manual | 4 | @settitle The Org Manual |
| 5 | @set VERSION 8.2.6 | 5 | @set VERSION 8.2.8 |
| 6 | 6 | ||
| 7 | @c Version and Contact Info | 7 | @c Version and Contact Info |
| 8 | @set MAINTAINERSITE @uref{http://orgmode.org,maintainers web page} | 8 | @set MAINTAINERSITE @uref{http://orgmode.org,maintainers web page} |
| @@ -584,8 +584,9 @@ Exporting | |||
| 584 | * Markdown export:: Exporting to Markdown | 584 | * Markdown export:: Exporting to Markdown |
| 585 | * OpenDocument Text export:: Exporting to OpenDocument Text | 585 | * OpenDocument Text export:: Exporting to OpenDocument Text |
| 586 | * Org export:: Exporting to Org | 586 | * Org export:: Exporting to Org |
| 587 | * Texinfo export:: Exporting to Texinfo | ||
| 587 | * iCalendar export:: Exporting to iCalendar | 588 | * iCalendar export:: Exporting to iCalendar |
| 588 | * Other built-in back-ends:: Exporting to @code{Texinfo} or a man page | 589 | * Other built-in back-ends:: Exporting to a man page |
| 589 | * Export in foreign buffers:: Author tables and lists in Org syntax | 590 | * Export in foreign buffers:: Author tables and lists in Org syntax |
| 590 | * Advanced configuration:: Fine-tuning the export output | 591 | * Advanced configuration:: Fine-tuning the export output |
| 591 | 592 | ||
| @@ -637,6 +638,16 @@ Advanced topics in ODT export | |||
| 637 | * Customizing tables in ODT export:: How to define and use Table templates | 638 | * Customizing tables in ODT export:: How to define and use Table templates |
| 638 | * Validating OpenDocument XML:: How to debug corrupt OpenDocument files | 639 | * Validating OpenDocument XML:: How to debug corrupt OpenDocument files |
| 639 | 640 | ||
| 641 | Texinfo export | ||
| 642 | |||
| 643 | * Texinfo export commands:: How to invoke Texinfo export | ||
| 644 | * Document preamble:: File header, title and copyright page | ||
| 645 | * Headings and sectioning structure:: Building document structure | ||
| 646 | * Indices:: Creating indices | ||
| 647 | * Quoting Texinfo code:: Incorporating literal Texinfo code | ||
| 648 | * Texinfo specific attributes:: Controlling Texinfo output | ||
| 649 | * An example:: | ||
| 650 | |||
| 640 | Publishing | 651 | Publishing |
| 641 | 652 | ||
| 642 | * Configuration:: Defining projects | 653 | * Configuration:: Defining projects |
| @@ -2725,9 +2736,11 @@ Operations, , Logical Operations, calc, GNU Emacs Calc Manual}). For example | |||
| 2725 | @item if($1 < 20, teen, string("")) | 2736 | @item if($1 < 20, teen, string("")) |
| 2726 | "teen" if age $1 is less than 20, else the Org table result field is set to | 2737 | "teen" if age $1 is less than 20, else the Org table result field is set to |
| 2727 | empty with the empty string. | 2738 | empty with the empty string. |
| 2728 | @item if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E | 2739 | @item if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1 |
| 2729 | Sum of the first two columns. When at least one of the input fields is empty | 2740 | Sum of the first two columns. When at least one of the input fields is empty |
| 2730 | the Org table result field is set to empty. | 2741 | the Org table result field is set to empty. @samp{E} is required to not |
| 2742 | convert empty fields to 0. @samp{f-1} is an optional Calc format string | ||
| 2743 | similar to @samp{%.1f} but leaves empty results empty. | ||
| 2731 | @item if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E | 2744 | @item if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7); E |
| 2732 | Mean value of a range unless there is any empty field. Every field in the | 2745 | Mean value of a range unless there is any empty field. Every field in the |
| 2733 | range that is empty is replaced by @samp{nan} which lets @samp{vmean} result | 2746 | range that is empty is replaced by @samp{nan} which lets @samp{vmean} result |
| @@ -4410,7 +4423,7 @@ To record a timestamp without a note for TODO keywords configured with | |||
| 4410 | 4423 | ||
| 4411 | @noindent | 4424 | @noindent |
| 4412 | @vindex org-log-done | 4425 | @vindex org-log-done |
| 4413 | you not only define global TODO keywords and fast access keys, but also | 4426 | You not only define global TODO keywords and fast access keys, but also |
| 4414 | request that a time is recorded when the entry is set to | 4427 | request that a time is recorded when the entry is set to |
| 4415 | DONE@footnote{It is possible that Org mode will record two timestamps | 4428 | DONE@footnote{It is possible that Org mode will record two timestamps |
| 4416 | when you are using both @code{org-log-done} and state change logging. | 4429 | when you are using both @code{org-log-done} and state change logging. |
| @@ -9951,11 +9964,10 @@ include your @file{.emacs} file, you could use: | |||
| 9951 | @end example | 9964 | @end example |
| 9952 | 9965 | ||
| 9953 | @noindent | 9966 | @noindent |
| 9954 | The optional second and third parameter are the markup (e.g., @samp{quote}, | 9967 | The optional second and third parameter are the markup (i.e., @samp{example} |
| 9955 | @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the | 9968 | or @samp{src}), and, if the markup is @samp{src}, the language for formatting |
| 9956 | language for formatting the contents. The markup is optional; if it is not | 9969 | the contents. The markup is optional; if it is not given, the text will be |
| 9957 | given, the text will be assumed to be in Org mode format and will be | 9970 | assumed to be in Org mode format and will be processed normally. |
| 9958 | processed normally. | ||
| 9959 | 9971 | ||
| 9960 | Contents of the included file will belong to the same structure (headline, | 9972 | Contents of the included file will belong to the same structure (headline, |
| 9961 | item) containing the @code{INCLUDE} keyword. In particular, headlines within | 9973 | item) containing the @code{INCLUDE} keyword. In particular, headlines within |
| @@ -10364,8 +10376,9 @@ in the iCalendar format. | |||
| 10364 | * Markdown export:: Exporting to Markdown | 10376 | * Markdown export:: Exporting to Markdown |
| 10365 | * OpenDocument Text export:: Exporting to OpenDocument Text | 10377 | * OpenDocument Text export:: Exporting to OpenDocument Text |
| 10366 | * Org export:: Exporting to Org | 10378 | * Org export:: Exporting to Org |
| 10379 | * Texinfo export:: Exporting to Texinfo | ||
| 10367 | * iCalendar export:: Exporting to iCalendar | 10380 | * iCalendar export:: Exporting to iCalendar |
| 10368 | * Other built-in back-ends:: Exporting to @code{Texinfo} or a man page | 10381 | * Other built-in back-ends:: Exporting to a man page |
| 10369 | * Export in foreign buffers:: Author tables and lists in Org syntax | 10382 | * Export in foreign buffers:: Author tables and lists in Org syntax |
| 10370 | * Advanced configuration:: Fine-tuning the export output | 10383 | * Advanced configuration:: Fine-tuning the export output |
| 10371 | @end menu | 10384 | @end menu |
| @@ -10690,16 +10703,12 @@ Toggle inclusion of TODO keywords into exported text | |||
| 10690 | Toggle inclusion of tables (@code{org-export-with-tables}). | 10703 | Toggle inclusion of tables (@code{org-export-with-tables}). |
| 10691 | @end table | 10704 | @end table |
| 10692 | 10705 | ||
| 10693 | @cindex property, EXPORT_FILE_NAME | ||
| 10694 | When exporting only a subtree, each of the previous keywords@footnote{With | 10706 | When exporting only a subtree, each of the previous keywords@footnote{With |
| 10695 | the exception of @samp{SETUPFILE}.} can be overridden locally by special node | 10707 | the exception of @samp{SETUPFILE}.} can be overridden locally by special node |
| 10696 | properties. These begin with @samp{EXPORT_}, followed by the name of the | 10708 | properties. These begin with @samp{EXPORT_}, followed by the name of the |
| 10697 | keyword they supplant. For example, @samp{DATE} and @samp{OPTIONS} keywords | 10709 | keyword they supplant. For example, @samp{DATE} and @samp{OPTIONS} keywords |
| 10698 | become, respectively, @samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS} | 10710 | become, respectively, @samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS} |
| 10699 | properties. Subtree export also supports the self-explicit | 10711 | properties. |
| 10700 | @samp{EXPORT_FILE_NAME} property@footnote{There is no buffer-wide equivalent | ||
| 10701 | for this property. The file name in this case is derived from the file | ||
| 10702 | associated to the buffer, if possible, or asked to the user otherwise.}. | ||
| 10703 | 10712 | ||
| 10704 | @cindex #+BIND | 10713 | @cindex #+BIND |
| 10705 | @vindex org-export-allow-bind-keywords | 10714 | @vindex org-export-allow-bind-keywords |
| @@ -10708,6 +10717,13 @@ can become buffer-local during export by using the BIND keyword. Its syntax | |||
| 10708 | is @samp{#+BIND: variable value}. This is particularly useful for in-buffer | 10717 | is @samp{#+BIND: variable value}. This is particularly useful for in-buffer |
| 10709 | settings that cannot be changed using specific keywords. | 10718 | settings that cannot be changed using specific keywords. |
| 10710 | 10719 | ||
| 10720 | @cindex property, EXPORT_FILE_NAME | ||
| 10721 | The name of the output file to be generated is taken from the file associated | ||
| 10722 | to the buffer, when possible, or asked to you otherwise. For subtree export, | ||
| 10723 | you can also set @samp{EXPORT_FILE_NAME} property. In all cases, only the | ||
| 10724 | base name of the file is retained, and a back-end specific extension is | ||
| 10725 | added. | ||
| 10726 | |||
| 10711 | @node ASCII/Latin-1/UTF-8 export, Beamer export, Export settings, Exporting | 10727 | @node ASCII/Latin-1/UTF-8 export, Beamer export, Export settings, Exporting |
| 10712 | @section ASCII/Latin-1/UTF-8 export | 10728 | @section ASCII/Latin-1/UTF-8 export |
| 10713 | @cindex ASCII export | 10729 | @cindex ASCII export |
| @@ -12228,7 +12244,7 @@ height:width ratio, do the following | |||
| 12228 | @cindex #+ATTR_ODT | 12244 | @cindex #+ATTR_ODT |
| 12229 | You can control the manner in which an image is anchored by setting the | 12245 | You can control the manner in which an image is anchored by setting the |
| 12230 | @code{:anchor} property of it's @code{#+ATTR_ODT} line. You can specify one | 12246 | @code{:anchor} property of it's @code{#+ATTR_ODT} line. You can specify one |
| 12231 | of the the following three values for the @code{:anchor} property: | 12247 | of the following three values for the @code{:anchor} property: |
| 12232 | @samp{"as-char"}, @samp{"paragraph"} and @samp{"page"}. | 12248 | @samp{"as-char"}, @samp{"paragraph"} and @samp{"page"}. |
| 12233 | 12249 | ||
| 12234 | To create an image that is anchored to a page, do the following: | 12250 | To create an image that is anchored to a page, do the following: |
| @@ -12834,7 +12850,324 @@ Export to a temporary buffer. Do not create a file. | |||
| 12834 | Export to an Org file, then open it. | 12850 | Export to an Org file, then open it. |
| 12835 | @end table | 12851 | @end table |
| 12836 | 12852 | ||
| 12837 | @node iCalendar export, Other built-in back-ends, Org export, Exporting | 12853 | @node Texinfo export, iCalendar export, Org export, Exporting |
| 12854 | @section Texinfo export | ||
| 12855 | @cindex Texinfo export | ||
| 12856 | |||
| 12857 | @samp{texinfo} export back-end generates Texinfo code and can compile it into | ||
| 12858 | an Info file. | ||
| 12859 | |||
| 12860 | @menu | ||
| 12861 | * Texinfo export commands:: How to invoke Texinfo export | ||
| 12862 | * Document preamble:: File header, title and copyright page | ||
| 12863 | * Headings and sectioning structure:: Building document structure | ||
| 12864 | * Indices:: Creating indices | ||
| 12865 | * Quoting Texinfo code:: Incorporating literal Texinfo code | ||
| 12866 | * Texinfo specific attributes:: Controlling Texinfo output | ||
| 12867 | * An example:: | ||
| 12868 | @end menu | ||
| 12869 | |||
| 12870 | @node Texinfo export commands, Document preamble, Texinfo export, Texinfo export | ||
| 12871 | @subsection Texinfo export commands | ||
| 12872 | |||
| 12873 | @vindex org-texinfo-info-process | ||
| 12874 | @table @kbd | ||
| 12875 | @orgcmd{C-c C-e i t,org-texinfo-export-to-texinfo} | ||
| 12876 | Export as a Texinfo file. For an Org file, @file{myfile.org}, the resulting | ||
| 12877 | file will be @file{myfile.texi}. The file will be overwritten without | ||
| 12878 | warning. | ||
| 12879 | @orgcmd{C-c C-e i i,org-texinfo-export-to-info} | ||
| 12880 | Export to Texinfo and then process to an Info file@footnote{By setting | ||
| 12881 | @code{org-texinfo-info-process}, it is possible to generate other formats, | ||
| 12882 | including DocBook.}. | ||
| 12883 | @end table | ||
| 12884 | |||
| 12885 | @node Document preamble, Headings and sectioning structure, Texinfo export commands, Texinfo export | ||
| 12886 | @subsection Document preamble | ||
| 12887 | |||
| 12888 | When processing a document, @samp{texinfo} back-end generates a minimal file | ||
| 12889 | header along with a title page, a copyright page, and a menu. You control | ||
| 12890 | the latter through the structure of the document (@pxref{Headings and | ||
| 12891 | sectioning structure}). Various keywords allow to tweak the other parts. It | ||
| 12892 | is also possible to give directions to install the document in the @samp{Top} | ||
| 12893 | node. | ||
| 12894 | |||
| 12895 | @subsubheading File header | ||
| 12896 | |||
| 12897 | @cindex #+TEXINFO_FILENAME | ||
| 12898 | Upon creating the header of a Texinfo file, the back-end guesses a name for | ||
| 12899 | the Info file to be compiled. This may not be a sensible choice, e.g., if | ||
| 12900 | you want to produce the final document in a different directory. Specify an | ||
| 12901 | alternate path with @code{#+TEXINFO_FILENAME} keyword to override the default | ||
| 12902 | destination. | ||
| 12903 | |||
| 12904 | @vindex org-texinfo-coding-system | ||
| 12905 | @vindex org-texinfo-classes | ||
| 12906 | @cindex #+TEXINFO_HEADER | ||
| 12907 | @cindex #+TEXINFO_CLASS | ||
| 12908 | Along with the output file name, the header contains information about the | ||
| 12909 | language (@pxref{Export settings}) and current encoding used@footnote{See | ||
| 12910 | @code{org-texinfo-coding-system} for more information.}. Insert | ||
| 12911 | a @code{#+TEXINFO_HEADER} keyword for each additional command needed, e.g., | ||
| 12912 | @@code@{@@synindex@}. | ||
| 12913 | |||
| 12914 | If you happen to regularly install the same set of commands, it may be easier | ||
| 12915 | to define your own class in @code{org-texinfo-classes}, which see. Set | ||
| 12916 | @code{#+TEXINFO_CLASS} keyword accordingly in your document to activate it. | ||
| 12917 | |||
| 12918 | @subsubheading Title and copyright page | ||
| 12919 | |||
| 12920 | @cindex #+TEXINFO_PRINTED_TITLE | ||
| 12921 | @cindex #+SUBTITLE | ||
| 12922 | The default template includes a title page for hard copy output. The title | ||
| 12923 | and author displayed on this page are extracted from, respectively, | ||
| 12924 | @code{#+TITLE} and @code{#+AUTHOR} keywords (@pxref{Export settings}). It is | ||
| 12925 | also possible to print a different, more specific, title with | ||
| 12926 | @code{#+TEXINFO_PRINTED_TITLE} keyword, and add subtitles with | ||
| 12927 | @code{#+SUBTITLE} keyword. Both expect raw Texinfo code in their value. | ||
| 12928 | |||
| 12929 | @cindex #+SUBAUTHOR | ||
| 12930 | Likewise, information brought by @code{#+AUTHOR} may not be enough. You can | ||
| 12931 | include other authors with several @code{#+SUBAUTHOR} keywords. Values are | ||
| 12932 | also expected to be written in Texinfo code. | ||
| 12933 | |||
| 12934 | @example | ||
| 12935 | #+AUTHOR: Jane Smith | ||
| 12936 | #+SUBAUTHOR: John Doe | ||
| 12937 | #+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@} | ||
| 12938 | @end example | ||
| 12939 | |||
| 12940 | @cindex property, COPYING | ||
| 12941 | Copying material is defined in a dedicated headline with a non-nil | ||
| 12942 | @code{:COPYING:} property. The contents are inserted within | ||
| 12943 | a @code{@@copying} command at the beginning of the document whereas the | ||
| 12944 | heading itself does not appear in the structure of the document. | ||
| 12945 | |||
| 12946 | Copyright information is printed on the back of the title page. | ||
| 12947 | |||
| 12948 | @example | ||
| 12949 | * Copying | ||
| 12950 | :PROPERTIES: | ||
| 12951 | :COPYING: t | ||
| 12952 | :END: | ||
| 12953 | |||
| 12954 | This is a short example of a complete Texinfo file, version 1.0. | ||
| 12955 | |||
| 12956 | Copyright \copy 2014 Free Software Foundation, Inc. | ||
| 12957 | @end example | ||
| 12958 | |||
| 12959 | @subsubheading The Top node | ||
| 12960 | |||
| 12961 | @cindex #+TEXINFO_DIR_CATEGORY | ||
| 12962 | @cindex #+TEXINFO_DIR_TITLE | ||
| 12963 | @cindex #+TEXINFO_DIR_DESC | ||
| 12964 | You may ultimately want to install your new Info file to your system. You | ||
| 12965 | can write an appropriate entry in the top level directory specifying its | ||
| 12966 | category and title with, respectively, @code{#+TEXINFO_DIR_CATEGORY} and | ||
| 12967 | @code{#+TEXINFO_DIR_TITLE}. Optionally, you can add a short description | ||
| 12968 | using @code{#+TEXINFO_DIR_DESC}. The following example would write an entry | ||
| 12969 | similar to Org's in the @samp{Top} node. | ||
| 12970 | |||
| 12971 | @example | ||
| 12972 | #+TEXINFO_DIR_CATEGORY: Emacs | ||
| 12973 | #+TEXINFO_DIR_TITLE: Org Mode: (org) | ||
| 12974 | #+TEXINFO_DIR_DESC: Outline-based notes management and organizer | ||
| 12975 | @end example | ||
| 12976 | |||
| 12977 | @node Headings and sectioning structure, Indices, Document preamble, Texinfo export | ||
| 12978 | @subsection Headings and sectioning structure | ||
| 12979 | |||
| 12980 | @vindex org-texinfo-classes | ||
| 12981 | @vindex org-texinfo-default-class | ||
| 12982 | @cindex #+TEXINFO_CLASS | ||
| 12983 | @samp{texinfo} uses a pre-defined scheme, or class, to convert headlines into | ||
| 12984 | Texinfo structuring commands. For example, a top level headline appears as | ||
| 12985 | @code{@@chapter} if it should be numbered or as @code{@@unnumbered} | ||
| 12986 | otherwise. If you need to use a different set of commands, e.g., to start | ||
| 12987 | with @code{@@part} instead of @code{@@chapter}, install a new class in | ||
| 12988 | @code{org-texinfo-classes}, then activate it with @code{#+TEXINFO_CLASS} | ||
| 12989 | keyword. Export process defaults to @code{org-texinfo-default-class} when | ||
| 12990 | there is no such keyword in the document. | ||
| 12991 | |||
| 12992 | If a headline's level has no associated structuring command, or is below | ||
| 12993 | a certain threshold @pxref{Export settings}, that headline becomes a list in | ||
| 12994 | Texinfo output. | ||
| 12995 | |||
| 12996 | @cindex property, APPENDIX | ||
| 12997 | As an exception, a headline with a non-nil @code{:APPENDIX:} property becomes | ||
| 12998 | an appendix, independently on its level and the class used. | ||
| 12999 | |||
| 13000 | @cindex property, DESCRIPTION | ||
| 13001 | Each regular sectioning structure creates a menu entry, named after the | ||
| 13002 | heading. You can provide a different, e.g., shorter, title in | ||
| 13003 | @code{:ALT_TITLE:} property (@pxref{Table of contents}). Optionally, you can | ||
| 13004 | specify a description for the item in @code{:DESCRIPTION:} property. E.g., | ||
| 13005 | |||
| 13006 | @example | ||
| 13007 | * Controlling Screen Display | ||
| 13008 | :PROPERTIES: | ||
| 13009 | :ALT_TITLE: Display | ||
| 13010 | :DESCRIPTION: Controlling Screen Display | ||
| 13011 | :END: | ||
| 13012 | @end example | ||
| 13013 | |||
| 13014 | @node Indices, Quoting Texinfo code, Headings and sectioning structure, Texinfo export | ||
| 13015 | @subsection Indices | ||
| 13016 | |||
| 13017 | @cindex #+CINDEX | ||
| 13018 | @cindex #+FINDEX | ||
| 13019 | @cindex #+KINDEX | ||
| 13020 | @cindex #+PINDEX | ||
| 13021 | @cindex #+TINDEX | ||
| 13022 | @cindex #+VINDEX | ||
| 13023 | Index entries are created using dedicated keywords. @samp{texinfo} back-end | ||
| 13024 | provides one for each predefined type: @code{#+CINDEX}, @code{#+FINDEX}, | ||
| 13025 | @code{#+KINDEX}, @code{#+PINDEX}, @code{#+TINDEX} and @code{#+VINDEX}. For | ||
| 13026 | custom indices, you can write raw Texinfo code (@pxref{Quoting Texinfo | ||
| 13027 | code}). | ||
| 13028 | |||
| 13029 | @example | ||
| 13030 | #+CINDEX: Defining indexing entries | ||
| 13031 | @end example | ||
| 13032 | |||
| 13033 | @cindex property, INDEX | ||
| 13034 | To generate an index, you need to set the @code{:INDEX:} property of | ||
| 13035 | a headline to an appropriate abbreviation (e.g., @samp{cp} or @samp{vr}). | ||
| 13036 | The headline is then exported as an unnumbered chapter or section command and | ||
| 13037 | the index is inserted after its contents. | ||
| 13038 | |||
| 13039 | @example | ||
| 13040 | * Concept Index | ||
| 13041 | :PROPERTIES: | ||
| 13042 | :INDEX: cp | ||
| 13043 | :END: | ||
| 13044 | @end example | ||
| 13045 | |||
| 13046 | @node Quoting Texinfo code, Texinfo specific attributes, Indices, Texinfo export | ||
| 13047 | @subsection Quoting Texinfo code | ||
| 13048 | |||
| 13049 | It is possible to insert raw Texinfo code using any of the following | ||
| 13050 | constructs | ||
| 13051 | |||
| 13052 | @cindex #+TEXINFO | ||
| 13053 | @cindex #+BEGIN_TEXINFO | ||
| 13054 | @example | ||
| 13055 | Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU. | ||
| 13056 | |||
| 13057 | #+TEXINFO: @@need800 | ||
| 13058 | This paragraph is preceded by... | ||
| 13059 | |||
| 13060 | #+BEGIN_TEXINFO | ||
| 13061 | @@auindex Johnson, Mark | ||
| 13062 | @@auindex Lakoff, George | ||
| 13063 | #+END_TEXINFO | ||
| 13064 | @end example | ||
| 13065 | |||
| 13066 | @node Texinfo specific attributes, An example, Quoting Texinfo code, Texinfo export | ||
| 13067 | @subsection Texinfo specific attributes | ||
| 13068 | |||
| 13069 | @cindex #+ATTR_TEXINFO | ||
| 13070 | @samp{texinfo} back-end understands several attributes in plain lists and | ||
| 13071 | tables. They must be specified using an @code{#+ATTR_TEXINFO} keyword, | ||
| 13072 | written just above the list or table. | ||
| 13073 | |||
| 13074 | @subsubheading Plain lists | ||
| 13075 | |||
| 13076 | In Texinfo output, description lists appear as two-column tables, using the | ||
| 13077 | default command @code{@@table}. You can use @code{@@ftable} or | ||
| 13078 | @code{@@vtable}@footnote{For more information, @inforef{Two-column | ||
| 13079 | Tables,,texinfo}.} instead with @code{:table-type} attribute. | ||
| 13080 | |||
| 13081 | @vindex org-texinfo-def-table-markup | ||
| 13082 | In any case, these constructs require a highlighting command for entries in | ||
| 13083 | the list. You can provide one with @code{:indic} attribute. If you do not, | ||
| 13084 | it defaults to the value stored in @code{org-texinfo-def-table-markup}, which | ||
| 13085 | see. | ||
| 13086 | |||
| 13087 | @example | ||
| 13088 | #+ATTR_TEXINFO: :indic @@asis | ||
| 13089 | - foo :: This is the text for /foo/, with no highlighting. | ||
| 13090 | @end example | ||
| 13091 | |||
| 13092 | @subsubheading Tables | ||
| 13093 | |||
| 13094 | When exporting a table, column widths are deduced from the longest cell in | ||
| 13095 | each column. You can also define them explicitly as fractions of the line | ||
| 13096 | length, using @code{:columns} attribute. | ||
| 13097 | |||
| 13098 | @example | ||
| 13099 | #+ATTR_TEXINFO: :columns .5 .5 | ||
| 13100 | | a cell | another cell | | ||
| 13101 | @end example | ||
| 13102 | |||
| 13103 | @node An example, , Texinfo specific attributes, Texinfo export | ||
| 13104 | @subsection An example | ||
| 13105 | |||
| 13106 | Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}. | ||
| 13107 | |||
| 13108 | @smallexample | ||
| 13109 | #+MACRO: version 2.0 | ||
| 13110 | #+MACRO: updated last updated 4 March 2014 | ||
| 13111 | |||
| 13112 | #+OPTIONS: ':t toc:t author:t email:t | ||
| 13113 | #+TITLE: GNU Sample @{@{@{version@}@}@} | ||
| 13114 | #+AUTHOR: A.U. Thor | ||
| 13115 | #+EMAIL: bug-sample@@gnu.org | ||
| 13116 | #+LANGUAGE: en | ||
| 13117 | |||
| 13118 | #+TEXINFO_FILENAME: sample.info | ||
| 13119 | #+TEXINFO_HEADER: @@syncodeindex pg cp | ||
| 13120 | |||
| 13121 | #+TEXINFO_DIR_CATEGORY: Texinfo documentation system | ||
| 13122 | #+TEXINFO_DIR_TITLE: sample: (sample) | ||
| 13123 | #+TEXINFO_DIR_DESC: Invoking sample | ||
| 13124 | |||
| 13125 | #+TEXINFO_PRINTED_TITLE: GNU Sample | ||
| 13126 | #+SUBTITLE: for version 2.0, last updated 4 March 2014 | ||
| 13127 | |||
| 13128 | * Copying | ||
| 13129 | :PROPERTIES: | ||
| 13130 | :COPYING: t | ||
| 13131 | :END: | ||
| 13132 | |||
| 13133 | This manual is for GNU Sample (version @{@{@{version@}@}@}, | ||
| 13134 | @{@{@{updated@}@}@}), which is an example in the Texinfo documentation. | ||
| 13135 | |||
| 13136 | Copyright @@@@texinfo:@@copyright@{@}@@@@ 2013 Free Software Foundation, | ||
| 13137 | Inc. | ||
| 13138 | |||
| 13139 | #+BEGIN_QUOTE | ||
| 13140 | Permission is granted to copy, distribute and/or modify this | ||
| 13141 | document under the terms of the GNU Free Documentation License, | ||
| 13142 | Version 1.3 or any later version published by the Free Software | ||
| 13143 | Foundation; with no Invariant Sections, with no Front-Cover Texts, | ||
| 13144 | and with no Back-Cover Texts. A copy of the license is included in | ||
| 13145 | the section entitled "GNU Free Documentation License". | ||
| 13146 | #+END_QUOTE | ||
| 13147 | |||
| 13148 | * Invoking sample | ||
| 13149 | |||
| 13150 | #+PINDEX: sample | ||
| 13151 | #+CINDEX: invoking @@command@{sample@} | ||
| 13152 | |||
| 13153 | This is a sample manual. There is no sample program to invoke, but | ||
| 13154 | if there were, you could see its basic usage and command line | ||
| 13155 | options here. | ||
| 13156 | |||
| 13157 | * GNU Free Documentation License | ||
| 13158 | :PROPERTIES: | ||
| 13159 | :APPENDIX: t | ||
| 13160 | :END: | ||
| 13161 | |||
| 13162 | #+TEXINFO: @@include fdl.texi | ||
| 13163 | |||
| 13164 | * Index | ||
| 13165 | :PROPERTIES: | ||
| 13166 | :INDEX: cp | ||
| 13167 | :END: | ||
| 13168 | @end smallexample | ||
| 13169 | |||
| 13170 | @node iCalendar export, Other built-in back-ends, Texinfo export, Exporting | ||
| 12838 | @section iCalendar export | 13171 | @section iCalendar export |
| 12839 | @cindex iCalendar export | 13172 | @cindex iCalendar export |
| 12840 | 13173 | ||
| @@ -12912,12 +13245,11 @@ On top of the aforementioned back-ends, Org comes with other built-in ones: | |||
| 12912 | 13245 | ||
| 12913 | @itemize | 13246 | @itemize |
| 12914 | @item @file{ox-man.el}: export to a man page. | 13247 | @item @file{ox-man.el}: export to a man page. |
| 12915 | @item @file{ox-texinfo.el}: export to @code{Texinfo} format. | ||
| 12916 | @end itemize | 13248 | @end itemize |
| 12917 | 13249 | ||
| 12918 | To activate these export back-end, customize @code{org-export-backends} or | 13250 | To activate these export back-end, customize @code{org-export-backends} or |
| 12919 | load them directly with e.g., @code{(require 'ox-texinfo)}. This will add | 13251 | load them directly with e.g., @code{(require 'ox-man)}. This will add new |
| 12920 | new keys in the export dispatcher (@pxref{The Export Dispatcher}). | 13252 | keys in the export dispatcher (@pxref{The Export Dispatcher}). |
| 12921 | 13253 | ||
| 12922 | See the comment section of these files for more information on how to use | 13254 | See the comment section of these files for more information on how to use |
| 12923 | them. | 13255 | them. |
| @@ -13334,7 +13666,6 @@ string of these options for details. | |||
| 13334 | @item @code{:headline-levels} @tab @code{org-export-headline-levels} | 13666 | @item @code{:headline-levels} @tab @code{org-export-headline-levels} |
| 13335 | @item @code{:language} @tab @code{org-export-default-language} | 13667 | @item @code{:language} @tab @code{org-export-default-language} |
| 13336 | @item @code{:preserve-breaks} @tab @code{org-export-preserve-breaks} | 13668 | @item @code{:preserve-breaks} @tab @code{org-export-preserve-breaks} |
| 13337 | @item @code{:publishing-directory} @tab @code{org-export-publishing-directory} | ||
| 13338 | @item @code{:section-numbers} @tab @code{org-export-with-section-numbers} | 13669 | @item @code{:section-numbers} @tab @code{org-export-with-section-numbers} |
| 13339 | @item @code{:select-tags} @tab @code{org-export-select-tags} | 13670 | @item @code{:select-tags} @tab @code{org-export-select-tags} |
| 13340 | @item @code{:with-author} @tab @code{org-export-with-author} | 13671 | @item @code{:with-author} @tab @code{org-export-with-author} |
| @@ -15473,10 +15804,10 @@ are active: | |||
| 15473 | @item @kbd{C-c C-c} @tab @code{org-babel-execute-src-block} | 15804 | @item @kbd{C-c C-c} @tab @code{org-babel-execute-src-block} |
| 15474 | @kindex C-c C-o | 15805 | @kindex C-c C-o |
| 15475 | @item @kbd{C-c C-o} @tab @code{org-babel-open-src-block-result} | 15806 | @item @kbd{C-c C-o} @tab @code{org-babel-open-src-block-result} |
| 15476 | @kindex C-up | 15807 | @kindex M-up |
| 15477 | @item @kbd{C-@key{up}} @tab @code{org-babel-load-in-session} | 15808 | @item @kbd{M-@key{up}} @tab @code{org-babel-load-in-session} |
| 15478 | @kindex M-down | 15809 | @kindex M-down |
| 15479 | @item @kbd{M-@key{down}} @tab @code{org-babel-pop-to-session} | 15810 | @item @kbd{M-@key{down}} @tab @code{org-babel-switch-to-session} |
| 15480 | @end multitable | 15811 | @end multitable |
| 15481 | 15812 | ||
| 15482 | In an Org mode buffer, the following key bindings are active: | 15813 | In an Org mode buffer, the following key bindings are active: |
| @@ -18208,7 +18539,6 @@ org-customize @key{RET}} and then click yourself through the tree. | |||
| 18208 | @bye | 18539 | @bye |
| 18209 | 18540 | ||
| 18210 | @c Local variables: | 18541 | @c Local variables: |
| 18211 | @c coding: utf-8 | ||
| 18212 | @c fill-column: 77 | 18542 | @c fill-column: 77 |
| 18213 | @c indent-tabs-mode: nil | 18543 | @c indent-tabs-mode: nil |
| 18214 | @c paragraph-start: "\\|^@[a-zA-Z]*[ \n]\\|^@x?org\\(key\\|cmd\\)\\|\f\\|[ ]*$" | 18544 | @c paragraph-start: "\\|^@[a-zA-Z]*[ \n]\\|^@x?org\\(key\\|cmd\\)\\|\f\\|[ ]*$" |
diff --git a/etc/org/OrgOdtContentTemplate.xml b/etc/org/OrgOdtContentTemplate.xml index 55e1b787066..d0c98a3e51c 100644 --- a/etc/org/OrgOdtContentTemplate.xml +++ b/etc/org/OrgOdtContentTemplate.xml | |||
| @@ -46,7 +46,19 @@ | |||
| 46 | 46 | ||
| 47 | <!-- automatic styles --> | 47 | <!-- automatic styles --> |
| 48 | <office:automatic-styles> | 48 | <office:automatic-styles> |
| 49 | |||
| 49 | <!-- Section styles --> | 50 | <!-- Section styles --> |
| 51 | |||
| 52 | <!-- Section styles for Table Of Contents and Other Indices --> | ||
| 53 | <style:style style:name="OrgIndexSection" style:family="section"> | ||
| 54 | <style:section-properties fo:background-color="#c0c0c0" style:editable="false"> | ||
| 55 | <style:columns fo:column-count="1" fo:column-gap="0cm"/> | ||
| 56 | <style:background-image/> | ||
| 57 | </style:section-properties> | ||
| 58 | </style:style> | ||
| 59 | |||
| 60 | <!-- Indented sections, used as container for tables that occur | ||
| 61 | within list items --> | ||
| 50 | <style:style style:name="OrgIndentedSection-Level-1" style:family="section"> | 62 | <style:style style:name="OrgIndentedSection-Level-1" style:family="section"> |
| 51 | <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="1.281cm" fo:margin-right="0cm" style:editable="false"> | 63 | <style:section-properties text:dont-balance-text-columns="false" fo:margin-left="1.281cm" fo:margin-right="0cm" style:editable="false"> |
| 52 | <style:columns fo:column-count="1" fo:column-gap="0cm"/> | 64 | <style:columns fo:column-count="1" fo:column-gap="0cm"/> |
diff --git a/etc/org/OrgOdtStyles.xml b/etc/org/OrgOdtStyles.xml index 5dfcfa83890..f41d9840cbe 100644 --- a/etc/org/OrgOdtStyles.xml +++ b/etc/org/OrgOdtStyles.xml | |||
| @@ -86,7 +86,11 @@ | |||
| 86 | 86 | ||
| 87 | <style:style style:name="Standard" style:family="paragraph" style:class="text"/> | 87 | <style:style style:name="Standard" style:family="paragraph" style:class="text"/> |
| 88 | <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text"> | 88 | <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text"> |
| 89 | <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"/> | 89 | <style:paragraph-properties fo:margin-top="0.423cm" fo:margin-bottom="0.212cm" fo:keep-with-next="always"> |
| 90 | <style:tab-stops> | ||
| 91 | <style:tab-stop style:position="17cm" style:type="right"/> | ||
| 92 | </style:tab-stops> | ||
| 93 | </style:paragraph-properties> | ||
| 90 | <style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="SimSun" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/> | 94 | <style:text-properties style:font-name="Arial" fo:font-size="14pt" style:font-name-asian="SimSun" style:font-size-asian="14pt" style:font-name-complex="Tahoma" style:font-size-complex="14pt"/> |
| 91 | </style:style> | 95 | </style:style> |
| 92 | <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> | 96 | <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text"> |
| @@ -252,26 +256,44 @@ | |||
| 252 | <style:style style:name="Quotations" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> | 256 | <style:style style:name="Quotations" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> |
| 253 | <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="1cm" fo:margin-top="0cm" fo:margin-bottom="0.499cm" fo:text-indent="0cm" style:auto-text-indent="false"/> | 257 | <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="1cm" fo:margin-top="0cm" fo:margin-bottom="0.499cm" fo:text-indent="0cm" style:auto-text-indent="false"/> |
| 254 | </style:style> | 258 | </style:style> |
| 259 | <style:style style:name="OrgFootnoteQuotations" style:family="paragraph" style:parent-style-name="Footnote" style:class="html"> | ||
| 260 | <style:paragraph-properties fo:margin-left="1cm" fo:margin-right="1cm" fo:margin-top="0cm" fo:margin-bottom="0.499cm" fo:text-indent="0cm" style:auto-text-indent="false"/> | ||
| 261 | </style:style> | ||
| 255 | <style:style style:name="Preformatted_20_Text" style:display-name="Preformatted Text" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> | 262 | <style:style style:name="Preformatted_20_Text" style:display-name="Preformatted Text" style:family="paragraph" style:parent-style-name="Standard" style:class="html"> |
| 256 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"/> | 263 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"/> |
| 257 | <style:text-properties style:font-name="Courier New" fo:font-size="10pt" style:font-name-asian="NSimSun" style:font-size-asian="10pt" style:font-name-complex="Courier New" style:font-size-complex="10pt"/> | 264 | <style:text-properties style:font-name="Courier New" fo:font-size="10pt" style:font-name-asian="NSimSun" style:font-size-asian="10pt" style:font-name-complex="Courier New" style:font-size-complex="10pt"/> |
| 258 | </style:style> | 265 | </style:style> |
| 266 | |||
| 259 | <style:style style:name="OrgVerse" style:family="paragraph" style:parent-style-name="Preformatted_20_Text"> | 267 | <style:style style:name="OrgVerse" style:family="paragraph" style:parent-style-name="Preformatted_20_Text"> |
| 260 | <style:paragraph-properties fo:background-color="#c0c0c0" fo:padding="0.049cm" fo:border="0.018cm solid #000000" style:shadow="none"> | 268 | <style:paragraph-properties fo:background-color="transparent" fo:padding="0cm" fo:border="none" style:shadow="none"> |
| 261 | <style:background-image/> | 269 | <style:background-image/> |
| 262 | </style:paragraph-properties> | 270 | </style:paragraph-properties> |
| 263 | </style:style> | 271 | </style:style> |
| 264 | 272 | ||
| 273 | <style:style style:name="OrgClock" style:family="paragraph" style:parent-style-name="Text_20_body"> | ||
| 274 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0cm"/> | ||
| 275 | </style:style> | ||
| 276 | <style:style style:name="OrgClockLastLine" style:family="paragraph" style:parent-style-name="OrgClock"/> | ||
| 277 | <style:style style:name="OrgPlanning" style:family="paragraph" style:parent-style-name="Text_20_body"/> | ||
| 278 | |||
| 279 | <!-- Fixed width block --> | ||
| 265 | <style:style style:name="OrgFixedWidthBlock" style:family="paragraph" style:parent-style-name="Preformatted_20_Text"> | 280 | <style:style style:name="OrgFixedWidthBlock" style:family="paragraph" style:parent-style-name="Preformatted_20_Text"> |
| 266 | <style:paragraph-properties fo:background-color="#c0c0c0" fo:padding="0.049cm" fo:border="0.018cm solid #000000" style:shadow="none"> | 281 | <style:paragraph-properties fo:background-color="#c0c0c0" fo:padding="0.049cm" fo:border="0.06pt solid #000000" style:shadow="none"> |
| 267 | <style:background-image/> | 282 | <style:background-image/> |
| 268 | </style:paragraph-properties> | 283 | </style:paragraph-properties> |
| 269 | </style:style> | 284 | </style:style> |
| 270 | |||
| 271 | <style:style style:name="OrgFixedWidthBlockLastLine" style:family="paragraph" style:parent-style-name="OrgFixedWidthBlock"> | 285 | <style:style style:name="OrgFixedWidthBlockLastLine" style:family="paragraph" style:parent-style-name="OrgFixedWidthBlock"> |
| 272 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm"/> | 286 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm"/> |
| 273 | </style:style> | 287 | </style:style> |
| 274 | 288 | ||
| 289 | <style:style style:name="OrgFormula" style:family="paragraph" style:parent-style-name="Text_20_body"> | ||
| 290 | <style:paragraph-properties> | ||
| 291 | <style:tab-stops> | ||
| 292 | <style:tab-stop style:position="17cm" style:type="right"/> | ||
| 293 | </style:tab-stops> | ||
| 294 | </style:paragraph-properties> | ||
| 295 | </style:style> | ||
| 296 | |||
| 275 | <style:style style:name="OrgSrcBlockLastLine" style:family="paragraph" style:parent-style-name="OrgSrcBlock"> | 297 | <style:style style:name="OrgSrcBlockLastLine" style:family="paragraph" style:parent-style-name="OrgSrcBlock"> |
| 276 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm"/> | 298 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm"/> |
| 277 | </style:style> | 299 | </style:style> |
| @@ -279,6 +301,9 @@ | |||
| 279 | <style:style style:name="OrgCenter" style:family="paragraph" style:parent-style-name="Text_20_body"> | 301 | <style:style style:name="OrgCenter" style:family="paragraph" style:parent-style-name="Text_20_body"> |
| 280 | <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> | 302 | <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> |
| 281 | </style:style> | 303 | </style:style> |
| 304 | <style:style style:name="OrgFootnoteCenter" style:family="paragraph" style:parent-style-name="Footnote"> | ||
| 305 | <style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/> | ||
| 306 | </style:style> | ||
| 282 | <style:style style:name="OrgTableContents" style:family="paragraph" style:parent-style-name="Text_20_body"/> | 307 | <style:style style:name="OrgTableContents" style:family="paragraph" style:parent-style-name="Text_20_body"/> |
| 283 | <style:style style:name="OrgTableHeading" style:family="paragraph" style:parent-style-name="OrgTableContents" style:class="extra"> | 308 | <style:style style:name="OrgTableHeading" style:family="paragraph" style:parent-style-name="OrgTableContents" style:class="extra"> |
| 284 | <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" text:number-lines="false" text:line-number="0"/> | 309 | <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" text:number-lines="false" text:line-number="0"/> |
| @@ -325,9 +350,10 @@ | |||
| 325 | </style:paragraph-properties> | 350 | </style:paragraph-properties> |
| 326 | </style:style> | 351 | </style:style> |
| 327 | <style:style style:name="Horizontal_20_Line" style:display-name="Horizontal Line" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="html"> | 352 | <style:style style:name="Horizontal_20_Line" style:display-name="Horizontal Line" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="html"> |
| 328 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.499cm" style:border-line-width-bottom="0.002cm 0.035cm 0.002cm" fo:padding="0cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.039cm double #808080" text:number-lines="false" text:line-number="0" style:join-border="false"/> | 353 | <style:paragraph-properties fo:margin-top="0cm" fo:margin-bottom="0.21cm" style:page-number="auto" fo:padding="0cm" fo:border-left="none" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.06pt solid #000000" style:shadow="none" text:number-lines="false" text:line-number="0" style:join-border="false"/> |
| 329 | <style:text-properties fo:font-size="6pt" style:font-size-asian="6pt" style:font-size-complex="6pt"/> | 354 | <style:text-properties fo:font-size="6pt" style:font-size-asian="6pt" style:font-size-complex="6pt"/> |
| 330 | </style:style> | 355 | </style:style> |
| 356 | |||
| 331 | <style:style style:name="Emphasis" style:family="text"> | 357 | <style:style style:name="Emphasis" style:family="text"> |
| 332 | <style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/> | 358 | <style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/> |
| 333 | </style:style> | 359 | </style:style> |
| @@ -349,23 +375,41 @@ | |||
| 349 | <style:style style:name="OrgCode" style:family="text" style:parent-style-name="Source_20_Text"/> | 375 | <style:style style:name="OrgCode" style:family="text" style:parent-style-name="Source_20_Text"/> |
| 350 | 376 | ||
| 351 | <!-- BEGIN: Org Agenda Styles --> | 377 | <!-- BEGIN: Org Agenda Styles --> |
| 352 | <style:style style:name="OrgTodo" style:family="text"> | 378 | <style:style style:name="OrgTodo" style:family="text"/> |
| 353 | <style:text-properties fo:color="#ff0000"/> | 379 | <style:style style:name="OrgDone" style:family="text"/> |
| 354 | </style:style> | 380 | |
| 355 | <style:style style:name="OrgDone" style:family="text"> | ||
| 356 | <style:text-properties fo:color="#008000"/> | ||
| 357 | </style:style> | ||
| 358 | <style:style style:name="OrgTag" style:family="text"> | 381 | <style:style style:name="OrgTag" style:family="text"> |
| 359 | <style:text-properties fo:background-color="#add8e6"/> | 382 | <style:text-properties fo:font-variant="small-caps" fo:background-color="transparent"/> |
| 360 | </style:style> | 383 | </style:style> |
| 361 | <style:style style:name="OrgTimestamp" style:family="text"> | 384 | <style:style style:name="OrgTags" style:family="text"/> |
| 362 | <style:text-properties fo:color="#bebebe"/> | 385 | |
| 386 | <style:style style:name="OrgPriority" style:family="text"/> | ||
| 387 | <style:style style:name="OrgPriority-A" style:family="text" style:parent-style-name="OrgPriority"/> | ||
| 388 | <style:style style:name="OrgPriority-B" style:family="text" style:parent-style-name="OrgPriority"/> | ||
| 389 | <style:style style:name="OrgPriority-C" style:family="text" style:parent-style-name="OrgPriority"/> | ||
| 390 | |||
| 391 | <style:style style:name="OrgTimestamp" style:display-name="OrgTimestamp" style:family="text"> | ||
| 392 | <style:text-properties style:font-name="Courier New" fo:background-color="transparent" style:font-name-asian="NSimSun" style:font-name-complex="Courier New"/> | ||
| 363 | </style:style> | 393 | </style:style> |
| 394 | <style:style style:name="OrgActiveTimestamp" style:family="text" style:parent-style-name="OrgTimestamp"/> | ||
| 395 | <style:style style:name="OrgInactiveTimestamp" style:family="text" style:parent-style-name="OrgTimestamp"/> | ||
| 364 | <style:style style:name="OrgTimestampKeyword" style:family="text"> | 396 | <style:style style:name="OrgTimestampKeyword" style:family="text"> |
| 365 | <style:text-properties fo:color="#5f9ea0"/> | 397 | <style:text-properties style:use-window-font-color="true" fo:font-weight="bold"/> |
| 366 | </style:style> | 398 | </style:style> |
| 399 | <style:style style:name="OrgScheduledKeyword" style:family="text" style:parent-style-name="OrgTimestampKeyword"/> | ||
| 400 | <style:style style:name="OrgDeadlineKeyword" style:family="text" style:parent-style-name="OrgTimestampKeyword"/> | ||
| 401 | <style:style style:name="OrgClockKeyword" style:family="text" style:parent-style-name="OrgTimestampKeyword"/> | ||
| 402 | <style:style style:name="OrgClosedKeyword" style:family="text" style:parent-style-name="OrgTimestampKeyword"/> | ||
| 367 | <style:style style:name="OrgTimestampWrapper" style:family="text"/> | 403 | <style:style style:name="OrgTimestampWrapper" style:family="text"/> |
| 368 | <style:style style:name="OrgTarget" style:family="text"/> | 404 | <style:style style:name="OrgTarget" style:family="text"/> |
| 405 | |||
| 406 | <number:date-style style:name="OrgDate" number:automatic-order="true"> | ||
| 407 | <number:day number:style="long"/> | ||
| 408 | <number:text>/</number:text> | ||
| 409 | <number:month number:style="long"/> | ||
| 410 | <number:text>/</number:text> | ||
| 411 | <number:year number:style="long"/> | ||
| 412 | </number:date-style> | ||
| 369 | <!-- END: Org Agenda Styles --> | 413 | <!-- END: Org Agenda Styles --> |
| 370 | 414 | ||
| 371 | <style:style style:name="Bold" style:family="text"> | 415 | <style:style style:name="Bold" style:family="text"> |
| @@ -441,7 +485,7 @@ | |||
| 441 | </style:style> | 485 | </style:style> |
| 442 | 486 | ||
| 443 | <style:style style:name="OrgFormulaCaptionFrame" style:family="graphic" style:parent-style-name="Frame"> | 487 | <style:style style:name="OrgFormulaCaptionFrame" style:family="graphic" style:parent-style-name="Frame"> |
| 444 | <style:graphic-properties fo:margin-top="0cm" fo:margin-bottom="0cm" style:vertical-pos="middle" style:vertical-rel="text" style:horizontal-pos="from-left" style:horizontal-rel="paragraph-content" fo:padding="0cm" fo:border="none"/> | 488 | <style:graphic-properties text:anchor-type="paragraph" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" style:wrap="right" style:number-wrapped-paragraphs="1" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph" style:horizontal-pos="center" style:horizontal-rel="paragraph" fo:padding="0cm" fo:border="none"/> |
| 445 | </style:style> | 489 | </style:style> |
| 446 | 490 | ||
| 447 | <style:style style:name="OrgCaptionedFormula" style:family="graphic" style:parent-style-name="OrgFormula"> | 491 | <style:style style:name="OrgCaptionedFormula" style:family="graphic" style:parent-style-name="OrgFormula"> |
diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index a74388b7d71..0e2838e6469 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog | |||
| @@ -1,3 +1,598 @@ | |||
| 1 | 2014-10-02 Achim Gratz <Stromeko@Stromeko.DE> | ||
| 2 | |||
| 3 | * ob-sh.el (org-babel-sh-initiate-session): After initiating a | ||
| 4 | session, initialize the marker `comint-last-output-start' since it | ||
| 5 | is going to be used by the ANSI color filter without further | ||
| 6 | checks in Emacs 23 and throws an error. | ||
| 7 | |||
| 8 | * ob-lilypond.el, testing/lisp/test-ob-lilypond.el: Change prefix | ||
| 9 | from `ly-' to `org-babel-lilypond-' throughout. | ||
| 10 | |||
| 11 | * org-footnote.el: Forward declare `org-element-context', | ||
| 12 | `org-element-property' and `org-element-type'. | ||
| 13 | |||
| 14 | * org.el: Add forward declarations for a number of functions that | ||
| 15 | the compiler otherwise warns about as potentially undefined at | ||
| 16 | runtime. | ||
| 17 | |||
| 18 | * ob-core.el: Add comment to forward declaration of | ||
| 19 | 'org-src-preserve-indentations'. | ||
| 20 | |||
| 21 | * ob-exp.el: Require org-src to import | ||
| 22 | 'org-src-preserve-indentations'. | ||
| 23 | |||
| 24 | * ob-haskell.el, lisp/ob-python.el: Remove superfluous forward | ||
| 25 | declaration of 'org-src-preserve-indentations', since it gets | ||
| 26 | imported by other requires. | ||
| 27 | |||
| 28 | * ob-core.el (org-every): Forward declare 'org-every'. | ||
| 29 | |||
| 30 | * ob-C.el: Require cl during compilation so that lexical-let is | ||
| 31 | known. | ||
| 32 | |||
| 33 | * org-entities.el: Remove superfluous require of org-macs. | ||
| 34 | Forward declare 'org-toggle-pretty-entities' and | ||
| 35 | 'org-pretty-entities'. | ||
| 36 | |||
| 37 | * ox.el (org-export-get-parent): Move definition of | ||
| 38 | 'org-export-get-parent' before first use. Leave comment at original | ||
| 39 | place of definition. | ||
| 40 | |||
| 41 | * org.el (org-uniquify): Move definition of 'org-uniquify' before | ||
| 42 | first use. Leave comment at original place of definition. | ||
| 43 | |||
| 44 | * ob-tangle.el (org-babel-tangle): When `file-name-directory' | ||
| 45 | returns nil, do not run make-directory. Remove superfluous when | ||
| 46 | clauses by using short-circuiting `and' instead. | ||
| 47 | |||
| 48 | 2014-10-02 Alex Kosorukoff <alex@3form.com> (tiny change) | ||
| 49 | |||
| 50 | * org-capture.el (org-capture-fill-template): Set `mark-active' to | ||
| 51 | nil. | ||
| 52 | |||
| 53 | 2014-10-02 Bastien Guerry <bzg@gnu.org> | ||
| 54 | |||
| 55 | * org-agenda.el (org-agenda-prepare): Reset preset filters when | ||
| 56 | using sticky agendas. | ||
| 57 | |||
| 58 | * org-agenda.el (org-agenda-get-sexps): Don't add tags as text | ||
| 59 | properties. | ||
| 60 | |||
| 61 | * org-capture.el (org-capture-fill-template): Take | ||
| 62 | `org-extend-today-until' into account when setting the format time | ||
| 63 | string. | ||
| 64 | |||
| 65 | * org.el (org-paste-subtree): Fix match subexpression. | ||
| 66 | |||
| 67 | * org.el (org-fix-ellipsis-at-bol): Delete. | ||
| 68 | (org-mode, org-show-context, org-isearch-end): Don't use | ||
| 69 | `org-fix-ellipsis-at-bol'. | ||
| 70 | |||
| 71 | * org-agenda.el (org-agenda-filter-apply): Fix setting of | ||
| 72 | `org-agenda-filtered-by-category'. | ||
| 73 | |||
| 74 | * org.el (org-fontify-meta-lines-and-blocks-1): Fix handling | ||
| 75 | of `org-hidden-keywords'. | ||
| 76 | |||
| 77 | * org-agenda.el (org-cmp-ts): Fix agenda entry type checking. | ||
| 78 | |||
| 79 | * org-agenda.el (org-entries-lessp): Fix inactive timestamp | ||
| 80 | comparison. | ||
| 81 | |||
| 82 | * org-agenda.el (org-agenda-mode): Let `org-agenda-redo' DTRT | ||
| 83 | when agenda are sticky. | ||
| 84 | (org-agenda-tag-filter-while-redo): Delete. | ||
| 85 | (org-agenda-list, org-agenda-redo, org-agenda-filter-by-tag): | ||
| 86 | Remove unused code. | ||
| 87 | (org-agenda-clockreport-mode, org-agenda-set-mode-name): Don't | ||
| 88 | consider tag filters. | ||
| 89 | |||
| 90 | * org.el (org-fix-ellipsis-at-bol) | ||
| 91 | (org-first-headline-recenter): Use `set-window-start' instead | ||
| 92 | of `recenter'. | ||
| 93 | |||
| 94 | * org-agenda.el (org-recenter-heading): Delete. | ||
| 95 | |||
| 96 | * org.el (org-insert-heading): With one universal prefix argument | ||
| 97 | or `org-insert-heading-respect-content' set to `t', always respect | ||
| 98 | the content, i.e. don't insert a list item and don't convert | ||
| 99 | normal lines into headings. Update docstring. | ||
| 100 | (org-insert-heading-respect-content): Remove unused arg. | ||
| 101 | (org-insert-todo-heading-respect-content): Don't use | ||
| 102 | `org-insert-todo-heading-respect-content', use the second argument | ||
| 103 | of `org-insert-todo-heading' instead. | ||
| 104 | |||
| 105 | * org-mobile.el (org-mobile-edit): Use only one arg. | ||
| 106 | |||
| 107 | * org.el (org-overview): Don't call `recenter'. | ||
| 108 | |||
| 109 | * org-agenda.el (org-agenda-custom-commands-local-options): Fix | ||
| 110 | misquoted values. | ||
| 111 | |||
| 112 | * org.el (org-property-re): Also match null properties by default. | ||
| 113 | (org-entry-delete): Also delete null properties. | ||
| 114 | (org-read-property-value): Allow the empty string as a new value. | ||
| 115 | (org-delete-property): Throw a message when there is not property | ||
| 116 | to delete. | ||
| 117 | |||
| 118 | * org-agenda.el (org-agenda-insert-diary-make-new-entry): Fix | ||
| 119 | docstring. | ||
| 120 | |||
| 121 | * org.el (org-re-property): New parameter `allow-null' to match | ||
| 122 | property with a null value. | ||
| 123 | (org-entry-put): Correctly update a property with a null | ||
| 124 | value. | ||
| 125 | |||
| 126 | * ox-md.el (org-md-headline): When exporting with a HTML table of | ||
| 127 | contents, add HTML anchors to Markdown headlines. | ||
| 128 | |||
| 129 | * org.el (org-insert-heading): Don't insert an item when called | ||
| 130 | with two universal prefix arguments. | ||
| 131 | |||
| 132 | * org-agenda.el (org-agenda-finalize): Remove duplicate check for | ||
| 133 | 'org-hd-marker. | ||
| 134 | |||
| 135 | * org-agenda.el (org-agenda-prepare-window): New parameter | ||
| 136 | `filter-alist' to set the filters correctly when | ||
| 137 | `org-agenda-persistent-filter' is on. | ||
| 138 | (org-agenda-prepare): Use the new parameter for | ||
| 139 | `org-agenda-prepare-window'. | ||
| 140 | |||
| 141 | * org-compat.el (org-in-invisibility-spec-p): Tiny code cleanup. | ||
| 142 | (org-move-to-column): Only remove '(org-filtered) from | ||
| 143 | `buffer-invisibility-spec'. | ||
| 144 | |||
| 145 | * org-agenda.el (org-agenda-mode): Add buffer invisibility specs. | ||
| 146 | (org-agenda-filter-hide-line, org-agenda-remove-filter): Set | ||
| 147 | the 'invisible text property to 'org-filtered. | ||
| 148 | (org-agenda-show-new-time): Add the default face to avoid the | ||
| 149 | foreground of the last character on the line to leak into the | ||
| 150 | timestamp notification. | ||
| 151 | |||
| 152 | * org-agenda.el (org-get-time-of-day): Don't return time string | ||
| 153 | from within links. | ||
| 154 | |||
| 155 | * org-timer.el (org-timer-value-string): Always return a positive | ||
| 156 | value. Add docstring. | ||
| 157 | |||
| 158 | * org-capture.el (org-capture-steal-local-variables): Don't steal | ||
| 159 | `mark-active', which should be nil in the target buffer. | ||
| 160 | |||
| 161 | * org-agenda.el (org-agenda-remove-filter): Use `save-excursion'. | ||
| 162 | |||
| 163 | * org.el (org-move-subtree-down): Use `org-end-of-subtree' instead | ||
| 164 | of `outline-end-of-subtree'. | ||
| 165 | (outline-end-of-subtree): Remove advice. | ||
| 166 | |||
| 167 | * org-mouse.el (org-mouse-move-tree, org-mouse-do-remotely): Use | ||
| 168 | `org-end-of-subtree' instead of `outline-end-of-subtree'. | ||
| 169 | |||
| 170 | * org-agenda.el (org-cmp-ts): Argument `type' is not optional. | ||
| 171 | Don't quote it. | ||
| 172 | |||
| 173 | * org-habit.el (org-habit-insert-consistency-graphs): Don't remove | ||
| 174 | filter overlays as we don't use overlays for filters anymore. | ||
| 175 | |||
| 176 | * org-agenda.el (org-agenda-local-vars): Add | ||
| 177 | `org-agenda-top-headline-filter'. | ||
| 178 | (org-agenda-filter-by-category): Fix syntax. | ||
| 179 | (org-agenda-filter-show-all-top-filter): New function. | ||
| 180 | (org-agenda-filter-by-top-headline) | ||
| 181 | (org-agenda-filter-remove-all): Use the new function. | ||
| 182 | (org-agenda-filter-top-headline-apply): Use a dedicated symbol | ||
| 183 | `top-headline'. | ||
| 184 | |||
| 185 | * org.el (org-entry-properties): Ensure the special property is | ||
| 186 | not commented out when matched. | ||
| 187 | |||
| 188 | * org-agenda.el (org-agenda-write): Code cleanup. | ||
| 189 | (org-agenda-mark-filtered-text) | ||
| 190 | (org-agenda-unmark-filtered-text) | ||
| 191 | (org-agenda-fix-tags-filter-overlays-at): Delete. | ||
| 192 | (org-agenda-remove-marked-text): Use the `property' argument | ||
| 193 | instead of hard-coding 'org-filtered. | ||
| 194 | (org-agenda-filter-remove-all): Use `org-agenda-finalize'. | ||
| 195 | (org-agenda-filter-hide-line): Rewrite using text properties | ||
| 196 | instead of overlays. | ||
| 197 | (org-agenda-remove-filter): New function. | ||
| 198 | (org-agenda-filter-show-all-tag) | ||
| 199 | (org-agenda-filter-show-all-cat) | ||
| 200 | (org-agenda-filter-show-all-re): Rewrite using | ||
| 201 | `org-agenda-remove-filter'. | ||
| 202 | |||
| 203 | * org-attach.el (org-attach-dir): When the property is "inherited" | ||
| 204 | from a variable outside of the file, do not use | ||
| 205 | `org-entry-property-inherited-from' to find the attachment | ||
| 206 | position, assume we need to go back to the current headline. | ||
| 207 | |||
| 208 | * ob-R.el (org-babel-R-assign-elisp): Fix parsing of a | ||
| 209 | one-dimensional value. | ||
| 210 | |||
| 211 | * org.el (org-insert-heading): Fix bug when trying to insert a | ||
| 212 | heading when point is before the first headline and not at the | ||
| 213 | beginning of a line. | ||
| 214 | |||
| 215 | * org-table.el (org-table-eval-formula): Fix conversion of | ||
| 216 | inactive timestamps to active ones. | ||
| 217 | |||
| 218 | * org.el (org-set-regexps-and-options): Allow | ||
| 219 | `org-complex-heading-regexp-format' to match [/] and [%] cookies | ||
| 220 | when they are both before and after the heading. | ||
| 221 | |||
| 222 | * org-agenda.el (org-agenda-max-todos, org-agenda-max-tags) | ||
| 223 | (org-agenda-max-effort): Fix type strings. | ||
| 224 | |||
| 225 | * org-capture.el (org-capture-fill-template): Deactivate region | ||
| 226 | while trying to align tags on the current headline. | ||
| 227 | |||
| 228 | * org-agenda.el (org-agenda-finalize): Filter by top headline if | ||
| 229 | `org-agenda-top-headline-filter' is set. | ||
| 230 | |||
| 231 | 2014-10-02 Bernt Hansen <bernt@norang.ca> | ||
| 232 | |||
| 233 | * org-macs.el: Remove restriction when locating markers. | ||
| 234 | |||
| 235 | 2014-10-02 Dmitry Gorbik <dgorbik@me.com> (tiny change) | ||
| 236 | |||
| 237 | * org.el (org-fast-tag-selection): Fix window splitting. | ||
| 238 | |||
| 239 | 2014-10-02 Eric Schulte <schulte.eric@gmail.com> | ||
| 240 | |||
| 241 | * ob-screen.el (org-babel-screen-test): Use unpredictable name for | ||
| 242 | temporary file. | ||
| 243 | |||
| 244 | * ob-screen.el (org-babel-screen-session-write-temp-file): Use | ||
| 245 | unpredictable temp file name, fixes bug#17416. | ||
| 246 | |||
| 247 | 2014-10-02 Ian Kelling <ian@iankelling.org> | ||
| 248 | |||
| 249 | * ob-core.el (org-babel-insert-result): Test all list elements | ||
| 250 | against listp and (eq element 'hline) instead of checking just the | ||
| 251 | first. | ||
| 252 | |||
| 253 | 2014-10-02 Konstantin Kliakhandler <kosta@slumpy.org> (tiny change) | ||
| 254 | |||
| 255 | * org-agenda.el (org-agenda-redo): Reapply the filters correctly. | ||
| 256 | |||
| 257 | 2014-10-02 Kyle Meyer <kyle@kyleam.com> (tiny change) | ||
| 258 | |||
| 259 | * ox.el (org-export-show-temporary-export-buffer): Fix typo. | ||
| 260 | |||
| 261 | 2014-10-02 Matt Lundin <mdl@imapmail.org> | ||
| 262 | |||
| 263 | * ox-publish.el (org-publish-find-title, org-publish-find-date): | ||
| 264 | Make sure to call org-export-get-environment in copy of buffer if | ||
| 265 | emacs is already visiting. Otherwise, #+bind variables meant for | ||
| 266 | export can be set in live buffers. | ||
| 267 | |||
| 268 | * org.el (org-agenda-inhibit-startup): fix docstring to reflect | ||
| 269 | default value | ||
| 270 | |||
| 271 | * ox-publish.el (org-publish-find-title, org-publish-find-date): | ||
| 272 | Fix unnecessary invocations of org-mode with org-inhibit-startup. | ||
| 273 | |||
| 274 | 2014-10-02 Nick Dokos <ndokos@gmail.com> | ||
| 275 | |||
| 276 | * org-table.el (org-table-clean-before-export): The regexes match | ||
| 277 | spaces in addition to the special characters that might be used in | ||
| 278 | the first column as special marking characters. Remove the space | ||
| 279 | from the character class. | ||
| 280 | |||
| 281 | * ox-ascii.el (org-ascii-superscript): Change _ to ^ in the | ||
| 282 | output. | ||
| 283 | |||
| 284 | 2014-10-02 Nick Dokos <ndokos@redhat.com> | ||
| 285 | |||
| 286 | * org-table.el (org-table-show-reference): Call `set-window-start' | ||
| 287 | with the calculated values `min' and `max', not with | ||
| 288 | (point-min) and (point-max). | ||
| 289 | |||
| 290 | 2014-10-02 Nicolas Goaziou <n.goaziou@gmail.com> | ||
| 291 | |||
| 292 | * ox-latex.el (org-latex-link): Improve test for unnumbered | ||
| 293 | headlines. | ||
| 294 | |||
| 295 | * ox-ascii.el (org-ascii--fill-string): Allow filling even when | ||
| 296 | `org-export-preserve-breaks' is non-nil. | ||
| 297 | |||
| 298 | * org.el (org-N-empty-lines-before-current): Make sure to delete | ||
| 299 | only empty lines, not trailing whitespaces. | ||
| 300 | |||
| 301 | * ox-html.el (org-html-headline): Make sure even listified | ||
| 302 | headlines have proper anchors so internal links can refer to them. | ||
| 303 | Small refactoring. | ||
| 304 | |||
| 305 | * org-src.el (org-edit-src-code): Fix regexp. | ||
| 306 | (org-edit-src-exit): Do not remove auto-save timer. This is | ||
| 307 | handled by the timer itself. | ||
| 308 | |||
| 309 | * org.el (org-re-property): Fix regexp. Improve docstring. | ||
| 310 | |||
| 311 | * org-element.el (org-element-property-drawer-parser) | ||
| 312 | (org-element-node-property-parser): Ignore lines that are not node | ||
| 313 | properties. | ||
| 314 | (org-element-node-property-interpreter): Allow nil properties. | ||
| 315 | |||
| 316 | * org.el (org-re-property): Fix regexp to match properties with | ||
| 317 | empty values. | ||
| 318 | |||
| 319 | * org-element.el (org-element-headline-interpreter): Take into | ||
| 320 | consideration `org-odd-levels-only' value. Small refactoring. | ||
| 321 | |||
| 322 | * ox-texinfo.el (org-texinfo--get-node): Return a node or anchor | ||
| 323 | name. | ||
| 324 | (org-texinfo--sanitize-content): Fix regexp. | ||
| 325 | (org-texinfo-link): Fix various bugs in link export. | ||
| 326 | |||
| 327 | * ox-beamer.el (org-beamer-link): | ||
| 328 | * ox-html.el (org-html-link): | ||
| 329 | * ox-latex.el (org-latex-link): | ||
| 330 | * ox-odt.el (org-odt-link): When radio link has no valid | ||
| 331 | target (e.g., this is a subtree export and the radio target is not | ||
| 332 | in the exported subtree), simply return contents. | ||
| 333 | |||
| 334 | * org.el (org-called-with-limited-levels): Initialize variable. | ||
| 335 | |||
| 336 | * org-agenda.el (org-agenda-write): Write headings in proper | ||
| 337 | order. | ||
| 338 | |||
| 339 | * org-element.el (org-element-table-interpreter): Enhance | ||
| 340 | docstring. | ||
| 341 | |||
| 342 | * ox-md.el (org-md-link): Allow custom link type export function. | ||
| 343 | |||
| 344 | * ox-texinfo.el (org-texinfo-template): Fix language and encoding | ||
| 345 | case. | ||
| 346 | |||
| 347 | * ox-md.el (org-md-separate-elements): Outside of lists, preserve | ||
| 348 | blank lines between paragraphs and plain lists. | ||
| 349 | |||
| 350 | * org-element.el (org-element-normalize-contents): Fix indentation | ||
| 351 | removal when there is an empty line within a verse block. | ||
| 352 | |||
| 353 | * ox-texinfo.el (org-texinfo--normalize-headlines): Properly add a | ||
| 354 | section to the contents. | ||
| 355 | |||
| 356 | * ox-texinfo.el (org-texinfo--normalize-headlines): Do not set pre | ||
| 357 | blanks since the value is now hard-coded. | ||
| 358 | (org-texinfo-headline): Force one blank line before contents, when non | ||
| 359 | empty. Refactoring. | ||
| 360 | (org-texinfo-src-block): Refactor code. Comply to predicate naming. | ||
| 361 | |||
| 362 | * ox-texinfo.el (org-texinfo--sanitize-node): Handle | ||
| 363 | " (not)allowed" case. | ||
| 364 | |||
| 365 | * ox-texinfo.el (org-texinfo-headline): Remove wrong code | ||
| 366 | comments. | ||
| 367 | |||
| 368 | * ox-texinfo.el (org-texinfo-headline): Remove `not-in-toc' | ||
| 369 | special case for tags. | ||
| 370 | |||
| 371 | * ox-texinfo.el (org-texinfo-headline): Remove LaTeXism (optional | ||
| 372 | arguments within square brackets). | ||
| 373 | |||
| 374 | * ox-texinfo.el (org-texinfo-info-process): Fix docstring. | ||
| 375 | (org-texinfo-compile): Do not check for impossible cases (e.g., if the | ||
| 376 | previous variable contains a function). | ||
| 377 | |||
| 378 | * ox-texinfo.el (org-texinfo-max-toc-depth): Fix docstring. | ||
| 379 | |||
| 380 | * ox-texinfo.el (org-texinfo--make-option-string, | ||
| 381 | org-texinfo--sanitize-headline, | ||
| 382 | org-texinfo--sanitize-headline-contents): Remove. | ||
| 383 | |||
| 384 | * ox-texinfo.el (org-texinfo--sanitize-node): "@", "{" and "}" | ||
| 385 | characters are allowed in a node name. So are "(" and ")" unless | ||
| 386 | "(" starts the name and there is ")" somewhere in the name. Also | ||
| 387 | trim and collapse whitespace characters. Renamed from | ||
| 388 | `org-texinfo--sanitize-menu'. | ||
| 389 | (org-texinfo--get-node): Do not sanitize node names over zealously. | ||
| 390 | Ensure returned node names are unique. | ||
| 391 | (org-texinfo-headline): Only add @node command where it makes sense. | ||
| 392 | |||
| 393 | * ox-texinfo.el (org-texinfo--sanitize-menu) | ||
| 394 | (org-texinfo--sanitize-content): Fix docstrings. | ||
| 395 | |||
| 396 | * ox-texinfo.el (org-texinfo--normalize-headlines): Make sure a | ||
| 397 | blank line always follows nodes. | ||
| 398 | |||
| 399 | * ox-texinfo.el (org-texinfo-make-menu): Change signature. Remove | ||
| 400 | some intermediate functions. Generate the full master menu when | ||
| 401 | asked. | ||
| 402 | (org-texinfo--build-menu): Use a simpler algorithm. | ||
| 403 | (org-texinfo--format-entries): Fix entries when both node and title | ||
| 404 | are different. | ||
| 405 | (org-texinfo--menu-entries): Renamed from `org-texinfo--generate-menu-list'. | ||
| 406 | (org-texinfo-headline): Move menu handling to next function. | ||
| 407 | (org-texinfo-section): Handle menu for current parent. | ||
| 408 | (org-texinfo--menu-headlines, org-texinfo--generate-detailed): Remove | ||
| 409 | functions. | ||
| 410 | (org-texinfo--normalize-headlines): New function. | ||
| 411 | |||
| 412 | * ox-texinfo.el (org-texinfo-headline): Fix @appendix command. | ||
| 413 | |||
| 414 | * ox-texinfo.el (org-texinfo-headline): Do not sanitize heading | ||
| 415 | text for sectioning command. | ||
| 416 | |||
| 417 | * ox-texinfo.el (org-texinfo--generate-menu-list): ":COPYING: nil" | ||
| 418 | is expected to be equivalent to no COPYING property at all. | ||
| 419 | |||
| 420 | * ox-texinfo.el (org-texinfo-item): Fix blank lines between items. | ||
| 421 | |||
| 422 | * ox-texinfo.el (org-texinfo-plain-list): Fix format string. | ||
| 423 | Small refactoring. | ||
| 424 | |||
| 425 | * ox-texinfo.el (texinfo): Provide new export property. | ||
| 426 | (org-texinfo-template): Use dedicated title for hard copy, when | ||
| 427 | available. | ||
| 428 | |||
| 429 | * ox-texinfo.el (org-texinfo-headline): Always obey to a non-nil | ||
| 430 | :APPENDIX: property. Small refactoring. | ||
| 431 | |||
| 432 | * ox-texinfo.el (org-texinfo-verse-block): Generate somewhat | ||
| 433 | meaningful Texinfo code instead of LaTeX. | ||
| 434 | |||
| 435 | * ox-texinfo.el (org-texinfo-table): Remove reference to | ||
| 436 | "verbatim" attribute. Handle table.el tables. Tiny refactoring. | ||
| 437 | (org-texinfo-table--org-table, org-texinfo-table--table.el-table): | ||
| 438 | Remove functions. | ||
| 439 | (org-texinfo-table-column-widths): Indent code correctly. Ignore | ||
| 440 | special column, if any. Add a comment about the limitation on the | ||
| 441 | width computation. | ||
| 442 | (org-texinfo-table-row): Small refactoring. | ||
| 443 | |||
| 444 | * ox-texinfo.el (texinfo): Do not provide a default value for | ||
| 445 | @setfilename value. | ||
| 446 | (org-texinfo-filename): Remove variable. | ||
| 447 | (org-texinfo-template): Correctly find value for @setfilename command. | ||
| 448 | If none is possible, do not provide the command at all. | ||
| 449 | |||
| 450 | * ox.el (org-export-to-file): Provide output file name in | ||
| 451 | communication channel, through :output-file property. | ||
| 452 | |||
| 453 | * ox-texinfo.el (org-texinfo-template): Do not hardcode "Manual" | ||
| 454 | in top node. | ||
| 455 | |||
| 456 | * ox-texinfo.el (org-texinfo-classes): Change default value. | ||
| 457 | Update docstring. | ||
| 458 | (org-texinfo-template): Insert header string from current class after | ||
| 459 | "@settitle" command. Always provide "\input texinfo" at the beginning | ||
| 460 | of the output. | ||
| 461 | |||
| 462 | * ox-texinfo.el (org-texinfo-template): Remove spurious blank | ||
| 463 | lines in output. Refactor code. | ||
| 464 | |||
| 465 | * ox-texinfo.el (org-texinfo-template): Fix multi-line subtitles. | ||
| 466 | |||
| 467 | * ox-texinfo.el (org-texinfo-template): Make sure table of | ||
| 468 | contents are allowed before inserting them. | ||
| 469 | |||
| 470 | * ox-texinfo.el (org-texinfo-template): Check if copying data is | ||
| 471 | not nil before using it. | ||
| 472 | |||
| 473 | * ox-texinfo.el (org-texinfo-template): Fix multi-line subauthors. | ||
| 474 | Correctly add email, when provided. Check if author info is | ||
| 475 | wanted first. | ||
| 476 | |||
| 477 | * ox-texinfo.el (org-texinfo-node-description-column) | ||
| 478 | (org-texinfo-format-drawer-function): Fix docstrings. | ||
| 479 | |||
| 480 | * ox-texinfo.el (texinfo): Make sure comments are ignored. | ||
| 481 | (org-texinfo-comment, org-texinfo-comment-block): Remove functions. | ||
| 482 | |||
| 483 | * ox-texinfo.el (org-texinfo-template): Properly pad @direntry | ||
| 484 | description. | ||
| 485 | |||
| 486 | * org-element.el (org-element-headline-parser): Add missing | ||
| 487 | `:post-blank' property in docstring. | ||
| 488 | |||
| 489 | * ox-latex.el (org-latex-table-scientific-notation): Set | ||
| 490 | appropriate value. | ||
| 491 | (org-latex-listings-options): Fix docstring. | ||
| 492 | |||
| 493 | * ox.el (org-export-raw-special-block-p): New function. | ||
| 494 | |||
| 495 | * org-element.el (org-element-link-parser): Properly handle | ||
| 496 | multi-line links according to RFC 3986 when enclosed within square | ||
| 497 | brackets. | ||
| 498 | |||
| 499 | * org-element.el (org-element-parse-secondary-string): Clone all | ||
| 500 | local variables from current buffer before parsing a secondary | ||
| 501 | string. Small refactoring. | ||
| 502 | (org-element-object-variables): Remove variable. | ||
| 503 | |||
| 504 | * ox-odt.el (org-odt--format-paragraph): Change signature to | ||
| 505 | include info. | ||
| 506 | (org-odt-footnote-reference, org-odt-paragraph): Apply signature | ||
| 507 | change. | ||
| 508 | |||
| 509 | * org-clock.el (org-clocktable-indent-string): Use "\emsp" instead | ||
| 510 | of "\__", which is not supported anymore since Org 8.0. | ||
| 511 | |||
| 512 | * ox-odt.el (org-odt--paragraph-style): New function. | ||
| 513 | (org-odt--format-paragraph): Use new function to get proper style | ||
| 514 | to apply. | ||
| 515 | |||
| 516 | * org-element.el (org-element--current-element): Fix regexp. | ||
| 517 | |||
| 518 | * org-element.el (org-element--current-element): Fix regexp | ||
| 519 | matching latex environments. Discrepancy with regexp used in | ||
| 520 | `org-element-latex-environment-parser' introduced matching errors. | ||
| 521 | |||
| 522 | * ox-ascii.el (org-ascii--table-cell-width): Correctly export | ||
| 523 | tables with width cookies. | ||
| 524 | |||
| 525 | * org.el (org-insert-heading): Fix error when inserting a headline | ||
| 526 | before first headline, with point not at bol. Remove source block | ||
| 527 | check for consistency with behavior after first headline. Tiny | ||
| 528 | fix to docstring. | ||
| 529 | |||
| 530 | * org.el (org-scan-tags): Fix typo in docstring. | ||
| 531 | |||
| 532 | * ox.el (org-export--get-inbuffer-options): Return the empty | ||
| 533 | string instead of nil when TITLE keywords has no value. | ||
| 534 | (org-export--get-buffer-attributes): Do not set :title property | ||
| 535 | early. | ||
| 536 | (org-export--get-global-options): Do not ignore anymore nil values. | ||
| 537 | Small refactoring. | ||
| 538 | (org-export-as): Correctly set :title here. | ||
| 539 | |||
| 540 | * org-list.el (org-list-repair): Fix typo in docstring. | ||
| 541 | |||
| 542 | * ox-ascii.el (org-ascii--current-text-width): Tiny fix. | ||
| 543 | |||
| 544 | * ox-org.el (org-org-section): Tiny refactoring. Use appropriate | ||
| 545 | property. | ||
| 546 | |||
| 547 | * ox-org.el (org-org-headline): Ignore footnote sections. | ||
| 548 | (org-org-section): New function. | ||
| 549 | |||
| 550 | * ox-beamer.el (org-beamer-select-environment): Ignore persistent | ||
| 551 | tags when displaying environments. | ||
| 552 | |||
| 553 | * ox-ascii.el (org-ascii-indented-line-width): Update docstring. | ||
| 554 | (org-ascii-paragraph): Do not apply indentation to the very first line | ||
| 555 | of a section. | ||
| 556 | |||
| 557 | * ox-latex.el (org-latex-inlinetask): Skip body if contents are | ||
| 558 | empty. | ||
| 559 | |||
| 560 | * ox-html.el (org-html-standalone-image-p): Ensure paragraph | ||
| 561 | contains at least a link before return a non-nil value. Clarify | ||
| 562 | docstring. | ||
| 563 | |||
| 564 | * ox.el (org-export-data): Always return a string, as specified | ||
| 565 | by the docstring. | ||
| 566 | |||
| 567 | * ox-ascii.el (org-ascii--indent-string): Fix regexp to avoid | ||
| 568 | stack overflow in regexp matcher on very long lines. | ||
| 569 | |||
| 570 | * org-element.el (org-element-timestamp-parser): Fix docstring. | ||
| 571 | |||
| 572 | * ox-icalendar.el (org-icalendar-include-sexps, | ||
| 573 | org-icalendar-blocked-headline-p): Fix docstrings. | ||
| 574 | (org-icalendar-clear-blank-lines): Fix docstring and regexp. | ||
| 575 | |||
| 576 | * ox-icalendar.el (org-icalendar-entry): Use | ||
| 577 | `org-icalendar-with-timestamps'. | ||
| 578 | |||
| 579 | 2014-10-02 Nicolas Richard <theonewiththeevillook@yahoo.fr> | ||
| 580 | |||
| 581 | * org.el (org-cycle-internal-local): Don't show a trailing | ||
| 582 | character when cycling a subtree that ends with a non-newline | ||
| 583 | character at the end of the buffer or the narrowed region. | ||
| 584 | |||
| 585 | 2014-10-02 Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> | ||
| 586 | |||
| 587 | * ox-ascii.el (org-ascii--box-string): Choose more universal | ||
| 588 | Unicode characters for boxquote corners. | ||
| 589 | |||
| 590 | 2014-10-02 marcowahlsoft@gmail.com <marcowahlsoft@gmail.com> (tiny change) | ||
| 591 | |||
| 592 | * org-agenda.el (org-agenda-bulk-mark) | ||
| 593 | (org-agenda-bulk-mark-regexp, org-agenda-bulk-toggle-all): Fix | ||
| 594 | org-agenda-bulk-mark-all when time-grid is shown. | ||
| 595 | |||
| 1 | 2014-05-12 Eric Schulte <eric.schulte@gmx.com> | 596 | 2014-05-12 Eric Schulte <eric.schulte@gmx.com> |
| 2 | 597 | ||
| 3 | * ob-screen.el (org-babel-screen-session-write-temp-file) | 598 | * ob-screen.el (org-babel-screen-session-write-temp-file) |
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el index c460be326f8..2fcec790c43 100644 --- a/lisp/org/ob-C.el +++ b/lisp/org/ob-C.el | |||
| @@ -30,6 +30,8 @@ | |||
| 30 | ;; - not much in the way of error feedback | 30 | ;; - not much in the way of error feedback |
| 31 | 31 | ||
| 32 | ;;; Code: | 32 | ;;; Code: |
| 33 | (eval-when-compile | ||
| 34 | (require 'cl)) | ||
| 33 | (require 'ob) | 35 | (require 'ob) |
| 34 | (require 'cc-mode) | 36 | (require 'cc-mode) |
| 35 | 37 | ||
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el index 93d6fe284f5..b97fd912eae 100644 --- a/lisp/org/ob-R.el +++ b/lisp/org/ob-R.el | |||
| @@ -173,12 +173,11 @@ This function is called by `org-babel-execute-src-block'." | |||
| 173 | (defun org-babel-R-assign-elisp (name value colnames-p rownames-p) | 173 | (defun org-babel-R-assign-elisp (name value colnames-p rownames-p) |
| 174 | "Construct R code assigning the elisp VALUE to a variable named NAME." | 174 | "Construct R code assigning the elisp VALUE to a variable named NAME." |
| 175 | (if (listp value) | 175 | (if (listp value) |
| 176 | (let ((max (apply #'max (mapcar #'length (org-remove-if-not | 176 | (let* ((lengths (mapcar 'length (org-remove-if-not 'sequencep value))) |
| 177 | #'sequencep value)))) | 177 | (max (if lengths (apply 'max lengths) 0)) |
| 178 | (min (apply #'min (mapcar #'length (org-remove-if-not | 178 | (min (if lengths (apply 'min lengths) 0)) |
| 179 | #'sequencep value)))) | 179 | (transition-file (org-babel-temp-file "R-import-"))) |
| 180 | (transition-file (org-babel-temp-file "R-import-"))) | 180 | ;; Ensure VALUE has an orgtbl structure (depth of at least 2). |
| 181 | ;; ensure VALUE has an orgtbl structure (depth of at least 2) | ||
| 182 | (unless (listp (car value)) (setq value (list value))) | 181 | (unless (listp (car value)) (setq value (list value))) |
| 183 | (with-temp-file transition-file | 182 | (with-temp-file transition-file |
| 184 | (insert | 183 | (insert |
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el index e8943c66561..eef408fd44f 100644 --- a/lisp/org/ob-core.el +++ b/lisp/org/ob-core.el | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | (defvar org-src-lang-modes) | 38 | (defvar org-src-lang-modes) |
| 39 | (defvar org-babel-library-of-babel) | 39 | (defvar org-babel-library-of-babel) |
| 40 | (declare-function show-all "outline" ()) | 40 | (declare-function show-all "outline" ()) |
| 41 | (declare-function org-every "org" (pred seq)) | ||
| 41 | (declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS)) | 42 | (declare-function org-reduce "org" (CL-FUNC CL-SEQ &rest CL-KEYS)) |
| 42 | (declare-function org-mark-ring-push "org" (&optional pos buffer)) | 43 | (declare-function org-mark-ring-push "org" (&optional pos buffer)) |
| 43 | (declare-function tramp-compat-make-temp-file "tramp-compat" | 44 | (declare-function tramp-compat-make-temp-file "tramp-compat" |
| @@ -1348,7 +1349,7 @@ specified in the properties of the current outline entry." | |||
| 1348 | (org-entry-get org-babel-current-src-block-location | 1349 | (org-entry-get org-babel-current-src-block-location |
| 1349 | (concat "header-args:" lang) 'inherit)))))) | 1350 | (concat "header-args:" lang) 'inherit)))))) |
| 1350 | 1351 | ||
| 1351 | (defvar org-src-preserve-indentation) | 1352 | (defvar org-src-preserve-indentation) ;; declare defcustom from org-src |
| 1352 | (defun org-babel-parse-src-block-match () | 1353 | (defun org-babel-parse-src-block-match () |
| 1353 | "Parse the results from a match of the `org-babel-src-block-regexp'." | 1354 | "Parse the results from a match of the `org-babel-src-block-regexp'." |
| 1354 | (let* ((block-indentation (length (match-string 1))) | 1355 | (let* ((block-indentation (length (match-string 1))) |
| @@ -2100,9 +2101,9 @@ code ---- the results are extracted in the syntax of the source | |||
| 2100 | ((funcall proper-list-p result) | 2101 | ((funcall proper-list-p result) |
| 2101 | (goto-char beg) | 2102 | (goto-char beg) |
| 2102 | (insert (concat (orgtbl-to-orgtbl | 2103 | (insert (concat (orgtbl-to-orgtbl |
| 2103 | (if (or (eq 'hline (car result)) | 2104 | (if (org-every |
| 2104 | (and (listp (car result)) | 2105 | (lambda (el) (or (listp el) (eq el 'hline))) |
| 2105 | (listp (cdr (car result))))) | 2106 | result) |
| 2106 | result (list result)) | 2107 | result (list result)) |
| 2107 | '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) | 2108 | '(:fmt (lambda (cell) (format "%s" cell)))) "\n")) |
| 2108 | (goto-char beg) (when (org-at-table-p) (org-table-align))) | 2109 | (goto-char beg) (when (org-at-table-p) (org-table-align))) |
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el index 6d65496dbd4..761c9f17ad0 100644 --- a/lisp/org/ob-exp.el +++ b/lisp/org/ob-exp.el | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Code: | 25 | ;;; Code: |
| 26 | (require 'ob-core) | 26 | (require 'ob-core) |
| 27 | (require 'org-src) | ||
| 27 | (eval-when-compile | 28 | (eval-when-compile |
| 28 | (require 'cl)) | 29 | (require 'cl)) |
| 29 | 30 | ||
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el index 22240addd8a..00066702a51 100644 --- a/lisp/org/ob-haskell.el +++ b/lisp/org/ob-haskell.el | |||
| @@ -147,7 +147,6 @@ specifying a variable of the same value." | |||
| 147 | (concat "[" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") "]") | 147 | (concat "[" (mapconcat #'org-babel-haskell-var-to-haskell var ", ") "]") |
| 148 | (format "%S" var))) | 148 | (format "%S" var))) |
| 149 | 149 | ||
| 150 | (defvar org-src-preserve-indentation) | ||
| 151 | (defvar org-export-copy-to-kill-ring) | 150 | (defvar org-export-copy-to-kill-ring) |
| 152 | (declare-function org-export-to-file "ox" | 151 | (declare-function org-export-to-file "ox" |
| 153 | (backend file | 152 | (backend file |
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el index 9b575464ea9..00a951d32d1 100644 --- a/lisp/org/ob-lilypond.el +++ b/lisp/org/ob-lilypond.el | |||
| @@ -39,62 +39,62 @@ | |||
| 39 | (defvar org-babel-default-header-args:lilypond '() | 39 | (defvar org-babel-default-header-args:lilypond '() |
| 40 | "Default header arguments for lilypond code blocks. | 40 | "Default header arguments for lilypond code blocks. |
| 41 | NOTE: The arguments are determined at lilypond compile time. | 41 | NOTE: The arguments are determined at lilypond compile time. |
| 42 | See (ly-set-header-args)") | 42 | See (org-babel-lilypond-set-header-args)") |
| 43 | 43 | ||
| 44 | (defvar ly-compile-post-tangle t | 44 | (defvar org-babel-lilypond-compile-post-tangle t |
| 45 | "Following the org-babel-tangle (C-c C-v t) command, | 45 | "Following the org-babel-tangle (C-c C-v t) command, |
| 46 | ly-compile-post-tangle determines whether ob-lilypond should | 46 | org-babel-lilypond-compile-post-tangle determines whether ob-lilypond should |
| 47 | automatically attempt to compile the resultant tangled file. | 47 | automatically attempt to compile the resultant tangled file. |
| 48 | If the value is nil, no automated compilation takes place. | 48 | If the value is nil, no automated compilation takes place. |
| 49 | Default value is t") | 49 | Default value is t") |
| 50 | 50 | ||
| 51 | (defvar ly-display-pdf-post-tangle t | 51 | (defvar org-babel-lilypond-display-pdf-post-tangle t |
| 52 | "Following a successful LilyPond compilation | 52 | "Following a successful LilyPond compilation |
| 53 | ly-display-pdf-post-tangle determines whether to automate the | 53 | org-babel-lilypond-display-pdf-post-tangle determines whether to automate the |
| 54 | drawing / redrawing of the resultant pdf. If the value is nil, | 54 | drawing / redrawing of the resultant pdf. If the value is nil, |
| 55 | the pdf is not automatically redrawn. Default value is t") | 55 | the pdf is not automatically redrawn. Default value is t") |
| 56 | 56 | ||
| 57 | (defvar ly-play-midi-post-tangle t | 57 | (defvar org-babel-lilypond-play-midi-post-tangle t |
| 58 | "Following a successful LilyPond compilation | 58 | "Following a successful LilyPond compilation |
| 59 | ly-play-midi-post-tangle determines whether to automate the | 59 | org-babel-lilypond-play-midi-post-tangle determines whether to automate the |
| 60 | playing of the resultant midi file. If the value is nil, | 60 | playing of the resultant midi file. If the value is nil, |
| 61 | the midi file is not automatically played. Default value is t") | 61 | the midi file is not automatically played. Default value is t") |
| 62 | 62 | ||
| 63 | (defvar ly-OSX-ly-path | 63 | (defvar org-babel-lilypond-OSX-ly-path |
| 64 | "/Applications/lilypond.app/Contents/Resources/bin/lilypond") | 64 | "/Applications/lilypond.app/Contents/Resources/bin/lilypond") |
| 65 | (defvar ly-OSX-pdf-path "open") | 65 | (defvar org-babel-lilypond-OSX-pdf-path "open") |
| 66 | (defvar ly-OSX-midi-path "open") | 66 | (defvar org-babel-lilypond-OSX-midi-path "open") |
| 67 | 67 | ||
| 68 | (defvar ly-nix-ly-path "/usr/bin/lilypond") | 68 | (defvar org-babel-lilypond-nix-ly-path "/usr/bin/lilypond") |
| 69 | (defvar ly-nix-pdf-path "evince") | 69 | (defvar org-babel-lilypond-nix-pdf-path "evince") |
| 70 | (defvar ly-nix-midi-path "timidity") | 70 | (defvar org-babel-lilypond-nix-midi-path "timidity") |
| 71 | 71 | ||
| 72 | (defvar ly-w32-ly-path "lilypond") | 72 | (defvar org-babel-lilypond-w32-ly-path "lilypond") |
| 73 | (defvar ly-w32-pdf-path "") | 73 | (defvar org-babel-lilypond-w32-pdf-path "") |
| 74 | (defvar ly-w32-midi-path "") | 74 | (defvar org-babel-lilypond-w32-midi-path "") |
| 75 | 75 | ||
| 76 | (defvar ly-gen-png nil | 76 | (defvar org-babel-lilypond-gen-png nil |
| 77 | "Image generation (png) can be turned on by default by setting | 77 | "Image generation (png) can be turned on by default by setting |
| 78 | LY-GEN-PNG to t") | 78 | ORG-BABEL-LILYPOND-GEN-PNG to t") |
| 79 | 79 | ||
| 80 | (defvar ly-gen-svg nil | 80 | (defvar org-babel-lilypond-gen-svg nil |
| 81 | "Image generation (SVG) can be turned on by default by setting | 81 | "Image generation (SVG) can be turned on by default by setting |
| 82 | LY-GEN-SVG to t") | 82 | ORG-BABEL-LILYPOND-GEN-SVG to t") |
| 83 | 83 | ||
| 84 | (defvar ly-gen-html nil | 84 | (defvar org-babel-lilypond-gen-html nil |
| 85 | "HTML generation can be turned on by default by setting | 85 | "HTML generation can be turned on by default by setting |
| 86 | LY-GEN-HTML to t") | 86 | ORG-BABEL-LILYPOND-GEN-HTML to t") |
| 87 | 87 | ||
| 88 | (defvar ly-gen-pdf nil | 88 | (defvar org-babel-lilypond-gen-pdf nil |
| 89 | "PDF generation can be turned on by default by setting | 89 | "PDF generation can be turned on by default by setting |
| 90 | LY-GEN-PDF to t") | 90 | ORG-BABEL-LILYPOND-GEN-PDF to t") |
| 91 | 91 | ||
| 92 | (defvar ly-use-eps nil | 92 | (defvar org-babel-lilypond-use-eps nil |
| 93 | "You can force the compiler to use the EPS backend by setting | 93 | "You can force the compiler to use the EPS backend by setting |
| 94 | LY-USE-EPS to t") | 94 | ORG-BABEL-LILYPOND-USE-EPS to t") |
| 95 | 95 | ||
| 96 | (defvar ly-arrange-mode nil | 96 | (defvar org-babel-lilypond-arrange-mode nil |
| 97 | "Arrange mode is turned on by setting LY-ARRANGE-MODE | 97 | "Arrange mode is turned on by setting ORG-BABEL-LILYPOND-ARRANGE-MODE |
| 98 | to t. In Arrange mode the following settings are altered | 98 | to t. In Arrange mode the following settings are altered |
| 99 | from default... | 99 | from default... |
| 100 | :tangle yes, :noweb yes | 100 | :tangle yes, :noweb yes |
| @@ -123,20 +123,20 @@ Depending on whether we are in arrange mode either: | |||
| 123 | 1. Attempt to execute lilypond block according to header settings | 123 | 1. Attempt to execute lilypond block according to header settings |
| 124 | (This is the default basic mode) | 124 | (This is the default basic mode) |
| 125 | 2. Tangle all lilypond blocks and process the result (arrange mode)" | 125 | 2. Tangle all lilypond blocks and process the result (arrange mode)" |
| 126 | (ly-set-header-args ly-arrange-mode) | 126 | (org-babel-lilypond-set-header-args org-babel-lilypond-arrange-mode) |
| 127 | (if ly-arrange-mode | 127 | (if org-babel-lilypond-arrange-mode |
| 128 | (ly-tangle) | 128 | (org-babel-lilypond-tangle) |
| 129 | (ly-process-basic body params))) | 129 | (org-babel-lilypond-process-basic body params))) |
| 130 | 130 | ||
| 131 | (defun ly-tangle () | 131 | (defun org-babel-lilypond-tangle () |
| 132 | "ob-lilypond specific tangle, attempts to invoke | 132 | "ob-lilypond specific tangle, attempts to invoke |
| 133 | =ly-execute-tangled-ly= if tangle is successful. Also passes | 133 | =ly-execute-tangled-ly= if tangle is successful. Also passes |
| 134 | specific arguments to =org-babel-tangle=" | 134 | specific arguments to =org-babel-tangle=" |
| 135 | (interactive) | 135 | (interactive) |
| 136 | (if (org-babel-tangle nil "yes" "lilypond") | 136 | (if (org-babel-tangle nil "yes" "lilypond") |
| 137 | (ly-execute-tangled-ly) nil)) | 137 | (org-babel-lilypond-execute-tangled-ly) nil)) |
| 138 | 138 | ||
| 139 | (defun ly-process-basic (body params) | 139 | (defun org-babel-lilypond-process-basic (body params) |
| 140 | "Execute a lilypond block in basic mode." | 140 | "Execute a lilypond block in basic mode." |
| 141 | (let* ((result-params (cdr (assoc :result-params params))) | 141 | (let* ((result-params (cdr (assoc :result-params params))) |
| 142 | (out-file (cdr (assoc :file params))) | 142 | (out-file (cdr (assoc :file params))) |
| @@ -148,7 +148,7 @@ specific arguments to =org-babel-tangle=" | |||
| 148 | (insert (org-babel-expand-body:generic body params))) | 148 | (insert (org-babel-expand-body:generic body params))) |
| 149 | (org-babel-eval | 149 | (org-babel-eval |
| 150 | (concat | 150 | (concat |
| 151 | (ly-determine-ly-path) | 151 | (org-babel-lilypond-determine-ly-path) |
| 152 | " -dbackend=eps " | 152 | " -dbackend=eps " |
| 153 | "-dno-gs-load-fonts " | 153 | "-dno-gs-load-fonts " |
| 154 | "-dinclude-eps-fonts " | 154 | "-dinclude-eps-fonts " |
| @@ -167,45 +167,45 @@ specific arguments to =org-babel-tangle=" | |||
| 167 | "Return an error because LilyPond exporter does not support sessions." | 167 | "Return an error because LilyPond exporter does not support sessions." |
| 168 | (error "Sorry, LilyPond does not currently support sessions!")) | 168 | (error "Sorry, LilyPond does not currently support sessions!")) |
| 169 | 169 | ||
| 170 | (defun ly-execute-tangled-ly () | 170 | (defun org-babel-lilypond-execute-tangled-ly () |
| 171 | "Compile result of block tangle with lilypond. | 171 | "Compile result of block tangle with lilypond. |
| 172 | If error in compilation, attempt to mark the error in lilypond org file" | 172 | If error in compilation, attempt to mark the error in lilypond org file" |
| 173 | (when ly-compile-post-tangle | 173 | (when org-babel-lilypond-compile-post-tangle |
| 174 | (let ((ly-tangled-file (ly-switch-extension | 174 | (let ((org-babel-lilypond-tangled-file (org-babel-lilypond-switch-extension |
| 175 | (buffer-file-name) ".lilypond")) | 175 | (buffer-file-name) ".lilypond")) |
| 176 | (ly-temp-file (ly-switch-extension | 176 | (org-babel-lilypond-temp-file (org-babel-lilypond-switch-extension |
| 177 | (buffer-file-name) ".ly"))) | 177 | (buffer-file-name) ".ly"))) |
| 178 | (if (file-exists-p ly-tangled-file) | 178 | (if (file-exists-p org-babel-lilypond-tangled-file) |
| 179 | (progn | 179 | (progn |
| 180 | (when (file-exists-p ly-temp-file) | 180 | (when (file-exists-p org-babel-lilypond-temp-file) |
| 181 | (delete-file ly-temp-file)) | 181 | (delete-file org-babel-lilypond-temp-file)) |
| 182 | (rename-file ly-tangled-file | 182 | (rename-file org-babel-lilypond-tangled-file |
| 183 | ly-temp-file)) | 183 | org-babel-lilypond-temp-file)) |
| 184 | (error "Error: Tangle Failed!") t) | 184 | (error "Error: Tangle Failed!") t) |
| 185 | (switch-to-buffer-other-window "*lilypond*") | 185 | (switch-to-buffer-other-window "*lilypond*") |
| 186 | (erase-buffer) | 186 | (erase-buffer) |
| 187 | (ly-compile-lilyfile ly-temp-file) | 187 | (org-babel-lilypond-compile-lilyfile org-babel-lilypond-temp-file) |
| 188 | (goto-char (point-min)) | 188 | (goto-char (point-min)) |
| 189 | (if (not (ly-check-for-compile-error ly-temp-file)) | 189 | (if (not (org-babel-lilypond-check-for-compile-error org-babel-lilypond-temp-file)) |
| 190 | (progn | 190 | (progn |
| 191 | (other-window -1) | 191 | (other-window -1) |
| 192 | (ly-attempt-to-open-pdf ly-temp-file) | 192 | (org-babel-lilypond-attempt-to-open-pdf org-babel-lilypond-temp-file) |
| 193 | (ly-attempt-to-play-midi ly-temp-file)) | 193 | (org-babel-lilypond-attempt-to-play-midi org-babel-lilypond-temp-file)) |
| 194 | (error "Error in Compilation!")))) nil) | 194 | (error "Error in Compilation!")))) nil) |
| 195 | 195 | ||
| 196 | (defun ly-compile-lilyfile (file-name &optional test) | 196 | (defun org-babel-lilypond-compile-lilyfile (file-name &optional test) |
| 197 | "Compile lilypond file and check for compile errors | 197 | "Compile lilypond file and check for compile errors |
| 198 | FILE-NAME is full path to lilypond (.ly) file" | 198 | FILE-NAME is full path to lilypond (.ly) file" |
| 199 | (message "Compiling LilyPond...") | 199 | (message "Compiling LilyPond...") |
| 200 | (let ((arg-1 (ly-determine-ly-path)) ;program | 200 | (let ((arg-1 (org-babel-lilypond-determine-ly-path)) ;program |
| 201 | (arg-2 nil) ;infile | 201 | (arg-2 nil) ;infile |
| 202 | (arg-3 "*lilypond*") ;buffer | 202 | (arg-3 "*lilypond*") ;buffer |
| 203 | (arg-4 t) ;display | 203 | (arg-4 t) ;display |
| 204 | (arg-5 (if ly-gen-png "--png" "")) ;&rest... | 204 | (arg-5 (if org-babel-lilypond-gen-png "--png" "")) ;&rest... |
| 205 | (arg-6 (if ly-gen-html "--html" "")) | 205 | (arg-6 (if org-babel-lilypond-gen-html "--html" "")) |
| 206 | (arg-7 (if ly-gen-pdf "--pdf" "")) | 206 | (arg-7 (if org-babel-lilypond-gen-pdf "--pdf" "")) |
| 207 | (arg-8 (if ly-use-eps "-dbackend=eps" "")) | 207 | (arg-8 (if org-babel-lilypond-use-eps "-dbackend=eps" "")) |
| 208 | (arg-9 (if ly-gen-svg "-dbackend=svg" "")) | 208 | (arg-9 (if org-babel-lilypond-gen-svg "-dbackend=svg" "")) |
| 209 | (arg-10 (concat "--output=" (file-name-sans-extension file-name))) | 209 | (arg-10 (concat "--output=" (file-name-sans-extension file-name))) |
| 210 | (arg-11 file-name)) | 210 | (arg-11 file-name)) |
| 211 | (if test | 211 | (if test |
| @@ -215,7 +215,7 @@ FILE-NAME is full path to lilypond (.ly) file" | |||
| 215 | arg-1 arg-2 arg-3 arg-4 arg-5 arg-6 | 215 | arg-1 arg-2 arg-3 arg-4 arg-5 arg-6 |
| 216 | arg-7 arg-8 arg-9 arg-10 arg-11)))) | 216 | arg-7 arg-8 arg-9 arg-10 arg-11)))) |
| 217 | 217 | ||
| 218 | (defun ly-check-for-compile-error (file-name &optional test) | 218 | (defun org-babel-lilypond-check-for-compile-error (file-name &optional test) |
| 219 | "Check for compile error. | 219 | "Check for compile error. |
| 220 | This is performed by parsing the *lilypond* buffer | 220 | This is performed by parsing the *lilypond* buffer |
| 221 | containing the output message from the compilation. | 221 | containing the output message from the compilation. |
| @@ -226,24 +226,24 @@ nil as file-name since it is unused in this context" | |||
| 226 | (if (not test) | 226 | (if (not test) |
| 227 | (if (not is-error) | 227 | (if (not is-error) |
| 228 | nil | 228 | nil |
| 229 | (ly-process-compile-error file-name)) | 229 | (org-babel-lilypond-process-compile-error file-name)) |
| 230 | is-error))) | 230 | is-error))) |
| 231 | 231 | ||
| 232 | (defun ly-process-compile-error (file-name) | 232 | (defun org-babel-lilypond-process-compile-error (file-name) |
| 233 | "Process the compilation error that has occurred. | 233 | "Process the compilation error that has occurred. |
| 234 | FILE-NAME is full path to lilypond file" | 234 | FILE-NAME is full path to lilypond file" |
| 235 | (let ((line-num (ly-parse-line-num))) | 235 | (let ((line-num (org-babel-lilypond-parse-line-num))) |
| 236 | (let ((error-lines (ly-parse-error-line file-name line-num))) | 236 | (let ((error-lines (org-babel-lilypond-parse-error-line file-name line-num))) |
| 237 | (ly-mark-error-line file-name error-lines) | 237 | (org-babel-lilypond-mark-error-line file-name error-lines) |
| 238 | (error "Error: Compilation Failed!")))) | 238 | (error "Error: Compilation Failed!")))) |
| 239 | 239 | ||
| 240 | (defun ly-mark-error-line (file-name line) | 240 | (defun org-babel-lilypond-mark-error-line (file-name line) |
| 241 | "Mark the erroneous lines in the lilypond org buffer. | 241 | "Mark the erroneous lines in the lilypond org buffer. |
| 242 | FILE-NAME is full path to lilypond file. | 242 | FILE-NAME is full path to lilypond file. |
| 243 | LINE is the erroneous line" | 243 | LINE is the erroneous line" |
| 244 | (switch-to-buffer-other-window | 244 | (switch-to-buffer-other-window |
| 245 | (concat (file-name-nondirectory | 245 | (concat (file-name-nondirectory |
| 246 | (ly-switch-extension file-name ".org")))) | 246 | (org-babel-lilypond-switch-extension file-name ".org")))) |
| 247 | (let ((temp (point))) | 247 | (let ((temp (point))) |
| 248 | (goto-char (point-min)) | 248 | (goto-char (point-min)) |
| 249 | (setq case-fold-search nil) | 249 | (setq case-fold-search nil) |
| @@ -254,7 +254,7 @@ LINE is the erroneous line" | |||
| 254 | (goto-char (- (point) (length line)))) | 254 | (goto-char (- (point) (length line)))) |
| 255 | (goto-char temp)))) | 255 | (goto-char temp)))) |
| 256 | 256 | ||
| 257 | (defun ly-parse-line-num (&optional buffer) | 257 | (defun org-babel-lilypond-parse-line-num (&optional buffer) |
| 258 | "Extract error line number." | 258 | "Extract error line number." |
| 259 | (when buffer | 259 | (when buffer |
| 260 | (set-buffer buffer)) | 260 | (set-buffer buffer)) |
| @@ -276,12 +276,12 @@ LINE is the erroneous line" | |||
| 276 | nil))) | 276 | nil))) |
| 277 | nil))) | 277 | nil))) |
| 278 | 278 | ||
| 279 | (defun ly-parse-error-line (file-name lineNo) | 279 | (defun org-babel-lilypond-parse-error-line (file-name lineNo) |
| 280 | "Extract the erroneous line from the tangled .ly file | 280 | "Extract the erroneous line from the tangled .ly file |
| 281 | FILE-NAME is full path to lilypond file. | 281 | FILE-NAME is full path to lilypond file. |
| 282 | LINENO is the number of the erroneous line" | 282 | LINENO is the number of the erroneous line" |
| 283 | (with-temp-buffer | 283 | (with-temp-buffer |
| 284 | (insert-file-contents (ly-switch-extension file-name ".ly") | 284 | (insert-file-contents (org-babel-lilypond-switch-extension file-name ".ly") |
| 285 | nil nil nil t) | 285 | nil nil nil t) |
| 286 | (if (> lineNo 0) | 286 | (if (> lineNo 0) |
| 287 | (progn | 287 | (progn |
| @@ -290,128 +290,128 @@ LINENO is the number of the erroneous line" | |||
| 290 | (buffer-substring (point) (point-at-eol))) | 290 | (buffer-substring (point) (point-at-eol))) |
| 291 | nil))) | 291 | nil))) |
| 292 | 292 | ||
| 293 | (defun ly-attempt-to-open-pdf (file-name &optional test) | 293 | (defun org-babel-lilypond-attempt-to-open-pdf (file-name &optional test) |
| 294 | "Attempt to display the generated pdf file | 294 | "Attempt to display the generated pdf file |
| 295 | FILE-NAME is full path to lilypond file | 295 | FILE-NAME is full path to lilypond file |
| 296 | If TEST is non-nil, the shell command is returned and is not run" | 296 | If TEST is non-nil, the shell command is returned and is not run" |
| 297 | (when ly-display-pdf-post-tangle | 297 | (when org-babel-lilypond-display-pdf-post-tangle |
| 298 | (let ((pdf-file (ly-switch-extension file-name ".pdf"))) | 298 | (let ((pdf-file (org-babel-lilypond-switch-extension file-name ".pdf"))) |
| 299 | (if (file-exists-p pdf-file) | 299 | (if (file-exists-p pdf-file) |
| 300 | (let ((cmd-string | 300 | (let ((cmd-string |
| 301 | (concat (ly-determine-pdf-path) " " pdf-file))) | 301 | (concat (org-babel-lilypond-determine-pdf-path) " " pdf-file))) |
| 302 | (if test | 302 | (if test |
| 303 | cmd-string | 303 | cmd-string |
| 304 | (start-process | 304 | (start-process |
| 305 | "\"Audition pdf\"" | 305 | "\"Audition pdf\"" |
| 306 | "*lilypond*" | 306 | "*lilypond*" |
| 307 | (ly-determine-pdf-path) | 307 | (org-babel-lilypond-determine-pdf-path) |
| 308 | pdf-file))) | 308 | pdf-file))) |
| 309 | (message "No pdf file generated so can't display!"))))) | 309 | (message "No pdf file generated so can't display!"))))) |
| 310 | 310 | ||
| 311 | (defun ly-attempt-to-play-midi (file-name &optional test) | 311 | (defun org-babel-lilypond-attempt-to-play-midi (file-name &optional test) |
| 312 | "Attempt to play the generated MIDI file | 312 | "Attempt to play the generated MIDI file |
| 313 | FILE-NAME is full path to lilypond file | 313 | FILE-NAME is full path to lilypond file |
| 314 | If TEST is non-nil, the shell command is returned and is not run" | 314 | If TEST is non-nil, the shell command is returned and is not run" |
| 315 | (when ly-play-midi-post-tangle | 315 | (when org-babel-lilypond-play-midi-post-tangle |
| 316 | (let ((midi-file (ly-switch-extension file-name ".midi"))) | 316 | (let ((midi-file (org-babel-lilypond-switch-extension file-name ".midi"))) |
| 317 | (if (file-exists-p midi-file) | 317 | (if (file-exists-p midi-file) |
| 318 | (let ((cmd-string | 318 | (let ((cmd-string |
| 319 | (concat (ly-determine-midi-path) " " midi-file))) | 319 | (concat (org-babel-lilypond-determine-midi-path) " " midi-file))) |
| 320 | (if test | 320 | (if test |
| 321 | cmd-string | 321 | cmd-string |
| 322 | (start-process | 322 | (start-process |
| 323 | "\"Audition midi\"" | 323 | "\"Audition midi\"" |
| 324 | "*lilypond*" | 324 | "*lilypond*" |
| 325 | (ly-determine-midi-path) | 325 | (org-babel-lilypond-determine-midi-path) |
| 326 | midi-file))) | 326 | midi-file))) |
| 327 | (message "No midi file generated so can't play!"))))) | 327 | (message "No midi file generated so can't play!"))))) |
| 328 | 328 | ||
| 329 | (defun ly-determine-ly-path (&optional test) | 329 | (defun org-babel-lilypond-determine-ly-path (&optional test) |
| 330 | "Return correct path to ly binary depending on OS | 330 | "Return correct path to ly binary depending on OS |
| 331 | If TEST is non-nil, it contains a simulation of the OS for test purposes" | 331 | If TEST is non-nil, it contains a simulation of the OS for test purposes" |
| 332 | (let ((sys-type | 332 | (let ((sys-type |
| 333 | (or test system-type))) | 333 | (or test system-type))) |
| 334 | (cond ((string= sys-type "darwin") | 334 | (cond ((string= sys-type "darwin") |
| 335 | ly-OSX-ly-path) | 335 | org-babel-lilypond-OSX-ly-path) |
| 336 | ((string= sys-type "windows-nt") | 336 | ((string= sys-type "windows-nt") |
| 337 | ly-w32-ly-path) | 337 | org-babel-lilypond-w32-ly-path) |
| 338 | (t ly-nix-ly-path)))) | 338 | (t org-babel-lilypond-nix-ly-path)))) |
| 339 | 339 | ||
| 340 | (defun ly-determine-pdf-path (&optional test) | 340 | (defun org-babel-lilypond-determine-pdf-path (&optional test) |
| 341 | "Return correct path to pdf viewer depending on OS | 341 | "Return correct path to pdf viewer depending on OS |
| 342 | If TEST is non-nil, it contains a simulation of the OS for test purposes" | 342 | If TEST is non-nil, it contains a simulation of the OS for test purposes" |
| 343 | (let ((sys-type | 343 | (let ((sys-type |
| 344 | (or test system-type))) | 344 | (or test system-type))) |
| 345 | (cond ((string= sys-type "darwin") | 345 | (cond ((string= sys-type "darwin") |
| 346 | ly-OSX-pdf-path) | 346 | org-babel-lilypond-OSX-pdf-path) |
| 347 | ((string= sys-type "windows-nt") | 347 | ((string= sys-type "windows-nt") |
| 348 | ly-w32-pdf-path) | 348 | org-babel-lilypond-w32-pdf-path) |
| 349 | (t ly-nix-pdf-path)))) | 349 | (t org-babel-lilypond-nix-pdf-path)))) |
| 350 | 350 | ||
| 351 | (defun ly-determine-midi-path (&optional test) | 351 | (defun org-babel-lilypond-determine-midi-path (&optional test) |
| 352 | "Return correct path to midi player depending on OS | 352 | "Return correct path to midi player depending on OS |
| 353 | If TEST is non-nil, it contains a simulation of the OS for test purposes" | 353 | If TEST is non-nil, it contains a simulation of the OS for test purposes" |
| 354 | (let ((sys-type | 354 | (let ((sys-type |
| 355 | (or test test system-type))) | 355 | (or test test system-type))) |
| 356 | (cond ((string= sys-type "darwin") | 356 | (cond ((string= sys-type "darwin") |
| 357 | ly-OSX-midi-path) | 357 | org-babel-lilypond-OSX-midi-path) |
| 358 | ((string= sys-type "windows-nt") | 358 | ((string= sys-type "windows-nt") |
| 359 | ly-w32-midi-path) | 359 | org-babel-lilypond-w32-midi-path) |
| 360 | (t ly-nix-midi-path)))) | 360 | (t org-babel-lilypond-nix-midi-path)))) |
| 361 | 361 | ||
| 362 | (defun ly-toggle-midi-play () | 362 | (defun org-babel-lilypond-toggle-midi-play () |
| 363 | "Toggle whether midi will be played following a successful compilation." | 363 | "Toggle whether midi will be played following a successful compilation." |
| 364 | (interactive) | 364 | (interactive) |
| 365 | (setq ly-play-midi-post-tangle | 365 | (setq org-babel-lilypond-play-midi-post-tangle |
| 366 | (not ly-play-midi-post-tangle)) | 366 | (not org-babel-lilypond-play-midi-post-tangle)) |
| 367 | (message (concat "Post-Tangle MIDI play has been " | 367 | (message (concat "Post-Tangle MIDI play has been " |
| 368 | (if ly-play-midi-post-tangle | 368 | (if org-babel-lilypond-play-midi-post-tangle |
| 369 | "ENABLED." "DISABLED.")))) | 369 | "ENABLED." "DISABLED.")))) |
| 370 | 370 | ||
| 371 | (defun ly-toggle-pdf-display () | 371 | (defun org-babel-lilypond-toggle-pdf-display () |
| 372 | "Toggle whether pdf will be displayed following a successful compilation." | 372 | "Toggle whether pdf will be displayed following a successful compilation." |
| 373 | (interactive) | 373 | (interactive) |
| 374 | (setq ly-display-pdf-post-tangle | 374 | (setq org-babel-lilypond-display-pdf-post-tangle |
| 375 | (not ly-display-pdf-post-tangle)) | 375 | (not org-babel-lilypond-display-pdf-post-tangle)) |
| 376 | (message (concat "Post-Tangle PDF display has been " | 376 | (message (concat "Post-Tangle PDF display has been " |
| 377 | (if ly-display-pdf-post-tangle | 377 | (if org-babel-lilypond-display-pdf-post-tangle |
| 378 | "ENABLED." "DISABLED.")))) | 378 | "ENABLED." "DISABLED.")))) |
| 379 | 379 | ||
| 380 | (defun ly-toggle-png-generation () | 380 | (defun org-babel-lilypond-toggle-png-generation () |
| 381 | "Toggle whether png image will be generated by compilation." | 381 | "Toggle whether png image will be generated by compilation." |
| 382 | (interactive) | 382 | (interactive) |
| 383 | (setq ly-gen-png (not ly-gen-png)) | 383 | (setq org-babel-lilypond-gen-png (not org-babel-lilypond-gen-png)) |
| 384 | (message (concat "PNG image generation has been " | 384 | (message (concat "PNG image generation has been " |
| 385 | (if ly-gen-png "ENABLED." "DISABLED.")))) | 385 | (if org-babel-lilypond-gen-png "ENABLED." "DISABLED.")))) |
| 386 | 386 | ||
| 387 | (defun ly-toggle-html-generation () | 387 | (defun org-babel-lilypond-toggle-html-generation () |
| 388 | "Toggle whether html will be generated by compilation." | 388 | "Toggle whether html will be generated by compilation." |
| 389 | (interactive) | 389 | (interactive) |
| 390 | (setq ly-gen-html (not ly-gen-html)) | 390 | (setq org-babel-lilypond-gen-html (not org-babel-lilypond-gen-html)) |
| 391 | (message (concat "HTML generation has been " | 391 | (message (concat "HTML generation has been " |
| 392 | (if ly-gen-html "ENABLED." "DISABLED.")))) | 392 | (if org-babel-lilypond-gen-html "ENABLED." "DISABLED.")))) |
| 393 | 393 | ||
| 394 | (defun ly-toggle-pdf-generation () | 394 | (defun org-babel-lilypond-toggle-pdf-generation () |
| 395 | "Toggle whether pdf will be generated by compilation." | 395 | "Toggle whether pdf will be generated by compilation." |
| 396 | (interactive) | 396 | (interactive) |
| 397 | (setq ly-gen-pdf (not ly-gen-pdf)) | 397 | (setq org-babel-lilypond-gen-pdf (not org-babel-lilypond-gen-pdf)) |
| 398 | (message (concat "PDF generation has been " | 398 | (message (concat "PDF generation has been " |
| 399 | (if ly-gen-pdf "ENABLED." "DISABLED.")))) | 399 | (if org-babel-lilypond-gen-pdf "ENABLED." "DISABLED.")))) |
| 400 | 400 | ||
| 401 | (defun ly-toggle-arrange-mode () | 401 | (defun org-babel-lilypond-toggle-arrange-mode () |
| 402 | "Toggle whether in Arrange mode or Basic mode." | 402 | "Toggle whether in Arrange mode or Basic mode." |
| 403 | (interactive) | 403 | (interactive) |
| 404 | (setq ly-arrange-mode | 404 | (setq org-babel-lilypond-arrange-mode |
| 405 | (not ly-arrange-mode)) | 405 | (not org-babel-lilypond-arrange-mode)) |
| 406 | (message (concat "Arrange mode has been " | 406 | (message (concat "Arrange mode has been " |
| 407 | (if ly-arrange-mode "ENABLED." "DISABLED.")))) | 407 | (if org-babel-lilypond-arrange-mode "ENABLED." "DISABLED.")))) |
| 408 | 408 | ||
| 409 | (defun ly-switch-extension (file-name ext) | 409 | (defun org-babel-lilypond-switch-extension (file-name ext) |
| 410 | "Utility command to swap current FILE-NAME extension with EXT" | 410 | "Utility command to swap current FILE-NAME extension with EXT" |
| 411 | (concat (file-name-sans-extension | 411 | (concat (file-name-sans-extension |
| 412 | file-name) ext)) | 412 | file-name) ext)) |
| 413 | 413 | ||
| 414 | (defun ly-get-header-args (mode) | 414 | (defun org-babel-lilypond-get-header-args (mode) |
| 415 | "Default arguments to use when evaluating a lilypond | 415 | "Default arguments to use when evaluating a lilypond |
| 416 | source block. These depend upon whether we are in arrange | 416 | source block. These depend upon whether we are in arrange |
| 417 | mode i.e. ARRANGE-MODE is t" | 417 | mode i.e. ARRANGE-MODE is t" |
| @@ -425,11 +425,11 @@ mode i.e. ARRANGE-MODE is t" | |||
| 425 | '((:results . "file") | 425 | '((:results . "file") |
| 426 | (:exports . "results"))))) | 426 | (:exports . "results"))))) |
| 427 | 427 | ||
| 428 | (defun ly-set-header-args (mode) | 428 | (defun org-babel-lilypond-set-header-args (mode) |
| 429 | "Set org-babel-default-header-args:lilypond | 429 | "Set org-babel-default-header-args:lilypond |
| 430 | dependent on LY-ARRANGE-MODE" | 430 | dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE" |
| 431 | (setq org-babel-default-header-args:lilypond | 431 | (setq org-babel-default-header-args:lilypond |
| 432 | (ly-get-header-args mode))) | 432 | (org-babel-lilypond-get-header-args mode))) |
| 433 | 433 | ||
| 434 | (provide 'ob-lilypond) | 434 | (provide 'ob-lilypond) |
| 435 | 435 | ||
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el index baa5764ac42..7cee1046690 100644 --- a/lisp/org/ob-python.el +++ b/lisp/org/ob-python.el | |||
| @@ -56,8 +56,6 @@ This will typically be either 'python or 'python-mode." | |||
| 56 | :package-version '(Org . "8.0") | 56 | :package-version '(Org . "8.0") |
| 57 | :type 'symbol) | 57 | :type 'symbol) |
| 58 | 58 | ||
| 59 | (defvar org-src-preserve-indentation) | ||
| 60 | |||
| 61 | (defcustom org-babel-python-hline-to "None" | 59 | (defcustom org-babel-python-hline-to "None" |
| 62 | "Replace hlines in incoming tables with this when translating to python." | 60 | "Replace hlines in incoming tables with this when translating to python." |
| 63 | :group 'org-babel | 61 | :group 'org-babel |
diff --git a/lisp/org/ob-sh.el b/lisp/org/ob-sh.el index 96f275bc87a..856c7a01c88 100644 --- a/lisp/org/ob-sh.el +++ b/lisp/org/ob-sh.el | |||
| @@ -123,7 +123,13 @@ Emacs-lisp table, otherwise return the results as a string." | |||
| 123 | (when (and session (not (string= session "none"))) | 123 | (when (and session (not (string= session "none"))) |
| 124 | (save-window-excursion | 124 | (save-window-excursion |
| 125 | (or (org-babel-comint-buffer-livep session) | 125 | (or (org-babel-comint-buffer-livep session) |
| 126 | (progn (shell session) (get-buffer (current-buffer))))))) | 126 | (progn |
| 127 | (shell session) | ||
| 128 | ;; Needed for Emacs 23 since the marker is initially | ||
| 129 | ;; undefined and the filter functions try to use it without | ||
| 130 | ;; checking. | ||
| 131 | (set-marker comint-last-output-start (point)) | ||
| 132 | (get-buffer (current-buffer))))))) | ||
| 127 | 133 | ||
| 128 | (defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'" | 134 | (defvar org-babel-sh-eoe-indicator "echo 'org_babel_sh_eoe'" |
| 129 | "String to indicate that evaluation has completed.") | 135 | "String to indicate that evaluation has completed.") |
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 37b2d92a8cf..3a43b42e3ad 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el | |||
| @@ -225,13 +225,14 @@ used to limit the exported source code blocks by language." | |||
| 225 | (concat base-name "." ext) base-name)))) | 225 | (concat base-name "." ext) base-name)))) |
| 226 | (when file-name | 226 | (when file-name |
| 227 | ;; Possibly create the parent directories for file. | 227 | ;; Possibly create the parent directories for file. |
| 228 | (when (let ((m (funcall get-spec :mkdirp))) | 228 | (let ((m (funcall get-spec :mkdirp)) |
| 229 | (and m (not (string= m "no")))) | 229 | (fnd (file-name-directory file-name))) |
| 230 | (make-directory (file-name-directory file-name) 'parents)) | 230 | (and m fnd (not (string= m "no")) |
| 231 | (make-directory fnd 'parents))) | ||
| 231 | ;; delete any old versions of file | 232 | ;; delete any old versions of file |
| 232 | (when (and (file-exists-p file-name) | 233 | (and (file-exists-p file-name) |
| 233 | (not (member file-name (mapcar #'car path-collector)))) | 234 | (not (member file-name (mapcar #'car path-collector))) |
| 234 | (delete-file file-name)) | 235 | (delete-file file-name)) |
| 235 | ;; drop source-block to file | 236 | ;; drop source-block to file |
| 236 | (with-temp-buffer | 237 | (with-temp-buffer |
| 237 | (when (fboundp lang-f) (ignore-errors (funcall lang-f))) | 238 | (when (fboundp lang-f) (ignore-errors (funcall lang-f))) |
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 18fada15de8..6f9db514d43 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el | |||
| @@ -390,32 +390,36 @@ the daily/weekly agenda, see `org-agenda-skip-function'.") | |||
| 390 | (repeat :inline t :tag "Conditions for skipping" | 390 | (repeat :inline t :tag "Conditions for skipping" |
| 391 | (choice | 391 | (choice |
| 392 | :tag "Condition type" | 392 | :tag "Condition type" |
| 393 | (list :tag "Regexp matches" :inline t (const :format "" regexp) (regexp)) | 393 | (list :tag "Regexp matches" :inline t |
| 394 | (list :tag "Regexp does not match" :inline t (const :format "" notregexp) (regexp)) | 394 | (const :format "" 'regexp) |
| 395 | (regexp)) | ||
| 396 | (list :tag "Regexp does not match" :inline t | ||
| 397 | (const :format "" 'notregexp) | ||
| 398 | (regexp)) | ||
| 395 | (list :tag "TODO state is" :inline t | 399 | (list :tag "TODO state is" :inline t |
| 396 | (const todo) | 400 | (const 'todo) |
| 397 | (choice | 401 | (choice |
| 398 | (const :tag "any not-done state" todo) | 402 | (const :tag "Any not-done state" 'todo) |
| 399 | (const :tag "any done state" done) | 403 | (const :tag "Any done state" 'done) |
| 400 | (const :tag "any state" any) | 404 | (const :tag "Any state" 'any) |
| 401 | (list :tag "Keyword list" | 405 | (list :tag "Keyword list" |
| 402 | (const :format "" quote) | 406 | (const :format "" quote) |
| 403 | (repeat (string :tag "Keyword"))))) | 407 | (repeat (string :tag "Keyword"))))) |
| 404 | (list :tag "TODO state is not" :inline t | 408 | (list :tag "TODO state is not" :inline t |
| 405 | (const nottodo) | 409 | (const 'nottodo) |
| 406 | (choice | 410 | (choice |
| 407 | (const :tag "any not-done state" todo) | 411 | (const :tag "Any not-done state" 'todo) |
| 408 | (const :tag "any done state" done) | 412 | (const :tag "Any done state" 'done) |
| 409 | (const :tag "any state" any) | 413 | (const :tag "Any state" 'any) |
| 410 | (list :tag "Keyword list" | 414 | (list :tag "Keyword list" |
| 411 | (const :format "" quote) | 415 | (const :format "" quote) |
| 412 | (repeat (string :tag "Keyword"))))) | 416 | (repeat (string :tag "Keyword"))))) |
| 413 | (const :tag "scheduled" scheduled) | 417 | (const :tag "scheduled" 'scheduled) |
| 414 | (const :tag "not scheduled" notscheduled) | 418 | (const :tag "not scheduled" 'notscheduled) |
| 415 | (const :tag "deadline" deadline) | 419 | (const :tag "deadline" 'deadline) |
| 416 | (const :tag "no deadline" notdeadline) | 420 | (const :tag "no deadline" 'notdeadline) |
| 417 | (const :tag "timestamp" timestamp) | 421 | (const :tag "timestamp" 'timestamp) |
| 418 | (const :tag "no timestamp" nottimestamp)))))) | 422 | (const :tag "no timestamp" 'nottimestamp)))))) |
| 419 | (list :tag "Non-standard skipping condition" | 423 | (list :tag "Non-standard skipping condition" |
| 420 | :value (org-agenda-skip-function) | 424 | :value (org-agenda-skip-function) |
| 421 | (const org-agenda-skip-function) | 425 | (const org-agenda-skip-function) |
| @@ -2092,11 +2096,9 @@ When nil, `q' will kill the single agenda buffer." | |||
| 2092 | org-agenda-info | 2096 | org-agenda-info |
| 2093 | org-agenda-pre-window-conf | 2097 | org-agenda-pre-window-conf |
| 2094 | org-agenda-columns-active | 2098 | org-agenda-columns-active |
| 2095 | org-agenda-tag-filter-overlays | ||
| 2096 | org-agenda-tag-filter | 2099 | org-agenda-tag-filter |
| 2097 | org-agenda-cat-filter-overlays | ||
| 2098 | org-agenda-category-filter | 2100 | org-agenda-category-filter |
| 2099 | org-agenda-re-filter-overlays | 2101 | org-agenda-top-headline-filter |
| 2100 | org-agenda-regexp-filter | 2102 | org-agenda-regexp-filter |
| 2101 | org-agenda-markers | 2103 | org-agenda-markers |
| 2102 | org-agenda-last-search-view-search-was-boolean | 2104 | org-agenda-last-search-view-search-was-boolean |
| @@ -2158,10 +2160,11 @@ The following commands are available: | |||
| 2158 | nil t) | 2160 | nil t) |
| 2159 | (unless org-agenda-keep-modes | 2161 | (unless org-agenda-keep-modes |
| 2160 | (setq org-agenda-follow-mode org-agenda-start-with-follow-mode | 2162 | (setq org-agenda-follow-mode org-agenda-start-with-follow-mode |
| 2161 | org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode | 2163 | org-agenda-entry-text-mode org-agenda-start-with-entry-text-mode)) |
| 2162 | org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode | 2164 | (setq org-agenda-show-log org-agenda-start-with-log-mode) |
| 2163 | org-agenda-show-log org-agenda-start-with-log-mode)) | 2165 | (setq org-agenda-clockreport-mode org-agenda-start-with-clockreport-mode) |
| 2164 | 2166 | (add-to-invisibility-spec '(org-filtered)) | |
| 2167 | (add-to-invisibility-spec '(org-link)) | ||
| 2165 | (easy-menu-change | 2168 | (easy-menu-change |
| 2166 | '("Agenda") "Agenda Files" | 2169 | '("Agenda") "Agenda Files" |
| 2167 | (append | 2170 | (append |
| @@ -2604,7 +2607,7 @@ type." | |||
| 2604 | :package-version '(Org . "8.0") | 2607 | :package-version '(Org . "8.0") |
| 2605 | :group 'org-agenda-custom-commands | 2608 | :group 'org-agenda-custom-commands |
| 2606 | :type '(choice (symbol :tag "No limit" nil) | 2609 | :type '(choice (symbol :tag "No limit" nil) |
| 2607 | (integer :tag "Max number of entries") | 2610 | (integer :tag "Max number of TODOs") |
| 2608 | (repeat | 2611 | (repeat |
| 2609 | (cons (choice :tag "Agenda type" | 2612 | (cons (choice :tag "Agenda type" |
| 2610 | (const agenda) | 2613 | (const agenda) |
| @@ -2612,7 +2615,7 @@ type." | |||
| 2612 | (const tags) | 2615 | (const tags) |
| 2613 | (const search) | 2616 | (const search) |
| 2614 | (const timeline)) | 2617 | (const timeline)) |
| 2615 | (integer :tag "Max number of entries"))))) | 2618 | (integer :tag "Max number of TODOs"))))) |
| 2616 | 2619 | ||
| 2617 | (defcustom org-agenda-max-tags nil | 2620 | (defcustom org-agenda-max-tags nil |
| 2618 | "Maximum number of tagged entries to display in an agenda. | 2621 | "Maximum number of tagged entries to display in an agenda. |
| @@ -2623,7 +2626,7 @@ type." | |||
| 2623 | :package-version '(Org . "8.0") | 2626 | :package-version '(Org . "8.0") |
| 2624 | :group 'org-agenda-custom-commands | 2627 | :group 'org-agenda-custom-commands |
| 2625 | :type '(choice (symbol :tag "No limit" nil) | 2628 | :type '(choice (symbol :tag "No limit" nil) |
| 2626 | (integer :tag "Max number of entries") | 2629 | (integer :tag "Max number of tagged entries") |
| 2627 | (repeat | 2630 | (repeat |
| 2628 | (cons (choice :tag "Agenda type" | 2631 | (cons (choice :tag "Agenda type" |
| 2629 | (const agenda) | 2632 | (const agenda) |
| @@ -2631,7 +2634,7 @@ type." | |||
| 2631 | (const tags) | 2634 | (const tags) |
| 2632 | (const search) | 2635 | (const search) |
| 2633 | (const timeline)) | 2636 | (const timeline)) |
| 2634 | (integer :tag "Max number of entries"))))) | 2637 | (integer :tag "Max number of tagged entries"))))) |
| 2635 | 2638 | ||
| 2636 | (defcustom org-agenda-max-effort nil | 2639 | (defcustom org-agenda-max-effort nil |
| 2637 | "Maximum cumulated effort duration for the agenda. | 2640 | "Maximum cumulated effort duration for the agenda. |
| @@ -2642,7 +2645,7 @@ to limit entries to in this type." | |||
| 2642 | :package-version '(Org . "8.0") | 2645 | :package-version '(Org . "8.0") |
| 2643 | :group 'org-agenda-custom-commands | 2646 | :group 'org-agenda-custom-commands |
| 2644 | :type '(choice (symbol :tag "No limit" nil) | 2647 | :type '(choice (symbol :tag "No limit" nil) |
| 2645 | (integer :tag "Max number of entries") | 2648 | (integer :tag "Max number of minutes") |
| 2646 | (repeat | 2649 | (repeat |
| 2647 | (cons (choice :tag "Agenda type" | 2650 | (cons (choice :tag "Agenda type" |
| 2648 | (const agenda) | 2651 | (const agenda) |
| @@ -2650,7 +2653,7 @@ to limit entries to in this type." | |||
| 2650 | (const tags) | 2653 | (const tags) |
| 2651 | (const search) | 2654 | (const search) |
| 2652 | (const timeline)) | 2655 | (const timeline)) |
| 2653 | (integer :tag "Max number of entries"))))) | 2656 | (integer :tag "Max number of minutes"))))) |
| 2654 | 2657 | ||
| 2655 | (defvar org-keys nil) | 2658 | (defvar org-keys nil) |
| 2656 | (defvar org-match nil) | 2659 | (defvar org-match nil) |
| @@ -3324,19 +3327,12 @@ If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write." | |||
| 3324 | (org-let (if nosettings nil org-agenda-exporter-settings) | 3327 | (org-let (if nosettings nil org-agenda-exporter-settings) |
| 3325 | '(save-excursion | 3328 | '(save-excursion |
| 3326 | (save-window-excursion | 3329 | (save-window-excursion |
| 3327 | (org-agenda-mark-filtered-text) | ||
| 3328 | (let ((bs (copy-sequence (buffer-string))) beg content) | 3330 | (let ((bs (copy-sequence (buffer-string))) beg content) |
| 3329 | (org-agenda-unmark-filtered-text) | ||
| 3330 | (with-temp-buffer | 3331 | (with-temp-buffer |
| 3331 | (rename-buffer org-agenda-write-buffer-name t) | 3332 | (rename-buffer org-agenda-write-buffer-name t) |
| 3332 | (set-buffer-modified-p nil) | 3333 | (set-buffer-modified-p nil) |
| 3333 | (insert bs) | 3334 | (insert bs) |
| 3334 | (org-agenda-remove-marked-text 'org-filtered) | 3335 | (org-agenda-remove-marked-text 'org-filtered) |
| 3335 | (while (setq beg (text-property-any (point-min) (point-max) | ||
| 3336 | 'org-filtered t)) | ||
| 3337 | (delete-region | ||
| 3338 | beg (or (next-single-property-change beg 'org-filtered) | ||
| 3339 | (point-max)))) | ||
| 3340 | (run-hooks 'org-agenda-before-write-hook) | 3336 | (run-hooks 'org-agenda-before-write-hook) |
| 3341 | (cond | 3337 | (cond |
| 3342 | ((org-bound-and-true-p org-mobile-creating-agendas) | 3338 | ((org-bound-and-true-p org-mobile-creating-agendas) |
| @@ -3356,7 +3352,7 @@ If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write." | |||
| 3356 | content))) | 3352 | content))) |
| 3357 | (find-file file) | 3353 | (find-file file) |
| 3358 | (erase-buffer) | 3354 | (erase-buffer) |
| 3359 | (mapcar (lambda (s) (org-paste-subtree 1 s)) (reverse content)) | 3355 | (dolist (s content) (org-paste-subtree 1 s)) |
| 3360 | (write-file file) | 3356 | (write-file file) |
| 3361 | (kill-buffer (current-buffer)) | 3357 | (kill-buffer (current-buffer)) |
| 3362 | (message "Org file written to %s" file))) | 3358 | (message "Org file written to %s" file))) |
| @@ -3402,28 +3398,6 @@ If AGENDA-BUFFER-NAME, use this as the buffer name for the agenda to write." | |||
| 3402 | org-agenda-buffer-name))) | 3398 | org-agenda-buffer-name))) |
| 3403 | (when open (org-open-file file))) | 3399 | (when open (org-open-file file))) |
| 3404 | 3400 | ||
| 3405 | (defvar org-agenda-tag-filter-overlays nil) | ||
| 3406 | (defvar org-agenda-cat-filter-overlays nil) | ||
| 3407 | (defvar org-agenda-re-filter-overlays nil) | ||
| 3408 | |||
| 3409 | (defun org-agenda-mark-filtered-text () | ||
| 3410 | "Mark all text hidden by filtering with a text property." | ||
| 3411 | (let ((inhibit-read-only t)) | ||
| 3412 | (mapc | ||
| 3413 | (lambda (o) | ||
| 3414 | (when (equal (overlay-buffer o) (current-buffer)) | ||
| 3415 | (put-text-property | ||
| 3416 | (overlay-start o) (overlay-end o) | ||
| 3417 | 'org-filtered t))) | ||
| 3418 | (append org-agenda-tag-filter-overlays | ||
| 3419 | org-agenda-cat-filter-overlays | ||
| 3420 | org-agenda-re-filter-overlays)))) | ||
| 3421 | |||
| 3422 | (defun org-agenda-unmark-filtered-text () | ||
| 3423 | "Remove the filtering text property." | ||
| 3424 | (let ((inhibit-read-only t)) | ||
| 3425 | (remove-text-properties (point-min) (point-max) '(org-filtered t)))) | ||
| 3426 | |||
| 3427 | (defun org-agenda-remove-marked-text (property &optional value) | 3401 | (defun org-agenda-remove-marked-text (property &optional value) |
| 3428 | "Delete all text marked with VALUE of PROPERTY. | 3402 | "Delete all text marked with VALUE of PROPERTY. |
| 3429 | VALUE defaults to t." | 3403 | VALUE defaults to t." |
| @@ -3432,7 +3406,7 @@ VALUE defaults to t." | |||
| 3432 | (while (setq beg (text-property-any (point-min) (point-max) | 3406 | (while (setq beg (text-property-any (point-min) (point-max) |
| 3433 | property value)) | 3407 | property value)) |
| 3434 | (delete-region | 3408 | (delete-region |
| 3435 | beg (or (next-single-property-change beg 'org-filtered) | 3409 | beg (or (next-single-property-change beg property) |
| 3436 | (point-max)))))) | 3410 | (point-max)))))) |
| 3437 | 3411 | ||
| 3438 | (defun org-agenda-add-entry-text () | 3412 | (defun org-agenda-add-entry-text () |
| @@ -3557,7 +3531,6 @@ removed from the entry content. Currently only `planning' is allowed here." | |||
| 3557 | (defvar org-agenda-category-filter nil) | 3531 | (defvar org-agenda-category-filter nil) |
| 3558 | (defvar org-agenda-regexp-filter nil) | 3532 | (defvar org-agenda-regexp-filter nil) |
| 3559 | (defvar org-agenda-top-headline-filter nil) | 3533 | (defvar org-agenda-top-headline-filter nil) |
| 3560 | (defvar org-agenda-tag-filter-while-redo nil) | ||
| 3561 | (defvar org-agenda-tag-filter-preset nil | 3534 | (defvar org-agenda-tag-filter-preset nil |
| 3562 | "A preset of the tags filter used for secondary agenda filtering. | 3535 | "A preset of the tags filter used for secondary agenda filtering. |
| 3563 | This must be a list of strings, each string must be a single tag preceded | 3536 | This must be a list of strings, each string must be a single tag preceded |
| @@ -3609,10 +3582,12 @@ generating a new one." | |||
| 3609 | ;; does not have org variables local | 3582 | ;; does not have org variables local |
| 3610 | org-agenda-this-buffer-is-sticky)))) | 3583 | org-agenda-this-buffer-is-sticky)))) |
| 3611 | 3584 | ||
| 3612 | (defun org-agenda-prepare-window (abuf) | 3585 | (defun org-agenda-prepare-window (abuf filter-alist) |
| 3613 | "Setup agenda buffer in the window." | 3586 | "Setup agenda buffer in the window. |
| 3614 | (let* ((awin (get-buffer-window abuf)) | 3587 | ABUF is the buffer for the agenda window. |
| 3615 | wconf) | 3588 | FILTER-ALIST is an alist of filters we need to apply when |
| 3589 | `org-agenda-persistent-filter' is non-nil." | ||
| 3590 | (let* ((awin (get-buffer-window abuf)) wconf) | ||
| 3616 | (cond | 3591 | (cond |
| 3617 | ((equal (current-buffer) abuf) nil) | 3592 | ((equal (current-buffer) abuf) nil) |
| 3618 | (awin (select-window awin)) | 3593 | (awin (select-window awin)) |
| @@ -3626,68 +3601,76 @@ generating a new one." | |||
| 3626 | ((equal org-agenda-window-setup 'reorganize-frame) | 3601 | ((equal org-agenda-window-setup 'reorganize-frame) |
| 3627 | (delete-other-windows) | 3602 | (delete-other-windows) |
| 3628 | (org-switch-to-buffer-other-window abuf))) | 3603 | (org-switch-to-buffer-other-window abuf))) |
| 3629 | ;; additional test in case agenda is invoked from within agenda | 3604 | (setq org-agenda-tag-filter (cdr (assoc 'tag filter-alist))) |
| 3630 | ;; buffer via elisp link | 3605 | (setq org-agenda-category-filter (cdr (assoc 'cat filter-alist))) |
| 3606 | (setq org-agenda-regexp-filter (cdr (assoc 're filter-alist))) | ||
| 3607 | ;; Additional test in case agenda is invoked from within agenda | ||
| 3608 | ;; buffer via elisp link. | ||
| 3631 | (unless (equal (current-buffer) abuf) | 3609 | (unless (equal (current-buffer) abuf) |
| 3632 | (org-pop-to-buffer-same-window abuf)) | 3610 | (org-pop-to-buffer-same-window abuf)) |
| 3633 | (setq org-agenda-pre-window-conf | 3611 | (setq org-agenda-pre-window-conf |
| 3634 | (or org-agenda-pre-window-conf wconf)))) | 3612 | (or org-agenda-pre-window-conf wconf)))) |
| 3635 | 3613 | ||
| 3636 | (defun org-agenda-prepare (&optional name) | 3614 | (defun org-agenda-prepare (&optional name) |
| 3637 | (if (org-agenda-use-sticky-p) | 3615 | (let ((filter-alist (if org-agenda-persistent-filter |
| 3638 | (progn | 3616 | (list `(tag . ,org-agenda-tag-filter) |
| 3639 | ;; Popup existing buffer | 3617 | `(re . ,org-agenda-regexp-filter) |
| 3640 | (org-agenda-prepare-window (get-buffer org-agenda-buffer-name)) | 3618 | `(car . ,org-agenda-category-filter))))) |
| 3641 | (message "Sticky Agenda buffer, use `r' to refresh") | 3619 | (if (org-agenda-use-sticky-p) |
| 3642 | (or org-agenda-multi (org-agenda-fit-window-to-buffer)) | ||
| 3643 | (throw 'exit "Sticky Agenda buffer, use `r' to refresh")) | ||
| 3644 | (setq org-todo-keywords-for-agenda nil) | ||
| 3645 | (setq org-drawers-for-agenda nil) | ||
| 3646 | (unless org-agenda-persistent-filter | ||
| 3647 | (setq org-agenda-tag-filter nil | ||
| 3648 | org-agenda-category-filter nil | ||
| 3649 | org-agenda-regexp-filter nil)) | ||
| 3650 | (put 'org-agenda-tag-filter :preset-filter | ||
| 3651 | org-agenda-tag-filter-preset) | ||
| 3652 | (put 'org-agenda-category-filter :preset-filter | ||
| 3653 | org-agenda-category-filter-preset) | ||
| 3654 | (put 'org-agenda-regexp-filter :preset-filter | ||
| 3655 | org-agenda-regexp-filter-preset) | ||
| 3656 | (if org-agenda-multi | ||
| 3657 | (progn | 3620 | (progn |
| 3658 | (setq buffer-read-only nil) | 3621 | (put 'org-agenda-tag-filter :preset-filter nil) |
| 3659 | (goto-char (point-max)) | 3622 | (put 'org-agenda-category-filter :preset-filter nil) |
| 3660 | (unless (or (bobp) org-agenda-compact-blocks | 3623 | (put 'org-agenda-regexp-filter :preset-filter nil) |
| 3661 | (not org-agenda-block-separator)) | 3624 | ;; Popup existing buffer |
| 3662 | (insert "\n" | 3625 | (org-agenda-prepare-window (get-buffer org-agenda-buffer-name) |
| 3663 | (if (stringp org-agenda-block-separator) | 3626 | filter-alist) |
| 3664 | org-agenda-block-separator | 3627 | (message "Sticky Agenda buffer, use `r' to refresh") |
| 3665 | (make-string (window-width) org-agenda-block-separator)) | 3628 | (or org-agenda-multi (org-agenda-fit-window-to-buffer)) |
| 3666 | "\n")) | 3629 | (throw 'exit "Sticky Agenda buffer, use `r' to refresh")) |
| 3667 | (narrow-to-region (point) (point-max))) | 3630 | (setq org-todo-keywords-for-agenda nil) |
| 3668 | (setq org-done-keywords-for-agenda nil) | 3631 | (setq org-drawers-for-agenda nil) |
| 3669 | 3632 | (put 'org-agenda-tag-filter :preset-filter | |
| 3670 | ;; Setting any org variables that are in org-agenda-local-vars | 3633 | org-agenda-tag-filter-preset) |
| 3671 | ;; list need to be done after the prepare call | 3634 | (put 'org-agenda-category-filter :preset-filter |
| 3672 | (org-agenda-prepare-window (get-buffer-create org-agenda-buffer-name)) | 3635 | org-agenda-category-filter-preset) |
| 3673 | (setq buffer-read-only nil) | 3636 | (put 'org-agenda-regexp-filter :preset-filter |
| 3674 | (org-agenda-reset-markers) | 3637 | org-agenda-regexp-filter-preset) |
| 3675 | (let ((inhibit-read-only t)) (erase-buffer)) | 3638 | (if org-agenda-multi |
| 3676 | (org-agenda-mode) | 3639 | (progn |
| 3677 | (setq org-agenda-buffer (current-buffer)) | 3640 | (setq buffer-read-only nil) |
| 3678 | (setq org-agenda-contributing-files nil) | 3641 | (goto-char (point-max)) |
| 3679 | (setq org-agenda-columns-active nil) | 3642 | (unless (or (bobp) org-agenda-compact-blocks |
| 3680 | (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode)) | 3643 | (not org-agenda-block-separator)) |
| 3681 | (setq org-todo-keywords-for-agenda | 3644 | (insert "\n" |
| 3682 | (org-uniquify org-todo-keywords-for-agenda)) | 3645 | (if (stringp org-agenda-block-separator) |
| 3683 | (setq org-done-keywords-for-agenda | 3646 | org-agenda-block-separator |
| 3684 | (org-uniquify org-done-keywords-for-agenda)) | 3647 | (make-string (window-width) org-agenda-block-separator)) |
| 3685 | (setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda)) | 3648 | "\n")) |
| 3686 | (setq org-agenda-last-prefix-arg current-prefix-arg) | 3649 | (narrow-to-region (point) (point-max))) |
| 3687 | (setq org-agenda-this-buffer-name org-agenda-buffer-name) | 3650 | (setq org-done-keywords-for-agenda nil) |
| 3688 | (and name (not org-agenda-name) | 3651 | |
| 3689 | (org-set-local 'org-agenda-name name))) | 3652 | ;; Setting any org variables that are in org-agenda-local-vars |
| 3690 | (setq buffer-read-only nil))) | 3653 | ;; list need to be done after the prepare call |
| 3654 | (org-agenda-prepare-window | ||
| 3655 | (get-buffer-create org-agenda-buffer-name) filter-alist) | ||
| 3656 | (setq buffer-read-only nil) | ||
| 3657 | (org-agenda-reset-markers) | ||
| 3658 | (let ((inhibit-read-only t)) (erase-buffer)) | ||
| 3659 | (org-agenda-mode) | ||
| 3660 | (setq org-agenda-buffer (current-buffer)) | ||
| 3661 | (setq org-agenda-contributing-files nil) | ||
| 3662 | (setq org-agenda-columns-active nil) | ||
| 3663 | (org-agenda-prepare-buffers (org-agenda-files nil 'ifmode)) | ||
| 3664 | (setq org-todo-keywords-for-agenda | ||
| 3665 | (org-uniquify org-todo-keywords-for-agenda)) | ||
| 3666 | (setq org-done-keywords-for-agenda | ||
| 3667 | (org-uniquify org-done-keywords-for-agenda)) | ||
| 3668 | (setq org-drawers-for-agenda (org-uniquify org-drawers-for-agenda)) | ||
| 3669 | (setq org-agenda-last-prefix-arg current-prefix-arg) | ||
| 3670 | (setq org-agenda-this-buffer-name org-agenda-buffer-name) | ||
| 3671 | (and name (not org-agenda-name) | ||
| 3672 | (org-set-local 'org-agenda-name name))) | ||
| 3673 | (setq buffer-read-only nil)))) | ||
| 3691 | 3674 | ||
| 3692 | (defvar org-agenda-overriding-columns-format) ; From org-colview.el | 3675 | (defvar org-agenda-overriding-columns-format) ; From org-colview.el |
| 3693 | (defun org-agenda-finalize () | 3676 | (defun org-agenda-finalize () |
| @@ -3739,13 +3722,15 @@ generating a new one." | |||
| 3739 | (save-excursion | 3722 | (save-excursion |
| 3740 | (goto-char (point-min)) | 3723 | (goto-char (point-min)) |
| 3741 | (while (equal (forward-line) 0) | 3724 | (while (equal (forward-line) 0) |
| 3742 | (when (setq mrk (or (get-text-property (point) 'org-hd-marker) | 3725 | (when (setq mrk (get-text-property (point) 'org-hd-marker)) |
| 3743 | (get-text-property (point) 'org-hd-marker))) | ||
| 3744 | (put-text-property (point-at-bol) (point-at-eol) | 3726 | (put-text-property (point-at-bol) (point-at-eol) |
| 3745 | 'tags (org-with-point-at mrk | 3727 | 'tags (org-with-point-at mrk |
| 3746 | (delete-dups | 3728 | (delete-dups |
| 3747 | (mapcar 'downcase (org-get-tags-at)))))))))) | 3729 | (mapcar 'downcase (org-get-tags-at)))))))))) |
| 3748 | (run-hooks 'org-agenda-finalize-hook) | 3730 | (run-hooks 'org-agenda-finalize-hook) |
| 3731 | (when org-agenda-top-headline-filter | ||
| 3732 | (org-agenda-filter-top-headline-apply | ||
| 3733 | org-agenda-top-headline-filter)) | ||
| 3749 | (when org-agenda-tag-filter | 3734 | (when org-agenda-tag-filter |
| 3750 | (org-agenda-filter-apply org-agenda-tag-filter 'tag)) | 3735 | (org-agenda-filter-apply org-agenda-tag-filter 'tag)) |
| 3751 | (when (get 'org-agenda-tag-filter :preset-filter) | 3736 | (when (get 'org-agenda-tag-filter :preset-filter) |
| @@ -4326,14 +4311,6 @@ items if they have an hour specification like [h]h:mm." | |||
| 4326 | (setq p (plist-put p :tstart clocktable-start)) | 4311 | (setq p (plist-put p :tstart clocktable-start)) |
| 4327 | (setq p (plist-put p :tend clocktable-end)) | 4312 | (setq p (plist-put p :tend clocktable-end)) |
| 4328 | (setq p (plist-put p :scope 'agenda)) | 4313 | (setq p (plist-put p :scope 'agenda)) |
| 4329 | (when (and (eq org-agenda-clockreport-mode 'with-filter) | ||
| 4330 | (setq filter (or org-agenda-tag-filter-while-redo | ||
| 4331 | (get 'org-agenda-tag-filter :preset-filter)))) | ||
| 4332 | (setq p (plist-put p :tags (mapconcat (lambda (x) | ||
| 4333 | (if (string-match "[<>=]" x) | ||
| 4334 | "" | ||
| 4335 | x)) | ||
| 4336 | filter "")))) | ||
| 4337 | (setq tbl (apply 'org-clock-get-clocktable p)) | 4314 | (setq tbl (apply 'org-clock-get-clocktable p)) |
| 4338 | (insert tbl))) | 4315 | (insert tbl))) |
| 4339 | (goto-char (point-min)) | 4316 | (goto-char (point-min)) |
| @@ -5703,7 +5680,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', | |||
| 5703 | (setq txt (org-agenda-format-item extra txt level category tags 'time)) | 5680 | (setq txt (org-agenda-format-item extra txt level category tags 'time)) |
| 5704 | (org-add-props txt props 'org-marker marker | 5681 | (org-add-props txt props 'org-marker marker |
| 5705 | 'org-category category 'date date 'todo-state todo-state | 5682 | 'org-category category 'date date 'todo-state todo-state |
| 5706 | 'org-category-position category-pos 'tags tags | 5683 | 'org-category-position category-pos |
| 5707 | 'level level | 5684 | 'level level |
| 5708 | 'type "sexp" 'warntime warntime) | 5685 | 'type "sexp" 'warntime warntime) |
| 5709 | (push txt ee))))) | 5686 | (push txt ee))))) |
| @@ -6781,8 +6758,10 @@ The optional STRING argument forces conversion into a 5 character wide string | |||
| 6781 | HH:MM." | 6758 | HH:MM." |
| 6782 | (save-match-data | 6759 | (save-match-data |
| 6783 | (when | 6760 | (when |
| 6784 | (or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) | 6761 | (and |
| 6785 | (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) | 6762 | (or (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)\\([AaPp][Mm]\\)?\\> *" s) |
| 6763 | (string-match "\\<\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\([AaPp][Mm]\\)\\> *" s)) | ||
| 6764 | (not (eq (get-text-property 1 'face s) 'org-link))) | ||
| 6786 | (let* ((h (string-to-number (match-string 1 s))) | 6765 | (let* ((h (string-to-number (match-string 1 s))) |
| 6787 | (m (if (match-end 3) (string-to-number (match-string 3 s)) 0)) | 6766 | (m (if (match-end 3) (string-to-number (match-string 3 s)) 0)) |
| 6788 | (ampm (if (match-end 4) (downcase (match-string 4 s)))) | 6767 | (ampm (if (match-end 4) (downcase (match-string 4 s)))) |
| @@ -7010,7 +6989,7 @@ The optional argument TYPE tells the agenda type." | |||
| 7010 | (cond ((< ta tb) -1) | 6989 | (cond ((< ta tb) -1) |
| 7011 | ((< tb ta) +1)))) | 6990 | ((< tb ta) +1)))) |
| 7012 | 6991 | ||
| 7013 | (defsubst org-cmp-ts (a b &optional type) | 6992 | (defsubst org-cmp-ts (a b type) |
| 7014 | "Compare the timestamps values of entries A and B. | 6993 | "Compare the timestamps values of entries A and B. |
| 7015 | When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or | 6994 | When TYPE is \"scheduled\", \"deadline\", \"timestamp\" or |
| 7016 | \"timestamp_ia\", compare within each of these type. When TYPE | 6995 | \"timestamp_ia\", compare within each of these type. When TYPE |
| @@ -7018,9 +6997,11 @@ is the empty string, compare all timestamps without respect of | |||
| 7018 | their type." | 6997 | their type." |
| 7019 | (let* ((def (if org-sort-agenda-notime-is-late most-positive-fixnum -1)) | 6998 | (let* ((def (if org-sort-agenda-notime-is-late most-positive-fixnum -1)) |
| 7020 | (ta (or (and (string-match type (or (get-text-property 1 'type a) "")) | 6999 | (ta (or (and (string-match type (or (get-text-property 1 'type a) "")) |
| 7021 | (get-text-property 1 'ts-date a)) def)) | 7000 | (get-text-property 1 'ts-date a)) |
| 7001 | def)) | ||
| 7022 | (tb (or (and (string-match type (or (get-text-property 1 'type b) "")) | 7002 | (tb (or (and (string-match type (or (get-text-property 1 'type b) "")) |
| 7023 | (get-text-property 1 'ts-date b)) def))) | 7003 | (get-text-property 1 'ts-date b)) |
| 7004 | def))) | ||
| 7024 | (cond ((< ta tb) -1) | 7005 | (cond ((< ta tb) -1) |
| 7025 | ((< tb ta) +1)))) | 7006 | ((< tb ta) +1)))) |
| 7026 | 7007 | ||
| @@ -7046,7 +7027,7 @@ their type." | |||
| 7046 | (org-cmp-ts a b "deadline"))) | 7027 | (org-cmp-ts a b "deadline"))) |
| 7047 | (deadline-down (if deadline-up (- deadline-up) nil)) | 7028 | (deadline-down (if deadline-up (- deadline-up) nil)) |
| 7048 | (tsia-up (and (org-em 'tsia-up 'tsia-down ss) | 7029 | (tsia-up (and (org-em 'tsia-up 'tsia-down ss) |
| 7049 | (org-cmp-ts a b "iatimestamp_ia"))) | 7030 | (org-cmp-ts a b "timestamp_ia"))) |
| 7050 | (tsia-down (if tsia-up (- tsia-up) nil)) | 7031 | (tsia-down (if tsia-up (- tsia-up) nil)) |
| 7051 | (ts-up (and (org-em 'ts-up 'ts-down ss) | 7032 | (ts-up (and (org-em 'ts-up 'ts-down ss) |
| 7052 | (org-cmp-ts a b "timestamp"))) | 7033 | (org-cmp-ts a b "timestamp"))) |
| @@ -7283,7 +7264,6 @@ in the agenda." | |||
| 7283 | (cat-preset (get 'org-agenda-category-filter :preset-filter)) | 7264 | (cat-preset (get 'org-agenda-category-filter :preset-filter)) |
| 7284 | (re-filter org-agenda-regexp-filter) | 7265 | (re-filter org-agenda-regexp-filter) |
| 7285 | (re-preset (get 'org-agenda-regexp-filter :preset-filter)) | 7266 | (re-preset (get 'org-agenda-regexp-filter :preset-filter)) |
| 7286 | (org-agenda-tag-filter-while-redo (or tag-filter tag-preset)) | ||
| 7287 | (cols org-agenda-columns-active) | 7267 | (cols org-agenda-columns-active) |
| 7288 | (line (org-current-line)) | 7268 | (line (org-current-line)) |
| 7289 | (window-line (- line (org-current-line (window-start)))) | 7269 | (window-line (- line (org-current-line (window-start)))) |
| @@ -7316,9 +7296,12 @@ in the agenda." | |||
| 7316 | (put 'org-agenda-tag-filter :preset-filter tag-preset) | 7296 | (put 'org-agenda-tag-filter :preset-filter tag-preset) |
| 7317 | (put 'org-agenda-category-filter :preset-filter cat-preset) | 7297 | (put 'org-agenda-category-filter :preset-filter cat-preset) |
| 7318 | (put 'org-agenda-regexp-filter :preset-filter re-preset) | 7298 | (put 'org-agenda-regexp-filter :preset-filter re-preset) |
| 7319 | (and (or tag-filter tag-preset) (org-agenda-filter-apply tag-filter 'tag)) | 7299 | (let ((tag (or tag-filter tag-preset)) |
| 7320 | (and (or cat-filter cat-preset) (org-agenda-filter-apply cat-filter 'category)) | 7300 | (cat (or cat-filter cat-preset)) |
| 7321 | (and (or re-filter re-preset) (org-agenda-filter-apply re-filter 'regexp)) | 7301 | (re (or re-filter re-preset))) |
| 7302 | (when tag (org-agenda-filter-apply tag 'tag)) | ||
| 7303 | (when cat (org-agenda-filter-apply cat 'category)) | ||
| 7304 | (when re (org-agenda-filter-apply re 'regexp))) | ||
| 7322 | (and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter)) | 7305 | (and top-hl-filter (org-agenda-filter-top-headline-apply top-hl-filter)) |
| 7323 | (and cols (org-called-interactively-p 'any) (org-agenda-columns)) | 7306 | (and cols (org-called-interactively-p 'any) (org-agenda-columns)) |
| 7324 | (org-goto-line line) | 7307 | (org-goto-line line) |
| @@ -7344,7 +7327,7 @@ The category is that of the current line." | |||
| 7344 | (org-agenda-filter-apply | 7327 | (org-agenda-filter-apply |
| 7345 | (setq org-agenda-category-filter | 7328 | (setq org-agenda-category-filter |
| 7346 | (list (concat "+" cat))) 'category)) | 7329 | (list (concat "+" cat))) 'category)) |
| 7347 | ((error "No category at point")))))) | 7330 | (t (error "No category at point")))))) |
| 7348 | 7331 | ||
| 7349 | (defun org-find-top-headline (&optional pos) | 7332 | (defun org-find-top-headline (&optional pos) |
| 7350 | "Find the topmost parent headline and return it." | 7333 | "Find the topmost parent headline and return it." |
| @@ -7365,10 +7348,10 @@ The top headline is that of the current line." | |||
| 7365 | (progn | 7348 | (progn |
| 7366 | (setq org-agenda-filtered-by-top-headline nil | 7349 | (setq org-agenda-filtered-by-top-headline nil |
| 7367 | org-agenda-top-headline-filter nil) | 7350 | org-agenda-top-headline-filter nil) |
| 7368 | (org-agenda-filter-show-all-cat)) | 7351 | (org-agenda-filter-show-all-top-filter)) |
| 7369 | (let ((cat (org-find-top-headline (org-get-at-bol 'org-hd-marker)))) | 7352 | (let ((toph (org-find-top-headline (org-get-at-bol 'org-hd-marker)))) |
| 7370 | (if cat (org-agenda-filter-top-headline-apply cat strip) | 7353 | (if toph (org-agenda-filter-top-headline-apply toph strip) |
| 7371 | (error "No top-level category at point"))))) | 7354 | (error "No top-level headline at point"))))) |
| 7372 | 7355 | ||
| 7373 | (defvar org-agenda-regexp-filter nil) | 7356 | (defvar org-agenda-regexp-filter nil) |
| 7374 | (defun org-agenda-filter-by-regexp (strip) | 7357 | (defun org-agenda-filter-by-regexp (strip) |
| @@ -7397,7 +7380,10 @@ With two prefix arguments, remove the regexp filters." | |||
| 7397 | (when org-agenda-category-filter | 7380 | (when org-agenda-category-filter |
| 7398 | (org-agenda-filter-show-all-cat)) | 7381 | (org-agenda-filter-show-all-cat)) |
| 7399 | (when org-agenda-regexp-filter | 7382 | (when org-agenda-regexp-filter |
| 7400 | (org-agenda-filter-show-all-re))) | 7383 | (org-agenda-filter-show-all-re)) |
| 7384 | (when org-agenda-top-headline-filter | ||
| 7385 | (org-agenda-filter-show-all-top-filter)) | ||
| 7386 | (org-agenda-finalize)) | ||
| 7401 | 7387 | ||
| 7402 | (defun org-agenda-filter-by-tag (strip &optional char narrow) | 7388 | (defun org-agenda-filter-by-tag (strip &optional char narrow) |
| 7403 | "Keep only those lines in the agenda buffer that have a specific tag. | 7389 | "Keep only those lines in the agenda buffer that have a specific tag. |
| @@ -7500,8 +7486,7 @@ to switch to narrowing." | |||
| 7500 | (org-agenda-filter-apply org-agenda-tag-filter 'tag) | 7486 | (org-agenda-filter-apply org-agenda-tag-filter 'tag) |
| 7501 | (setq maybe-refresh t)) | 7487 | (setq maybe-refresh t)) |
| 7502 | (t (error "Invalid tag selection character %c" char))) | 7488 | (t (error "Invalid tag selection character %c" char))) |
| 7503 | (when (and maybe-refresh | 7489 | (when maybe-refresh |
| 7504 | (eq org-agenda-clockreport-mode 'with-filter)) | ||
| 7505 | (org-agenda-redo)))) | 7490 | (org-agenda-redo)))) |
| 7506 | 7491 | ||
| 7507 | (defun org-agenda-get-represented-tags () | 7492 | (defun org-agenda-get-represented-tags () |
| @@ -7622,13 +7607,12 @@ When NO-OPERATOR is non-nil, do not add the + operator to returned tags." | |||
| 7622 | ;; Deactivate `org-agenda-entry-text-mode' when filtering | 7607 | ;; Deactivate `org-agenda-entry-text-mode' when filtering |
| 7623 | (if org-agenda-entry-text-mode (org-agenda-entry-text-mode)) | 7608 | (if org-agenda-entry-text-mode (org-agenda-entry-text-mode)) |
| 7624 | (let (tags cat txt) | 7609 | (let (tags cat txt) |
| 7625 | (setq org-agenda-filter-form | 7610 | (setq org-agenda-filter-form (org-agenda-filter-make-matcher filter type)) |
| 7626 | (org-agenda-filter-make-matcher filter type)) | 7611 | ;; Only set `org-agenda-filtered-by-category' to t when a unique |
| 7627 | (if (and (eq type 'category) | 7612 | ;; category is used as the filter: |
| 7628 | (not (equal (substring (car filter) 0 1) "-"))) | 7613 | (setq org-agenda-filtered-by-category |
| 7629 | ;; Only set `org-agenda-filtered-by-category' to t | 7614 | (and (eq type 'category) |
| 7630 | ;; when a unique category is used as the filter | 7615 | (not (equal (substring (car filter) 0 1) "-")))) |
| 7631 | (setq org-agenda-filtered-by-category t)) | ||
| 7632 | (org-agenda-set-mode-name) | 7616 | (org-agenda-set-mode-name) |
| 7633 | (save-excursion | 7617 | (save-excursion |
| 7634 | (goto-char (point-min)) | 7618 | (goto-char (point-min)) |
| @@ -7659,7 +7643,7 @@ When NO-OPERATOR is non-nil, do not add the + operator to returned tags." | |||
| 7659 | (tophl (and pos (org-find-top-headline pos)))) | 7643 | (tophl (and pos (org-find-top-headline pos)))) |
| 7660 | (if (and tophl (funcall (if negative 'identity 'not) | 7644 | (if (and tophl (funcall (if negative 'identity 'not) |
| 7661 | (string= hl tophl))) | 7645 | (string= hl tophl))) |
| 7662 | (org-agenda-filter-hide-line 'category))) | 7646 | (org-agenda-filter-hide-line 'top-headline))) |
| 7663 | (beginning-of-line 2))) | 7647 | (beginning-of-line 2))) |
| 7664 | (if (get-char-property (point) 'invisible) | 7648 | (if (get-char-property (point) 'invisible) |
| 7665 | (org-agenda-previous-line)) | 7649 | (org-agenda-previous-line)) |
| @@ -7669,50 +7653,35 @@ When NO-OPERATOR is non-nil, do not add the + operator to returned tags." | |||
| 7669 | (defun org-agenda-filter-hide-line (type) | 7653 | (defun org-agenda-filter-hide-line (type) |
| 7670 | "Hide lines with TYPE in the agenda buffer." | 7654 | "Hide lines with TYPE in the agenda buffer." |
| 7671 | (let* ((b (max (point-min) (1- (point-at-bol)))) | 7655 | (let* ((b (max (point-min) (1- (point-at-bol)))) |
| 7672 | (e (point-at-eol)) | 7656 | (e (point-at-eol))) |
| 7673 | (ov (make-overlay b e))) | 7657 | (let ((inhibit-read-only t)) |
| 7674 | (overlay-put ov 'invisible t) | 7658 | (add-text-properties |
| 7675 | (overlay-put ov 'intangible t) | 7659 | b e `(invisible org-filtered org-filter-type ,type))))) |
| 7676 | (overlay-put ov 'type type) | 7660 | |
| 7677 | (cond ((eq type 'tag) (push ov org-agenda-tag-filter-overlays)) | 7661 | (defun org-agenda-remove-filter (type) |
| 7678 | ((eq type 'category) (push ov org-agenda-cat-filter-overlays)) | 7662 | (interactive) |
| 7679 | ((eq type 'regexp) (push ov org-agenda-re-filter-overlays))))) | 7663 | "Remove filter of type TYPE from the agenda buffer." |
| 7680 | |||
| 7681 | (defun org-agenda-fix-tags-filter-overlays-at (&optional pos) | ||
| 7682 | (setq pos (or pos (point))) | ||
| 7683 | (save-excursion | 7664 | (save-excursion |
| 7684 | (dolist (ov (overlays-at pos)) | 7665 | (goto-char (point-min)) |
| 7685 | (when (and (overlay-get ov 'invisible) | 7666 | (let ((inhibit-read-only t) pos) |
| 7686 | (eq (overlay-get ov 'type) 'tag)) | 7667 | (while (setq pos (text-property-any (point) (point-max) 'org-filter-type type)) |
| 7687 | (goto-char pos) | 7668 | (goto-char pos) |
| 7688 | (if (< (overlay-start ov) (point-at-eol)) | 7669 | (remove-text-properties |
| 7689 | (move-overlay ov (point-at-eol) | 7670 | (point) (next-single-property-change (point) 'org-filter-type) |
| 7690 | (overlay-end ov))))))) | 7671 | `(invisible org-filtered org-filter-type ,type)))) |
| 7672 | (set (intern (format "org-agenda-%s-filter" (intern-soft type))) nil) | ||
| 7673 | (setq org-agenda-filter-form nil) | ||
| 7674 | (org-agenda-set-mode-name) | ||
| 7675 | (org-agenda-finalize))) | ||
| 7691 | 7676 | ||
| 7692 | (defun org-agenda-filter-show-all-tag nil | 7677 | (defun org-agenda-filter-show-all-tag nil |
| 7693 | "Remove tag filter overlays from the agenda buffer." | 7678 | (org-agenda-remove-filter 'tag)) |
| 7694 | (mapc 'delete-overlay org-agenda-tag-filter-overlays) | ||
| 7695 | (setq org-agenda-tag-filter-overlays nil | ||
| 7696 | org-agenda-tag-filter nil | ||
| 7697 | org-agenda-filter-form nil) | ||
| 7698 | (org-agenda-set-mode-name)) | ||
| 7699 | |||
| 7700 | (defun org-agenda-filter-show-all-re nil | 7679 | (defun org-agenda-filter-show-all-re nil |
| 7701 | "Remove regexp filter overlays from the agenda buffer." | 7680 | (org-agenda-remove-filter 'regexp)) |
| 7702 | (mapc 'delete-overlay org-agenda-re-filter-overlays) | ||
| 7703 | (setq org-agenda-re-filter-overlays nil | ||
| 7704 | org-agenda-regexp-filter nil | ||
| 7705 | org-agenda-filter-form nil) | ||
| 7706 | (org-agenda-set-mode-name)) | ||
| 7707 | |||
| 7708 | (defun org-agenda-filter-show-all-cat nil | 7681 | (defun org-agenda-filter-show-all-cat nil |
| 7709 | "Remove category filter overlays from the agenda buffer." | 7682 | (org-agenda-remove-filter 'category)) |
| 7710 | (mapc 'delete-overlay org-agenda-cat-filter-overlays) | 7683 | (defun org-agenda-filter-show-all-top-filter nil |
| 7711 | (setq org-agenda-cat-filter-overlays nil | 7684 | (org-agenda-remove-filter 'top-headline)) |
| 7712 | org-agenda-filtered-by-category nil | ||
| 7713 | org-agenda-category-filter nil | ||
| 7714 | org-agenda-filter-form nil) | ||
| 7715 | (org-agenda-set-mode-name)) | ||
| 7716 | 7685 | ||
| 7717 | (defun org-agenda-manipulate-query-add () | 7686 | (defun org-agenda-manipulate-query-add () |
| 7718 | "Manipulate the query by adding a search term with positive selection. | 7687 | "Manipulate the query by adding a search term with positive selection. |
| @@ -8106,15 +8075,12 @@ so that the date SD will be in that range." | |||
| 8106 | (format " (maximum number of lines is %d)" | 8075 | (format " (maximum number of lines is %d)" |
| 8107 | (if (integerp arg) arg org-agenda-entry-text-maxlines)))))) | 8076 | (if (integerp arg) arg org-agenda-entry-text-maxlines)))))) |
| 8108 | 8077 | ||
| 8109 | (defun org-agenda-clockreport-mode (&optional with-filter) | 8078 | (defun org-agenda-clockreport-mode () |
| 8110 | "Toggle clocktable mode in an agenda buffer. | 8079 | "Toggle clocktable mode in an agenda buffer." |
| 8111 | With prefix arg WITH-FILTER, make the clocktable respect the current | 8080 | (interactive) |
| 8112 | agenda filter." | ||
| 8113 | (interactive "P") | ||
| 8114 | (org-agenda-check-type t 'agenda) | 8081 | (org-agenda-check-type t 'agenda) |
| 8115 | (if with-filter | 8082 | (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode)) |
| 8116 | (setq org-agenda-clockreport-mode 'with-filter) | 8083 | (setq org-agenda-start-with-clockreport-mode org-agenda-clockreport-mode) |
| 8117 | (setq org-agenda-clockreport-mode (not org-agenda-clockreport-mode))) | ||
| 8118 | (org-agenda-set-mode-name) | 8084 | (org-agenda-set-mode-name) |
| 8119 | (org-agenda-redo) | 8085 | (org-agenda-redo) |
| 8120 | (message "Clocktable mode is %s" | 8086 | (message "Clocktable mode is %s" |
| @@ -8135,6 +8101,7 @@ With a double `C-u' prefix arg, show *only* log items, nothing else." | |||
| 8135 | nil 'clockcheck)) | 8101 | nil 'clockcheck)) |
| 8136 | (special '(closed clock state)) | 8102 | (special '(closed clock state)) |
| 8137 | (t (not org-agenda-show-log)))) | 8103 | (t (not org-agenda-show-log)))) |
| 8104 | (setq org-agenda-start-with-log-mode org-agenda-show-log) | ||
| 8138 | (org-agenda-set-mode-name) | 8105 | (org-agenda-set-mode-name) |
| 8139 | (org-agenda-redo) | 8106 | (org-agenda-redo) |
| 8140 | (message "Log mode is %s" | 8107 | (message "Log mode is %s" |
| @@ -8252,10 +8219,7 @@ When called with a prefix argument, include all archive files as well." | |||
| 8252 | " Archives" | 8219 | " Archives" |
| 8253 | (format " :%s:" org-archive-tag)) | 8220 | (format " :%s:" org-archive-tag)) |
| 8254 | "") | 8221 | "") |
| 8255 | (if org-agenda-clockreport-mode | 8222 | (if org-agenda-clockreport-mode " Clock" ""))) |
| 8256 | (if (eq org-agenda-clockreport-mode 'with-filter) | ||
| 8257 | " Clock{}" " Clock") | ||
| 8258 | ""))) | ||
| 8259 | (force-mode-line-update)) | 8223 | (force-mode-line-update)) |
| 8260 | 8224 | ||
| 8261 | (define-obsolete-function-alias | 8225 | (define-obsolete-function-alias |
| @@ -8623,7 +8587,8 @@ if it was hidden in the outline." | |||
| 8623 | (interactive "p") | 8587 | (interactive "p") |
| 8624 | (let ((win (selected-window))) | 8588 | (let ((win (selected-window))) |
| 8625 | (org-agenda-goto t) | 8589 | (org-agenda-goto t) |
| 8626 | (org-recenter-heading 1) | 8590 | (org-back-to-heading) |
| 8591 | (set-window-start (selected-window) (point-at-bol)) | ||
| 8627 | (cond | 8592 | (cond |
| 8628 | ((= more 0) | 8593 | ((= more 0) |
| 8629 | (hide-subtree) | 8594 | (hide-subtree) |
| @@ -8662,11 +8627,6 @@ if it was hidden in the outline." | |||
| 8662 | (message "Remote: SUBTREE AND ALL DRAWERS"))) | 8627 | (message "Remote: SUBTREE AND ALL DRAWERS"))) |
| 8663 | (select-window win))) | 8628 | (select-window win))) |
| 8664 | 8629 | ||
| 8665 | (defun org-recenter-heading (n) | ||
| 8666 | (save-excursion | ||
| 8667 | (org-back-to-heading) | ||
| 8668 | (recenter n))) | ||
| 8669 | |||
| 8670 | (defvar org-agenda-cycle-counter nil) | 8630 | (defvar org-agenda-cycle-counter nil) |
| 8671 | (defun org-agenda-cycle-show (&optional n) | 8631 | (defun org-agenda-cycle-show (&optional n) |
| 8672 | "Show the current entry in another window, with default settings. | 8632 | "Show the current entry in another window, with default settings. |
| @@ -9177,8 +9137,6 @@ Called with a universal prefix arg, show the priority instead of setting it." | |||
| 9177 | (when (equal marker (org-get-at-bol 'org-marker)) | 9137 | (when (equal marker (org-get-at-bol 'org-marker)) |
| 9178 | (remove-text-properties (point-at-bol) (point-at-eol) '(display)) | 9138 | (remove-text-properties (point-at-bol) (point-at-eol) '(display)) |
| 9179 | (org-move-to-column (- (window-width) (length stamp)) t) | 9139 | (org-move-to-column (- (window-width) (length stamp)) t) |
| 9180 | |||
| 9181 | (org-agenda-fix-tags-filter-overlays-at (point)) | ||
| 9182 | (if (featurep 'xemacs) | 9140 | (if (featurep 'xemacs) |
| 9183 | ;; Use `duplicable' property to trigger undo recording | 9141 | ;; Use `duplicable' property to trigger undo recording |
| 9184 | (let ((ex (make-extent nil nil)) | 9142 | (let ((ex (make-extent nil nil)) |
| @@ -9190,7 +9148,7 @@ Called with a universal prefix arg, show the priority instead of setting it." | |||
| 9190 | (add-text-properties | 9148 | (add-text-properties |
| 9191 | (1- (point)) (point-at-eol) | 9149 | (1- (point)) (point-at-eol) |
| 9192 | (list 'display (org-add-props stamp nil | 9150 | (list 'display (org-add-props stamp nil |
| 9193 | 'face 'secondary-selection)))) | 9151 | 'face '(secondary-selection default))))) |
| 9194 | (beginning-of-line 1)) | 9152 | (beginning-of-line 1)) |
| 9195 | (beginning-of-line 0))))) | 9153 | (beginning-of-line 0))))) |
| 9196 | 9154 | ||
| @@ -9478,9 +9436,9 @@ a timestamp can be added there." | |||
| 9478 | (if org-adapt-indentation (org-indent-to-column 2))) | 9436 | (if org-adapt-indentation (org-indent-to-column 2))) |
| 9479 | 9437 | ||
| 9480 | (defun org-agenda-insert-diary-make-new-entry (text) | 9438 | (defun org-agenda-insert-diary-make-new-entry (text) |
| 9481 | "Make new entry as last child of current entry. | 9439 | "Make a new entry with TEXT as the first child of the current subtree. |
| 9482 | Add TEXT as headline, and position the cursor in the second line so that | 9440 | Position the point in the line right after the new heading so |
| 9483 | a timestamp can be added there." | 9441 | that a timestamp can be added there." |
| 9484 | (let ((org-show-following-heading t) | 9442 | (let ((org-show-following-heading t) |
| 9485 | (org-show-siblings t) | 9443 | (org-show-siblings t) |
| 9486 | (org-show-hierarchy-above t) | 9444 | (org-show-hierarchy-above t) |
| @@ -9669,7 +9627,7 @@ This is a command that has to be installed in `calendar-mode-map'." | |||
| 9669 | (overlay-put ov 'type 'org-marked-entry-overlay)) | 9627 | (overlay-put ov 'type 'org-marked-entry-overlay)) |
| 9670 | (end-of-line 1) | 9628 | (end-of-line 1) |
| 9671 | (or (ignore-errors | 9629 | (or (ignore-errors |
| 9672 | (goto-char (next-single-property-change (point) 'txt))) | 9630 | (goto-char (next-single-property-change (point) 'org-hd-marker))) |
| 9673 | (beginning-of-line 2)) | 9631 | (beginning-of-line 2)) |
| 9674 | (while (and (get-char-property (point) 'invisible) (not (eobp))) | 9632 | (while (and (get-char-property (point) 'invisible) (not (eobp))) |
| 9675 | (beginning-of-line 2)) | 9633 | (beginning-of-line 2)) |
| @@ -9687,7 +9645,7 @@ This is a command that has to be installed in `calendar-mode-map'." | |||
| 9687 | (let ((entries-marked 0) txt-at-point) | 9645 | (let ((entries-marked 0) txt-at-point) |
| 9688 | (save-excursion | 9646 | (save-excursion |
| 9689 | (goto-char (point-min)) | 9647 | (goto-char (point-min)) |
| 9690 | (goto-char (next-single-property-change (point) 'txt)) | 9648 | (goto-char (next-single-property-change (point) 'org-hd-marker)) |
| 9691 | (while (and (re-search-forward regexp nil t) | 9649 | (while (and (re-search-forward regexp nil t) |
| 9692 | (setq txt-at-point (get-text-property (point) 'txt))) | 9650 | (setq txt-at-point (get-text-property (point) 'txt))) |
| 9693 | (when (string-match regexp txt-at-point) | 9651 | (when (string-match regexp txt-at-point) |
| @@ -9723,7 +9681,7 @@ This is a command that has to be installed in `calendar-mode-map'." | |||
| 9723 | (save-excursion | 9681 | (save-excursion |
| 9724 | (goto-char (point-min)) | 9682 | (goto-char (point-min)) |
| 9725 | (while (ignore-errors | 9683 | (while (ignore-errors |
| 9726 | (goto-char (next-single-property-change (point) 'txt))) | 9684 | (goto-char (next-single-property-change (point) 'org-hd-marker))) |
| 9727 | (org-agenda-bulk-toggle)))) | 9685 | (org-agenda-bulk-toggle)))) |
| 9728 | 9686 | ||
| 9729 | (defun org-agenda-bulk-toggle () | 9687 | (defun org-agenda-bulk-toggle () |
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el index 07307e68f6f..bcf7ba736fd 100644 --- a/lisp/org/org-attach.el +++ b/lisp/org/org-attach.el | |||
| @@ -208,7 +208,9 @@ the directory and (if necessary) the corresponding ID will be created." | |||
| 208 | (save-excursion | 208 | (save-excursion |
| 209 | (save-restriction | 209 | (save-restriction |
| 210 | (widen) | 210 | (widen) |
| 211 | (goto-char org-entry-property-inherited-from) | 211 | (if (marker-position org-entry-property-inherited-from) |
| 212 | (goto-char org-entry-property-inherited-from) | ||
| 213 | (org-back-to-heading t)) | ||
| 212 | (let (org-attach-allow-inheritance) | 214 | (let (org-attach-allow-inheritance) |
| 213 | (org-attach-dir create-if-not-exists-p))))) | 215 | (org-attach-dir create-if-not-exists-p))))) |
| 214 | (org-attach-check-absolute-path attach-dir) | 216 | (org-attach-check-absolute-path attach-dir) |
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el index b9841a65b84..cfd5b3b6a8c 100644 --- a/lisp/org/org-bbdb.el +++ b/lisp/org/org-bbdb.el | |||
| @@ -400,8 +400,11 @@ This is used by Org to re-create the anniversary hash table." | |||
| 400 | (defun org-bbdb-complete-link () | 400 | (defun org-bbdb-complete-link () |
| 401 | "Read a bbdb link with name completion." | 401 | "Read a bbdb link with name completion." |
| 402 | (require 'bbdb-com) | 402 | (require 'bbdb-com) |
| 403 | (concat "bbdb:" | 403 | (let ((rec (bbdb-completing-read-record "Name: "))) |
| 404 | (bbdb-record-name (car (bbdb-completing-read-record "Name: "))))) | 404 | (concat "bbdb:" |
| 405 | (bbdb-record-name (if (listp rec) | ||
| 406 | (car rec) | ||
| 407 | rec))))) | ||
| 405 | 408 | ||
| 406 | (defun org-bbdb-anniv-export-ical () | 409 | (defun org-bbdb-anniv-export-ical () |
| 407 | "Extract anniversaries from BBDB and convert them to icalendar format." | 410 | "Extract anniversaries from BBDB and convert them to icalendar format." |
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el index b6557108845..75ac69ba704 100644 --- a/lisp/org/org-bibtex.el +++ b/lisp/org/org-bibtex.el | |||
| @@ -203,7 +203,7 @@ | |||
| 203 | (:pages . "One or more page numbers or range of numbers, such as 42-111 or 7,41,73-97 or 43+ (the ‘+’ in this last example indicates pages following that don’t form simple range). BibTEX requires double dashes for page ranges (--).") | 203 | (:pages . "One or more page numbers or range of numbers, such as 42-111 or 7,41,73-97 or 43+ (the ‘+’ in this last example indicates pages following that don’t form simple range). BibTEX requires double dashes for page ranges (--).") |
| 204 | (:publisher . "The publisher’s name.") | 204 | (:publisher . "The publisher’s name.") |
| 205 | (:school . "The name of the school where a thesis was written.") | 205 | (:school . "The name of the school where a thesis was written.") |
| 206 | (:series . "The name of a series or set of books. When citing an entire book, the the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published.") | 206 | (:series . "The name of a series or set of books. When citing an entire book, the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published.") |
| 207 | (:title . "The work’s title, typed as explained in the LaTeX book.") | 207 | (:title . "The work’s title, typed as explained in the LaTeX book.") |
| 208 | (:type . "The type of a technical report for example, 'Research Note'.") | 208 | (:type . "The type of a technical report for example, 'Research Note'.") |
| 209 | (:volume . "The volume of a journal or multi-volume book.") | 209 | (:volume . "The volume of a journal or multi-volume book.") |
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el index 0433306a909..c7086837437 100644 --- a/lisp/org/org-capture.el +++ b/lisp/org/org-capture.el | |||
| @@ -1529,8 +1529,8 @@ The template may still contain \"%?\" for cursor positioning." | |||
| 1529 | (v-x (or (org-get-x-clipboard 'PRIMARY) | 1529 | (v-x (or (org-get-x-clipboard 'PRIMARY) |
| 1530 | (org-get-x-clipboard 'CLIPBOARD) | 1530 | (org-get-x-clipboard 'CLIPBOARD) |
| 1531 | (org-get-x-clipboard 'SECONDARY))) | 1531 | (org-get-x-clipboard 'SECONDARY))) |
| 1532 | (v-t (format-time-string (car org-time-stamp-formats) ct)) | 1532 | (v-t (format-time-string (car org-time-stamp-formats) ct1)) |
| 1533 | (v-T (format-time-string (cdr org-time-stamp-formats) ct)) | 1533 | (v-T (format-time-string (cdr org-time-stamp-formats) ct1)) |
| 1534 | (v-u (concat "[" (substring v-t 1 -1) "]")) | 1534 | (v-u (concat "[" (substring v-t 1 -1) "]")) |
| 1535 | (v-U (concat "[" (substring v-T 1 -1) "]")) | 1535 | (v-U (concat "[" (substring v-T 1 -1) "]")) |
| 1536 | ;; `initial' and `annotation' might habe been passed. | 1536 | ;; `initial' and `annotation' might habe been passed. |
| @@ -1587,7 +1587,7 @@ The template may still contain \"%?\" for cursor positioning." | |||
| 1587 | (insert template) | 1587 | (insert template) |
| 1588 | (goto-char (point-min)) | 1588 | (goto-char (point-min)) |
| 1589 | (org-capture-steal-local-variables buffer) | 1589 | (org-capture-steal-local-variables buffer) |
| 1590 | (setq buffer-file-name nil) | 1590 | (setq buffer-file-name nil mark-active nil) |
| 1591 | 1591 | ||
| 1592 | ;; %[] Insert contents of a file. | 1592 | ;; %[] Insert contents of a file. |
| 1593 | (goto-char (point-min)) | 1593 | (goto-char (point-min)) |
| @@ -1674,7 +1674,9 @@ The template may still contain \"%?\" for cursor positioning." | |||
| 1674 | (or (equal (char-before) ?:) (insert ":")) | 1674 | (or (equal (char-before) ?:) (insert ":")) |
| 1675 | (insert ins) | 1675 | (insert ins) |
| 1676 | (or (equal (char-after) ?:) (insert ":")) | 1676 | (or (equal (char-after) ?:) (insert ":")) |
| 1677 | (and (org-at-heading-p) (org-set-tags nil 'align))))) | 1677 | (and (org-at-heading-p) |
| 1678 | (let ((org-ignore-region t)) | ||
| 1679 | (org-set-tags nil 'align)))))) | ||
| 1678 | ((equal char "C") | 1680 | ((equal char "C") |
| 1679 | (cond ((= (length clipboards) 1) (insert (car clipboards))) | 1681 | (cond ((= (length clipboards) 1) (insert (car clipboards))) |
| 1680 | ((> (length clipboards) 1) | 1682 | ((> (length clipboards) 1) |
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index f2a37484cc0..892ae18108a 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el | |||
| @@ -2556,13 +2556,10 @@ from the dynamic block definition." | |||
| 2556 | total-time)) | 2556 | total-time)) |
| 2557 | 2557 | ||
| 2558 | (defun org-clocktable-indent-string (level) | 2558 | (defun org-clocktable-indent-string (level) |
| 2559 | (if (= level 1) | 2559 | (if (= level 1) "" |
| 2560 | "" | 2560 | (let ((str " ")) |
| 2561 | (let ((str "\\__")) | 2561 | (dotimes (k (1- level) str) |
| 2562 | (while (> level 2) | 2562 | (setq str (concat "\\emsp" str)))))) |
| 2563 | (setq level (1- level) | ||
| 2564 | str (concat str "___"))) | ||
| 2565 | (concat str " ")))) | ||
| 2566 | 2563 | ||
| 2567 | (defun org-clocktable-steps (params) | 2564 | (defun org-clocktable-steps (params) |
| 2568 | "Step through the range to make a number of clock tables." | 2565 | "Step through the range to make a number of clock tables." |
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el index 70c41d53cd9..90380a8806c 100644 --- a/lisp/org/org-compat.el +++ b/lisp/org/org-compat.el | |||
| @@ -312,8 +312,7 @@ Works on both Emacs and XEmacs." | |||
| 312 | (defun org-in-invisibility-spec-p (arg) | 312 | (defun org-in-invisibility-spec-p (arg) |
| 313 | "Is ARG a member of `buffer-invisibility-spec'?" | 313 | "Is ARG a member of `buffer-invisibility-spec'?" |
| 314 | (if (consp buffer-invisibility-spec) | 314 | (if (consp buffer-invisibility-spec) |
| 315 | (member arg buffer-invisibility-spec) | 315 | (member arg buffer-invisibility-spec))) |
| 316 | nil)) | ||
| 317 | 316 | ||
| 318 | (defmacro org-xemacs-without-invisibility (&rest body) | 317 | (defmacro org-xemacs-without-invisibility (&rest body) |
| 319 | "Turn off extents with invisibility while executing BODY." | 318 | "Turn off extents with invisibility while executing BODY." |
| @@ -347,18 +346,8 @@ Works on both Emacs and XEmacs." | |||
| 347 | "Move to column COLUMN. | 346 | "Move to column COLUMN. |
| 348 | Pass COLUMN and FORCE to `move-to-column'. | 347 | Pass COLUMN and FORCE to `move-to-column'. |
| 349 | Pass BUFFER to the XEmacs version of `move-to-column'." | 348 | Pass BUFFER to the XEmacs version of `move-to-column'." |
| 350 | (let* ((with-bracket-link | 349 | (let ((buffer-invisibility-spec |
| 351 | (save-excursion | 350 | (remove '(org-filtered) buffer-invisibility-spec))) |
| 352 | (forward-line 0) | ||
| 353 | (looking-at (concat "^.*" org-bracket-link-regexp)))) | ||
| 354 | (buffer-invisibility-spec | ||
| 355 | (cond | ||
| 356 | ((or (not (derived-mode-p 'org-mode)) | ||
| 357 | (and with-bracket-link (org-invisible-p2))) | ||
| 358 | (remove '(org-link) buffer-invisibility-spec)) | ||
| 359 | (with-bracket-link | ||
| 360 | (remove t buffer-invisibility-spec)) | ||
| 361 | (t buffer-invisibility-spec)))) | ||
| 362 | (if (featurep 'xemacs) | 351 | (if (featurep 'xemacs) |
| 363 | (org-xemacs-without-invisibility | 352 | (org-xemacs-without-invisibility |
| 364 | (move-to-column column force buffer)) | 353 | (move-to-column column force buffer)) |
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el index b44466e53df..eb8ff415861 100644 --- a/lisp/org/org-element.el +++ b/lisp/org/org-element.el | |||
| @@ -360,11 +360,6 @@ still has an entry since one of its properties (`:title') does.") | |||
| 360 | (footnote-reference . :inline-definition)) | 360 | (footnote-reference . :inline-definition)) |
| 361 | "Alist between element types and location of secondary value.") | 361 | "Alist between element types and location of secondary value.") |
| 362 | 362 | ||
| 363 | (defconst org-element-object-variables '(org-link-abbrev-alist-local) | ||
| 364 | "List of buffer-local variables used when parsing objects. | ||
| 365 | These variables are copied to the temporary buffer created by | ||
| 366 | `org-export-secondary-string'.") | ||
| 367 | |||
| 368 | 363 | ||
| 369 | 364 | ||
| 370 | ;;; Accessors and Setters | 365 | ;;; Accessors and Setters |
| @@ -732,11 +727,11 @@ CONTENTS is the contents of the footnote-definition." | |||
| 732 | 727 | ||
| 733 | Return a list whose CAR is `headline' and CDR is a plist | 728 | Return a list whose CAR is `headline' and CDR is a plist |
| 734 | containing `:raw-value', `:title', `:alt-title', `:begin', | 729 | containing `:raw-value', `:title', `:alt-title', `:begin', |
| 735 | `:end', `:pre-blank', `:hiddenp', `:contents-begin' and | 730 | `:end', `:pre-blank', `:hiddenp', `:contents-begin', |
| 736 | `:contents-end', `:level', `:priority', `:tags', | 731 | `:contents-end', `:level', `:priority', `:tags', |
| 737 | `:todo-keyword',`:todo-type', `:scheduled', `:deadline', | 732 | `:todo-keyword',`:todo-type', `:scheduled', `:deadline', |
| 738 | `:closed', `:quotedp', `:archivedp', `:commentedp' and | 733 | `:closed', `:quotedp', `:archivedp', `:commentedp', |
| 739 | `:footnote-section-p' keywords. | 734 | `:footnote-section-p' and `:post-blank' keywords. |
| 740 | 735 | ||
| 741 | The plist also contains any property set in the property drawer, | 736 | The plist also contains any property set in the property drawer, |
| 742 | with its name in upper cases and colons added at the | 737 | with its name in upper cases and colons added at the |
| @@ -875,38 +870,40 @@ CONTENTS is the contents of the element." | |||
| 875 | (org-element-property :tags headline)) | 870 | (org-element-property :tags headline)) |
| 876 | (org-element-property :tags headline)))) | 871 | (org-element-property :tags headline)))) |
| 877 | (and tag-list | 872 | (and tag-list |
| 878 | (format ":%s:" (mapconcat 'identity tag-list ":"))))) | 873 | (format ":%s:" (mapconcat #'identity tag-list ":"))))) |
| 879 | (commentedp (org-element-property :commentedp headline)) | 874 | (commentedp (org-element-property :commentedp headline)) |
| 880 | (quotedp (org-element-property :quotedp headline)) | 875 | (quotedp (org-element-property :quotedp headline)) |
| 881 | (pre-blank (or (org-element-property :pre-blank headline) 0)) | 876 | (pre-blank (or (org-element-property :pre-blank headline) 0)) |
| 882 | (heading (concat (make-string (org-reduced-level level) ?*) | 877 | (heading |
| 883 | (and todo (concat " " todo)) | 878 | (concat (make-string (if org-odd-levels-only (1- (* level 2)) level) |
| 884 | (and quotedp (concat " " org-quote-string)) | 879 | ?*) |
| 885 | (and commentedp (concat " " org-comment-string)) | 880 | (and todo (concat " " todo)) |
| 886 | (and priority | 881 | (and quotedp (concat " " org-quote-string)) |
| 887 | (format " [#%s]" (char-to-string priority))) | 882 | (and commentedp (concat " " org-comment-string)) |
| 888 | (cond ((and org-footnote-section | 883 | (and priority (format " [#%s]" (char-to-string priority))) |
| 889 | (org-element-property | 884 | " " |
| 890 | :footnote-section-p headline)) | 885 | (if (and org-footnote-section |
| 891 | (concat " " org-footnote-section)) | 886 | (org-element-property :footnote-section-p headline)) |
| 892 | (title (concat " " title)))))) | 887 | org-footnote-section |
| 893 | (concat heading | 888 | title)))) |
| 894 | ;; Align tags. | 889 | (concat |
| 895 | (when tags | 890 | heading |
| 896 | (cond | 891 | ;; Align tags. |
| 897 | ((zerop org-tags-column) (format " %s" tags)) | 892 | (when tags |
| 898 | ((< org-tags-column 0) | 893 | (cond |
| 899 | (concat | 894 | ((zerop org-tags-column) (format " %s" tags)) |
| 900 | (make-string | 895 | ((< org-tags-column 0) |
| 901 | (max (- (+ org-tags-column (length heading) (length tags))) 1) | 896 | (concat |
| 902 | ? ) | 897 | (make-string |
| 903 | tags)) | 898 | (max (- (+ org-tags-column (length heading) (length tags))) 1) |
| 904 | (t | 899 | ?\s) |
| 905 | (concat | 900 | tags)) |
| 906 | (make-string (max (- org-tags-column (length heading)) 1) ? ) | 901 | (t |
| 907 | tags)))) | 902 | (concat |
| 908 | (make-string (1+ pre-blank) 10) | 903 | (make-string (max (- org-tags-column (length heading)) 1) ?\s) |
| 909 | contents))) | 904 | tags)))) |
| 905 | (make-string (1+ pre-blank) ?\n) | ||
| 906 | contents))) | ||
| 910 | 907 | ||
| 911 | 908 | ||
| 912 | ;;;; Inlinetask | 909 | ;;;; Inlinetask |
| @@ -1315,36 +1312,36 @@ containing `:begin', `:end', `:hiddenp', `:contents-begin', | |||
| 1315 | `:contents-end', `:post-blank' and `:post-affiliated' keywords. | 1312 | `:contents-end', `:post-blank' and `:post-affiliated' keywords. |
| 1316 | 1313 | ||
| 1317 | Assume point is at the beginning of the property drawer." | 1314 | Assume point is at the beginning of the property drawer." |
| 1318 | (save-excursion | 1315 | (let ((case-fold-search t)) |
| 1319 | (let ((case-fold-search t)) | 1316 | (if (not (save-excursion (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) |
| 1320 | (if (not (save-excursion | 1317 | ;; Incomplete drawer: parse it as a paragraph. |
| 1321 | (re-search-forward "^[ \t]*:END:[ \t]*$" limit t))) | 1318 | (org-element-paragraph-parser limit affiliated) |
| 1322 | ;; Incomplete drawer: parse it as a paragraph. | 1319 | (save-excursion |
| 1323 | (org-element-paragraph-parser limit affiliated) | 1320 | (let* ((drawer-end-line (match-beginning 0)) |
| 1324 | (save-excursion | 1321 | (begin (car affiliated)) |
| 1325 | (let* ((drawer-end-line (match-beginning 0)) | 1322 | (post-affiliated (point)) |
| 1326 | (begin (car affiliated)) | 1323 | (contents-begin |
| 1327 | (post-affiliated (point)) | 1324 | (progn |
| 1328 | (contents-begin (progn (forward-line) | 1325 | (forward-line) |
| 1329 | (and (< (point) drawer-end-line) | 1326 | (and (re-search-forward org-property-re drawer-end-line t) |
| 1330 | (point)))) | 1327 | (line-beginning-position)))) |
| 1331 | (contents-end (and contents-begin drawer-end-line)) | 1328 | (contents-end (and contents-begin drawer-end-line)) |
| 1332 | (hidden (org-invisible-p2)) | 1329 | (hidden (org-invisible-p2)) |
| 1333 | (pos-before-blank (progn (goto-char drawer-end-line) | 1330 | (pos-before-blank (progn (goto-char drawer-end-line) |
| 1334 | (forward-line) | 1331 | (forward-line) |
| 1335 | (point))) | 1332 | (point))) |
| 1336 | (end (progn (skip-chars-forward " \r\t\n" limit) | 1333 | (end (progn (skip-chars-forward " \r\t\n" limit) |
| 1337 | (if (eobp) (point) (line-beginning-position))))) | 1334 | (if (eobp) (point) (line-beginning-position))))) |
| 1338 | (list 'property-drawer | 1335 | (list 'property-drawer |
| 1339 | (nconc | 1336 | (nconc |
| 1340 | (list :begin begin | 1337 | (list :begin begin |
| 1341 | :end end | 1338 | :end end |
| 1342 | :hiddenp hidden | 1339 | :hiddenp hidden |
| 1343 | :contents-begin contents-begin | 1340 | :contents-begin contents-begin |
| 1344 | :contents-end contents-end | 1341 | :contents-end contents-end |
| 1345 | :post-blank (count-lines pos-before-blank end) | 1342 | :post-blank (count-lines pos-before-blank end) |
| 1346 | :post-affiliated post-affiliated) | 1343 | :post-affiliated post-affiliated) |
| 1347 | (cdr affiliated))))))))) | 1344 | (cdr affiliated)))))))) |
| 1348 | 1345 | ||
| 1349 | (defun org-element-property-drawer-interpreter (property-drawer contents) | 1346 | (defun org-element-property-drawer-interpreter (property-drawer contents) |
| 1350 | "Interpret PROPERTY-DRAWER element as Org syntax. | 1347 | "Interpret PROPERTY-DRAWER element as Org syntax. |
| @@ -2099,28 +2096,28 @@ LIMIT bounds the search. | |||
| 2099 | Return a list whose CAR is `node-property' and CDR is a plist | 2096 | Return a list whose CAR is `node-property' and CDR is a plist |
| 2100 | containing `:key', `:value', `:begin', `:end' and `:post-blank' | 2097 | containing `:key', `:value', `:begin', `:end' and `:post-blank' |
| 2101 | keywords." | 2098 | keywords." |
| 2102 | (save-excursion | 2099 | (looking-at org-property-re) |
| 2103 | (looking-at org-property-re) | 2100 | (let ((begin (point)) |
| 2104 | (let ((case-fold-search t) | 2101 | (key (org-match-string-no-properties 2)) |
| 2105 | (begin (point)) | 2102 | (value (org-match-string-no-properties 3)) |
| 2106 | (key (org-match-string-no-properties 2)) | 2103 | (end (save-excursion |
| 2107 | (value (org-match-string-no-properties 3)) | 2104 | (end-of-line) |
| 2108 | (pos-before-blank (progn (forward-line) (point))) | 2105 | (if (re-search-forward org-property-re limit t) |
| 2109 | (end (progn (skip-chars-forward " \r\t\n" limit) | 2106 | (line-beginning-position) |
| 2110 | (if (eobp) (point) (point-at-bol))))) | 2107 | limit)))) |
| 2111 | (list 'node-property | 2108 | (list 'node-property |
| 2112 | (list :key key | 2109 | (list :key key |
| 2113 | :value value | 2110 | :value value |
| 2114 | :begin begin | 2111 | :begin begin |
| 2115 | :end end | 2112 | :end end |
| 2116 | :post-blank (count-lines pos-before-blank end)))))) | 2113 | :post-blank 0)))) |
| 2117 | 2114 | ||
| 2118 | (defun org-element-node-property-interpreter (node-property contents) | 2115 | (defun org-element-node-property-interpreter (node-property contents) |
| 2119 | "Interpret NODE-PROPERTY element as Org syntax. | 2116 | "Interpret NODE-PROPERTY element as Org syntax. |
| 2120 | CONTENTS is nil." | 2117 | CONTENTS is nil." |
| 2121 | (format org-property-format | 2118 | (format org-property-format |
| 2122 | (format ":%s:" (org-element-property :key node-property)) | 2119 | (format ":%s:" (org-element-property :key node-property)) |
| 2123 | (org-element-property :value node-property))) | 2120 | (or (org-element-property :value node-property) ""))) |
| 2124 | 2121 | ||
| 2125 | 2122 | ||
| 2126 | ;;;; Paragraph | 2123 | ;;;; Paragraph |
| @@ -2486,7 +2483,7 @@ Assume point is at the beginning of the table." | |||
| 2486 | 2483 | ||
| 2487 | (defun org-element-table-interpreter (table contents) | 2484 | (defun org-element-table-interpreter (table contents) |
| 2488 | "Interpret TABLE element as Org syntax. | 2485 | "Interpret TABLE element as Org syntax. |
| 2489 | CONTENTS is nil." | 2486 | CONTENTS is a string, if table's type is `org', or nil." |
| 2490 | (if (eq (org-element-property :type table) 'table.el) | 2487 | (if (eq (org-element-property :type table) 'table.el) |
| 2491 | (org-remove-indentation (org-element-property :value table)) | 2488 | (org-remove-indentation (org-element-property :value table)) |
| 2492 | (concat (with-temp-buffer (insert contents) | 2489 | (concat (with-temp-buffer (insert contents) |
| @@ -3112,16 +3109,20 @@ Assume point is at the beginning of the link." | |||
| 3112 | (cond | 3109 | (cond |
| 3113 | ;; File type. | 3110 | ;; File type. |
| 3114 | ((or (file-name-absolute-p raw-link) | 3111 | ((or (file-name-absolute-p raw-link) |
| 3115 | (string-match "^\\.\\.?/" raw-link)) | 3112 | (string-match "\\`\\.\\.?/" raw-link)) |
| 3116 | (setq type "file" path raw-link)) | 3113 | (setq type "file" path raw-link)) |
| 3117 | ;; Explicit type (http, irc, bbdb...). See `org-link-types'. | 3114 | ;; Explicit type (http, irc, bbdb...). See `org-link-types'. |
| 3118 | ((string-match org-link-re-with-space3 raw-link) | 3115 | ((string-match org-link-types-re raw-link) |
| 3119 | (setq type (match-string 1 raw-link) path (match-string 2 raw-link))) | 3116 | (setq type (match-string 1 raw-link) |
| 3117 | ;; According to RFC 3986, extra whitespace should be | ||
| 3118 | ;; ignored when a URI is extracted. | ||
| 3119 | path (replace-regexp-in-string | ||
| 3120 | "[ \t]*\n[ \t]*" "" (substring raw-link (match-end 0))))) | ||
| 3120 | ;; Id type: PATH is the id. | 3121 | ;; Id type: PATH is the id. |
| 3121 | ((string-match "^id:\\([-a-f0-9]+\\)" raw-link) | 3122 | ((string-match "\\`id:\\([-a-f0-9]+\\)" raw-link) |
| 3122 | (setq type "id" path (match-string 1 raw-link))) | 3123 | (setq type "id" path (match-string 1 raw-link))) |
| 3123 | ;; Code-ref type: PATH is the name of the reference. | 3124 | ;; Code-ref type: PATH is the name of the reference. |
| 3124 | ((string-match "^(\\(.*\\))$" raw-link) | 3125 | ((string-match "\\`(\\(.*\\))\\'" raw-link) |
| 3125 | (setq type "coderef" path (match-string 1 raw-link))) | 3126 | (setq type "coderef" path (match-string 1 raw-link))) |
| 3126 | ;; Custom-id type: PATH is the name of the custom id. | 3127 | ;; Custom-id type: PATH is the name of the custom id. |
| 3127 | ((= (aref raw-link 0) ?#) | 3128 | ((= (aref raw-link 0) ?#) |
| @@ -3541,7 +3542,7 @@ Return a list whose CAR is `timestamp', and CDR a plist with | |||
| 3541 | `:month-end', `:day-end', `:hour-end', `:minute-end', | 3542 | `:month-end', `:day-end', `:hour-end', `:minute-end', |
| 3542 | `:repeater-type', `:repeater-value', `:repeater-unit', | 3543 | `:repeater-type', `:repeater-value', `:repeater-unit', |
| 3543 | `:warning-type', `:warning-value', `:warning-unit', `:begin', | 3544 | `:warning-type', `:warning-value', `:warning-unit', `:begin', |
| 3544 | `:end', `:value' and `:post-blank' keywords. | 3545 | `:end' and `:post-blank' keywords. |
| 3545 | 3546 | ||
| 3546 | Assume point is at the beginning of the timestamp." | 3547 | Assume point is at the beginning of the timestamp." |
| 3547 | (save-excursion | 3548 | (save-excursion |
| @@ -3890,8 +3891,7 @@ element it has to parse." | |||
| 3890 | (goto-char (car affiliated)) | 3891 | (goto-char (car affiliated)) |
| 3891 | (org-element-keyword-parser limit nil)) | 3892 | (org-element-keyword-parser limit nil)) |
| 3892 | ;; LaTeX Environment. | 3893 | ;; LaTeX Environment. |
| 3893 | ((looking-at | 3894 | ((looking-at "[ \t]*\\\\begin{\\([A-Za-z0-9]+\\*?\\)}\\(\\[.*?\\]\\|{.*?}\\)*[ \t]*$") |
| 3894 | "[ \t]*\\\\begin{[A-Za-z0-9*]+}\\(\\[.*?\\]\\|{.*?}\\)*[ \t]*$") | ||
| 3895 | (org-element-latex-environment-parser limit affiliated)) | 3895 | (org-element-latex-environment-parser limit affiliated)) |
| 3896 | ;; Drawer and Property Drawer. | 3896 | ;; Drawer and Property Drawer. |
| 3897 | ((looking-at org-drawer-regexp) | 3897 | ((looking-at org-drawer-regexp) |
| @@ -4090,21 +4090,18 @@ looked after. | |||
| 4090 | Optional argument PARENT, when non-nil, is the element or object | 4090 | Optional argument PARENT, when non-nil, is the element or object |
| 4091 | containing the secondary string. It is used to set correctly | 4091 | containing the secondary string. It is used to set correctly |
| 4092 | `:parent' property within the string." | 4092 | `:parent' property within the string." |
| 4093 | ;; Copy buffer-local variables listed in | 4093 | (let ((local-variables (buffer-local-variables))) |
| 4094 | ;; `org-element-object-variables' into temporary buffer. This is | ||
| 4095 | ;; required since object parsing is dependent on these variables. | ||
| 4096 | (let ((pairs (delq nil (mapcar (lambda (var) | ||
| 4097 | (when (boundp var) | ||
| 4098 | (cons var (symbol-value var)))) | ||
| 4099 | org-element-object-variables)))) | ||
| 4100 | (with-temp-buffer | 4094 | (with-temp-buffer |
| 4101 | (mapc (lambda (pair) (org-set-local (car pair) (cdr pair))) pairs) | 4095 | (dolist (v local-variables) |
| 4096 | (ignore-errors | ||
| 4097 | (if (symbolp v) (makunbound v) | ||
| 4098 | (org-set-local (car v) (cdr v))))) | ||
| 4102 | (insert string) | 4099 | (insert string) |
| 4100 | (restore-buffer-modified-p nil) | ||
| 4103 | (let ((secondary (org-element--parse-objects | 4101 | (let ((secondary (org-element--parse-objects |
| 4104 | (point-min) (point-max) nil restriction))) | 4102 | (point-min) (point-max) nil restriction))) |
| 4105 | (when parent | 4103 | (when parent |
| 4106 | (mapc (lambda (obj) (org-element-put-property obj :parent parent)) | 4104 | (dolist (o secondary) (org-element-put-property o :parent parent))) |
| 4107 | secondary)) | ||
| 4108 | secondary)))) | 4105 | secondary)))) |
| 4109 | 4106 | ||
| 4110 | (defun org-element-map | 4107 | (defun org-element-map |
| @@ -4617,29 +4614,29 @@ indentation is not done with TAB characters." | |||
| 4617 | (let* ((min-ind most-positive-fixnum) | 4614 | (let* ((min-ind most-positive-fixnum) |
| 4618 | find-min-ind ; For byte-compiler. | 4615 | find-min-ind ; For byte-compiler. |
| 4619 | (find-min-ind | 4616 | (find-min-ind |
| 4620 | (function | 4617 | ;; Return minimal common indentation within BLOB. This is |
| 4621 | ;; Return minimal common indentation within BLOB. This is | 4618 | ;; done by walking recursively BLOB and updating MIN-IND |
| 4622 | ;; done by walking recursively BLOB and updating MIN-IND | 4619 | ;; along the way. FIRST-FLAG is non-nil when the first |
| 4623 | ;; along the way. FIRST-FLAG is non-nil when the first | 4620 | ;; string hasn't been seen yet. It is required as this |
| 4624 | ;; string hasn't been seen yet. It is required as this | 4621 | ;; string is the only one whose indentation doesn't happen |
| 4625 | ;; string is the only one whose indentation doesn't happen | 4622 | ;; after a newline character. |
| 4626 | ;; after a newline character. | 4623 | (lambda (blob first-flag) |
| 4627 | (lambda (blob first-flag) | 4624 | (dolist (object (org-element-contents blob)) |
| 4628 | (dolist (object (org-element-contents blob)) | 4625 | (when (and first-flag (stringp object)) |
| 4629 | (when (and first-flag (stringp object)) | 4626 | (setq first-flag nil) |
| 4630 | (setq first-flag nil) | 4627 | (string-match "\\` *" object) |
| 4631 | (string-match "\\`\\( *\\)" object) | 4628 | (let ((len (match-end 0))) |
| 4632 | (let ((len (length (match-string 1 object)))) | 4629 | ;; An indentation of zero means no string will be |
| 4633 | ;; An indentation of zero means no string will be | 4630 | ;; modified. Quit the process. |
| 4634 | ;; modified. Quit the process. | 4631 | (if (zerop len) (throw 'zero (setq min-ind 0)) |
| 4635 | (if (zerop len) (throw 'zero (setq min-ind 0)) | 4632 | (setq min-ind (min len min-ind))))) |
| 4636 | (setq min-ind (min len min-ind))))) | 4633 | (cond |
| 4637 | (cond | 4634 | ((stringp object) |
| 4638 | ((stringp object) | 4635 | (dolist (line (cdr (org-split-string object " *\n"))) |
| 4639 | (dolist (line (delq "" (cdr (org-split-string object " *\n")))) | 4636 | (unless (string= line "") |
| 4640 | (setq min-ind (min (org-get-indentation line) min-ind)))) | 4637 | (setq min-ind (min (org-get-indentation line) min-ind))))) |
| 4641 | ((memq (org-element-type object) org-element-recursive-objects) | 4638 | ((memq (org-element-type object) org-element-recursive-objects) |
| 4642 | (funcall find-min-ind object first-flag)))))))) | 4639 | (funcall find-min-ind object first-flag))))))) |
| 4643 | ;; Find minimal indentation in ELEMENT. | 4640 | ;; Find minimal indentation in ELEMENT. |
| 4644 | (catch 'zero (funcall find-min-ind element (not ignore-first))) | 4641 | (catch 'zero (funcall find-min-ind element (not ignore-first))) |
| 4645 | (if (or (zerop min-ind) (= min-ind most-positive-fixnum)) element | 4642 | (if (or (zerop min-ind) (= min-ind most-positive-fixnum)) element |
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el index ba1eed12bdb..6324a625dbd 100644 --- a/lisp/org/org-entities.el +++ b/lisp/org/org-entities.el | |||
| @@ -27,9 +27,8 @@ | |||
| 27 | 27 | ||
| 28 | ;;; Code: | 28 | ;;; Code: |
| 29 | 29 | ||
| 30 | (require 'org-macs) | 30 | (declare-function org-toggle-pretty-entities "org" ()) |
| 31 | 31 | (declare-function org-table-align "org-table" ()) | |
| 32 | (declare-function org-table-align "org-table" ()) | ||
| 33 | 32 | ||
| 34 | (eval-when-compile | 33 | (eval-when-compile |
| 35 | (require 'cl)) | 34 | (require 'cl)) |
| @@ -568,6 +567,7 @@ Kind can be any of `latex', `html', `ascii', `latin1', or `utf8'." | |||
| 568 | (goto-char pos) | 567 | (goto-char pos) |
| 569 | (org-table-align))) | 568 | (org-table-align))) |
| 570 | 569 | ||
| 570 | (defvar org-pretty-entities) ;; declare defcustom from org | ||
| 571 | (defun org-entities-help () | 571 | (defun org-entities-help () |
| 572 | "Create a Help buffer with all available entities." | 572 | "Create a Help buffer with all available entities." |
| 573 | (interactive) | 573 | (interactive) |
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el index 721718d2b6c..60137568c00 100644 --- a/lisp/org/org-habit.el +++ b/lisp/org/org-habit.el | |||
| @@ -351,14 +351,7 @@ current time." | |||
| 351 | (let ((inhibit-read-only t) l c | 351 | (let ((inhibit-read-only t) l c |
| 352 | (buffer-invisibility-spec '(org-link)) | 352 | (buffer-invisibility-spec '(org-link)) |
| 353 | (moment (time-subtract (current-time) | 353 | (moment (time-subtract (current-time) |
| 354 | (list 0 (* 3600 org-extend-today-until) 0))) | 354 | (list 0 (* 3600 org-extend-today-until) 0)))) |
| 355 | disabled-overlays) | ||
| 356 | ;; Disable filters; this helps with alignment if there are links. | ||
| 357 | (mapc (lambda (ol) | ||
| 358 | (when (overlay-get ol 'invisible) | ||
| 359 | (overlay-put ol 'invisible nil) | ||
| 360 | (setq disabled-overlays (cons ol disabled-overlays)))) | ||
| 361 | (overlays-in (point-min) (point-max))) | ||
| 362 | (save-excursion | 355 | (save-excursion |
| 363 | (goto-char (if line (point-at-bol) (point-min))) | 356 | (goto-char (if line (point-at-bol) (point-min))) |
| 364 | (while (not (eobp)) | 357 | (while (not (eobp)) |
| @@ -374,9 +367,7 @@ current time." | |||
| 374 | (time-subtract moment (days-to-time org-habit-preceding-days)) | 367 | (time-subtract moment (days-to-time org-habit-preceding-days)) |
| 375 | moment | 368 | moment |
| 376 | (time-add moment (days-to-time org-habit-following-days)))))) | 369 | (time-add moment (days-to-time org-habit-following-days)))))) |
| 377 | (forward-line))) | 370 | (forward-line))))) |
| 378 | (mapc (lambda (ol) (overlay-put ol 'invisible t)) | ||
| 379 | disabled-overlays))) | ||
| 380 | 371 | ||
| 381 | (defun org-habit-toggle-habits () | 372 | (defun org-habit-toggle-habits () |
| 382 | "Toggle display of habits in an agenda buffer." | 373 | "Toggle display of habits in an agenda buffer." |
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el index d24dad28363..a00e557371c 100644 --- a/lisp/org/org-list.el +++ b/lisp/org/org-list.el | |||
| @@ -1254,7 +1254,7 @@ some heuristics to guess the result." | |||
| 1254 | If POS is before first character after bullet of the item, the | 1254 | If POS is before first character after bullet of the item, the |
| 1255 | new item will be created before the current one. | 1255 | new item will be created before the current one. |
| 1256 | 1256 | ||
| 1257 | STRUCT is the list structure. PREVS is the the alist of previous | 1257 | STRUCT is the list structure. PREVS is the alist of previous |
| 1258 | items, as returned by `org-list-prevs-alist'. | 1258 | items, as returned by `org-list-prevs-alist'. |
| 1259 | 1259 | ||
| 1260 | Insert a checkbox if CHECKBOX is non-nil, and string AFTER-BULLET | 1260 | Insert a checkbox if CHECKBOX is non-nil, and string AFTER-BULLET |
| @@ -2237,7 +2237,7 @@ item is invisible." | |||
| 2237 | t))))) | 2237 | t))))) |
| 2238 | 2238 | ||
| 2239 | (defun org-list-repair () | 2239 | (defun org-list-repair () |
| 2240 | "Fix indentation, bullets and checkboxes is the list at point." | 2240 | "Fix indentation, bullets and checkboxes in the list at point." |
| 2241 | (interactive) | 2241 | (interactive) |
| 2242 | (unless (org-at-item-p) (error "This is not a list")) | 2242 | (unless (org-at-item-p) (error "This is not a list")) |
| 2243 | (let* ((struct (org-list-struct)) | 2243 | (let* ((struct (org-list-struct)) |
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index ddd6e2e90f5..96265ec02fe 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el | |||
| @@ -154,9 +154,9 @@ We use a macro so that the test can happen at compilation time." | |||
| 154 | `(let ((,mpom ,pom)) | 154 | `(let ((,mpom ,pom)) |
| 155 | (save-excursion | 155 | (save-excursion |
| 156 | (if (markerp ,mpom) (set-buffer (marker-buffer ,mpom))) | 156 | (if (markerp ,mpom) (set-buffer (marker-buffer ,mpom))) |
| 157 | (save-excursion | 157 | (org-with-wide-buffer |
| 158 | (goto-char (or ,mpom (point))) | 158 | (goto-char (or ,mpom (point))) |
| 159 | ,@body))))) | 159 | ,@body))))) |
| 160 | (def-edebug-spec org-with-point-at (form body)) | 160 | (def-edebug-spec org-with-point-at (form body)) |
| 161 | (put 'org-with-point-at 'lisp-indent-function 1) | 161 | (put 'org-with-point-at 'lisp-indent-function 1) |
| 162 | 162 | ||
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index f59d1c47911..41a99586742 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el | |||
| @@ -1074,7 +1074,7 @@ be returned that indicates what went wrong." | |||
| 1074 | ;; which prevents correct insertion when point is invisible | 1074 | ;; which prevents correct insertion when point is invisible |
| 1075 | (org-show-subtree) | 1075 | (org-show-subtree) |
| 1076 | (end-of-line 1) | 1076 | (end-of-line 1) |
| 1077 | (org-insert-heading-respect-content '(16) t) | 1077 | (org-insert-heading-respect-content t) |
| 1078 | (org-demote)) | 1078 | (org-demote)) |
| 1079 | (beginning-of-line) | 1079 | (beginning-of-line) |
| 1080 | (insert "* ")) | 1080 | (insert "* ")) |
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index 27dc0e070fc..74046c73fe3 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el | |||
| @@ -953,20 +953,23 @@ This means, between the beginning of line and the point." | |||
| 953 | (point) | 953 | (point) |
| 954 | (save-excursion (goto-char start) | 954 | (save-excursion (goto-char start) |
| 955 | (org-back-to-heading) (point)))) | 955 | (org-back-to-heading) (point)))) |
| 956 | (outline-end-of-subtree) | 956 | (progn (org-end-of-subtree nil t) |
| 957 | (unless (eobp) (backward-char))) | ||
| 957 | (end-of-line) | 958 | (end-of-line) |
| 958 | (if (eobp) (newline) (forward-char))) | 959 | (if (eobp) (newline) (forward-char))) |
| 959 | 960 | ||
| 960 | (when (looking-at org-outline-regexp) | 961 | (when (looking-at org-outline-regexp) |
| 961 | (let ((level (- (match-end 0) (match-beginning 0)))) | 962 | (let ((level (- (match-end 0) (match-beginning 0)))) |
| 962 | (when (> end (match-end 0)) | 963 | (when (> end (match-end 0)) |
| 963 | (outline-end-of-subtree) | 964 | (progn (org-end-of-subtree nil t) |
| 965 | (unless (eobp) (backward-char))) | ||
| 964 | (end-of-line) | 966 | (end-of-line) |
| 965 | (if (eobp) (newline) (forward-char)) | 967 | (if (eobp) (newline) (forward-char)) |
| 966 | (setq level (1+ level))) | 968 | (setq level (1+ level))) |
| 967 | (org-paste-subtree level) | 969 | (org-paste-subtree level) |
| 968 | (save-excursion | 970 | (save-excursion |
| 969 | (outline-end-of-subtree) | 971 | (progn (org-end-of-subtree nil t) |
| 972 | (unless (eobp) (backward-char))) | ||
| 970 | (when (bolp) (delete-char -1)))))))))) | 973 | (when (bolp) (delete-char -1)))))))))) |
| 971 | 974 | ||
| 972 | 975 | ||
| @@ -1003,8 +1006,8 @@ This means, between the beginning of line and the point." | |||
| 1003 | (org-mouse-main-buffer (current-buffer))) | 1006 | (org-mouse-main-buffer (current-buffer))) |
| 1004 | (when (eq (with-current-buffer buffer major-mode) 'org-mode) | 1007 | (when (eq (with-current-buffer buffer major-mode) 'org-mode) |
| 1005 | (let ((endmarker (with-current-buffer buffer | 1008 | (let ((endmarker (with-current-buffer buffer |
| 1006 | (outline-end-of-subtree) | 1009 | (org-end-of-subtree nil t) |
| 1007 | (forward-char 1) | 1010 | (unless (eobp) (forward-char 1)) |
| 1008 | (copy-marker (point))))) | 1011 | (copy-marker (point))))) |
| 1009 | (org-with-remote-undo buffer | 1012 | (org-with-remote-undo buffer |
| 1010 | (with-current-buffer buffer | 1013 | (with-current-buffer buffer |
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el index f870b2c714d..752fa30bd12 100644 --- a/lisp/org/org-src.el +++ b/lisp/org/org-src.el | |||
| @@ -376,23 +376,21 @@ the display of windows containing the Org buffer and the code buffer." | |||
| 376 | (when (fboundp edit-prep-func) | 376 | (when (fboundp edit-prep-func) |
| 377 | (funcall edit-prep-func full-info))) | 377 | (funcall edit-prep-func full-info))) |
| 378 | (or org-edit-src-code-timer | 378 | (or org-edit-src-code-timer |
| 379 | (zerop org-edit-src-auto-save-idle-delay) | ||
| 379 | (setq org-edit-src-code-timer | 380 | (setq org-edit-src-code-timer |
| 380 | (unless (zerop org-edit-src-auto-save-idle-delay) | 381 | (run-with-idle-timer |
| 381 | (run-with-idle-timer | 382 | org-edit-src-auto-save-idle-delay t |
| 382 | org-edit-src-auto-save-idle-delay t | 383 | (lambda () |
| 383 | (lambda () | 384 | (cond |
| 384 | (cond | 385 | ((org-string-match-p "\\`\\*Org Src" (buffer-name)) |
| 385 | ((and (string-match "\*Org Src" (buffer-name)) | 386 | (when (buffer-modified-p) (org-edit-src-save))) |
| 386 | (buffer-modified-p)) | 387 | ((not (org-some (lambda (b) |
| 387 | (org-edit-src-save)) | 388 | (org-string-match-p "\\`\\*Org Src" |
| 388 | ((not | 389 | (buffer-name b))) |
| 389 | (delq nil (mapcar | 390 | (buffer-list))) |
| 390 | (lambda (b) | 391 | (cancel-timer org-edit-src-code-timer) |
| 391 | (string-match "\*Org Src" (buffer-name b))) | 392 | (setq org-edit-src-code-timer nil)))))))) |
| 392 | (buffer-list)))) | 393 | t))) |
| 393 | (cancel-timer org-edit-src-code-timer) | ||
| 394 | (setq org-edit-src-code-timer))))))))) | ||
| 395 | t))) | ||
| 396 | 394 | ||
| 397 | (defun org-edit-src-continue (e) | 395 | (defun org-edit-src-continue (e) |
| 398 | "Continue editing source blocks." ;; Fixme: be more accurate | 396 | "Continue editing source blocks." ;; Fixme: be more accurate |
| @@ -757,8 +755,8 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." | |||
| 757 | (delete-region beg (max beg end)) | 755 | (delete-region beg (max beg end)) |
| 758 | (unless (string-match "\\`[ \t]*\\'" code) | 756 | (unless (string-match "\\`[ \t]*\\'" code) |
| 759 | (insert code)) | 757 | (insert code)) |
| 760 | ;; Make sure the overlay stays in place | 758 | ;; Make sure the overlay stays in place |
| 761 | (when (eq context 'save) (move-overlay ovl beg (point))) | 759 | (when (eq context 'save) (move-overlay ovl beg (point))) |
| 762 | (goto-char beg) | 760 | (goto-char beg) |
| 763 | (if single (just-one-space))) | 761 | (if single (just-one-space))) |
| 764 | (if (memq t (mapcar (lambda (overlay) | 762 | (if (memq t (mapcar (lambda (overlay) |
| @@ -774,9 +772,6 @@ with \",*\", \",#+\", \",,*\" and \",,#+\"." | |||
| 774 | (unless (eq context 'save) | 772 | (unless (eq context 'save) |
| 775 | (move-marker beg nil) | 773 | (move-marker beg nil) |
| 776 | (move-marker end nil))) | 774 | (move-marker end nil))) |
| 777 | (when org-edit-src-code-timer | ||
| 778 | (cancel-timer org-edit-src-code-timer) | ||
| 779 | (setq org-edit-src-code-timer nil)) | ||
| 780 | (unless (eq context 'save) | 775 | (unless (eq context 'save) |
| 781 | (when org-edit-src-saved-temp-window-config | 776 | (when org-edit-src-saved-temp-window-config |
| 782 | (set-window-configuration org-edit-src-saved-temp-window-config) | 777 | (set-window-configuration org-edit-src-saved-temp-window-config) |
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el index c9522341106..30a66c9c234 100644 --- a/lisp/org/org-table.el +++ b/lisp/org/org-table.el | |||
| @@ -2712,7 +2712,8 @@ not overwrite the stored one." | |||
| 2712 | (or (fboundp 'calc-eval) | 2712 | (or (fboundp 'calc-eval) |
| 2713 | (user-error "Calc does not seem to be installed, and is needed to evaluate the formula")) | 2713 | (user-error "Calc does not seem to be installed, and is needed to evaluate the formula")) |
| 2714 | ;; Use <...> time-stamps so that Calc can handle them | 2714 | ;; Use <...> time-stamps so that Calc can handle them |
| 2715 | (setq form (replace-regexp-in-string org-ts-regexp3 "<\\1>" form)) | 2715 | (while (string-match (concat "\\[" org-ts-regexp1 "\\]") form) |
| 2716 | (setq form (replace-match "<\\1>" nil nil form))) | ||
| 2716 | ;; I18n-ize local time-stamps by setting (system-time-locale "C") | 2717 | ;; I18n-ize local time-stamps by setting (system-time-locale "C") |
| 2717 | (when (string-match org-ts-regexp2 form) | 2718 | (when (string-match org-ts-regexp2 form) |
| 2718 | (let* ((ts (match-string 0 form)) | 2719 | (let* ((ts (match-string 0 form)) |
| @@ -3862,9 +3863,10 @@ With prefix ARG, apply the new formulas to the table." | |||
| 3862 | (push org-table-current-begin-pos org-show-positions) | 3863 | (push org-table-current-begin-pos org-show-positions) |
| 3863 | (let ((min (apply 'min org-show-positions)) | 3864 | (let ((min (apply 'min org-show-positions)) |
| 3864 | (max (apply 'max org-show-positions))) | 3865 | (max (apply 'max org-show-positions))) |
| 3865 | (goto-char min) (recenter 0) | 3866 | (set-window-start (selected-window) min) |
| 3866 | (goto-char max) | 3867 | (goto-char max) |
| 3867 | (or (pos-visible-in-window-p max) (recenter -1)))) | 3868 | (or (pos-visible-in-window-p max) |
| 3869 | (set-window-start (selected-window) max)))) | ||
| 3868 | (select-window win)))) | 3870 | (select-window win)))) |
| 3869 | 3871 | ||
| 3870 | (defun org-table-force-dataline () | 3872 | (defun org-table-force-dataline () |
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index 1a86ffa7488..8161699f316 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el | |||
| @@ -186,7 +186,10 @@ it in the buffer." | |||
| 186 | (insert (org-timer-value-string)))) | 186 | (insert (org-timer-value-string)))) |
| 187 | 187 | ||
| 188 | (defun org-timer-value-string () | 188 | (defun org-timer-value-string () |
| 189 | (format org-timer-format (org-timer-secs-to-hms (floor (org-timer-seconds))))) | 189 | "Set the timer string." |
| 190 | (format org-timer-format | ||
| 191 | (org-timer-secs-to-hms | ||
| 192 | (abs (floor (org-timer-seconds)))))) | ||
| 190 | 193 | ||
| 191 | (defvar org-timer-timer-is-countdown nil) | 194 | (defvar org-timer-timer-is-countdown nil) |
| 192 | (defun org-timer-seconds () | 195 | (defun org-timer-seconds () |
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 4909d45530a..b96025785c2 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el | |||
| @@ -5,13 +5,13 @@ | |||
| 5 | (defun org-release () | 5 | (defun org-release () |
| 6 | "The release version of org-mode. | 6 | "The release version of org-mode. |
| 7 | Inserted by installing org-mode or when a release is made." | 7 | Inserted by installing org-mode or when a release is made." |
| 8 | (let ((org-release "8.2.6")) | 8 | (let ((org-release "8.2.8")) |
| 9 | org-release)) | 9 | org-release)) |
| 10 | ;;;###autoload | 10 | ;;;###autoload |
| 11 | (defun org-git-version () | 11 | (defun org-git-version () |
| 12 | "The Git version of org-mode. | 12 | "The Git version of org-mode. |
| 13 | Inserted by installing org-mode or when a release is made." | 13 | Inserted by installing org-mode or when a release is made." |
| 14 | (let ((org-git-version "release_8.2.6-1")) | 14 | (let ((org-git-version "release_8.2.8")) |
| 15 | org-git-version)) | 15 | org-git-version)) |
| 16 | 16 | ||
| 17 | (provide 'org-version) | 17 | (provide 'org-version) |
diff --git a/lisp/org/org.el b/lisp/org/org.el index 2a451ed5456..c42102cac37 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el | |||
| @@ -111,6 +111,8 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 111 | (unless (boundp 'diary-fancy-buffer) | 111 | (unless (boundp 'diary-fancy-buffer) |
| 112 | (org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)) | 112 | (org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)) |
| 113 | 113 | ||
| 114 | (declare-function org-add-archive-files "org-archive" (files)) | ||
| 115 | |||
| 114 | (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) | 116 | (declare-function org-inlinetask-at-task-p "org-inlinetask" ()) |
| 115 | (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) | 117 | (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) |
| 116 | (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) | 118 | (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) |
| @@ -118,7 +120,10 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 118 | (declare-function org-clock-get-last-clock-out-time "org-clock" ()) | 120 | (declare-function org-clock-get-last-clock-out-time "org-clock" ()) |
| 119 | (declare-function org-clock-timestamps-up "org-clock" (&optional n)) | 121 | (declare-function org-clock-timestamps-up "org-clock" (&optional n)) |
| 120 | (declare-function org-clock-timestamps-down "org-clock" (&optional n)) | 122 | (declare-function org-clock-timestamps-down "org-clock" (&optional n)) |
| 123 | (declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove)) | ||
| 121 | (declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) | 124 | (declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) |
| 125 | (declare-function org-clock-update-time-maybe "org-clock" ()) | ||
| 126 | (declare-function org-clocktable-shift "org-clock" (dir n)) | ||
| 122 | 127 | ||
| 123 | (declare-function orgtbl-mode "org-table" (&optional arg)) | 128 | (declare-function orgtbl-mode "org-table" (&optional arg)) |
| 124 | (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time)) | 129 | (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time)) |
| @@ -133,6 +138,10 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 133 | (declare-function org-agenda-list "org-agenda" (&optional arg start-day span)) | 138 | (declare-function org-agenda-list "org-agenda" (&optional arg start-day span)) |
| 134 | (declare-function org-agenda-redo "org-agenda" (&optional all)) | 139 | (declare-function org-agenda-redo "org-agenda" (&optional all)) |
| 135 | (declare-function org-table-align "org-table" ()) | 140 | (declare-function org-table-align "org-table" ()) |
| 141 | (declare-function org-table-begin "org-table" (&optional table-type)) | ||
| 142 | (declare-function org-table-blank-field "org-table" ()) | ||
| 143 | (declare-function org-table-end "org-table" (&optional table-type)) | ||
| 144 | (declare-function org-table-insert-row "org-table" (&optional arg)) | ||
| 136 | (declare-function org-table-paste-rectangle "org-table" ()) | 145 | (declare-function org-table-paste-rectangle "org-table" ()) |
| 137 | (declare-function org-table-maybe-eval-formula "org-table" ()) | 146 | (declare-function org-table-maybe-eval-formula "org-table" ()) |
| 138 | (declare-function org-table-maybe-recalculate-line "org-table" ()) | 147 | (declare-function org-table-maybe-recalculate-line "org-table" ()) |
| @@ -179,6 +188,7 @@ Stars are put in group 1 and the trimmed body in group 2.") | |||
| 179 | (intern (concat "org-babel-expand-body:" lang))))))) | 188 | (intern (concat "org-babel-expand-body:" lang))))))) |
| 180 | org-babel-load-languages)) | 189 | org-babel-load-languages)) |
| 181 | 190 | ||
| 191 | (declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang)) | ||
| 182 | ;;;###autoload | 192 | ;;;###autoload |
| 183 | (defun org-babel-load-file (file &optional compile) | 193 | (defun org-babel-load-file (file &optional compile) |
| 184 | "Load Emacs Lisp source code blocks in the Org-mode FILE. | 194 | "Load Emacs Lisp source code blocks in the Org-mode FILE. |
| @@ -5109,9 +5119,9 @@ Support for group tags is controlled by the option | |||
| 5109 | "\\(?: +\\(\\[#.\\]\\)\\)?" | 5119 | "\\(?: +\\(\\[#.\\]\\)\\)?" |
| 5110 | "\\(?: +" | 5120 | "\\(?: +" |
| 5111 | ;; Stats cookies can be stuck to body. | 5121 | ;; Stats cookies can be stuck to body. |
| 5112 | "\\(?:\\[[0-9%%/]+\\] *\\)?" | 5122 | "\\(?:\\[[0-9%%/]+\\] *\\)*" |
| 5113 | "\\(%s\\)" | 5123 | "\\(%s\\)" |
| 5114 | "\\(?: *\\[[0-9%%/]+\\]\\)?" | 5124 | "\\(?: *\\[[0-9%%/]+\\]\\)*" |
| 5115 | "\\)" | 5125 | "\\)" |
| 5116 | (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") | 5126 | (org-re "\\(?:[ \t]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?") |
| 5117 | "[ \t]*$") | 5127 | "[ \t]*$") |
| @@ -5417,8 +5427,7 @@ The following commands are available: | |||
| 5417 | (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) | 5427 | (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) |
| 5418 | ;; Emacs 22 deals with this through a special variable | 5428 | ;; Emacs 22 deals with this through a special variable |
| 5419 | (org-set-local 'outline-isearch-open-invisible-function | 5429 | (org-set-local 'outline-isearch-open-invisible-function |
| 5420 | (lambda (&rest ignore) (org-show-context 'isearch))) | 5430 | (lambda (&rest ignore) (org-show-context 'isearch)))) |
| 5421 | (org-add-hook 'isearch-mode-end-hook 'org-fix-ellipsis-at-bol 'append 'local)) | ||
| 5422 | 5431 | ||
| 5423 | ;; Setup the pcomplete hooks | 5432 | ;; Setup the pcomplete hooks |
| 5424 | (set (make-local-variable 'pcomplete-command-completion-function) | 5433 | (set (make-local-variable 'pcomplete-command-completion-function) |
| @@ -5473,9 +5482,6 @@ The following commands are available: | |||
| 5473 | 5482 | ||
| 5474 | (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) | 5483 | (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) |
| 5475 | 5484 | ||
| 5476 | (defsubst org-fix-ellipsis-at-bol () | ||
| 5477 | (save-excursion (goto-char (window-start)) (recenter 0))) | ||
| 5478 | |||
| 5479 | (defun org-find-invisible-foreground () | 5485 | (defun org-find-invisible-foreground () |
| 5480 | (let ((candidates (remove | 5486 | (let ((candidates (remove |
| 5481 | "unspecified-bg" | 5487 | "unspecified-bg" |
| @@ -5881,7 +5887,7 @@ by a #." | |||
| 5881 | ((member dc1 '("+title:" "+author:" "+email:" "+date:")) | 5887 | ((member dc1 '("+title:" "+author:" "+email:" "+date:")) |
| 5882 | (add-text-properties | 5888 | (add-text-properties |
| 5883 | beg (match-end 3) | 5889 | beg (match-end 3) |
| 5884 | (if (member (intern (substring dc1 0 -1)) org-hidden-keywords) | 5890 | (if (member (intern (substring dc1 1 -1)) org-hidden-keywords) |
| 5885 | '(font-lock-fontified t invisible t) | 5891 | '(font-lock-fontified t invisible t) |
| 5886 | '(font-lock-fontified t face org-document-info-keyword))) | 5892 | '(font-lock-fontified t face org-document-info-keyword))) |
| 5887 | (add-text-properties | 5893 | (add-text-properties |
| @@ -6145,15 +6151,25 @@ Use `org-reduced-level' to remove the effect of `org-odd-levels'." | |||
| 6145 | 6151 | ||
| 6146 | (defvar org-font-lock-keywords nil) | 6152 | (defvar org-font-lock-keywords nil) |
| 6147 | 6153 | ||
| 6148 | (defsubst org-re-property (property &optional literal) | 6154 | (defsubst org-re-property (property &optional literal allow-null) |
| 6149 | "Return a regexp matching a PROPERTY line. | 6155 | "Return a regexp matching a PROPERTY line. |
| 6150 | Match group 3 will be set to the value if it exists." | 6156 | |
| 6151 | (concat "^\\(?4:[ \t]*\\)\\(?1::\\(?2:" | 6157 | When optional argument LITERAL is non-nil, do not quote PROPERTY. |
| 6152 | (if literal property (regexp-quote property)) | 6158 | This is useful when PROPERTY is a regexp. When ALLOW-NULL is |
| 6153 | "\\):\\)[ \t]+\\(?3:[^ \t\r\n].*?\\)\\(?5:[ \t]*\\)$")) | 6159 | non-nil, match properties even without a value. |
| 6160 | |||
| 6161 | Match group 3 is set to the value when it exists. If there is no | ||
| 6162 | value and ALLOW-NULL is non-nil, it is set to the empty string." | ||
| 6163 | (concat | ||
| 6164 | "^\\(?4:[ \t]*\\)" | ||
| 6165 | (format "\\(?1::\\(?2:%s\\):\\)" | ||
| 6166 | (if literal property (regexp-quote property))) | ||
| 6167 | (if allow-null | ||
| 6168 | "\\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$" | ||
| 6169 | "[ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$"))) | ||
| 6154 | 6170 | ||
| 6155 | (defconst org-property-re | 6171 | (defconst org-property-re |
| 6156 | (org-re-property ".*?" 'literal) | 6172 | (org-re-property ".*?" 'literal t) |
| 6157 | "Regular expression matching a property line. | 6173 | "Regular expression matching a property line. |
| 6158 | There are four matching groups: | 6174 | There are four matching groups: |
| 6159 | 1: :PROPKEY: including the leading and trailing colon, | 6175 | 1: :PROPKEY: including the leading and trailing colon, |
| @@ -6712,7 +6728,8 @@ in special contexts. | |||
| 6712 | (setq org-cycle-global-status 'overview) | 6728 | (setq org-cycle-global-status 'overview) |
| 6713 | (run-hook-with-args 'org-cycle-hook 'overview))))) | 6729 | (run-hook-with-args 'org-cycle-hook 'overview))))) |
| 6714 | 6730 | ||
| 6715 | (defvar org-called-with-limited-levels);Dyn-bound in ̀org-with-limited-levels'. | 6731 | (defvar org-called-with-limited-levels nil |
| 6732 | "Non-nil when `org-with-limited-levels' is currently active.") | ||
| 6716 | 6733 | ||
| 6717 | (defun org-cycle-internal-local () | 6734 | (defun org-cycle-internal-local () |
| 6718 | "Do the local cycling action." | 6735 | "Do the local cycling action." |
| @@ -6729,7 +6746,8 @@ in special contexts. | |||
| 6729 | (setq has-children (org-list-has-child-p (point) struct))) | 6746 | (setq has-children (org-list-has-child-p (point) struct))) |
| 6730 | (org-back-to-heading) | 6747 | (org-back-to-heading) |
| 6731 | (setq eoh (save-excursion (outline-end-of-heading) (point))) | 6748 | (setq eoh (save-excursion (outline-end-of-heading) (point))) |
| 6732 | (setq eos (save-excursion (1- (org-end-of-subtree t t)))) | 6749 | (setq eos (save-excursion (org-end-of-subtree t t) |
| 6750 | (when (bolp) (backward-char)) (point))) | ||
| 6733 | (setq has-children | 6751 | (setq has-children |
| 6734 | (or (save-excursion | 6752 | (or (save-excursion |
| 6735 | (let ((level (funcall outline-level))) | 6753 | (let ((level (funcall outline-level))) |
| @@ -6894,21 +6912,20 @@ With a numeric prefix, show all headlines up to that level." | |||
| 6894 | ;; buffers, where outline-regexp is needed. | 6912 | ;; buffers, where outline-regexp is needed. |
| 6895 | (defun org-overview () | 6913 | (defun org-overview () |
| 6896 | "Switch to overview mode, showing only top-level headlines. | 6914 | "Switch to overview mode, showing only top-level headlines. |
| 6897 | Really, this shows all headlines with level equal or greater than the level | 6915 | This shows all headlines with a level equal or greater than the level |
| 6898 | of the first headline in the buffer. This is important, because if the | 6916 | of the first headline in the buffer. This is important, because if the |
| 6899 | first headline is not level one, then (hide-sublevels 1) gives confusing | 6917 | first headline is not level one, then (hide-sublevels 1) gives confusing |
| 6900 | results." | 6918 | results." |
| 6901 | (interactive) | 6919 | (interactive) |
| 6902 | (let ((pos (point)) | 6920 | (save-excursion |
| 6903 | (level (save-excursion | 6921 | (let ((level |
| 6904 | (goto-char (point-min)) | 6922 | (save-excursion |
| 6905 | (if (re-search-forward (concat "^" outline-regexp) nil t) | 6923 | (goto-char (point-min)) |
| 6906 | (progn | 6924 | (if (re-search-forward (concat "^" outline-regexp) nil t) |
| 6907 | (goto-char (match-beginning 0)) | 6925 | (progn |
| 6908 | (funcall outline-level)))))) | 6926 | (goto-char (match-beginning 0)) |
| 6909 | (and level (hide-sublevels level)) | 6927 | (funcall outline-level)))))) |
| 6910 | (recenter '(4)) | 6928 | (and level (hide-sublevels level))))) |
| 6911 | (goto-char pos))) | ||
| 6912 | 6929 | ||
| 6913 | (defun org-content (&optional arg) | 6930 | (defun org-content (&optional arg) |
| 6914 | "Show all headlines in the buffer, like a table of contents. | 6931 | "Show all headlines in the buffer, like a table of contents. |
| @@ -7105,13 +7122,11 @@ Otherwise make it visible." | |||
| 7105 | (pos-visible-in-window-p | 7122 | (pos-visible-in-window-p |
| 7106 | (save-excursion (org-end-of-subtree t) (point)))) | 7123 | (save-excursion (org-end-of-subtree t) (point)))) |
| 7107 | 7124 | ||
| 7108 | (defun org-first-headline-recenter (&optional N) | 7125 | (defun org-first-headline-recenter () |
| 7109 | "Move cursor to the first headline and recenter the headline. | 7126 | "Move cursor to the first headline and recenter the headline." |
| 7110 | Optional argument N means put the headline into the Nth line of the window." | ||
| 7111 | (goto-char (point-min)) | 7127 | (goto-char (point-min)) |
| 7112 | (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t) | 7128 | (when (re-search-forward (concat "^\\(" org-outline-regexp "\\)") nil t) |
| 7113 | (beginning-of-line) | 7129 | (set-window-start (selected-window) (point-at-bol)))) |
| 7114 | (recenter (prefix-numeric-value N)))) | ||
| 7115 | 7130 | ||
| 7116 | ;;; Saving and restoring visibility | 7131 | ;;; Saving and restoring visibility |
| 7117 | 7132 | ||
| @@ -7545,23 +7560,22 @@ When NEXT is non-nil, check the next line instead." | |||
| 7545 | (looking-at "[ \t]*$"))))) | 7560 | (looking-at "[ \t]*$"))))) |
| 7546 | 7561 | ||
| 7547 | (defun org-insert-heading (&optional arg invisible-ok) | 7562 | (defun org-insert-heading (&optional arg invisible-ok) |
| 7548 | "Insert a new heading or item with same depth at point. | 7563 | "Insert a new heading or an item with the same depth at point. |
| 7549 | 7564 | ||
| 7550 | If point is at the beginning of a heading or a list item, insert | 7565 | If point is at the beginning of a heading or a list item, insert |
| 7551 | a heading or a list item before it. | 7566 | a new heading or a new item above the current one. If point is |
| 7552 | 7567 | at the beginning of a normal line, turn the line into a heading. | |
| 7553 | If point is at the beginning of a normal line, turn this line | ||
| 7554 | into a heading. | ||
| 7555 | 7568 | ||
| 7556 | If point is in the middle of a headline or a list item, split the | 7569 | If point is in the middle of a headline or a list item, split the |
| 7557 | headline or the item and create a new headline/item with the text | 7570 | headline or the item and create a new headline/item with the text |
| 7558 | in the current line after point \(see `org-M-RET-may-split-line' | 7571 | in the current line after point \(see `org-M-RET-may-split-line' |
| 7559 | on how to modify this behavior). | 7572 | on how to modify this behavior). |
| 7560 | 7573 | ||
| 7561 | With one universal prefix argument: If point is within a list, | 7574 | With one universal prefirx argument, set the user option |
| 7562 | insert a heading instead of a list item. Otherwise, set the | 7575 | `org-insert-heading-respect-content' to t for the duration of |
| 7563 | value of `org-insert-heading-respect-content' to `t' for the | 7576 | the command. This modifies the behavior described above in this |
| 7564 | duration of the command. | 7577 | ways: on list items and at the beginning of normal lines, force |
| 7578 | the insertion of a heading after the current subtree. | ||
| 7565 | 7579 | ||
| 7566 | With two universal prefix arguments, insert the heading at the | 7580 | With two universal prefix arguments, insert the heading at the |
| 7567 | end of the grandparent subtree. For example, if point is within | 7581 | end of the grandparent subtree. For example, if point is within |
| @@ -7589,12 +7603,19 @@ command." | |||
| 7589 | (or arg (not itemp)))) | 7603 | (or arg (not itemp)))) |
| 7590 | ;; At beginning of buffer or so high up that only a heading | 7604 | ;; At beginning of buffer or so high up that only a heading |
| 7591 | ;; makes sense. | 7605 | ;; makes sense. |
| 7592 | (insert | 7606 | (cond ((and (bolp) (not respect-content)) (insert "* ")) |
| 7593 | (if (or (bobp) (org-previous-line-empty-p)) "" "\n") | 7607 | ((not respect-content) |
| 7594 | (if (org-in-src-block-p) ",* " "* ")) | 7608 | (unless may-split (end-of-line)) |
| 7609 | (insert "\n* ")) | ||
| 7610 | ((re-search-forward org-outline-regexp-bol nil t) | ||
| 7611 | (beginning-of-line) | ||
| 7612 | (insert "* \n") | ||
| 7613 | (backward-char)) | ||
| 7614 | (t (goto-char (point-max)) | ||
| 7615 | (insert "\n* "))) | ||
| 7595 | (run-hooks 'org-insert-heading-hook)) | 7616 | (run-hooks 'org-insert-heading-hook)) |
| 7596 | 7617 | ||
| 7597 | ((and itemp (not (equal arg '(4)))) | 7618 | ((and itemp (not (member arg '((4) (16))))) |
| 7598 | ;; Insert an item | 7619 | ;; Insert an item |
| 7599 | (org-insert-item)) | 7620 | (org-insert-item)) |
| 7600 | 7621 | ||
| @@ -7614,11 +7635,12 @@ command." | |||
| 7614 | nil)) | 7635 | nil)) |
| 7615 | ;; Get a level string to fall back on | 7636 | ;; Get a level string to fall back on |
| 7616 | (fix-level | 7637 | (fix-level |
| 7617 | (save-excursion | 7638 | (if (org-before-first-heading-p) "*" |
| 7618 | (org-back-to-heading t) | 7639 | (save-excursion |
| 7619 | (if (org-previous-line-empty-p) (setq empty-line-p t)) | 7640 | (org-back-to-heading t) |
| 7620 | (looking-at org-outline-regexp) | 7641 | (if (org-previous-line-empty-p) (setq empty-line-p t)) |
| 7621 | (make-string (1- (length (match-string 0))) ?*))) | 7642 | (looking-at org-outline-regexp) |
| 7643 | (make-string (1- (length (match-string 0))) ?*)))) | ||
| 7622 | (stars | 7644 | (stars |
| 7623 | (save-excursion | 7645 | (save-excursion |
| 7624 | (condition-case nil | 7646 | (condition-case nil |
| @@ -7650,8 +7672,12 @@ command." | |||
| 7650 | pos hide-previous previous-pos) | 7672 | pos hide-previous previous-pos) |
| 7651 | 7673 | ||
| 7652 | ;; If we insert after content, move there and clean up whitespace | 7674 | ;; If we insert after content, move there and clean up whitespace |
| 7653 | (when (and respect-content (not (org-on-heading-p))) | 7675 | (when (and respect-content |
| 7654 | (org-end-of-subtree nil t) | 7676 | (not (org-looking-at-p org-outline-regexp-bol))) |
| 7677 | (if (not (org-before-first-heading-p)) | ||
| 7678 | (org-end-of-subtree nil t) | ||
| 7679 | (re-search-forward org-outline-regexp-bol) | ||
| 7680 | (beginning-of-line 0)) | ||
| 7655 | (skip-chars-backward " \r\n") | 7681 | (skip-chars-backward " \r\n") |
| 7656 | (and (not (looking-back "^\*+")) | 7682 | (and (not (looking-back "^\*+")) |
| 7657 | (looking-at "[ \t]+") (replace-match "")) | 7683 | (looking-at "[ \t]+") (replace-match "")) |
| @@ -7680,10 +7706,9 @@ command." | |||
| 7680 | (setq initial-content (org-trim initial-content))) | 7706 | (setq initial-content (org-trim initial-content))) |
| 7681 | (goto-char pos)) | 7707 | (goto-char pos)) |
| 7682 | ;; a normal line | 7708 | ;; a normal line |
| 7683 | (unless (bolp) | 7709 | (setq initial-content |
| 7684 | (setq initial-content (buffer-substring (point) (point-at-eol))) | 7710 | (org-trim (buffer-substring (point) (point-at-eol)))) |
| 7685 | (delete-region (point) (point-at-eol)) | 7711 | (delete-region (point) (point-at-eol)))) |
| 7686 | (setq initial-content (org-trim initial-content))))) | ||
| 7687 | 7712 | ||
| 7688 | ;; If we are at the beginning of the line, insert before it. Else after | 7713 | ;; If we are at the beginning of the line, insert before it. Else after |
| 7689 | (cond | 7714 | (cond |
| @@ -7708,13 +7733,12 @@ command." | |||
| 7708 | "Make the number of empty lines before current exactly N. | 7733 | "Make the number of empty lines before current exactly N. |
| 7709 | So this will delete or add empty lines." | 7734 | So this will delete or add empty lines." |
| 7710 | (save-excursion | 7735 | (save-excursion |
| 7711 | (goto-char (point-at-bol)) | 7736 | (beginning-of-line) |
| 7712 | (if (looking-back "\\s-+" nil 'greedy) | 7737 | (let ((p (point))) |
| 7713 | (replace-match "")) | 7738 | (skip-chars-backward " \r\t\n") |
| 7714 | (or (bobp) (insert "\n")) | 7739 | (unless (bolp) (forward-line)) |
| 7715 | (while (> N 0) | 7740 | (delete-region (point) p)) |
| 7716 | (insert "\n") | 7741 | (when (> N 0) (insert (make-string N ?\n))))) |
| 7717 | (setq N (1- N))))) | ||
| 7718 | 7742 | ||
| 7719 | (defun org-get-heading (&optional no-tags no-todo) | 7743 | (defun org-get-heading (&optional no-tags no-todo) |
| 7720 | "Return the heading of the current entry, without the stars. | 7744 | "Return the heading of the current entry, without the stars. |
| @@ -7783,17 +7807,15 @@ This is a list with the following elements: | |||
| 7783 | (org-move-subtree-down) | 7807 | (org-move-subtree-down) |
| 7784 | (end-of-line 1)) | 7808 | (end-of-line 1)) |
| 7785 | 7809 | ||
| 7786 | (defun org-insert-heading-respect-content (&optional arg invisible-ok) | 7810 | (defun org-insert-heading-respect-content (&optional invisible-ok) |
| 7787 | "Insert heading with `org-insert-heading-respect-content' set to t." | 7811 | "Insert heading with `org-insert-heading-respect-content' set to t." |
| 7788 | (interactive "P") | 7812 | (interactive) |
| 7789 | (let ((org-insert-heading-respect-content t)) | 7813 | (org-insert-heading '(4) invisible-ok)) |
| 7790 | (org-insert-heading '(4) invisible-ok))) | ||
| 7791 | 7814 | ||
| 7792 | (defun org-insert-todo-heading-respect-content (&optional force-state) | 7815 | (defun org-insert-todo-heading-respect-content (&optional force-state) |
| 7793 | "Insert TODO heading with `org-insert-heading-respect-content' set to t." | 7816 | "Insert TODO heading with `org-insert-heading-respect-content' set to t." |
| 7794 | (interactive "P") | 7817 | (interactive) |
| 7795 | (let ((org-insert-heading-respect-content t)) | 7818 | (org-insert-todo-heading force-state '(4))) |
| 7796 | (org-insert-todo-heading force-state '(4)))) | ||
| 7797 | 7819 | ||
| 7798 | (defun org-insert-todo-heading (arg &optional force-heading) | 7820 | (defun org-insert-todo-heading (arg &optional force-heading) |
| 7799 | "Insert a new heading with the same level and TODO state as current heading. | 7821 | "Insert a new heading with the same level and TODO state as current heading. |
| @@ -8150,7 +8172,8 @@ case." | |||
| 8150 | (save-match-data | 8172 | (save-match-data |
| 8151 | (save-excursion (outline-end-of-heading) | 8173 | (save-excursion (outline-end-of-heading) |
| 8152 | (setq folded (outline-invisible-p))) | 8174 | (setq folded (outline-invisible-p))) |
| 8153 | (outline-end-of-subtree)) | 8175 | (progn (org-end-of-subtree nil t) |
| 8176 | (unless (eobp) (backward-char)))) | ||
| 8154 | (outline-next-heading) | 8177 | (outline-next-heading) |
| 8155 | (setq ne-end (org-back-over-empty-lines)) | 8178 | (setq ne-end (org-back-over-empty-lines)) |
| 8156 | (setq end (point)) | 8179 | (setq end (point)) |
| @@ -8303,7 +8326,7 @@ the inserted text when done." | |||
| 8303 | (string-match | 8326 | (string-match |
| 8304 | "^\\*+$" (buffer-substring | 8327 | "^\\*+$" (buffer-substring |
| 8305 | (point-at-bol) (point)))) | 8328 | (point-at-bol) (point)))) |
| 8306 | (- (match-end 1) (match-beginning 1))) | 8329 | (- (match-end 0) (match-beginning 0))) |
| 8307 | ((and (bolp) | 8330 | ((and (bolp) |
| 8308 | (looking-at org-outline-regexp)) | 8331 | (looking-at org-outline-regexp)) |
| 8309 | (- (match-end 0) (point) 1)))) | 8332 | (- (match-end 0) (point) 1)))) |
| @@ -10592,6 +10615,10 @@ application the system uses for this file type." | |||
| 10592 | (move-marker org-open-link-marker nil) | 10615 | (move-marker org-open-link-marker nil) |
| 10593 | (run-hook-with-args 'org-follow-link-hook))) | 10616 | (run-hook-with-args 'org-follow-link-hook))) |
| 10594 | 10617 | ||
| 10618 | (defsubst org-uniquify (list) | ||
| 10619 | "Non-destructively remove duplicate elements from LIST." | ||
| 10620 | (let ((res (copy-sequence list))) (delete-dups res))) | ||
| 10621 | |||
| 10595 | (defun org-offer-links-in-entry (buffer marker &optional nth zero) | 10622 | (defun org-offer-links-in-entry (buffer marker &optional nth zero) |
| 10596 | "Offer links in the current entry and return the selected link. | 10623 | "Offer links in the current entry and return the selected link. |
| 10597 | If there is only one link, return it. | 10624 | If there is only one link, return it. |
| @@ -13640,8 +13667,7 @@ How much context is shown depends upon the variables | |||
| 13640 | (error nil)) | 13667 | (error nil)) |
| 13641 | (not (bobp))) | 13668 | (not (bobp))) |
| 13642 | (org-flag-heading nil) | 13669 | (org-flag-heading nil) |
| 13643 | (when siblings-p (org-show-siblings))))) | 13670 | (when siblings-p (org-show-siblings))))))) |
| 13644 | (unless (eq key 'agenda) (org-fix-ellipsis-at-bol)))) | ||
| 13645 | 13671 | ||
| 13646 | (defvar org-reveal-start-hook nil | 13672 | (defvar org-reveal-start-hook nil |
| 13647 | "Hook run before revealing a location.") | 13673 | "Hook run before revealing a location.") |
| @@ -13836,7 +13862,7 @@ a file becomes an N^2 operation - but with this variable set, it scales | |||
| 13836 | as N.") | 13862 | as N.") |
| 13837 | 13863 | ||
| 13838 | (defun org-scan-tags (action matcher todo-only &optional start-level) | 13864 | (defun org-scan-tags (action matcher todo-only &optional start-level) |
| 13839 | "Sca headline tags with inheritance and produce output ACTION. | 13865 | "Scan headline tags with inheritance and produce output ACTION. |
| 13840 | 13866 | ||
| 13841 | ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, | 13867 | ACTION can be `sparse-tree' to produce a sparse tree in the current buffer, |
| 13842 | or `agenda' to produce an entry list for an agenda view. It can also be | 13868 | or `agenda' to produce an entry list for an agenda view. It can also be |
| @@ -14744,8 +14770,8 @@ Returns the new tags string, or nil to not change the current settings." | |||
| 14744 | (if expert | 14770 | (if expert |
| 14745 | (set-buffer (get-buffer-create " *Org tags*")) | 14771 | (set-buffer (get-buffer-create " *Org tags*")) |
| 14746 | (delete-other-windows) | 14772 | (delete-other-windows) |
| 14747 | (split-window-vertically) | 14773 | (set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*")) |
| 14748 | (org-switch-to-buffer-other-window (get-buffer-create " *Org tags*"))) | 14774 | (org-switch-to-buffer-other-window " *Org tags*")) |
| 14749 | (erase-buffer) | 14775 | (erase-buffer) |
| 14750 | (org-set-local 'org-done-keywords done-keywords) | 14776 | (org-set-local 'org-done-keywords done-keywords) |
| 14751 | (org-fast-tag-insert "Inherited" inherited i-face "\n") | 14777 | (org-fast-tag-insert "Inherited" inherited i-face "\n") |
| @@ -15269,7 +15295,10 @@ things up because then unnecessary parsing is avoided." | |||
| 15269 | '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" | 15295 | '("SCHEDULED" "DEADLINE" "CLOCK" "CLOSED" |
| 15270 | "TIMESTAMP" "TIMESTAMP_IA"))) | 15296 | "TIMESTAMP" "TIMESTAMP_IA"))) |
| 15271 | (catch 'match | 15297 | (catch 'match |
| 15272 | (while (re-search-forward org-maybe-keyword-time-regexp end t) | 15298 | (while (and (re-search-forward org-maybe-keyword-time-regexp end t) |
| 15299 | (not (text-property-any 0 (length (match-string 0)) | ||
| 15300 | 'face 'font-lock-comment-face | ||
| 15301 | (match-string 0)))) | ||
| 15273 | (setq key (if (match-end 1) | 15302 | (setq key (if (match-end 1) |
| 15274 | (substring (org-match-string-no-properties 1) | 15303 | (substring (org-match-string-no-properties 1) |
| 15275 | 0 -1)) | 15304 | 0 -1)) |
| @@ -15397,7 +15426,7 @@ an empty drawer to delete." | |||
| 15397 | (if (and range | 15426 | (if (and range |
| 15398 | (goto-char (car range)) | 15427 | (goto-char (car range)) |
| 15399 | (re-search-forward | 15428 | (re-search-forward |
| 15400 | (org-re-property property) | 15429 | (org-re-property property nil t) |
| 15401 | (cdr range) t)) | 15430 | (cdr range) t)) |
| 15402 | (progn | 15431 | (progn |
| 15403 | (delete-region (match-beginning 0) (1+ (point-at-eol))) | 15432 | (delete-region (match-beginning 0) (1+ (point-at-eol))) |
| @@ -15562,7 +15591,7 @@ If it is not a string, an error is raised." | |||
| 15562 | (setq range (org-get-property-block beg end 'force)) | 15591 | (setq range (org-get-property-block beg end 'force)) |
| 15563 | (goto-char (car range)) | 15592 | (goto-char (car range)) |
| 15564 | (if (re-search-forward | 15593 | (if (re-search-forward |
| 15565 | (org-re-property property) (cdr range) t) | 15594 | (org-re-property property nil t) (cdr range) t) |
| 15566 | (progn | 15595 | (progn |
| 15567 | (delete-region (match-beginning 0) (match-end 0)) | 15596 | (delete-region (match-beginning 0) (match-end 0)) |
| 15568 | (goto-char (match-beginning 0))) | 15597 | (goto-char (match-beginning 0))) |
| @@ -15773,9 +15802,7 @@ This is computed according to `org-property-set-functions-alist'." | |||
| 15773 | (funcall set-function prompt | 15802 | (funcall set-function prompt |
| 15774 | (mapcar 'list (org-property-values property)) | 15803 | (mapcar 'list (org-property-values property)) |
| 15775 | nil nil "" nil cur))))) | 15804 | nil nil "" nil cur))))) |
| 15776 | (if (equal val "") | 15805 | (org-trim val))) |
| 15777 | cur | ||
| 15778 | val))) | ||
| 15779 | 15806 | ||
| 15780 | (defvar org-last-set-property nil) | 15807 | (defvar org-last-set-property nil) |
| 15781 | (defvar org-last-set-property-value nil) | 15808 | (defvar org-last-set-property-value nil) |
| @@ -15853,8 +15880,10 @@ an empty drawer to delete." | |||
| 15853 | (org-icompleting-read "Property: " props nil t) | 15880 | (org-icompleting-read "Property: " props nil t) |
| 15854 | (caar props)))) | 15881 | (caar props)))) |
| 15855 | (list prop))) | 15882 | (list prop))) |
| 15856 | (if (org-entry-delete nil property delete-empty-drawer) | 15883 | (if (not property) |
| 15857 | (message "Property %s deleted" property))) | 15884 | (message "No property to delete in this entry") |
| 15885 | (org-entry-delete nil property delete-empty-drawer) | ||
| 15886 | (message "Property \"%s\" deleted" property))) | ||
| 15858 | 15887 | ||
| 15859 | (defun org-delete-property-globally (property) | 15888 | (defun org-delete-property-globally (property) |
| 15860 | "Remove PROPERTY globally, from all entries." | 15889 | "Remove PROPERTY globally, from all entries." |
| @@ -17743,9 +17772,9 @@ This requires Emacs >= 24.1, build with imagemagick support." | |||
| 17743 | 17772 | ||
| 17744 | (defcustom org-agenda-inhibit-startup nil | 17773 | (defcustom org-agenda-inhibit-startup nil |
| 17745 | "Inhibit startup when preparing agenda buffers. | 17774 | "Inhibit startup when preparing agenda buffers. |
| 17746 | When this variable is `t' (the default), the initialization of | 17775 | When this variable is `t', the initialization of the Org agenda |
| 17747 | the Org agenda buffers is inhibited: e.g. the visibility state | 17776 | buffers is inhibited: e.g. the visibility state is not set, the |
| 17748 | is not set, the tables are not re-aligned, etc." | 17777 | tables are not re-aligned, etc." |
| 17749 | :type 'boolean | 17778 | :type 'boolean |
| 17750 | :version "24.3" | 17779 | :version "24.3" |
| 17751 | :group 'org-agenda) | 17780 | :group 'org-agenda) |
| @@ -21819,9 +21848,7 @@ for the search purpose." | |||
| 21819 | "Return the reverse of STRING." | 21848 | "Return the reverse of STRING." |
| 21820 | (apply 'string (reverse (string-to-list string)))) | 21849 | (apply 'string (reverse (string-to-list string)))) |
| 21821 | 21850 | ||
| 21822 | (defsubst org-uniquify (list) | 21851 | ;; defsubst org-uniquify must be defined before first use |
| 21823 | "Non-destructively remove duplicate elements from LIST." | ||
| 21824 | (let ((res (copy-sequence list))) (delete-dups res))) | ||
| 21825 | 21852 | ||
| 21826 | (defun org-uniquify-alist (alist) | 21853 | (defun org-uniquify-alist (alist) |
| 21827 | "Merge elements of ALIST with the same key. | 21854 | "Merge elements of ALIST with the same key. |
| @@ -23273,14 +23300,6 @@ If there is no such heading, return nil." | |||
| 23273 | (forward-char -1)))))) | 23300 | (forward-char -1)))))) |
| 23274 | (point)) | 23301 | (point)) |
| 23275 | 23302 | ||
| 23276 | (defadvice outline-end-of-subtree (around prefer-org-version activate compile) | ||
| 23277 | "Use Org version in org-mode, for dramatic speed-up." | ||
| 23278 | (if (derived-mode-p 'org-mode) | ||
| 23279 | (progn | ||
| 23280 | (org-end-of-subtree nil t) | ||
| 23281 | (unless (eobp) (backward-char 1))) | ||
| 23282 | ad-do-it)) | ||
| 23283 | |||
| 23284 | (defun org-end-of-meta-data-and-drawers () | 23303 | (defun org-end-of-meta-data-and-drawers () |
| 23285 | "Jump to the first text after meta data and drawers in the current entry. | 23304 | "Jump to the first text after meta data and drawers in the current entry. |
| 23286 | This will move over empty lines, lines with planning time stamps, | 23305 | This will move over empty lines, lines with planning time stamps, |
| @@ -23777,8 +23796,7 @@ Show the heading too, if it is currently invisible." | |||
| 23777 | isearch-mode-end-hook-quit) | 23796 | isearch-mode-end-hook-quit) |
| 23778 | ;; Only when the isearch was not quitted. | 23797 | ;; Only when the isearch was not quitted. |
| 23779 | (org-add-hook 'post-command-hook 'org-isearch-post-command | 23798 | (org-add-hook 'post-command-hook 'org-isearch-post-command |
| 23780 | 'append 'local))) | 23799 | 'append 'local))))) |
| 23781 | (org-fix-ellipsis-at-bol))) | ||
| 23782 | 23800 | ||
| 23783 | (defun org-isearch-post-command () | 23801 | (defun org-isearch-post-command () |
| 23784 | "Remove self from hook, and show context." | 23802 | "Remove self from hook, and show context." |
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el index 6208cdbe065..cd2a9af10ac 100644 --- a/lisp/org/ox-ascii.el +++ b/lisp/org/ox-ascii.el | |||
| @@ -192,8 +192,10 @@ original Org buffer at the same place." | |||
| 192 | (defcustom org-ascii-indented-line-width 'auto | 192 | (defcustom org-ascii-indented-line-width 'auto |
| 193 | "Additional indentation width for the first line in a paragraph. | 193 | "Additional indentation width for the first line in a paragraph. |
| 194 | If the value is an integer, indent the first line of each | 194 | If the value is an integer, indent the first line of each |
| 195 | paragraph by this number. If it is the symbol `auto' preserve | 195 | paragraph by this width, unless it is located at the beginning of |
| 196 | indentation from original document." | 196 | a section, in which case indentation is removed from that line. |
| 197 | If it is the symbol `auto' preserve indentation from original | ||
| 198 | document." | ||
| 197 | :group 'org-export-ascii | 199 | :group 'org-export-ascii |
| 198 | :version "24.4" | 200 | :version "24.4" |
| 199 | :package-version '(Org . "8.0") | 201 | :package-version '(Org . "8.0") |
| @@ -421,17 +423,17 @@ equivalent to `left'. For a justification that doesn't also fill | |||
| 421 | string, see `org-ascii--justify-string'. | 423 | string, see `org-ascii--justify-string'. |
| 422 | 424 | ||
| 423 | Return nil if S isn't a string." | 425 | Return nil if S isn't a string." |
| 424 | ;; Don't fill paragraph when break should be preserved. | 426 | (when (stringp s) |
| 425 | (cond ((not (stringp s)) nil) | 427 | (let ((double-space-p sentence-end-double-space)) |
| 426 | ((plist-get info :preserve-breaks) s) | 428 | (with-temp-buffer |
| 427 | (t (let ((double-space-p sentence-end-double-space)) | 429 | (let ((fill-column text-width) |
| 428 | (with-temp-buffer | 430 | (use-hard-newlines t) |
| 429 | (let ((fill-column text-width) | 431 | (sentence-end-double-space double-space-p)) |
| 430 | (use-hard-newlines t) | 432 | (insert (if (plist-get info :preserve-breaks) |
| 431 | (sentence-end-double-space double-space-p)) | 433 | (replace-regexp-in-string "\n" hard-newline s) |
| 432 | (insert s) | 434 | s)) |
| 433 | (fill-region (point-min) (point-max) justify)) | 435 | (fill-region (point-min) (point-max) justify)) |
| 434 | (buffer-string)))))) | 436 | (buffer-string))))) |
| 435 | 437 | ||
| 436 | (defun org-ascii--justify-string (s text-width how) | 438 | (defun org-ascii--justify-string (s text-width how) |
| 437 | "Justify string S. | 439 | "Justify string S. |
| @@ -455,13 +457,13 @@ HOW determines the type of justification: it can be `left', | |||
| 455 | Empty lines are not indented." | 457 | Empty lines are not indented." |
| 456 | (when (stringp s) | 458 | (when (stringp s) |
| 457 | (replace-regexp-in-string | 459 | (replace-regexp-in-string |
| 458 | "\\(^\\)\\(?:.*\\S-\\)" (make-string width ? ) s nil nil 1))) | 460 | "\\(^\\)[ \t]*\\S-" (make-string width ?\s) s nil nil 1))) |
| 459 | 461 | ||
| 460 | (defun org-ascii--box-string (s info) | 462 | (defun org-ascii--box-string (s info) |
| 461 | "Return string S with a partial box to its left. | 463 | "Return string S with a partial box to its left. |
| 462 | INFO is a plist used as a communication channel." | 464 | INFO is a plist used as a communication channel." |
| 463 | (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) | 465 | (let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) |
| 464 | (format (if utf8p "â•────\n%s\n╰────" ",----\n%s\n`----") | 466 | (format (if utf8p "┌────\n%s\n└────" ",----\n%s\n`----") |
| 465 | (replace-regexp-in-string | 467 | (replace-regexp-in-string |
| 466 | "^" (if utf8p "│ " "| ") | 468 | "^" (if utf8p "│ " "| ") |
| 467 | ;; Remove last newline character. | 469 | ;; Remove last newline character. |
| @@ -473,7 +475,7 @@ INFO is a plist used as a communication channel." | |||
| 473 | (case (org-element-type element) | 475 | (case (org-element-type element) |
| 474 | ;; Elements with an absolute width: `headline' and `inlinetask'. | 476 | ;; Elements with an absolute width: `headline' and `inlinetask'. |
| 475 | (inlinetask org-ascii-inlinetask-width) | 477 | (inlinetask org-ascii-inlinetask-width) |
| 476 | ('headline | 478 | (headline |
| 477 | (- org-ascii-text-width | 479 | (- org-ascii-text-width |
| 478 | (let ((low-level-rank (org-export-low-level-p element info))) | 480 | (let ((low-level-rank (org-export-low-level-p element info))) |
| 479 | (if low-level-rank (* low-level-rank 2) org-ascii-global-margin)))) | 481 | (if low-level-rank (* low-level-rank 2) org-ascii-global-margin)))) |
| @@ -1418,12 +1420,16 @@ INFO is a plist holding contextual information." | |||
| 1418 | "Transcode a PARAGRAPH element from Org to ASCII. | 1420 | "Transcode a PARAGRAPH element from Org to ASCII. |
| 1419 | CONTENTS is the contents of the paragraph, as a string. INFO is | 1421 | CONTENTS is the contents of the paragraph, as a string. INFO is |
| 1420 | the plist used as a communication channel." | 1422 | the plist used as a communication channel." |
| 1421 | (let ((contents (if (not (wholenump org-ascii-indented-line-width)) contents | 1423 | (org-ascii--fill-string |
| 1422 | (concat | 1424 | (if (not (wholenump org-ascii-indented-line-width)) contents |
| 1423 | (make-string org-ascii-indented-line-width ? ) | 1425 | (concat |
| 1424 | (replace-regexp-in-string "\\`[ \t]+" "" contents))))) | 1426 | ;; Do not indent first paragraph in a section. |
| 1425 | (org-ascii--fill-string | 1427 | (unless (and (not (org-export-get-previous-element paragraph info)) |
| 1426 | contents (org-ascii--current-text-width paragraph info) info))) | 1428 | (eq (org-element-type (org-export-get-parent paragraph)) |
| 1429 | 'section)) | ||
| 1430 | (make-string org-ascii-indented-line-width ?\s)) | ||
| 1431 | (replace-regexp-in-string "\\`[ \t]+" "" contents))) | ||
| 1432 | (org-ascii--current-text-width paragraph info) info)) | ||
| 1427 | 1433 | ||
| 1428 | 1434 | ||
| 1429 | ;;;; Plain List | 1435 | ;;;; Plain List |
| @@ -1591,8 +1597,8 @@ contextual information." | |||
| 1591 | CONTENTS is the contents of the object. INFO is a plist holding | 1597 | CONTENTS is the contents of the object. INFO is a plist holding |
| 1592 | contextual information." | 1598 | contextual information." |
| 1593 | (if (org-element-property :use-brackets-p superscript) | 1599 | (if (org-element-property :use-brackets-p superscript) |
| 1594 | (format "_{%s}" contents) | 1600 | (format "^{%s}" contents) |
| 1595 | (format "_%s" contents))) | 1601 | (format "^%s" contents))) |
| 1596 | 1602 | ||
| 1597 | 1603 | ||
| 1598 | ;;;; Strike-through | 1604 | ;;;; Strike-through |
| @@ -1659,20 +1665,25 @@ are ignored." | |||
| 1659 | (or (gethash key cache) | 1665 | (or (gethash key cache) |
| 1660 | (puthash | 1666 | (puthash |
| 1661 | key | 1667 | key |
| 1662 | (or (and (not org-ascii-table-widen-columns) | 1668 | (let ((cookie-width (org-export-table-cell-width table-cell info))) |
| 1663 | (org-export-table-cell-width table-cell info)) | 1669 | (or (and (not org-ascii-table-widen-columns) cookie-width) |
| 1664 | (let* ((max-width 0)) | 1670 | (let ((contents-width |
| 1665 | (org-element-map table 'table-row | 1671 | (let ((max-width 0)) |
| 1666 | (lambda (row) | 1672 | (org-element-map table 'table-row |
| 1667 | (setq max-width | 1673 | (lambda (row) |
| 1668 | (max (string-width | 1674 | (setq max-width |
| 1669 | (org-export-data | 1675 | (max (string-width |
| 1670 | (org-element-contents | 1676 | (org-export-data |
| 1671 | (elt (org-element-contents row) col)) | 1677 | (org-element-contents |
| 1672 | info)) | 1678 | (elt (org-element-contents row) col)) |
| 1673 | max-width))) | 1679 | info)) |
| 1674 | info) | 1680 | max-width))) |
| 1675 | max-width)) | 1681 | info) |
| 1682 | max-width))) | ||
| 1683 | (cond ((not cookie-width) contents-width) | ||
| 1684 | (org-ascii-table-widen-columns | ||
| 1685 | (max cookie-width contents-width)) | ||
| 1686 | (t cookie-width))))) | ||
| 1676 | cache)))) | 1687 | cache)))) |
| 1677 | 1688 | ||
| 1678 | (defun org-ascii-table-cell (table-cell contents info) | 1689 | (defun org-ascii-table-cell (table-cell contents info) |
diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el index f3a79d7c860..5ab805db271 100644 --- a/lisp/org/ox-beamer.el +++ b/lisp/org/ox-beamer.el | |||
| @@ -687,7 +687,7 @@ used as a communication channel." | |||
| 687 | (cond | 687 | (cond |
| 688 | ((equal type "radio") | 688 | ((equal type "radio") |
| 689 | (let ((destination (org-export-resolve-radio-link link info))) | 689 | (let ((destination (org-export-resolve-radio-link link info))) |
| 690 | (when destination | 690 | (if (not destination) contents |
| 691 | (format "\\hyperlink%s{%s}{%s}" | 691 | (format "\\hyperlink%s{%s}{%s}" |
| 692 | (or (org-beamer--element-has-overlay-p link) "") | 692 | (or (org-beamer--element-has-overlay-p link) "") |
| 693 | (org-export-solidify-link-text | 693 | (org-export-solidify-link-text |
| @@ -1092,6 +1092,7 @@ aid, but the tag does not have any semantic meaning." | |||
| 1092 | envs) | 1092 | envs) |
| 1093 | '((:endgroup)) | 1093 | '((:endgroup)) |
| 1094 | '(("BMCOL" . ?|)))) | 1094 | '(("BMCOL" . ?|)))) |
| 1095 | (org-tag-persistent-alist nil) | ||
| 1095 | (org-use-fast-tag-selection t) | 1096 | (org-use-fast-tag-selection t) |
| 1096 | (org-fast-tag-selection-single-key t)) | 1097 | (org-fast-tag-selection-single-key t)) |
| 1097 | (org-set-tags) | 1098 | (org-set-tags) |
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el index 88e572084c8..23498b26924 100644 --- a/lisp/org/ox-html.el +++ b/lisp/org/ox-html.el | |||
| @@ -2275,83 +2275,70 @@ holding contextual information." | |||
| 2275 | "Transcode a HEADLINE element from Org to HTML. | 2275 | "Transcode a HEADLINE element from Org to HTML. |
| 2276 | CONTENTS holds the contents of the headline. INFO is a plist | 2276 | CONTENTS holds the contents of the headline. INFO is a plist |
| 2277 | holding contextual information." | 2277 | holding contextual information." |
| 2278 | ;; Empty contents? | 2278 | (unless (org-element-property :footnote-section-p headline) |
| 2279 | (setq contents (or contents "")) | 2279 | (let* ((contents (or contents "")) |
| 2280 | (let* ((numberedp (org-export-numbered-headline-p headline info)) | 2280 | (numberedp (org-export-numbered-headline-p headline info)) |
| 2281 | (level (org-export-get-relative-level headline info)) | 2281 | (level (org-export-get-relative-level headline info)) |
| 2282 | (text (org-export-data (org-element-property :title headline) info)) | 2282 | (text (org-export-data (org-element-property :title headline) info)) |
| 2283 | (todo (and (plist-get info :with-todo-keywords) | 2283 | (todo (and (plist-get info :with-todo-keywords) |
| 2284 | (let ((todo (org-element-property :todo-keyword headline))) | 2284 | (let ((todo (org-element-property :todo-keyword headline))) |
| 2285 | (and todo (org-export-data todo info))))) | 2285 | (and todo (org-export-data todo info))))) |
| 2286 | (todo-type (and todo (org-element-property :todo-type headline))) | 2286 | (todo-type (and todo (org-element-property :todo-type headline))) |
| 2287 | (tags (and (plist-get info :with-tags) | 2287 | (tags (and (plist-get info :with-tags) |
| 2288 | (org-export-get-tags headline info))) | 2288 | (org-export-get-tags headline info))) |
| 2289 | (priority (and (plist-get info :with-priority) | 2289 | (priority (and (plist-get info :with-priority) |
| 2290 | (org-element-property :priority headline))) | 2290 | (org-element-property :priority headline))) |
| 2291 | (section-number (and (org-export-numbered-headline-p headline info) | 2291 | (section-number (mapconcat #'number-to-string |
| 2292 | (mapconcat 'number-to-string | 2292 | (org-export-get-headline-number |
| 2293 | (org-export-get-headline-number | 2293 | headline info) "-")) |
| 2294 | headline info) "."))) | 2294 | (ids (delq 'nil |
| 2295 | ;; Create the headline text. | 2295 | (list (org-element-property :CUSTOM_ID headline) |
| 2296 | (full-text (org-html-format-headline--wrap headline info))) | 2296 | (concat "sec-" section-number) |
| 2297 | (cond | 2297 | (org-element-property :ID headline)))) |
| 2298 | ;; Case 1: This is a footnote section: ignore it. | 2298 | (preferred-id (car ids)) |
| 2299 | ((org-element-property :footnote-section-p headline) nil) | 2299 | (extra-ids (mapconcat |
| 2300 | ;; Case 2. This is a deep sub-tree: export it as a list item. | 2300 | (lambda (id) |
| 2301 | ;; Also export as items headlines for which no section | 2301 | (org-html--anchor |
| 2302 | ;; format has been found. | 2302 | (org-export-solidify-link-text |
| 2303 | ((org-export-low-level-p headline info) | 2303 | (if (org-uuidgen-p id) (concat "ID-" id) id)))) |
| 2304 | ;; Build the real contents of the sub-tree. | 2304 | (cdr ids) "")) |
| 2305 | (let* ((type (if numberedp 'ordered 'unordered)) | 2305 | ;; Create the headline text. |
| 2306 | (itemized-body (org-html-format-list-item | 2306 | (full-text (org-html-format-headline--wrap headline info))) |
| 2307 | contents type nil info nil full-text))) | 2307 | (if (org-export-low-level-p headline info) |
| 2308 | (concat | 2308 | ;; This is a deep sub-tree: export it as a list item. |
| 2309 | (and (org-export-first-sibling-p headline info) | 2309 | (let* ((type (if numberedp 'ordered 'unordered)) |
| 2310 | (org-html-begin-plain-list type)) | 2310 | (itemized-body |
| 2311 | itemized-body | 2311 | (org-html-format-list-item |
| 2312 | (and (org-export-last-sibling-p headline info) | 2312 | contents type nil info nil |
| 2313 | (org-html-end-plain-list type))))) | 2313 | (concat (org-html--anchor preferred-id) extra-ids |
| 2314 | ;; Case 3. Standard headline. Export it as a section. | 2314 | full-text)))) |
| 2315 | (t | 2315 | (concat |
| 2316 | (let* ((section-number (mapconcat 'number-to-string | 2316 | (and (org-export-first-sibling-p headline info) |
| 2317 | (org-export-get-headline-number | 2317 | (org-html-begin-plain-list type)) |
| 2318 | headline info) "-")) | 2318 | itemized-body |
| 2319 | (ids (remove 'nil | 2319 | (and (org-export-last-sibling-p headline info) |
| 2320 | (list (org-element-property :CUSTOM_ID headline) | 2320 | (org-html-end-plain-list type)))) |
| 2321 | (concat "sec-" section-number) | 2321 | ;; Standard headline. Export it as a section. |
| 2322 | (org-element-property :ID headline)))) | 2322 | (let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline)) |
| 2323 | (preferred-id (car ids)) | 2323 | (level1 (+ level (1- org-html-toplevel-hlevel))) |
| 2324 | (extra-ids (cdr ids)) | 2324 | (first-content (car (org-element-contents headline)))) |
| 2325 | (extra-class (org-element-property :HTML_CONTAINER_CLASS headline)) | 2325 | (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n" |
| 2326 | (level1 (+ level (1- org-html-toplevel-hlevel))) | 2326 | (org-html--container headline info) |
| 2327 | (first-content (car (org-element-contents headline)))) | 2327 | (format "outline-container-%s" |
| 2328 | (format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n" | 2328 | (or (org-element-property :CUSTOM_ID headline) |
| 2329 | (org-html--container headline info) | 2329 | (concat "sec-" section-number))) |
| 2330 | (format "outline-container-%s" | 2330 | (concat (format "outline-%d" level1) (and extra-class " ") |
| 2331 | (or (org-element-property :CUSTOM_ID headline) | 2331 | extra-class) |
| 2332 | (concat "sec-" section-number))) | 2332 | (format "\n<h%d id=\"%s\">%s%s</h%d>\n" |
| 2333 | (concat (format "outline-%d" level1) (and extra-class " ") | 2333 | level1 preferred-id extra-ids full-text level1) |
| 2334 | extra-class) | 2334 | ;; When there is no section, pretend there is an |
| 2335 | (format "\n<h%d id=\"%s\">%s%s</h%d>\n" | 2335 | ;; empty one to get the correct <div class="outline- |
| 2336 | level1 | 2336 | ;; ...> which is needed by `org-info.js'. |
| 2337 | preferred-id | 2337 | (if (not (eq (org-element-type first-content) 'section)) |
| 2338 | (mapconcat | 2338 | (concat (org-html-section first-content "" info) |
| 2339 | (lambda (x) | 2339 | contents) |
| 2340 | (let ((id (org-export-solidify-link-text | 2340 | contents) |
| 2341 | (if (org-uuidgen-p x) (concat "ID-" x) | 2341 | (org-html--container headline info))))))) |
| 2342 | x)))) | ||
| 2343 | (org-html--anchor id))) | ||
| 2344 | extra-ids "") | ||
| 2345 | full-text | ||
| 2346 | level1) | ||
| 2347 | ;; When there is no section, pretend there is an empty | ||
| 2348 | ;; one to get the correct <div class="outline- ...> | ||
| 2349 | ;; which is needed by `org-info.js'. | ||
| 2350 | (if (not (eq (org-element-type first-content) 'section)) | ||
| 2351 | (concat (org-html-section first-content "" info) | ||
| 2352 | contents) | ||
| 2353 | contents) | ||
| 2354 | (org-html--container headline info))))))) | ||
| 2355 | 2342 | ||
| 2356 | (defun org-html--container (headline info) | 2343 | (defun org-html--container (headline info) |
| 2357 | (or (org-element-property :HTML_CONTAINER headline) | 2344 | (or (org-element-property :HTML_CONTAINER headline) |
| @@ -2596,18 +2583,17 @@ if its description is a single link targeting an image file." | |||
| 2596 | 2583 | ||
| 2597 | (defvar org-html-standalone-image-predicate) | 2584 | (defvar org-html-standalone-image-predicate) |
| 2598 | (defun org-html-standalone-image-p (element info) | 2585 | (defun org-html-standalone-image-p (element info) |
| 2599 | "Test if ELEMENT is a standalone image. | 2586 | "Non-nil if ELEMENT is a standalone image. |
| 2600 | 2587 | ||
| 2601 | INFO is a plist holding contextual information. | 2588 | INFO is a plist holding contextual information. |
| 2602 | 2589 | ||
| 2603 | Return non-nil, if ELEMENT is of type paragraph and its sole | 2590 | An element or object is a standalone image when |
| 2604 | content, save for white spaces, is a link that qualifies as an | ||
| 2605 | inline image. | ||
| 2606 | 2591 | ||
| 2607 | Return non-nil, if ELEMENT is of type link and its containing | 2592 | - its type is `paragraph' and its sole content, save for white |
| 2608 | paragraph has no other content save white spaces. | 2593 | spaces, is a link that qualifies as an inline image; |
| 2609 | 2594 | ||
| 2610 | Return nil, otherwise. | 2595 | - its type is `link' and its containing paragraph has no other |
| 2596 | content save white spaces. | ||
| 2611 | 2597 | ||
| 2612 | Bind `org-html-standalone-image-predicate' to constrain paragraph | 2598 | Bind `org-html-standalone-image-predicate' to constrain paragraph |
| 2613 | further. For example, to check for only captioned standalone | 2599 | further. For example, to check for only captioned standalone |
| @@ -2618,19 +2604,21 @@ images, set it to: | |||
| 2618 | (paragraph element) | 2604 | (paragraph element) |
| 2619 | (link (org-export-get-parent element))))) | 2605 | (link (org-export-get-parent element))))) |
| 2620 | (and (eq (org-element-type paragraph) 'paragraph) | 2606 | (and (eq (org-element-type paragraph) 'paragraph) |
| 2621 | (or (not (and (boundp 'org-html-standalone-image-predicate) | 2607 | (or (not (fboundp 'org-html-standalone-image-predicate)) |
| 2622 | (functionp org-html-standalone-image-predicate))) | ||
| 2623 | (funcall org-html-standalone-image-predicate paragraph)) | 2608 | (funcall org-html-standalone-image-predicate paragraph)) |
| 2624 | (not (let ((link-count 0)) | 2609 | (catch 'exit |
| 2625 | (org-element-map (org-element-contents paragraph) | 2610 | (let ((link-count 0)) |
| 2626 | (cons 'plain-text org-element-all-objects) | 2611 | (org-element-map (org-element-contents paragraph) |
| 2627 | (lambda (obj) (case (org-element-type obj) | 2612 | (cons 'plain-text org-element-all-objects) |
| 2628 | (plain-text (org-string-nw-p obj)) | 2613 | #'(lambda (obj) |
| 2629 | (link | 2614 | (when (case (org-element-type obj) |
| 2630 | (or (> (incf link-count) 1) | 2615 | (plain-text (org-string-nw-p obj)) |
| 2631 | (not (org-html-inline-image-p obj info)))) | 2616 | (link (or (> (incf link-count) 1) |
| 2632 | (otherwise t))) | 2617 | (not (org-html-inline-image-p obj info)))) |
| 2633 | info 'first-match 'link)))))) | 2618 | (otherwise t)) |
| 2619 | (throw 'exit nil))) | ||
| 2620 | info nil 'link) | ||
| 2621 | (= link-count 1)))))) | ||
| 2634 | 2622 | ||
| 2635 | (defun org-html-link (link desc info) | 2623 | (defun org-html-link (link desc info) |
| 2636 | "Transcode a LINK object from Org to HTML. | 2624 | "Transcode a LINK object from Org to HTML. |
| @@ -2719,7 +2707,7 @@ INFO is a plist holding contextual information. See | |||
| 2719 | ;; link's description. | 2707 | ;; link's description. |
| 2720 | ((string= type "radio") | 2708 | ((string= type "radio") |
| 2721 | (let ((destination (org-export-resolve-radio-link link info))) | 2709 | (let ((destination (org-export-resolve-radio-link link info))) |
| 2722 | (when destination | 2710 | (if (not destination) desc |
| 2723 | (format "<a href=\"#%s\"%s>%s</a>" | 2711 | (format "<a href=\"#%s\"%s>%s</a>" |
| 2724 | (org-export-solidify-link-text | 2712 | (org-export-solidify-link-text |
| 2725 | (org-element-property :value destination)) | 2713 | (org-element-property :value destination)) |
diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el index a60c2f92f39..cd48bbf9aef 100644 --- a/lisp/org/ox-icalendar.el +++ b/lisp/org/ox-icalendar.el | |||
| @@ -174,8 +174,7 @@ The anniversaries are defined in the BBDB database." | |||
| 174 | 174 | ||
| 175 | (defcustom org-icalendar-include-sexps t | 175 | (defcustom org-icalendar-include-sexps t |
| 176 | "Non-nil means export to iCalendar files should also cover sexp entries. | 176 | "Non-nil means export to iCalendar files should also cover sexp entries. |
| 177 | These are entries like in the diary, but directly in an Org mode | 177 | These are entries like in the diary, but directly in an Org file." |
| 178 | file." | ||
| 179 | :group 'org-export-icalendar | 178 | :group 'org-export-icalendar |
| 180 | :type 'boolean) | 179 | :type 'boolean) |
| 181 | 180 | ||
| @@ -302,14 +301,14 @@ which will be updated." | |||
| 302 | 301 | ||
| 303 | INFO is a plist used as a communication channel. | 302 | INFO is a plist used as a communication channel. |
| 304 | 303 | ||
| 305 | a headline is blocked when either: | 304 | A headline is blocked when either |
| 306 | 305 | ||
| 307 | - It has children which are not all in a completed state. | 306 | - it has children which are not all in a completed state; |
| 308 | 307 | ||
| 309 | - It has a parent with the property :ORDERED:, and there are | 308 | - it has a parent with the property :ORDERED:, and there are |
| 310 | siblings prior to it with incomplete status. | 309 | siblings prior to it with incomplete status; |
| 311 | 310 | ||
| 312 | - Its parent is blocked because it has siblings that should be | 311 | - its parent is blocked because it has siblings that should be |
| 313 | done first or is a child of a blocked grandparent entry." | 312 | done first or is a child of a blocked grandparent entry." |
| 314 | (or | 313 | (or |
| 315 | ;; Check if any child is not done. | 314 | ;; Check if any child is not done. |
| @@ -478,10 +477,10 @@ or subject for the event." | |||
| 478 | ;;; Filters | 477 | ;;; Filters |
| 479 | 478 | ||
| 480 | (defun org-icalendar-clear-blank-lines (headline back-end info) | 479 | (defun org-icalendar-clear-blank-lines (headline back-end info) |
| 481 | "Remove trailing blank lines in HEADLINE export. | 480 | "Remove blank lines in HEADLINE export. |
| 482 | HEADLINE is a string representing a transcoded headline. | 481 | HEADLINE is a string representing a transcoded headline. |
| 483 | BACK-END and INFO are ignored." | 482 | BACK-END and INFO are ignored." |
| 484 | (replace-regexp-in-string "^\\(?:[ \t]*\n\\)*" "" headline)) | 483 | (replace-regexp-in-string "^\\(?:[ \t]*\n\\)+" "" headline)) |
| 485 | 484 | ||
| 486 | 485 | ||
| 487 | 486 | ||
| @@ -570,13 +569,19 @@ inlinetask within the section." | |||
| 570 | ;; happen once ENTRY is one of them. | 569 | ;; happen once ENTRY is one of them. |
| 571 | (let ((counter 0)) | 570 | (let ((counter 0)) |
| 572 | (mapconcat | 571 | (mapconcat |
| 573 | 'identity | 572 | #'identity |
| 574 | (org-element-map (cons (org-element-property :title entry) | 573 | (org-element-map (cons (org-element-property :title entry) |
| 575 | (org-element-contents inside)) | 574 | (org-element-contents inside)) |
| 576 | 'timestamp | 575 | 'timestamp |
| 577 | (lambda (ts) | 576 | (lambda (ts) |
| 578 | (let ((uid (format "TS%d-%s" (incf counter) uid))) | 577 | (when (let ((type (org-element-property :type ts))) |
| 579 | (org-icalendar--vevent entry ts uid summary loc desc cat))) | 578 | (case (plist-get info :with-timestamps) |
| 579 | (active (memq type '(active active-range))) | ||
| 580 | (inactive (memq type '(inactive inactive-range))) | ||
| 581 | ((t) t))) | ||
| 582 | (let ((uid (format "TS%d-%s" (incf counter) uid))) | ||
| 583 | (org-icalendar--vevent | ||
| 584 | entry ts uid summary loc desc cat)))) | ||
| 580 | info nil (and (eq type 'headline) 'inlinetask)) | 585 | info nil (and (eq type 'headline) 'inlinetask)) |
| 581 | "")) | 586 | "")) |
| 582 | ;; Task: First check if it is appropriate to export it. | 587 | ;; Task: First check if it is appropriate to export it. |
| @@ -589,7 +594,7 @@ inlinetask within the section." | |||
| 589 | (and (eq type 'headline) | 594 | (and (eq type 'headline) |
| 590 | (not (org-icalendar-blocked-headline-p | 595 | (not (org-icalendar-blocked-headline-p |
| 591 | entry info)))) | 596 | entry info)))) |
| 592 | ('t (eq todo-type 'todo)))) | 597 | ((t) (eq todo-type 'todo)))) |
| 593 | (org-icalendar--vtodo entry uid summary loc desc cat)) | 598 | (org-icalendar--vtodo entry uid summary loc desc cat)) |
| 594 | ;; Diary-sexp: Collect every diary-sexp element within | 599 | ;; Diary-sexp: Collect every diary-sexp element within |
| 595 | ;; ENTRY and its title, and transcode them. If ENTRY is | 600 | ;; ENTRY and its title, and transcode them. If ENTRY is |
| @@ -597,7 +602,7 @@ inlinetask within the section." | |||
| 597 | ;; separately. | 602 | ;; separately. |
| 598 | (when org-icalendar-include-sexps | 603 | (when org-icalendar-include-sexps |
| 599 | (let ((counter 0)) | 604 | (let ((counter 0)) |
| 600 | (mapconcat 'identity | 605 | (mapconcat #'identity |
| 601 | (org-element-map | 606 | (org-element-map |
| 602 | (cons (org-element-property :title entry) | 607 | (cons (org-element-property :title entry) |
| 603 | (org-element-contents inside)) | 608 | (org-element-contents inside)) |
| @@ -613,7 +618,7 @@ inlinetask within the section." | |||
| 613 | ;; inlinetask within it. In agenda export, this is independent | 618 | ;; inlinetask within it. In agenda export, this is independent |
| 614 | ;; from the mark (or lack thereof) on the entry. | 619 | ;; from the mark (or lack thereof) on the entry. |
| 615 | (when (eq type 'headline) | 620 | (when (eq type 'headline) |
| 616 | (mapconcat 'identity | 621 | (mapconcat #'identity |
| 617 | (org-element-map inside 'inlinetask | 622 | (org-element-map inside 'inlinetask |
| 618 | (lambda (task) (org-icalendar-entry task nil info)) | 623 | (lambda (task) (org-icalendar-entry task nil info)) |
| 619 | info) "")) | 624 | info) "")) |
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el index 53cc54f00f7..2c71f7d785a 100644 --- a/lisp/org/ox-latex.el +++ b/lisp/org/ox-latex.el | |||
| @@ -524,7 +524,7 @@ When nil, no transformation is made." | |||
| 524 | :package-version '(Org . "8.0") | 524 | :package-version '(Org . "8.0") |
| 525 | :type '(choice | 525 | :type '(choice |
| 526 | (string :tag "Format string") | 526 | (string :tag "Format string") |
| 527 | (const :tag "No formatting"))) | 527 | (const :tag "No formatting" nil))) |
| 528 | 528 | ||
| 529 | 529 | ||
| 530 | ;;;; Text markup | 530 | ;;;; Text markup |
| @@ -689,9 +689,9 @@ These options are supplied as a comma-separated list to the | |||
| 689 | a list containing two strings: the name of the option, and the | 689 | a list containing two strings: the name of the option, and the |
| 690 | value. For example, | 690 | value. For example, |
| 691 | 691 | ||
| 692 | (setq org-latex-listings-options | 692 | \(setq org-latex-listings-options |
| 693 | '((\"basicstyle\" \"\\\\small\") | 693 | '((\"basicstyle\" \"\\\\small\") |
| 694 | (\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\"))) | 694 | \(\"keywordstyle\" \"\\\\color{black}\\\\bfseries\\\\underbar\"))) |
| 695 | 695 | ||
| 696 | will typeset the code in a small size font with underlined, bold | 696 | will typeset the code in a small size font with underlined, bold |
| 697 | black keywords. | 697 | black keywords. |
| @@ -1526,17 +1526,16 @@ holding contextual information." | |||
| 1526 | (when priority (format "\\framebox{\\#%c} " priority)) | 1526 | (when priority (format "\\framebox{\\#%c} " priority)) |
| 1527 | title | 1527 | title |
| 1528 | (when tags (format "\\hfill{}\\textsc{:%s:}" | 1528 | (when tags (format "\\hfill{}\\textsc{:%s:}" |
| 1529 | (mapconcat 'identity tags ":")))))) | 1529 | (mapconcat #'identity tags ":")))))) |
| 1530 | (format (concat "\\begin{center}\n" | 1530 | (concat "\\begin{center}\n" |
| 1531 | "\\fbox{\n" | 1531 | "\\fbox{\n" |
| 1532 | "\\begin{minipage}[c]{.6\\textwidth}\n" | 1532 | "\\begin{minipage}[c]{.6\\textwidth}\n" |
| 1533 | "%s\n\n" | 1533 | full-title "\n\n" |
| 1534 | "\\rule[.8em]{\\textwidth}{2pt}\n\n" | 1534 | (and (org-string-nw-p contents) |
| 1535 | "%s" | 1535 | (concat "\\rule[.8em]{\\textwidth}{2pt}\n\n" contents)) |
| 1536 | "\\end{minipage}\n" | 1536 | "\\end{minipage}\n" |
| 1537 | "}\n" | 1537 | "}\n" |
| 1538 | "\\end{center}") | 1538 | "\\end{center}")))))) |
| 1539 | full-title contents)))))) | ||
| 1540 | 1539 | ||
| 1541 | 1540 | ||
| 1542 | ;;;; Italic | 1541 | ;;;; Italic |
| @@ -1810,7 +1809,7 @@ INFO is a plist holding contextual information. See | |||
| 1810 | ;; description. | 1809 | ;; description. |
| 1811 | ((string= type "radio") | 1810 | ((string= type "radio") |
| 1812 | (let ((destination (org-export-resolve-radio-link link info))) | 1811 | (let ((destination (org-export-resolve-radio-link link info))) |
| 1813 | (when destination | 1812 | (if (not destination) desc |
| 1814 | (format "\\hyperref[%s]{%s}" | 1813 | (format "\\hyperref[%s]{%s}" |
| 1815 | (org-export-solidify-link-text | 1814 | (org-export-solidify-link-text |
| 1816 | (org-element-property :value destination)) | 1815 | (org-element-property :value destination)) |
| @@ -1843,7 +1842,8 @@ INFO is a plist holding contextual information. See | |||
| 1843 | 'number-to-string | 1842 | 'number-to-string |
| 1844 | (org-export-get-headline-number destination info) | 1843 | (org-export-get-headline-number destination info) |
| 1845 | "-")))) | 1844 | "-")))) |
| 1846 | (if (and (plist-get info :section-numbers) (not desc)) | 1845 | (if (and (not desc) |
| 1846 | (org-export-numbered-headline-p destination info)) | ||
| 1847 | (format "\\ref{%s}" label) | 1847 | (format "\\ref{%s}" label) |
| 1848 | (format "\\hyperref[%s]{%s}" label | 1848 | (format "\\hyperref[%s]{%s}" label |
| 1849 | (or desc | 1849 | (or desc |
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el index 1f841c865fa..99a4ae01786 100644 --- a/lisp/org/ox-md.el +++ b/lisp/org/ox-md.el | |||
| @@ -102,21 +102,28 @@ This variable can be set to either `atx' or `setext'." | |||
| 102 | TREE is the parse tree being exported. BACKEND is the export | 102 | TREE is the parse tree being exported. BACKEND is the export |
| 103 | back-end used. INFO is a plist used as a communication channel. | 103 | back-end used. INFO is a plist used as a communication channel. |
| 104 | 104 | ||
| 105 | Make sure there's no blank line before a plain list, unless it is | 105 | Enforce a blank line between elements. There are three |
| 106 | located right after a paragraph. Otherwise, add a blank line | 106 | exceptions to this rule: |
| 107 | between elements. Blank lines between items are preserved. | 107 | |
| 108 | 1. Preserve blank lines between sibling items in a plain list, | ||
| 109 | |||
| 110 | 2. Outside of plain lists, preserve blank lines between | ||
| 111 | a paragraph and a plain list, | ||
| 112 | |||
| 113 | 3. In an item, remove any blank line before the very first | ||
| 114 | paragraph and the next sub-list. | ||
| 108 | 115 | ||
| 109 | Assume BACKEND is `md'." | 116 | Assume BACKEND is `md'." |
| 110 | (org-element-map tree (remq 'item org-element-all-elements) | 117 | (org-element-map tree (remq 'item org-element-all-elements) |
| 111 | (lambda (elem) | 118 | (lambda (e) |
| 112 | (org-element-put-property | 119 | (cond |
| 113 | elem :post-blank | 120 | ((not (and (eq (org-element-type e) 'paragraph) |
| 114 | (if (and (eq (org-element-type (org-export-get-next-element elem info)) | 121 | (eq (org-element-type (org-export-get-next-element e info)) |
| 115 | 'plain-list) | 122 | 'plain-list))) |
| 116 | (not (and (eq (org-element-type elem) 'paragraph) | 123 | (org-element-put-property e :post-blank 1)) |
| 117 | (org-export-get-previous-element elem info)))) | 124 | ((not (eq (org-element-type (org-element-property :parent e)) 'item))) |
| 118 | 0 | 125 | (t (org-element-put-property |
| 119 | 1)))) | 126 | e :post-blank (if (org-export-get-previous-element e info) 1 0)))))) |
| 120 | ;; Return updated tree. | 127 | ;; Return updated tree. |
| 121 | tree) | 128 | tree) |
| 122 | 129 | ||
| @@ -182,6 +189,14 @@ a communication channel." | |||
| 182 | (and (plist-get info :with-priority) | 189 | (and (plist-get info :with-priority) |
| 183 | (let ((char (org-element-property :priority headline))) | 190 | (let ((char (org-element-property :priority headline))) |
| 184 | (and char (format "[#%c] " char))))) | 191 | (and char (format "[#%c] " char))))) |
| 192 | (anchor | ||
| 193 | (when (plist-get info :with-toc) | ||
| 194 | (org-html--anchor | ||
| 195 | (or (org-element-property :CUSTOM_ID headline) | ||
| 196 | (concat "sec-" | ||
| 197 | (mapconcat 'number-to-string | ||
| 198 | (org-export-get-headline-number | ||
| 199 | headline info) "-")))))) | ||
| 185 | ;; Headline text without tags. | 200 | ;; Headline text without tags. |
| 186 | (heading (concat todo priority title))) | 201 | (heading (concat todo priority title))) |
| 187 | (cond | 202 | (cond |
| @@ -202,12 +217,12 @@ a communication channel." | |||
| 202 | (replace-regexp-in-string "^" " " contents))))) | 217 | (replace-regexp-in-string "^" " " contents))))) |
| 203 | ;; Use "Setext" style. | 218 | ;; Use "Setext" style. |
| 204 | ((eq org-md-headline-style 'setext) | 219 | ((eq org-md-headline-style 'setext) |
| 205 | (concat heading tags "\n" | 220 | (concat heading tags anchor "\n" |
| 206 | (make-string (length heading) (if (= level 1) ?= ?-)) | 221 | (make-string (length heading) (if (= level 1) ?= ?-)) |
| 207 | "\n\n" | 222 | "\n\n" |
| 208 | contents)) | 223 | contents)) |
| 209 | ;; Use "atx" style. | 224 | ;; Use "atx" style. |
| 210 | (t (concat (make-string level ?#) " " heading tags "\n\n" contents)))))) | 225 | (t (concat (make-string level ?#) " " heading tags anchor "\n\n" contents)))))) |
| 211 | 226 | ||
| 212 | 227 | ||
| 213 | ;;;; Horizontal Rule | 228 | ;;;; Horizontal Rule |
| @@ -279,57 +294,65 @@ a communication channel." | |||
| 279 | (concat (file-name-sans-extension raw-path) ".md") | 294 | (concat (file-name-sans-extension raw-path) ".md") |
| 280 | raw-path)))) | 295 | raw-path)))) |
| 281 | (type (org-element-property :type link))) | 296 | (type (org-element-property :type link))) |
| 282 | (cond ((member type '("custom-id" "id")) | 297 | (cond |
| 283 | (let ((destination (org-export-resolve-id-link link info))) | 298 | ((member type '("custom-id" "id")) |
| 284 | (if (stringp destination) ; External file. | 299 | (let ((destination (org-export-resolve-id-link link info))) |
| 285 | (let ((path (funcall link-org-files-as-md destination))) | 300 | (if (stringp destination) ; External file. |
| 286 | (if (not contents) (format "<%s>" path) | 301 | (let ((path (funcall link-org-files-as-md destination))) |
| 287 | (format "[%s](%s)" contents path))) | 302 | (if (not contents) (format "<%s>" path) |
| 288 | (concat | 303 | (format "[%s](%s)" contents path))) |
| 289 | (and contents (concat contents " ")) | 304 | (concat |
| 290 | (format "(%s)" | 305 | (and contents (concat contents " ")) |
| 291 | (format (org-export-translate "See section %s" :html info) | 306 | (format "(%s)" |
| 292 | (mapconcat 'number-to-string | 307 | (format (org-export-translate "See section %s" :html info) |
| 293 | (org-export-get-headline-number | 308 | (mapconcat 'number-to-string |
| 294 | destination info) | 309 | (org-export-get-headline-number |
| 295 | "."))))))) | 310 | destination info) |
| 296 | ((org-export-inline-image-p link org-html-inline-image-rules) | 311 | "."))))))) |
| 297 | (let ((path (let ((raw-path (org-element-property :path link))) | 312 | ((org-export-inline-image-p link org-html-inline-image-rules) |
| 298 | (if (not (file-name-absolute-p raw-path)) raw-path | 313 | (let ((path (let ((raw-path (org-element-property :path link))) |
| 299 | (expand-file-name raw-path)))) | 314 | (if (not (file-name-absolute-p raw-path)) raw-path |
| 300 | (caption (org-export-data | 315 | (expand-file-name raw-path)))) |
| 301 | (org-export-get-caption | 316 | (caption (org-export-data |
| 302 | (org-export-get-parent-element link)) info))) | 317 | (org-export-get-caption |
| 303 | (format "" | 318 | (org-export-get-parent-element link)) info))) |
| 304 | (if (not (org-string-nw-p caption)) path | 319 | (format "" |
| 305 | (format "%s \"%s\"" path caption))))) | 320 | (if (not (org-string-nw-p caption)) path |
| 306 | ((string= type "coderef") | 321 | (format "%s \"%s\"" path caption))))) |
| 307 | (let ((ref (org-element-property :path link))) | 322 | ((string= type "coderef") |
| 308 | (format (org-export-get-coderef-format ref contents) | 323 | (let ((ref (org-element-property :path link))) |
| 309 | (org-export-resolve-coderef ref info)))) | 324 | (format (org-export-get-coderef-format ref contents) |
| 310 | ((equal type "radio") contents) | 325 | (org-export-resolve-coderef ref info)))) |
| 311 | ((equal type "fuzzy") | 326 | ((equal type "radio") contents) |
| 312 | (let ((destination (org-export-resolve-fuzzy-link link info))) | 327 | ((equal type "fuzzy") |
| 313 | (if (org-string-nw-p contents) contents | 328 | (let ((destination (org-export-resolve-fuzzy-link link info))) |
| 314 | (when destination | 329 | (if (org-string-nw-p contents) contents |
| 315 | (let ((number (org-export-get-ordinal destination info))) | 330 | (when destination |
| 316 | (when number | 331 | (let ((number (org-export-get-ordinal destination info))) |
| 317 | (if (atom number) (number-to-string number) | 332 | (when number |
| 318 | (mapconcat 'number-to-string number ".")))))))) | 333 | (if (atom number) (number-to-string number) |
| 319 | (t (let* ((raw-path (org-element-property :path link)) | 334 | (mapconcat 'number-to-string number ".")))))))) |
| 320 | (path | 335 | ;; Link type is handled by a special function. |
| 321 | (cond | 336 | ((let ((protocol (nth 2 (assoc type org-link-protocols)))) |
| 322 | ((member type '("http" "https" "ftp")) | 337 | (and (functionp protocol) |
| 323 | (concat type ":" raw-path)) | 338 | (funcall protocol |
| 324 | ((string= type "file") | 339 | (org-link-unescape (org-element-property :path link)) |
| 325 | (let ((path (funcall link-org-files-as-md raw-path))) | 340 | contents |
| 326 | (if (not (file-name-absolute-p path)) path | 341 | 'md)))) |
| 327 | ;; If file path is absolute, prepend it | 342 | (t (let* ((raw-path (org-element-property :path link)) |
| 328 | ;; with "file:" component. | 343 | (path |
| 329 | (concat "file:" path)))) | 344 | (cond |
| 330 | (t raw-path)))) | 345 | ((member type '("http" "https" "ftp")) |
| 331 | (if (not contents) (format "<%s>" path) | 346 | (concat type ":" raw-path)) |
| 332 | (format "[%s](%s)" contents path))))))) | 347 | ((string= type "file") |
| 348 | (let ((path (funcall link-org-files-as-md raw-path))) | ||
| 349 | (if (not (file-name-absolute-p path)) path | ||
| 350 | ;; If file path is absolute, prepend it | ||
| 351 | ;; with "file:" component. | ||
| 352 | (concat "file:" path)))) | ||
| 353 | (t raw-path)))) | ||
| 354 | (if (not contents) (format "<%s>" path) | ||
| 355 | (format "[%s](%s)" contents path))))))) | ||
| 333 | 356 | ||
| 334 | 357 | ||
| 335 | ;;;; Paragraph | 358 | ;;;; Paragraph |
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el index 772017cdd0c..03b3214a469 100644 --- a/lisp/org/ox-odt.el +++ b/lisp/org/ox-odt.el | |||
| @@ -1741,7 +1741,8 @@ CONTENTS is nil. INFO is a plist holding contextual information." | |||
| 1741 | :transcoders | 1741 | :transcoders |
| 1742 | '((paragraph . (lambda (p c i) | 1742 | '((paragraph . (lambda (p c i) |
| 1743 | (org-odt--format-paragraph | 1743 | (org-odt--format-paragraph |
| 1744 | p c "Footnote" | 1744 | p c i |
| 1745 | "Footnote" | ||
| 1745 | "OrgFootnoteCenter" | 1746 | "OrgFootnoteCenter" |
| 1746 | "OrgFootnoteQuotations"))))) | 1747 | "OrgFootnoteQuotations"))))) |
| 1747 | info)))) | 1748 | info)))) |
| @@ -2732,7 +2733,7 @@ INFO is a plist holding contextual information. See | |||
| 2732 | ;; link's description. | 2733 | ;; link's description. |
| 2733 | ((string= type "radio") | 2734 | ((string= type "radio") |
| 2734 | (let ((destination (org-export-resolve-radio-link link info))) | 2735 | (let ((destination (org-export-resolve-radio-link link info))) |
| 2735 | (when destination | 2736 | (if (not destination) desc |
| 2736 | (format | 2737 | (format |
| 2737 | "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" | 2738 | "<text:bookmark-ref text:reference-format=\"text\" text:ref-name=\"OrgXref.%s\">%s</text:bookmark-ref>" |
| 2738 | (org-export-solidify-link-text | 2739 | (org-export-solidify-link-text |
| @@ -2832,33 +2833,44 @@ INFO is a plist holding contextual information. See | |||
| 2832 | 2833 | ||
| 2833 | ;;;; Paragraph | 2834 | ;;;; Paragraph |
| 2834 | 2835 | ||
| 2835 | (defun org-odt--format-paragraph (paragraph contents default center quote) | 2836 | (defun org-odt--paragraph-style (paragraph) |
| 2837 | "Return style of PARAGRAPH. | ||
| 2838 | Style is a symbol among `quoted', `centered' and nil." | ||
| 2839 | (let ((up paragraph)) | ||
| 2840 | (while (and (setq up (org-element-property :parent up)) | ||
| 2841 | (not (memq (org-element-type up) | ||
| 2842 | '(center-block quote-block section))))) | ||
| 2843 | (case (org-element-type up) | ||
| 2844 | (center-block 'centered) | ||
| 2845 | (quote-block 'quoted)))) | ||
| 2846 | |||
| 2847 | (defun org-odt--format-paragraph (paragraph contents info default center quote) | ||
| 2836 | "Format paragraph according to given styles. | 2848 | "Format paragraph according to given styles. |
| 2837 | PARAGRAPH is a paragraph type element. CONTENTS is the | 2849 | PARAGRAPH is a paragraph type element. CONTENTS is the |
| 2838 | transcoded contents of that paragraph, as a string. DEFAULT, | 2850 | transcoded contents of that paragraph, as a string. INFO is |
| 2839 | CENTER and QUOTE are, respectively, style to use when paragraph | 2851 | a plist used as a communication channel. DEFAULT, CENTER and |
| 2840 | belongs to no special environment, a center block, or a quote | 2852 | QUOTE are, respectively, style to use when paragraph belongs to |
| 2841 | block." | 2853 | no special environment, a center block, or a quote block." |
| 2842 | (let* ((parent (org-export-get-parent paragraph)) | 2854 | (format "\n<text:p text:style-name=\"%s\">%s</text:p>" |
| 2843 | (parent-type (org-element-type parent)) | 2855 | (case (org-odt--paragraph-style paragraph) |
| 2844 | (style (case parent-type | 2856 | (quoted quote) |
| 2845 | (quote-block quote) | 2857 | (centered center) |
| 2846 | (center-block center) | 2858 | (otherwise default)) |
| 2847 | (t default)))) | 2859 | ;; If PARAGRAPH is a leading paragraph in an item that has |
| 2848 | ;; If this paragraph is a leading paragraph in an item and the | 2860 | ;; a checkbox, splice checkbox and paragraph contents |
| 2849 | ;; item has a checkbox, splice the checkbox and paragraph contents | 2861 | ;; together. |
| 2850 | ;; together. | 2862 | (concat (let ((parent (org-element-property :parent paragraph))) |
| 2851 | (when (and (eq (org-element-type parent) 'item) | 2863 | (and (eq (org-element-type parent) 'item) |
| 2852 | (eq paragraph (car (org-element-contents parent)))) | 2864 | (not (org-export-get-previous-element paragraph info)) |
| 2853 | (setq contents (concat (org-odt--checkbox parent) contents))) | 2865 | (org-odt--checkbox parent))) |
| 2854 | (format "\n<text:p text:style-name=\"%s\">%s</text:p>" style contents))) | 2866 | contents))) |
| 2855 | 2867 | ||
| 2856 | (defun org-odt-paragraph (paragraph contents info) | 2868 | (defun org-odt-paragraph (paragraph contents info) |
| 2857 | "Transcode a PARAGRAPH element from Org to ODT. | 2869 | "Transcode a PARAGRAPH element from Org to ODT. |
| 2858 | CONTENTS is the contents of the paragraph, as a string. INFO is | 2870 | CONTENTS is the contents of the paragraph, as a string. INFO is |
| 2859 | the plist used as a communication channel." | 2871 | the plist used as a communication channel." |
| 2860 | (org-odt--format-paragraph | 2872 | (org-odt--format-paragraph |
| 2861 | paragraph contents | 2873 | paragraph contents info |
| 2862 | (or (org-element-property :style paragraph) "Text_20_body") | 2874 | (or (org-element-property :style paragraph) "Text_20_body") |
| 2863 | "OrgCenter" | 2875 | "OrgCenter" |
| 2864 | "Quotations")) | 2876 | "Quotations")) |
diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el index 3b2e55e2d45..195b9d76587 100644 --- a/lisp/org/ox-org.el +++ b/lisp/org/ox-org.el | |||
| @@ -65,7 +65,7 @@ setting of `org-html-htmlize-output-type' is 'css." | |||
| 65 | (entity . org-org-identity) | 65 | (entity . org-org-identity) |
| 66 | (example-block . org-org-identity) | 66 | (example-block . org-org-identity) |
| 67 | (fixed-width . org-org-identity) | 67 | (fixed-width . org-org-identity) |
| 68 | (footnote-definition . org-org-identity) | 68 | (footnote-definition . ignore) |
| 69 | (footnote-reference . org-org-identity) | 69 | (footnote-reference . org-org-identity) |
| 70 | (headline . org-org-headline) | 70 | (headline . org-org-headline) |
| 71 | (horizontal-rule . org-org-identity) | 71 | (horizontal-rule . org-org-identity) |
| @@ -87,7 +87,7 @@ setting of `org-html-htmlize-output-type' is 'css." | |||
| 87 | (quote-block . org-org-identity) | 87 | (quote-block . org-org-identity) |
| 88 | (quote-section . org-org-identity) | 88 | (quote-section . org-org-identity) |
| 89 | (radio-target . org-org-identity) | 89 | (radio-target . org-org-identity) |
| 90 | (section . org-org-identity) | 90 | (section . org-org-section) |
| 91 | (special-block . org-org-identity) | 91 | (special-block . org-org-identity) |
| 92 | (src-block . org-org-identity) | 92 | (src-block . org-org-identity) |
| 93 | (statistics-cookie . org-org-identity) | 93 | (statistics-cookie . org-org-identity) |
| @@ -122,15 +122,16 @@ CONTENTS is its contents, as a string or nil. INFO is ignored." | |||
| 122 | (defun org-org-headline (headline contents info) | 122 | (defun org-org-headline (headline contents info) |
| 123 | "Transcode HEADLINE element back into Org syntax. | 123 | "Transcode HEADLINE element back into Org syntax. |
| 124 | CONTENTS is its contents, as a string or nil. INFO is ignored." | 124 | CONTENTS is its contents, as a string or nil. INFO is ignored." |
| 125 | (unless (plist-get info :with-todo-keywords) | 125 | (unless (org-element-property :footnote-section-p headline) |
| 126 | (org-element-put-property headline :todo-keyword nil)) | 126 | (unless (plist-get info :with-todo-keywords) |
| 127 | (unless (plist-get info :with-tags) | 127 | (org-element-put-property headline :todo-keyword nil)) |
| 128 | (org-element-put-property headline :tags nil)) | 128 | (unless (plist-get info :with-tags) |
| 129 | (unless (plist-get info :with-priority) | 129 | (org-element-put-property headline :tags nil)) |
| 130 | (org-element-put-property headline :priority nil)) | 130 | (unless (plist-get info :with-priority) |
| 131 | (org-element-put-property headline :level | 131 | (org-element-put-property headline :priority nil)) |
| 132 | (org-export-get-relative-level headline info)) | 132 | (org-element-put-property headline :level |
| 133 | (org-element-headline-interpreter headline contents)) | 133 | (org-export-get-relative-level headline info)) |
| 134 | (org-element-headline-interpreter headline contents))) | ||
| 134 | 135 | ||
| 135 | (defun org-org-keyword (keyword contents info) | 136 | (defun org-org-keyword (keyword contents info) |
| 136 | "Transcode KEYWORD element back into Org syntax. | 137 | "Transcode KEYWORD element back into Org syntax. |
| @@ -144,6 +145,33 @@ keywords targeted at other export back-ends." | |||
| 144 | org-element-block-name-alist)) | 145 | org-element-block-name-alist)) |
| 145 | (org-element-keyword-interpreter keyword nil))) | 146 | (org-element-keyword-interpreter keyword nil))) |
| 146 | 147 | ||
| 148 | (defun org-org-section (section contents info) | ||
| 149 | "Transcode SECTION element back into Org syntax. | ||
| 150 | CONTENTS is the contents of the section. INFO is a plist used as | ||
| 151 | a communication channel." | ||
| 152 | (concat | ||
| 153 | (org-element-normalize-string contents) | ||
| 154 | ;; Insert footnote definitions appearing for the first time in this | ||
| 155 | ;; section. Indeed, some of them may not be available to narrowing | ||
| 156 | ;; so we make sure all of them are included in the result. | ||
| 157 | (let ((footnotes-alist | ||
| 158 | (org-element-map section 'footnote-reference | ||
| 159 | (lambda (fn) | ||
| 160 | (and (eq (org-element-property :type fn) 'standard) | ||
| 161 | (org-export-footnote-first-reference-p fn info) | ||
| 162 | (cons (org-element-property :label fn) | ||
| 163 | (org-export-get-footnote-definition fn info)))) | ||
| 164 | info))) | ||
| 165 | (and footnotes-alist | ||
| 166 | (concat "\n" | ||
| 167 | (mapconcat | ||
| 168 | (lambda (d) | ||
| 169 | (org-element-normalize-string | ||
| 170 | (concat (format "[%s] "(car d)) | ||
| 171 | (org-export-data (cdr d) info)))) | ||
| 172 | footnotes-alist "\n")))) | ||
| 173 | (make-string (or (org-element-property :post-blank section) 0) ?\n))) | ||
| 174 | |||
| 147 | ;;;###autoload | 175 | ;;;###autoload |
| 148 | (defun org-org-export-as-org (&optional async subtreep visible-only ext-plist) | 176 | (defun org-org-export-as-org (&optional async subtreep visible-only ext-plist) |
| 149 | "Export current buffer to an Org buffer. | 177 | "Export current buffer to an Org buffer. |
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el index b38fca97059..1dc790daf37 100644 --- a/lisp/org/ox-publish.el +++ b/lisp/org/ox-publish.el | |||
| @@ -805,9 +805,14 @@ Default for SITEMAP-FILENAME is 'sitemap.org'." | |||
| 805 | (visiting (find-buffer-visiting file)) | 805 | (visiting (find-buffer-visiting file)) |
| 806 | (buffer (or visiting (find-file-noselect file)))) | 806 | (buffer (or visiting (find-file-noselect file)))) |
| 807 | (with-current-buffer buffer | 807 | (with-current-buffer buffer |
| 808 | (org-mode) | ||
| 809 | (let ((title | 808 | (let ((title |
| 810 | (let ((property (plist-get (org-export-get-environment) :title))) | 809 | (let ((property |
| 810 | (plist-get | ||
| 811 | ;; protect local variables in open buffers | ||
| 812 | (if visiting | ||
| 813 | (org-export-with-buffer-copy (org-export-get-environment)) | ||
| 814 | (org-export-get-environment)) | ||
| 815 | :title))) | ||
| 811 | (if property | 816 | (if property |
| 812 | (org-no-properties (org-element-interpret-data property)) | 817 | (org-no-properties (org-element-interpret-data property)) |
| 813 | (file-name-nondirectory (file-name-sans-extension file)))))) | 818 | (file-name-nondirectory (file-name-sans-extension file)))))) |
| @@ -822,12 +827,14 @@ If FILE is an Org file and provides a DATE keyword use it. In | |||
| 822 | any other case use the file system's modification time. Return | 827 | any other case use the file system's modification time. Return |
| 823 | time in `current-time' format." | 828 | time in `current-time' format." |
| 824 | (if (file-directory-p file) (nth 5 (file-attributes file)) | 829 | (if (file-directory-p file) (nth 5 (file-attributes file)) |
| 825 | (let* ((visiting (find-buffer-visiting file)) | 830 | (let* ((org-inhibit-startup t) |
| 831 | (visiting (find-buffer-visiting file)) | ||
| 826 | (file-buf (or visiting (find-file-noselect file nil))) | 832 | (file-buf (or visiting (find-file-noselect file nil))) |
| 827 | (date (plist-get | 833 | (date (plist-get |
| 828 | (with-current-buffer file-buf | 834 | (with-current-buffer file-buf |
| 829 | (let ((org-inhibit-startup t)) (org-mode)) | 835 | (if visiting |
| 830 | (org-export-get-environment)) | 836 | (org-export-with-buffer-copy (org-export-get-environment)) |
| 837 | (org-export-get-environment))) | ||
| 831 | :date))) | 838 | :date))) |
| 832 | (unless visiting (kill-buffer file-buf)) | 839 | (unless visiting (kill-buffer file-buf)) |
| 833 | ;; DATE is either a timestamp object or a secondary string. If it | 840 | ;; DATE is either a timestamp object or a secondary string. If it |
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index a961d7acdbc..37841d776f4 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el | |||
| @@ -21,38 +21,7 @@ | |||
| 21 | 21 | ||
| 22 | ;;; Commentary: | 22 | ;;; Commentary: |
| 23 | ;; | 23 | ;; |
| 24 | ;; This library implements a Texinfo back-end for Org generic | 24 | ;; See Org manual for details. |
| 25 | ;; exporter. | ||
| 26 | ;; | ||
| 27 | ;; To test it, run | ||
| 28 | ;; | ||
| 29 | ;; M-: (org-export-to-buffer 'texinfo "*Test Texinfo*") RET | ||
| 30 | ;; | ||
| 31 | ;; in an Org mode buffer then switch to the buffer to see the Texinfo | ||
| 32 | ;; export. See ox.el for more details on how this exporter works. | ||
| 33 | ;; | ||
| 34 | |||
| 35 | ;; It introduces nine new buffer keywords: "TEXINFO_CLASS", | ||
| 36 | ;; "TEXINFO_FILENAME", "TEXINFO_HEADER", "TEXINFO_POST_HEADER", | ||
| 37 | ;; "TEXINFO_DIR_CATEGORY", "TEXINFO_DIR_TITLE", "TEXINFO_DIR_DESC" | ||
| 38 | ;; "SUBTITLE" and "SUBAUTHOR". | ||
| 39 | |||
| 40 | ;; | ||
| 41 | ;; It introduces 1 new headline property keywords: | ||
| 42 | ;; "TEXINFO_MENU_TITLE" for optional menu titles. | ||
| 43 | ;; | ||
| 44 | ;; To include inline code snippets (for example for generating @kbd{} | ||
| 45 | ;; and @key{} commands), the following export-snippet keys are | ||
| 46 | ;; accepted: | ||
| 47 | ;; | ||
| 48 | ;; texinfo | ||
| 49 | ;; info | ||
| 50 | ;; | ||
| 51 | ;; You can add them for export snippets via any of the below: | ||
| 52 | ;; | ||
| 53 | ;; (add-to-list 'org-export-snippet-translation-alist | ||
| 54 | ;; '("info" . "texinfo")) | ||
| 55 | ;; | ||
| 56 | 25 | ||
| 57 | ;;; Code: | 26 | ;;; Code: |
| 58 | 27 | ||
| @@ -70,8 +39,8 @@ | |||
| 70 | (center-block . org-texinfo-center-block) | 39 | (center-block . org-texinfo-center-block) |
| 71 | (clock . org-texinfo-clock) | 40 | (clock . org-texinfo-clock) |
| 72 | (code . org-texinfo-code) | 41 | (code . org-texinfo-code) |
| 73 | (comment . org-texinfo-comment) | 42 | (comment . (lambda (&rest args) "")) |
| 74 | (comment-block . org-texinfo-comment-block) | 43 | (comment-block . (lambda (&rest args) "")) |
| 75 | (drawer . org-texinfo-drawer) | 44 | (drawer . org-texinfo-drawer) |
| 76 | (dynamic-block . org-texinfo-dynamic-block) | 45 | (dynamic-block . org-texinfo-dynamic-block) |
| 77 | (entity . org-texinfo-entity) | 46 | (entity . org-texinfo-entity) |
| @@ -114,13 +83,14 @@ | |||
| 114 | :export-block "TEXINFO" | 83 | :export-block "TEXINFO" |
| 115 | :filters-alist | 84 | :filters-alist |
| 116 | '((:filter-headline . org-texinfo-filter-section-blank-lines) | 85 | '((:filter-headline . org-texinfo-filter-section-blank-lines) |
| 86 | (:filter-parse-tree . org-texinfo--normalize-headlines) | ||
| 117 | (:filter-section . org-texinfo-filter-section-blank-lines)) | 87 | (:filter-section . org-texinfo-filter-section-blank-lines)) |
| 118 | :menu-entry | 88 | :menu-entry |
| 119 | '(?i "Export to Texinfo" | 89 | '(?i "Export to Texinfo" |
| 120 | ((?t "As TEXI file" org-texinfo-export-to-texinfo) | 90 | ((?t "As TEXI file" org-texinfo-export-to-texinfo) |
| 121 | (?i "As INFO file" org-texinfo-export-to-info))) | 91 | (?i "As INFO file" org-texinfo-export-to-info))) |
| 122 | :options-alist | 92 | :options-alist |
| 123 | '((:texinfo-filename "TEXINFO_FILENAME" nil org-texinfo-filename t) | 93 | '((:texinfo-filename "TEXINFO_FILENAME" nil nil t) |
| 124 | (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t) | 94 | (:texinfo-class "TEXINFO_CLASS" nil org-texinfo-default-class t) |
| 125 | (:texinfo-header "TEXINFO_HEADER" nil nil newline) | 95 | (:texinfo-header "TEXINFO_HEADER" nil nil newline) |
| 126 | (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline) | 96 | (:texinfo-post-header "TEXINFO_POST_HEADER" nil nil newline) |
| @@ -128,7 +98,8 @@ | |||
| 128 | (:subauthor "SUBAUTHOR" nil nil newline) | 98 | (:subauthor "SUBAUTHOR" nil nil newline) |
| 129 | (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t) | 99 | (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t) |
| 130 | (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) | 100 | (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) |
| 131 | (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t))) | 101 | (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t) |
| 102 | (:texinfo-printed-title "TEXINFO_PRINTED_TITLE" nil nil t))) | ||
| 132 | 103 | ||
| 133 | 104 | ||
| 134 | 105 | ||
| @@ -141,12 +112,7 @@ | |||
| 141 | :package-version '(Org . "8.0") | 112 | :package-version '(Org . "8.0") |
| 142 | :group 'org-export) | 113 | :group 'org-export) |
| 143 | 114 | ||
| 144 | ;;; Preamble | 115 | ;;;; Preamble |
| 145 | |||
| 146 | (defcustom org-texinfo-filename "" | ||
| 147 | "Default filename for Texinfo output." | ||
| 148 | :group 'org-export-texinfo | ||
| 149 | :type '(string :tag "Export Filename")) | ||
| 150 | 116 | ||
| 151 | (defcustom org-texinfo-coding-system nil | 117 | (defcustom org-texinfo-coding-system nil |
| 152 | "Default document encoding for Texinfo output. | 118 | "Default document encoding for Texinfo output. |
| @@ -162,19 +128,42 @@ If `nil' it will default to `buffer-file-coding-system'." | |||
| 162 | 128 | ||
| 163 | (defcustom org-texinfo-classes | 129 | (defcustom org-texinfo-classes |
| 164 | '(("info" | 130 | '(("info" |
| 165 | "\\input texinfo @c -*- texinfo -*-" | 131 | "@documentencoding AUTO\n@documentlanguage AUTO" |
| 166 | ("@chapter %s" . "@unnumbered %s") | 132 | ("@chapter %s" . "@unnumbered %s") |
| 167 | ("@section %s" . "@unnumberedsec %s") | 133 | ("@section %s" . "@unnumberedsec %s") |
| 168 | ("@subsection %s" . "@unnumberedsubsec %s") | 134 | ("@subsection %s" . "@unnumberedsubsec %s") |
| 169 | ("@subsubsection %s" . "@unnumberedsubsubsec %s"))) | 135 | ("@subsubsection %s" . "@unnumberedsubsubsec %s"))) |
| 170 | "Alist of Texinfo classes and associated header and structure. | 136 | "Alist of Texinfo classes and associated header and structure. |
| 171 | If #+Texinfo_CLASS is set in the buffer, use its value and the | 137 | If #+TEXINFO_CLASS is set in the buffer, use its value and the |
| 172 | associated information. Here is the structure of each cell: | 138 | associated information. Here is the structure of each cell: |
| 173 | 139 | ||
| 174 | \(class-name | 140 | \(class-name |
| 175 | header-string | 141 | header-string |
| 176 | \(numbered-section . unnumbered-section\) | 142 | \(numbered-section . unnumbered-section) |
| 177 | ...\) | 143 | ...) |
| 144 | |||
| 145 | |||
| 146 | The header string | ||
| 147 | ----------------- | ||
| 148 | |||
| 149 | The header string is inserted in the header of the generated | ||
| 150 | document, right after \"@setfilename\" and \"@settitle\" | ||
| 151 | commands. | ||
| 152 | |||
| 153 | If it contains the special string | ||
| 154 | |||
| 155 | \"@documentencoding AUTO\" | ||
| 156 | |||
| 157 | \"AUTO\" will be replaced with an appropriate coding system. See | ||
| 158 | `org-texinfo-coding-system' for more information. Likewise, if | ||
| 159 | the string contains the special string | ||
| 160 | |||
| 161 | \"@documentlanguage AUTO\" | ||
| 162 | |||
| 163 | \"AUTO\" will be replaced with the language defined in the | ||
| 164 | buffer, through #+LANGUAGE keyword, or globally, with | ||
| 165 | `org-export-default-language', which see. | ||
| 166 | |||
| 178 | 167 | ||
| 179 | The sectioning structure | 168 | The sectioning structure |
| 180 | ------------------------ | 169 | ------------------------ |
| @@ -186,10 +175,12 @@ section string and will be replaced by the title of the section. | |||
| 186 | 175 | ||
| 187 | Instead of a list of sectioning commands, you can also specify | 176 | Instead of a list of sectioning commands, you can also specify |
| 188 | a function name. That function will be called with two | 177 | a function name. That function will be called with two |
| 189 | parameters, the \(reduced) level of the headline, and a predicate | 178 | parameters, the reduced) level of the headline, and a predicate |
| 190 | non-nil when the headline should be numbered. It must return | 179 | non-nil when the headline should be numbered. It must return |
| 191 | a format string in which the section title will be added." | 180 | a format string in which the section title will be added." |
| 192 | :group 'org-export-texinfo | 181 | :group 'org-export-texinfo |
| 182 | :version "24.4" | ||
| 183 | :package-version '(Org . "8.2") | ||
| 193 | :type '(repeat | 184 | :type '(repeat |
| 194 | (list (string :tag "Texinfo class") | 185 | (list (string :tag "Texinfo class") |
| 195 | (string :tag "Texinfo header") | 186 | (string :tag "Texinfo header") |
| @@ -200,7 +191,7 @@ a format string in which the section title will be added." | |||
| 200 | (string :tag "unnumbered")) | 191 | (string :tag "unnumbered")) |
| 201 | (function :tag "Hook computing sectioning")))))) | 192 | (function :tag "Hook computing sectioning")))))) |
| 202 | 193 | ||
| 203 | ;;; Headline | 194 | ;;;; Headline |
| 204 | 195 | ||
| 205 | (defcustom org-texinfo-format-headline-function 'ignore | 196 | (defcustom org-texinfo-format-headline-function 'ignore |
| 206 | "Function to format headline text. | 197 | "Function to format headline text. |
| @@ -230,22 +221,16 @@ order to reproduce the default set-up: | |||
| 230 | :group 'org-export-texinfo | 221 | :group 'org-export-texinfo |
| 231 | :type 'function) | 222 | :type 'function) |
| 232 | 223 | ||
| 233 | ;;; Node listing (menu) | 224 | ;;;; Node listing (menu) |
| 234 | 225 | ||
| 235 | (defcustom org-texinfo-node-description-column 32 | 226 | (defcustom org-texinfo-node-description-column 32 |
| 236 | "Column at which to start the description in the node | 227 | "Column at which to start the description in the node listings. |
| 237 | listings. | ||
| 238 | |||
| 239 | If a node title is greater than this length, the description will | 228 | If a node title is greater than this length, the description will |
| 240 | be placed after the end of the title." | 229 | be placed after the end of the title." |
| 241 | :group 'org-export-texinfo | 230 | :group 'org-export-texinfo |
| 242 | :type 'integer) | 231 | :type 'integer) |
| 243 | 232 | ||
| 244 | ;;; Footnotes | 233 | ;;;; Timestamps |
| 245 | ;; | ||
| 246 | ;; Footnotes are inserted directly | ||
| 247 | |||
| 248 | ;;; Timestamps | ||
| 249 | 234 | ||
| 250 | (defcustom org-texinfo-active-timestamp-format "@emph{%s}" | 235 | (defcustom org-texinfo-active-timestamp-format "@emph{%s}" |
| 251 | "A printf format string to be applied to active timestamps." | 236 | "A printf format string to be applied to active timestamps." |
| @@ -262,14 +247,14 @@ be placed after the end of the title." | |||
| 262 | :group 'org-export-texinfo | 247 | :group 'org-export-texinfo |
| 263 | :type 'string) | 248 | :type 'string) |
| 264 | 249 | ||
| 265 | ;;; Links | 250 | ;;;; Links |
| 266 | 251 | ||
| 267 | (defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}" | 252 | (defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}" |
| 268 | "Format string for links with unknown path type." | 253 | "Format string for links with unknown path type." |
| 269 | :group 'org-export-texinfo | 254 | :group 'org-export-texinfo |
| 270 | :type 'string) | 255 | :type 'string) |
| 271 | 256 | ||
| 272 | ;;; Tables | 257 | ;;;; Tables |
| 273 | 258 | ||
| 274 | (defcustom org-texinfo-tables-verbatim nil | 259 | (defcustom org-texinfo-tables-verbatim nil |
| 275 | "When non-nil, tables are exported verbatim." | 260 | "When non-nil, tables are exported verbatim." |
| @@ -285,14 +270,14 @@ When nil, no transformation is made." | |||
| 285 | :group 'org-export-texinfo | 270 | :group 'org-export-texinfo |
| 286 | :type '(choice | 271 | :type '(choice |
| 287 | (string :tag "Format string") | 272 | (string :tag "Format string") |
| 288 | (const :tag "No formatting"))) | 273 | (const :tag "No formatting" nil))) |
| 289 | 274 | ||
| 290 | (defcustom org-texinfo-def-table-markup "@samp" | 275 | (defcustom org-texinfo-def-table-markup "@samp" |
| 291 | "Default setting for @table environments." | 276 | "Default setting for @table environments." |
| 292 | :group 'org-export-texinfo | 277 | :group 'org-export-texinfo |
| 293 | :type 'string) | 278 | :type 'string) |
| 294 | 279 | ||
| 295 | ;;; Text markup | 280 | ;;;; Text markup |
| 296 | 281 | ||
| 297 | (defcustom org-texinfo-text-markup-alist '((bold . "@strong{%s}") | 282 | (defcustom org-texinfo-text-markup-alist '((bold . "@strong{%s}") |
| 298 | (code . code) | 283 | (code . code) |
| @@ -316,7 +301,7 @@ returned as-is." | |||
| 316 | :type 'alist | 301 | :type 'alist |
| 317 | :options '(bold code italic verbatim comment)) | 302 | :options '(bold code italic verbatim comment)) |
| 318 | 303 | ||
| 319 | ;;; Drawers | 304 | ;;;; Drawers |
| 320 | 305 | ||
| 321 | (defcustom org-texinfo-format-drawer-function | 306 | (defcustom org-texinfo-format-drawer-function |
| 322 | (lambda (name contents) contents) | 307 | (lambda (name contents) contents) |
| @@ -331,10 +316,10 @@ The function should return the string to be exported. | |||
| 331 | The default function simply returns the value of CONTENTS." | 316 | The default function simply returns the value of CONTENTS." |
| 332 | :group 'org-export-texinfo | 317 | :group 'org-export-texinfo |
| 333 | :version "24.4" | 318 | :version "24.4" |
| 334 | :package-version '(Org . "8.3") | 319 | :package-version '(Org . "8.2") |
| 335 | :type 'function) | 320 | :type 'function) |
| 336 | 321 | ||
| 337 | ;;; Inlinetasks | 322 | ;;;; Inlinetasks |
| 338 | 323 | ||
| 339 | (defcustom org-texinfo-format-inlinetask-function 'ignore | 324 | (defcustom org-texinfo-format-inlinetask-function 'ignore |
| 340 | "Function called to format an inlinetask in Texinfo code. | 325 | "Function called to format an inlinetask in Texinfo code. |
| @@ -370,18 +355,13 @@ in order to mimic default behavior: | |||
| 370 | :group 'org-export-texinfo | 355 | :group 'org-export-texinfo |
| 371 | :type 'function) | 356 | :type 'function) |
| 372 | 357 | ||
| 373 | ;;; Src blocks | 358 | ;;;; Compilation |
| 374 | ;; | ||
| 375 | ;; Src Blocks are example blocks, except for LISP | ||
| 376 | |||
| 377 | ;;; Compilation | ||
| 378 | 359 | ||
| 379 | (defcustom org-texinfo-info-process | 360 | (defcustom org-texinfo-info-process '("makeinfo %f") |
| 380 | '("makeinfo %f") | ||
| 381 | "Commands to process a Texinfo file to an INFO file. | 361 | "Commands to process a Texinfo file to an INFO file. |
| 382 | This is list of strings, each of them will be given to the shell | 362 | This is list of strings, each of them will be given to the shell |
| 383 | as a command. %f in the command will be replaced by the full | 363 | as a command. %f in the command will be replaced by the full |
| 384 | file name, %b by the file base name \(i.e without extension) and | 364 | file name, %b by the file base name (i.e without extension) and |
| 385 | %o by the base directory of the file." | 365 | %o by the base directory of the file." |
| 386 | :group 'org-export-texinfo | 366 | :group 'org-export-texinfo |
| 387 | :type '(repeat :tag "Shell command sequence" | 367 | :type '(repeat :tag "Shell command sequence" |
| @@ -403,12 +383,13 @@ set `org-texinfo-logfiles-extensions'." | |||
| 403 | :group 'org-export-latex | 383 | :group 'org-export-latex |
| 404 | :type 'boolean) | 384 | :type 'boolean) |
| 405 | 385 | ||
| 406 | |||
| 407 | ;;; Constants | 386 | ;;; Constants |
| 387 | |||
| 408 | (defconst org-texinfo-max-toc-depth 4 | 388 | (defconst org-texinfo-max-toc-depth 4 |
| 409 | "Maximum depth for creation of detailed menu listings. Beyond | 389 | "Maximum depth for creation of detailed menu listings. |
| 410 | this depth Texinfo will not recognize the nodes and will cause | 390 | Beyond this depth, Texinfo will not recognize the nodes and will |
| 411 | errors. Left as a constant in case this value ever changes.") | 391 | cause errors. Left as a constant in case this value ever |
| 392 | changes.") | ||
| 412 | 393 | ||
| 413 | (defconst org-texinfo-supported-coding-systems | 394 | (defconst org-texinfo-supported-coding-systems |
| 414 | '("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u") | 395 | '("US-ASCII" "UTF-8" "ISO-8859-15" "ISO-8859-1" "ISO-8859-2" "koi8-r" "koi8-u") |
| @@ -425,6 +406,31 @@ If two strings share the same prefix (e.g. \"ISO-8859-1\" and | |||
| 425 | (let ((blanks (make-string 2 ?\n))) | 406 | (let ((blanks (make-string 2 ?\n))) |
| 426 | (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline))) | 407 | (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline))) |
| 427 | 408 | ||
| 409 | (defun org-texinfo--normalize-headlines (tree back-end info) | ||
| 410 | "Normalize headlines in TREE. | ||
| 411 | |||
| 412 | BACK-END is the symbol specifying back-end used for export. INFO | ||
| 413 | is a plist used as a communication channel. | ||
| 414 | |||
| 415 | Make sure every headline in TREE contains a section, since those | ||
| 416 | are required to install a menu. Also put exactly one blank line | ||
| 417 | at the end of each section. | ||
| 418 | |||
| 419 | Return new tree." | ||
| 420 | (org-element-map tree 'headline | ||
| 421 | (lambda (hl) | ||
| 422 | (org-element-put-property hl :post-blank 1) | ||
| 423 | (let ((contents (org-element-contents hl))) | ||
| 424 | (when contents | ||
| 425 | (let ((first (org-element-map contents '(headline section) | ||
| 426 | #'identity info t))) | ||
| 427 | (unless (eq (org-element-type first) 'section) | ||
| 428 | (apply #'org-element-set-contents | ||
| 429 | hl | ||
| 430 | (cons `(section (:parent ,hl)) contents))))))) | ||
| 431 | info) | ||
| 432 | tree) | ||
| 433 | |||
| 428 | (defun org-texinfo--find-verb-separator (s) | 434 | (defun org-texinfo--find-verb-separator (s) |
| 429 | "Return a character not used in string S. | 435 | "Return a character not used in string S. |
| 430 | This is used to choose a separator for constructs like \\verb." | 436 | This is used to choose a separator for constructs like \\verb." |
| @@ -433,18 +439,6 @@ This is used to choose a separator for constructs like \\verb." | |||
| 433 | when (not (string-match (regexp-quote (char-to-string c)) s)) | 439 | when (not (string-match (regexp-quote (char-to-string c)) s)) |
| 434 | return (char-to-string c)))) | 440 | return (char-to-string c)))) |
| 435 | 441 | ||
| 436 | (defun org-texinfo--make-option-string (options) | ||
| 437 | "Return a comma separated string of keywords and values. | ||
| 438 | OPTIONS is an alist where the key is the options keyword as | ||
| 439 | a string, and the value a list containing the keyword value, or | ||
| 440 | nil." | ||
| 441 | (mapconcat (lambda (pair) | ||
| 442 | (concat (first pair) | ||
| 443 | (when (> (length (second pair)) 0) | ||
| 444 | (concat "=" (second pair))))) | ||
| 445 | options | ||
| 446 | ",")) | ||
| 447 | |||
| 448 | (defun org-texinfo--text-markup (text markup) | 442 | (defun org-texinfo--text-markup (text markup) |
| 449 | "Format TEXT depending on MARKUP text markup. | 443 | "Format TEXT depending on MARKUP text markup. |
| 450 | See `org-texinfo-text-markup-alist' for details." | 444 | See `org-texinfo-text-markup-alist' for details." |
| @@ -472,207 +466,44 @@ See `org-texinfo-text-markup-alist' for details." | |||
| 472 | ;; Else use format string. | 466 | ;; Else use format string. |
| 473 | (t (format fmt text))))) | 467 | (t (format fmt text))))) |
| 474 | 468 | ||
| 475 | (defun org-texinfo--get-node (headline info) | 469 | (defun org-texinfo--get-node (blob info) |
| 476 | "Return node entry associated to HEADLINE. | 470 | "Return node or anchor associated to BLOB. |
| 477 | INFO is a plist used as a communication channel." | 471 | BLOB is an element or object. INFO is a plist used as |
| 478 | (let ((menu-title (org-export-get-alt-title headline info))) | 472 | a communication channel. The function guarantees the node or |
| 479 | (org-texinfo--sanitize-menu | 473 | anchor name is unique." |
| 480 | (replace-regexp-in-string | 474 | (let ((cache (plist-get info :texinfo-node-cache))) |
| 481 | "%" "%%" | 475 | (or (cdr (assq blob cache)) |
| 482 | (if menu-title (org-export-data menu-title info) | 476 | (let ((name |
| 483 | (org-texinfo--sanitize-headline | 477 | (org-texinfo--sanitize-node |
| 484 | (org-element-property :title headline) info)))))) | 478 | (case (org-element-type blob) |
| 485 | 479 | (headline | |
| 486 | ;;; Headline sanitizing | 480 | (org-export-data (org-export-get-alt-title blob info) info)) |
| 487 | 481 | ((radio-target target) (org-element-property :value blob)) | |
| 488 | (defun org-texinfo--sanitize-headline (headline info) | 482 | (otherwise (or (org-element-property :name blob) "")))))) |
| 489 | "Remove all formatting from the text of a headline for use in | 483 | ;; Ensure NAME is unique. |
| 490 | node and menu listing." | 484 | (while (rassoc name cache) (setq name (concat name "x"))) |
| 491 | (mapconcat 'identity | 485 | (plist-put info :texinfo-node-cache (cons (cons blob name) cache)) |
| 492 | (org-texinfo--sanitize-headline-contents headline info) " ")) | 486 | name)))) |
| 493 | 487 | ||
| 494 | (defun org-texinfo--sanitize-headline-contents (headline info) | 488 | ;;;; Menu sanitizing |
| 495 | "Retrieve the content of the headline. | 489 | |
| 496 | 490 | (defun org-texinfo--sanitize-node (title) | |
| 497 | Any content that can contain further formatting is checked | 491 | "Bend string TITLE to node line requirements. |
| 498 | recursively, to ensure that nested content is also properly | 492 | Trim string and collapse multiple whitespace characters as they |
| 499 | retrieved." | 493 | are not significant. Also remove the following characters: @ |
| 500 | (loop for contents in headline append | 494 | { } ( ) : . ," |
| 501 | (cond | 495 | (replace-regexp-in-string |
| 502 | ;; already a string | 496 | "[:,.]" "" |
| 503 | ((stringp contents) | 497 | (replace-regexp-in-string |
| 504 | (list (replace-regexp-in-string " $" "" contents))) | 498 | "\\`(\\(.*)\\)" "[\\1" |
| 505 | ;; Is exported as-is (value) | 499 | (org-trim (replace-regexp-in-string "[ \t]\\{2,\\}" " " title))))) |
| 506 | ((org-element-map contents '(verbatim code) | 500 | |
| 507 | (lambda (value) (org-element-property :value value)) info)) | 501 | ;;;; Content sanitizing |
| 508 | ;; Has content and recurse into the content | ||
| 509 | ((org-element-contents contents) | ||
| 510 | (org-texinfo--sanitize-headline-contents | ||
| 511 | (org-element-contents contents) info))))) | ||
| 512 | |||
| 513 | ;;; Menu sanitizing | ||
| 514 | |||
| 515 | (defun org-texinfo--sanitize-menu (title) | ||
| 516 | "Remove invalid characters from TITLE for use in menus and | ||
| 517 | nodes. | ||
| 518 | |||
| 519 | Based on Texinfo specifications, the following must be removed: | ||
| 520 | @ { } ( ) : . ," | ||
| 521 | (replace-regexp-in-string "[@{}():,.]" "" title)) | ||
| 522 | |||
| 523 | ;;; Content sanitizing | ||
| 524 | 502 | ||
| 525 | (defun org-texinfo--sanitize-content (text) | 503 | (defun org-texinfo--sanitize-content (text) |
| 526 | "Ensure characters are properly escaped when used in headlines or blocks. | 504 | "Escape special characters in string TEXT. |
| 527 | 505 | Special characters are: @ { }" | |
| 528 | Escape characters are: @ { }" | 506 | (replace-regexp-in-string "[@{}]" "@\\&" text)) |
| 529 | (replace-regexp-in-string "\\\([@{}]\\\)" "@\\1" text)) | ||
| 530 | |||
| 531 | ;;; Menu creation | ||
| 532 | |||
| 533 | (defun org-texinfo--build-menu (tree level info &optional detailed) | ||
| 534 | "Create the @menu/@end menu information from TREE at headline | ||
| 535 | level LEVEL. | ||
| 536 | |||
| 537 | TREE contains the parse-tree to work with, either of the entire | ||
| 538 | document or of a specific parent headline. LEVEL indicates what | ||
| 539 | level of headlines to look at when generating the menu. INFO is | ||
| 540 | a plist containing contextual information. | ||
| 541 | |||
| 542 | Detailed determines whether to build a single level of menu, or | ||
| 543 | recurse into all children as well." | ||
| 544 | (let ((menu (org-texinfo--generate-menu-list tree level info)) | ||
| 545 | output text-menu) | ||
| 546 | (cond | ||
| 547 | (detailed | ||
| 548 | ;; Looping is done within the menu generation. | ||
| 549 | (setq text-menu (org-texinfo--generate-detailed menu level info))) | ||
| 550 | (t | ||
| 551 | (setq text-menu (org-texinfo--generate-menu-items menu info)))) | ||
| 552 | (when text-menu | ||
| 553 | (setq output (org-texinfo--format-menu text-menu)) | ||
| 554 | (mapconcat 'identity output "\n")))) | ||
| 555 | |||
| 556 | (defun org-texinfo--generate-detailed (menu level info) | ||
| 557 | "Generate a detailed listing of all subheadings within MENU starting at LEVEL. | ||
| 558 | |||
| 559 | MENU is the parse-tree to work with. LEVEL is the starting level | ||
| 560 | for the menu headlines and from which recursion occurs. INFO is | ||
| 561 | a plist containing contextual information." | ||
| 562 | (when level | ||
| 563 | (let ((max-depth (min org-texinfo-max-toc-depth | ||
| 564 | (plist-get info :headline-levels)))) | ||
| 565 | (when (> max-depth level) | ||
| 566 | (loop for headline in menu append | ||
| 567 | (let* ((title (org-texinfo--menu-headlines headline info)) | ||
| 568 | ;; Create list of menu entries for the next level | ||
| 569 | (sublist (org-texinfo--generate-menu-list | ||
| 570 | headline (1+ level) info)) | ||
| 571 | ;; Generate the menu items for that level. If | ||
| 572 | ;; there are none omit that heading completely, | ||
| 573 | ;; otherwise join the title to it's related entries. | ||
| 574 | (submenu (if (org-texinfo--generate-menu-items sublist info) | ||
| 575 | (append (list title) | ||
| 576 | (org-texinfo--generate-menu-items sublist info)) | ||
| 577 | 'nil)) | ||
| 578 | ;; Start the process over the next level down. | ||
| 579 | (recursion (org-texinfo--generate-detailed sublist (1+ level) info))) | ||
| 580 | (setq recursion (append submenu recursion)) | ||
| 581 | recursion)))))) | ||
| 582 | |||
| 583 | (defun org-texinfo--generate-menu-list (tree level info) | ||
| 584 | "Generate the list of headlines that are within a given level | ||
| 585 | of the tree for further formatting. | ||
| 586 | |||
| 587 | TREE is the parse-tree containing the headlines. LEVEL is the | ||
| 588 | headline level to generate a list of. INFO is a plist holding | ||
| 589 | contextual information." | ||
| 590 | (org-element-map tree 'headline | ||
| 591 | (lambda (head) | ||
| 592 | (and (= (org-export-get-relative-level head info) level) | ||
| 593 | ;; Do not take note of footnotes or copying headlines. | ||
| 594 | (not (org-element-property :COPYING head)) | ||
| 595 | (not (org-element-property :footnote-section-p head)) | ||
| 596 | ;; Collect headline. | ||
| 597 | head)) | ||
| 598 | info)) | ||
| 599 | |||
| 600 | (defun org-texinfo--generate-menu-items (items info) | ||
| 601 | "Generate a list of headline information from the listing ITEMS. | ||
| 602 | |||
| 603 | ITEMS is a list of the headlines to be converted into entries. | ||
| 604 | INFO is a plist containing contextual information. | ||
| 605 | |||
| 606 | Returns a list containing the following information from each | ||
| 607 | headline: length, title, description. This is used to format the | ||
| 608 | menu using `org-texinfo--format-menu'." | ||
| 609 | (loop for headline in items collect | ||
| 610 | (let* ((menu-title (org-texinfo--sanitize-menu | ||
| 611 | (org-export-data | ||
| 612 | (org-export-get-alt-title headline info) | ||
| 613 | info))) | ||
| 614 | (title (org-texinfo--sanitize-menu | ||
| 615 | (org-texinfo--sanitize-headline | ||
| 616 | (org-element-property :title headline) info))) | ||
| 617 | (descr (org-export-data | ||
| 618 | (org-element-property :DESCRIPTION headline) | ||
| 619 | info)) | ||
| 620 | (menu-entry (if (string= "" menu-title) title menu-title)) | ||
| 621 | (len (length menu-entry)) | ||
| 622 | (output (list len menu-entry descr))) | ||
| 623 | output))) | ||
| 624 | |||
| 625 | (defun org-texinfo--menu-headlines (headline info) | ||
| 626 | "Retrieve the title from HEADLINE. | ||
| 627 | |||
| 628 | INFO is a plist holding contextual information. | ||
| 629 | |||
| 630 | Return the headline as a list of (length title description) with | ||
| 631 | length of -1 and nil description. This is used in | ||
| 632 | `org-texinfo--format-menu' to identify headlines as opposed to | ||
| 633 | entries." | ||
| 634 | (let ((title (org-export-data | ||
| 635 | (org-element-property :title headline) info))) | ||
| 636 | (list -1 title 'nil))) | ||
| 637 | |||
| 638 | (defun org-texinfo--format-menu (text-menu) | ||
| 639 | "Format the TEXT-MENU items to be properly printed in the menu. | ||
| 640 | |||
| 641 | Each entry in the menu should be provided as (length title | ||
| 642 | description). | ||
| 643 | |||
| 644 | Headlines in the detailed menu are given length -1 to ensure they | ||
| 645 | are never confused with other entries. They also have no | ||
| 646 | description. | ||
| 647 | |||
| 648 | Other menu items are output as: | ||
| 649 | Title:: description | ||
| 650 | |||
| 651 | With the spacing between :: and description based on the length | ||
| 652 | of the longest menu entry." | ||
| 653 | |||
| 654 | (let (output) | ||
| 655 | (setq output | ||
| 656 | (mapcar (lambda (name) | ||
| 657 | (let* ((title (nth 1 name)) | ||
| 658 | (desc (nth 2 name)) | ||
| 659 | (length (nth 0 name)) | ||
| 660 | (column (max | ||
| 661 | ;;6 is "* " ":: " for inserted text | ||
| 662 | length | ||
| 663 | (- | ||
| 664 | org-texinfo-node-description-column | ||
| 665 | 6))) | ||
| 666 | (spacing (- column length) | ||
| 667 | )) | ||
| 668 | (if (> length -1) | ||
| 669 | (concat "* " title ":: " | ||
| 670 | (make-string spacing ?\s) | ||
| 671 | (if desc | ||
| 672 | (concat desc))) | ||
| 673 | (concat "\n" title "\n")))) | ||
| 674 | text-menu)) | ||
| 675 | output)) | ||
| 676 | 507 | ||
| 677 | ;;; Template | 508 | ;;; Template |
| 678 | 509 | ||
| @@ -680,145 +511,127 @@ of the longest menu entry." | |||
| 680 | "Return complete document string after Texinfo conversion. | 511 | "Return complete document string after Texinfo conversion. |
| 681 | CONTENTS is the transcoded contents string. INFO is a plist | 512 | CONTENTS is the transcoded contents string. INFO is a plist |
| 682 | holding export options." | 513 | holding export options." |
| 683 | (let* ((title (org-export-data (plist-get info :title) info)) | 514 | (let ((title (org-export-data (plist-get info :title) info)) |
| 684 | (info-filename (or (plist-get info :texinfo-filename) | 515 | ;; Copying data is the contents of the first headline in |
| 685 | (file-name-nondirectory | 516 | ;; parse tree with a non-nil copying property. |
| 686 | (org-export-output-file-name ".info")))) | 517 | (copying (org-element-map (plist-get info :parse-tree) 'headline |
| 687 | (author (org-export-data (plist-get info :author) info)) | 518 | (lambda (hl) |
| 688 | (lang (org-export-data (plist-get info :language) info)) | 519 | (and (org-not-nil (org-element-property :COPYING hl)) |
| 689 | (texinfo-header (plist-get info :texinfo-header)) | 520 | (org-element-contents hl))) |
| 690 | (texinfo-post-header (plist-get info :texinfo-post-header)) | 521 | info t))) |
| 691 | (subtitle (plist-get info :subtitle)) | ||
| 692 | (subauthor (plist-get info :subauthor)) | ||
| 693 | (class (plist-get info :texinfo-class)) | ||
| 694 | (header (nth 1 (assoc class org-texinfo-classes))) | ||
| 695 | (copying | ||
| 696 | (org-element-map (plist-get info :parse-tree) 'headline | ||
| 697 | (lambda (hl) (and (org-element-property :COPYING hl) hl)) info t)) | ||
| 698 | (dircat (plist-get info :texinfo-dircat)) | ||
| 699 | (dirtitle (plist-get info :texinfo-dirtitle)) | ||
| 700 | (dirdesc (plist-get info :texinfo-dirdesc)) | ||
| 701 | ;; Spacing to align description (column 32 - 3 for `* ' and | ||
| 702 | ;; `.' in text. | ||
| 703 | (dirspacing (- 29 (length dirtitle))) | ||
| 704 | (menu (org-texinfo-make-menu info 'main)) | ||
| 705 | (detail-menu (org-texinfo-make-menu info 'detailed))) | ||
| 706 | (concat | 522 | (concat |
| 707 | ;; Header | 523 | "\\input texinfo @c -*- texinfo -*-\n" |
| 708 | header "\n" | ||
| 709 | "@c %**start of header\n" | 524 | "@c %**start of header\n" |
| 710 | ;; Filename and Title | 525 | (let ((file (or (plist-get info :texinfo-filename) |
| 711 | "@setfilename " info-filename "\n" | 526 | (let ((f (plist-get info :output-file))) |
| 712 | "@settitle " title "\n" | 527 | (and f (concat (file-name-sans-extension f) ".info")))))) |
| 713 | ;; Coding system. | 528 | (and file (format "@setfilename %s\n" file))) |
| 714 | (format | 529 | (format "@settitle %s\n" title) |
| 715 | "@documentencoding %s\n" | 530 | ;; Insert class-defined header. |
| 716 | (catch 'coding-system | 531 | (org-element-normalize-string |
| 717 | (let ((case-fold-search t) | 532 | (let ((header (nth 1 (assoc (plist-get info :texinfo-class) |
| 718 | (name (symbol-name (or org-texinfo-coding-system | 533 | org-texinfo-classes))) |
| 719 | buffer-file-coding-system)))) | 534 | (coding |
| 720 | (dolist (system org-texinfo-supported-coding-systems "UTF-8") | 535 | (catch 'coding-system |
| 721 | (when (org-string-match-p (regexp-quote system) name) | 536 | (let ((case-fold-search t) |
| 722 | (throw 'coding-system system)))))) | 537 | (name (symbol-name (or org-texinfo-coding-system |
| 723 | "\n" | 538 | buffer-file-coding-system)))) |
| 724 | (format "@documentlanguage %s\n" lang) | 539 | (dolist (system org-texinfo-supported-coding-systems "UTF-8") |
| 725 | "\n\n" | 540 | (when (org-string-match-p (regexp-quote system) name) |
| 726 | "@c Version and Contact Info\n" | 541 | (throw 'coding-system system)))))) |
| 727 | "@set AUTHOR " author "\n" | 542 | (language (plist-get info :language)) |
| 728 | 543 | (case-fold-search nil)) | |
| 729 | ;; Additional Header Options set by `#+TEXINFO_HEADER | 544 | ;; Auto coding system. |
| 730 | (if texinfo-header | 545 | (replace-regexp-in-string |
| 731 | (concat "\n" | 546 | "^@documentencoding \\(AUTO\\)$" |
| 732 | texinfo-header | 547 | coding |
| 733 | "\n")) | 548 | (replace-regexp-in-string |
| 734 | 549 | "^@documentlanguage \\(AUTO\\)$" language header t nil 1) t nil 1))) | |
| 735 | "@c %**end of header\n" | 550 | ;; Additional header options set by #+TEXINFO_HEADER. |
| 736 | "@finalout\n" | 551 | (let ((texinfo-header (plist-get info :texinfo-header))) |
| 737 | "\n\n" | 552 | (and texinfo-header (org-element-normalize-string texinfo-header))) |
| 738 | 553 | "@c %**end of header\n\n" | |
| 739 | ;; Additional Header Options set by #+TEXINFO_POST_HEADER | 554 | ;; Additional options set by #+TEXINFO_POST_HEADER. |
| 740 | (if texinfo-post-header | 555 | (let ((texinfo-post-header (plist-get info :texinfo-post-header))) |
| 741 | (concat "\n" | 556 | (and texinfo-post-header |
| 742 | texinfo-post-header | 557 | (org-element-normalize-string texinfo-post-header))) |
| 743 | "\n")) | 558 | ;; Copying. |
| 744 | 559 | (and copying | |
| 745 | ;; Copying | 560 | (format "@copying\n%s@end copying\n\n" |
| 746 | "@copying\n" | 561 | (org-element-normalize-string |
| 747 | ;; Only export the content of the headline, do not need the | 562 | (org-export-data copying info)))) |
| 748 | ;; initial headline. | 563 | ;; Info directory information. Only supply if both title and |
| 749 | (org-export-data (nth 2 copying) info) | 564 | ;; category are provided. |
| 750 | "@end copying\n" | 565 | (let ((dircat (plist-get info :texinfo-dircat)) |
| 751 | "\n\n" | 566 | (dirtitle |
| 752 | 567 | (let ((title (plist-get info :texinfo-dirtitle))) | |
| 753 | ;; Info directory information | 568 | (and title |
| 754 | ;; Only supply if both title and category are provided | 569 | (string-match "^\\(?:\\* \\)?\\(.*?\\)\\(\\.\\)?$" title) |
| 755 | (if (and dircat dirtitle) | 570 | (format "* %s." (match-string 1 title)))))) |
| 571 | (when (and dircat dirtitle) | ||
| 756 | (concat "@dircategory " dircat "\n" | 572 | (concat "@dircategory " dircat "\n" |
| 757 | "@direntry\n" | 573 | "@direntry\n" |
| 758 | "* " dirtitle "." | 574 | (let ((dirdesc |
| 759 | (make-string dirspacing ?\s) | 575 | (let ((desc (plist-get info :texinfo-dirdesc))) |
| 760 | dirdesc "\n" | 576 | (cond ((not desc) nil) |
| 761 | "@end direntry\n")) | 577 | ((org-string-match-p "\\.$" desc) desc) |
| 762 | "\n\n" | 578 | (t (concat desc ".")))))) |
| 763 | 579 | (if dirdesc (format "%-23s %s" dirtitle dirdesc) dirtitle)) | |
| 580 | "\n" | ||
| 581 | "@end direntry\n\n"))) | ||
| 764 | ;; Title | 582 | ;; Title |
| 583 | "@finalout\n" | ||
| 765 | "@titlepage\n" | 584 | "@titlepage\n" |
| 766 | "@title " title "\n\n" | 585 | (format "@title %s\n" (or (plist-get info :texinfo-printed-title) title)) |
| 767 | (if subtitle | 586 | (let ((subtitle (plist-get info :subtitle))) |
| 768 | (concat "@subtitle " subtitle "\n")) | 587 | (and subtitle |
| 769 | "@author " author "\n" | 588 | (org-element-normalize-string |
| 770 | (if subauthor | 589 | (replace-regexp-in-string "^" "@subtitle " subtitle)))) |
| 771 | (concat subauthor "\n")) | 590 | (when (plist-get info :with-author) |
| 772 | "\n" | 591 | (concat |
| 773 | "@c The following two commands start the copyright page.\n" | 592 | ;; Primary author. |
| 774 | "@page\n" | 593 | (let ((author (org-string-nw-p |
| 775 | "@vskip 0pt plus 1filll\n" | 594 | (org-export-data (plist-get info :author) info))) |
| 776 | "@insertcopying\n" | 595 | (email (and (plist-get info :with-email) |
| 596 | (org-string-nw-p | ||
| 597 | (org-export-data (plist-get info :email) info))))) | ||
| 598 | (cond ((and author email) | ||
| 599 | (format "@author %s (@email{%s})\n" author email)) | ||
| 600 | (author (format "@author %s\n" author)) | ||
| 601 | (email (format "@author @email{%s}\n" email)))) | ||
| 602 | ;; Other authors. | ||
| 603 | (let ((subauthor (plist-get info :subauthor))) | ||
| 604 | (and subauthor | ||
| 605 | (org-element-normalize-string | ||
| 606 | (replace-regexp-in-string "^" "@author " subauthor)))))) | ||
| 607 | (and copying "@page\n@vskip 0pt plus 1filll\n@insertcopying\n") | ||
| 777 | "@end titlepage\n\n" | 608 | "@end titlepage\n\n" |
| 778 | "@c Output the table of contents at the beginning.\n" | 609 | ;; Table of contents. |
| 779 | "@contents\n\n" | 610 | (and (plist-get info :with-toc) "@contents\n\n") |
| 780 | |||
| 781 | ;; Configure Top Node when not for Tex | 611 | ;; Configure Top Node when not for Tex |
| 782 | "@ifnottex\n" | 612 | "@ifnottex\n" |
| 783 | "@node Top\n" | 613 | "@node Top\n" |
| 784 | "@top " title " Manual\n" | 614 | (format "@top %s\n" title) |
| 785 | "@insertcopying\n" | 615 | (and copying "@insertcopying\n") |
| 786 | "@end ifnottex\n\n" | 616 | "@end ifnottex\n\n" |
| 787 | 617 | ;; Menu. | |
| 788 | ;; Do not output menus if they are empty | 618 | (org-texinfo-make-menu (plist-get info :parse-tree) info 'master) |
| 789 | (if menu | ||
| 790 | ;; Menu | ||
| 791 | (concat "@menu\n" | ||
| 792 | menu | ||
| 793 | "\n\n" | ||
| 794 | ;; Detailed Menu | ||
| 795 | (if detail-menu | ||
| 796 | (concat "@detailmenu\n" | ||
| 797 | " --- The Detailed Node Listing ---\n" | ||
| 798 | detail-menu | ||
| 799 | "\n\n" | ||
| 800 | "@end detailmenu\n")) | ||
| 801 | "@end menu\n")) | ||
| 802 | "\n\n" | ||
| 803 | |||
| 804 | ;; Document's body. | ||
| 805 | contents | ||
| 806 | "\n" | 619 | "\n" |
| 620 | ;; Document's body. | ||
| 621 | contents "\n" | ||
| 807 | ;; Creator. | 622 | ;; Creator. |
| 808 | (let ((creator-info (plist-get info :with-creator))) | 623 | (case (plist-get info :with-creator) |
| 809 | (cond | 624 | ((nil) nil) |
| 810 | ((not creator-info) "") | 625 | (comment (format "@c %s\n" (plist-get info :creator))) |
| 811 | ((eq creator-info 'comment) | 626 | (otherwise (concat (plist-get info :creator) "\n"))) |
| 812 | (format "@c %s\n" (plist-get info :creator))) | ||
| 813 | (t (concat (plist-get info :creator) "\n")))) | ||
| 814 | ;; Document end. | 627 | ;; Document end. |
| 815 | "\n@bye"))) | 628 | "@bye"))) |
| 816 | 629 | ||
| 817 | 630 | ||
| 818 | 631 | ||
| 819 | ;;; Transcode Functions | 632 | ;;; Transcode Functions |
| 820 | 633 | ||
| 821 | ;;; Bold | 634 | ;;;; Bold |
| 822 | 635 | ||
| 823 | (defun org-texinfo-bold (bold contents info) | 636 | (defun org-texinfo-bold (bold contents info) |
| 824 | "Transcode BOLD from Org to Texinfo. | 637 | "Transcode BOLD from Org to Texinfo. |
| @@ -826,7 +639,7 @@ CONTENTS is the text with bold markup. INFO is a plist holding | |||
| 826 | contextual information." | 639 | contextual information." |
| 827 | (org-texinfo--text-markup contents 'bold)) | 640 | (org-texinfo--text-markup contents 'bold)) |
| 828 | 641 | ||
| 829 | ;;; Center Block | 642 | ;;;; Center Block |
| 830 | 643 | ||
| 831 | (defun org-texinfo-center-block (center-block contents info) | 644 | (defun org-texinfo-center-block (center-block contents info) |
| 832 | "Transcode a CENTER-BLOCK element from Org to Texinfo. | 645 | "Transcode a CENTER-BLOCK element from Org to Texinfo. |
| @@ -834,7 +647,7 @@ CONTENTS holds the contents of the block. INFO is a plist used | |||
| 834 | as a communication channel." | 647 | as a communication channel." |
| 835 | contents) | 648 | contents) |
| 836 | 649 | ||
| 837 | ;;; Clock | 650 | ;;;; Clock |
| 838 | 651 | ||
| 839 | (defun org-texinfo-clock (clock contents info) | 652 | (defun org-texinfo-clock (clock contents info) |
| 840 | "Transcode a CLOCK element from Org to Texinfo. | 653 | "Transcode a CLOCK element from Org to Texinfo. |
| @@ -851,7 +664,7 @@ information." | |||
| 851 | (and time (format " (%s)" time))))) | 664 | (and time (format " (%s)" time))))) |
| 852 | "@*")) | 665 | "@*")) |
| 853 | 666 | ||
| 854 | ;;; Code | 667 | ;;;; Code |
| 855 | 668 | ||
| 856 | (defun org-texinfo-code (code contents info) | 669 | (defun org-texinfo-code (code contents info) |
| 857 | "Transcode a CODE object from Org to Texinfo. | 670 | "Transcode a CODE object from Org to Texinfo. |
| @@ -859,23 +672,7 @@ CONTENTS is nil. INFO is a plist used as a communication | |||
| 859 | channel." | 672 | channel." |
| 860 | (org-texinfo--text-markup (org-element-property :value code) 'code)) | 673 | (org-texinfo--text-markup (org-element-property :value code) 'code)) |
| 861 | 674 | ||
| 862 | ;;; Comment | 675 | ;;;; Drawer |
| 863 | |||
| 864 | (defun org-texinfo-comment (comment contents info) | ||
| 865 | "Transcode a COMMENT object from Org to Texinfo. | ||
| 866 | CONTENTS is the text in the comment. INFO is a plist holding | ||
| 867 | contextual information." | ||
| 868 | (org-texinfo--text-markup (org-element-property :value comment) 'comment)) | ||
| 869 | |||
| 870 | ;;; Comment Block | ||
| 871 | |||
| 872 | (defun org-texinfo-comment-block (comment-block contents info) | ||
| 873 | "Transcode a COMMENT-BLOCK object from Org to Texinfo. | ||
| 874 | CONTENTS is the text within the block. INFO is a plist holding | ||
| 875 | contextual information." | ||
| 876 | (format "@ignore\n%s@end ignore" (org-element-property :value comment-block))) | ||
| 877 | |||
| 878 | ;;; Drawer | ||
| 879 | 676 | ||
| 880 | (defun org-texinfo-drawer (drawer contents info) | 677 | (defun org-texinfo-drawer (drawer contents info) |
| 881 | "Transcode a DRAWER element from Org to Texinfo. | 678 | "Transcode a DRAWER element from Org to Texinfo. |
| @@ -886,15 +683,15 @@ holding contextual information." | |||
| 886 | name contents))) | 683 | name contents))) |
| 887 | output)) | 684 | output)) |
| 888 | 685 | ||
| 889 | ;;; Dynamic Block | 686 | ;;;; Dynamic Block |
| 890 | 687 | ||
| 891 | (defun org-texinfo-dynamic-block (dynamic-block contents info) | 688 | (defun org-texinfo-dynamic-block (dynamic-block contents info) |
| 892 | "Transcode a DYNAMIC-BLOCK element from Org to Texinfo. | 689 | "Transcode a DYNAMIC-BLOCK element from Org to Texinfo. |
| 893 | CONTENTS holds the contents of the block. INFO is a plist | 690 | CONTENTS holds the contents of the block. INFO is a plist |
| 894 | holding contextual information. See `org-export-data'." | 691 | holding contextual information." |
| 895 | contents) | 692 | contents) |
| 896 | 693 | ||
| 897 | ;;; Entity | 694 | ;;;; Entity |
| 898 | 695 | ||
| 899 | (defun org-texinfo-entity (entity contents info) | 696 | (defun org-texinfo-entity (entity contents info) |
| 900 | "Transcode an ENTITY object from Org to Texinfo. | 697 | "Transcode an ENTITY object from Org to Texinfo. |
| @@ -903,7 +700,7 @@ contextual information." | |||
| 903 | (let ((ent (org-element-property :latex entity))) | 700 | (let ((ent (org-element-property :latex entity))) |
| 904 | (if (org-element-property :latex-math-p entity) (format "@math{%s}" ent) ent))) | 701 | (if (org-element-property :latex-math-p entity) (format "@math{%s}" ent) ent))) |
| 905 | 702 | ||
| 906 | ;;; Example Block | 703 | ;;;; Example Block |
| 907 | 704 | ||
| 908 | (defun org-texinfo-example-block (example-block contents info) | 705 | (defun org-texinfo-example-block (example-block contents info) |
| 909 | "Transcode an EXAMPLE-BLOCK element from Org to Texinfo. | 706 | "Transcode an EXAMPLE-BLOCK element from Org to Texinfo. |
| @@ -912,7 +709,7 @@ information." | |||
| 912 | (format "@verbatim\n%s@end verbatim" | 709 | (format "@verbatim\n%s@end verbatim" |
| 913 | (org-export-format-code-default example-block info))) | 710 | (org-export-format-code-default example-block info))) |
| 914 | 711 | ||
| 915 | ;;; Export Block | 712 | ;;;; Export Block |
| 916 | 713 | ||
| 917 | (defun org-texinfo-export-block (export-block contents info) | 714 | (defun org-texinfo-export-block (export-block contents info) |
| 918 | "Transcode a EXPORT-BLOCK element from Org to Texinfo. | 715 | "Transcode a EXPORT-BLOCK element from Org to Texinfo. |
| @@ -920,7 +717,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." | |||
| 920 | (when (string= (org-element-property :type export-block) "TEXINFO") | 717 | (when (string= (org-element-property :type export-block) "TEXINFO") |
| 921 | (org-remove-indentation (org-element-property :value export-block)))) | 718 | (org-remove-indentation (org-element-property :value export-block)))) |
| 922 | 719 | ||
| 923 | ;;; Export Snippet | 720 | ;;;; Export Snippet |
| 924 | 721 | ||
| 925 | (defun org-texinfo-export-snippet (export-snippet contents info) | 722 | (defun org-texinfo-export-snippet (export-snippet contents info) |
| 926 | "Transcode a EXPORT-SNIPPET object from Org to Texinfo. | 723 | "Transcode a EXPORT-SNIPPET object from Org to Texinfo. |
| @@ -928,7 +725,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." | |||
| 928 | (when (eq (org-export-snippet-backend export-snippet) 'texinfo) | 725 | (when (eq (org-export-snippet-backend export-snippet) 'texinfo) |
| 929 | (org-element-property :value export-snippet))) | 726 | (org-element-property :value export-snippet))) |
| 930 | 727 | ||
| 931 | ;;; Fixed Width | 728 | ;;;; Fixed Width |
| 932 | 729 | ||
| 933 | (defun org-texinfo-fixed-width (fixed-width contents info) | 730 | (defun org-texinfo-fixed-width (fixed-width contents info) |
| 934 | "Transcode a FIXED-WIDTH element from Org to Texinfo. | 731 | "Transcode a FIXED-WIDTH element from Org to Texinfo. |
| @@ -938,8 +735,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." | |||
| 938 | (org-texinfo--sanitize-content | 735 | (org-texinfo--sanitize-content |
| 939 | (org-element-property :value fixed-width))))) | 736 | (org-element-property :value fixed-width))))) |
| 940 | 737 | ||
| 941 | ;;; Footnote Reference | 738 | ;;;; Footnote Reference |
| 942 | ;; | ||
| 943 | 739 | ||
| 944 | (defun org-texinfo-footnote-reference (footnote contents info) | 740 | (defun org-texinfo-footnote-reference (footnote contents info) |
| 945 | "Create a footnote reference for FOOTNOTE. | 741 | "Create a footnote reference for FOOTNOTE. |
| @@ -950,7 +746,7 @@ plist holding contextual information." | |||
| 950 | (format "@footnote{%s}" | 746 | (format "@footnote{%s}" |
| 951 | (org-trim (org-export-data def info))))) | 747 | (org-trim (org-export-data def info))))) |
| 952 | 748 | ||
| 953 | ;;; Headline | 749 | ;;;; Headline |
| 954 | 750 | ||
| 955 | (defun org-texinfo-headline (headline contents info) | 751 | (defun org-texinfo-headline (headline contents info) |
| 956 | "Transcode a HEADLINE element from Org to Texinfo. | 752 | "Transcode a HEADLINE element from Org to Texinfo. |
| @@ -960,66 +756,29 @@ holding contextual information." | |||
| 960 | (level (org-export-get-relative-level headline info)) | 756 | (level (org-export-get-relative-level headline info)) |
| 961 | (numberedp (org-export-numbered-headline-p headline info)) | 757 | (numberedp (org-export-numbered-headline-p headline info)) |
| 962 | (class-sectioning (assoc class org-texinfo-classes)) | 758 | (class-sectioning (assoc class org-texinfo-classes)) |
| 963 | ;; Find the index type, if any | 759 | ;; Find the index type, if any. |
| 964 | (index (org-element-property :INDEX headline)) | 760 | (index (org-element-property :INDEX headline)) |
| 965 | ;; Check if it is an appendix | ||
| 966 | (appendix (org-element-property :APPENDIX headline)) | ||
| 967 | ;; Retrieve headline text | ||
| 968 | (text (org-texinfo--sanitize-headline | ||
| 969 | (org-element-property :title headline) info)) | ||
| 970 | ;; Create node info, to insert it before section formatting. | 761 | ;; Create node info, to insert it before section formatting. |
| 971 | ;; Use custom menu title if present | 762 | ;; Use custom menu title if present. |
| 972 | (node (format "@node %s\n" (org-texinfo--get-node headline info))) | 763 | (node (format "@node %s\n" (org-texinfo--get-node headline info))) |
| 973 | ;; Menus must be generated with first child, otherwise they | ||
| 974 | ;; will not nest properly | ||
| 975 | (menu (let* ((first (org-export-first-sibling-p headline info)) | ||
| 976 | (parent (org-export-get-parent-headline headline)) | ||
| 977 | (title (org-texinfo--sanitize-headline | ||
| 978 | (org-element-property :title parent) info)) | ||
| 979 | heading listing | ||
| 980 | (tree (plist-get info :parse-tree))) | ||
| 981 | (if first | ||
| 982 | (org-element-map (plist-get info :parse-tree) 'headline | ||
| 983 | (lambda (ref) | ||
| 984 | (if (member title (org-element-property :title ref)) | ||
| 985 | (push ref heading))) | ||
| 986 | info t)) | ||
| 987 | (setq listing (org-texinfo--build-menu | ||
| 988 | (car heading) level info)) | ||
| 989 | (if listing | ||
| 990 | (setq listing (replace-regexp-in-string | ||
| 991 | "%" "%%" listing) | ||
| 992 | listing (format | ||
| 993 | "\n@menu\n%s\n@end menu\n\n" listing)) | ||
| 994 | 'nil))) | ||
| 995 | ;; Section formatting will set two placeholders: one for the | 764 | ;; Section formatting will set two placeholders: one for the |
| 996 | ;; title and the other for the contents. | 765 | ;; title and the other for the contents. |
| 997 | (section-fmt | 766 | (section-fmt |
| 998 | (let ((sec (if (and (symbolp (nth 2 class-sectioning)) | 767 | (if (org-not-nil (org-element-property :APPENDIX headline)) |
| 999 | (fboundp (nth 2 class-sectioning))) | 768 | "@appendix %s\n%s" |
| 1000 | (funcall (nth 2 class-sectioning) level numberedp) | 769 | (let ((sec (if (and (symbolp (nth 2 class-sectioning)) |
| 1001 | (nth (1+ level) class-sectioning)))) | 770 | (fboundp (nth 2 class-sectioning))) |
| 1002 | (cond | 771 | (funcall (nth 2 class-sectioning) level numberedp) |
| 1003 | ;; No section available for that LEVEL. | 772 | (nth (1+ level) class-sectioning)))) |
| 1004 | ((not sec) nil) | ||
| 1005 | ;; Section format directly returned by a function. | ||
| 1006 | ((stringp sec) sec) | ||
| 1007 | ;; (numbered-section . unnumbered-section) | ||
| 1008 | ((not (consp (cdr sec))) | ||
| 1009 | (cond | 773 | (cond |
| 1010 | ;;If an index, always unnumbered | 774 | ;; No section available for that LEVEL. |
| 1011 | (index | 775 | ((not sec) nil) |
| 1012 | (concat menu node (cdr sec) "\n%s")) | 776 | ;; Section format directly returned by a function. |
| 1013 | (appendix | 777 | ((stringp sec) sec) |
| 1014 | (concat menu node (replace-regexp-in-string | 778 | ;; (numbered-section . unnumbered-section) |
| 1015 | "unnumbered" | 779 | ((not (consp (cdr sec))) |
| 1016 | "appendix" | 780 | (concat (if (or index (not numberedp)) (cdr sec) (car sec)) |
| 1017 | (cdr sec)) "\n%s")) | 781 | "\n%s")))))) |
| 1018 | ;; Otherwise number as needed. | ||
| 1019 | (t | ||
| 1020 | (concat menu node | ||
| 1021 | (funcall | ||
| 1022 | (if numberedp #'car #'cdr) sec) "\n%s"))))))) | ||
| 1023 | (todo | 782 | (todo |
| 1024 | (and (plist-get info :with-todo-keywords) | 783 | (and (plist-get info :with-todo-keywords) |
| 1025 | (let ((todo (org-element-property :todo-keyword headline))) | 784 | (let ((todo (org-element-property :todo-keyword headline))) |
| @@ -1029,100 +788,54 @@ holding contextual information." | |||
| 1029 | (org-export-get-tags headline info))) | 788 | (org-export-get-tags headline info))) |
| 1030 | (priority (and (plist-get info :with-priority) | 789 | (priority (and (plist-get info :with-priority) |
| 1031 | (org-element-property :priority headline))) | 790 | (org-element-property :priority headline))) |
| 1032 | ;; Create the headline text along with a no-tag version. The | 791 | (text (org-export-data (org-element-property :title headline) info)) |
| 1033 | ;; latter is required to remove tags from table of contents. | 792 | (full-text (if (not (eq org-texinfo-format-headline-function 'ignore)) |
| 1034 | (full-text (org-texinfo--sanitize-content | 793 | ;; User-defined formatting function. |
| 1035 | (if (not (eq org-texinfo-format-headline-function 'ignore)) | 794 | (funcall org-texinfo-format-headline-function |
| 1036 | ;; User-defined formatting function. | 795 | todo todo-type priority text tags) |
| 1037 | (funcall org-texinfo-format-headline-function | 796 | ;; Default formatting. |
| 1038 | todo todo-type priority text tags) | 797 | (concat |
| 1039 | ;; Default formatting. | 798 | (when todo |
| 1040 | (concat | 799 | (format "@strong{%s} " todo)) |
| 1041 | (when todo | 800 | (when priority (format "@emph{#%s} " priority)) |
| 1042 | (format "@strong{%s} " todo)) | 801 | text |
| 1043 | (when priority (format "@emph{#%s} " priority)) | 802 | (when tags |
| 1044 | text | 803 | (format " :%s:" |
| 1045 | (when tags | 804 | (mapconcat 'identity tags ":")))))) |
| 1046 | (format " :%s:" | 805 | (contents (if (org-string-nw-p contents) (concat "\n" contents) ""))) |
| 1047 | (mapconcat 'identity tags ":"))))))) | ||
| 1048 | (full-text-no-tag | ||
| 1049 | (org-texinfo--sanitize-content | ||
| 1050 | (if (not (eq org-texinfo-format-headline-function 'ignore)) | ||
| 1051 | ;; User-defined formatting function. | ||
| 1052 | (funcall org-texinfo-format-headline-function | ||
| 1053 | todo todo-type priority text nil) | ||
| 1054 | ;; Default formatting. | ||
| 1055 | (concat | ||
| 1056 | (when todo (format "@strong{%s} " todo)) | ||
| 1057 | (when priority (format "@emph{#%c} " priority)) | ||
| 1058 | text)))) | ||
| 1059 | (pre-blanks | ||
| 1060 | (make-string (org-element-property :pre-blank headline) 10))) | ||
| 1061 | (cond | 806 | (cond |
| 1062 | ;; Case 1: This is a footnote section: ignore it. | 807 | ;; Case 1: This is a footnote section: ignore it. |
| 1063 | ((org-element-property :footnote-section-p headline) nil) | 808 | ((org-element-property :footnote-section-p headline) nil) |
| 1064 | ;; Case 2: This is the `copying' section: ignore it | 809 | ;; Case 2: This is the `copying' section: ignore it |
| 1065 | ;; This is used elsewhere. | 810 | ;; This is used elsewhere. |
| 1066 | ((org-element-property :COPYING headline) nil) | 811 | ((org-not-nil (org-element-property :COPYING headline)) nil) |
| 1067 | ;; Case 3: An index. If it matches one of the known indexes, | 812 | ;; Case 3: An index. If it matches one of the known indexes, |
| 1068 | ;; print it as such following the contents, otherwise | 813 | ;; print it as such following the contents, otherwise |
| 1069 | ;; print the contents and leave the index up to the user. | 814 | ;; print the contents and leave the index up to the user. |
| 1070 | (index | 815 | (index |
| 1071 | (format | 816 | (concat node |
| 1072 | section-fmt full-text | 817 | (format |
| 1073 | (concat pre-blanks contents "\n" | 818 | section-fmt |
| 1074 | (if (member index '("cp" "fn" "ky" "pg" "tp" "vr")) | 819 | full-text |
| 1075 | (concat "@printindex " index))))) | 820 | (concat contents |
| 821 | (and (member index '("cp" "fn" "ky" "pg" "tp" "vr")) | ||
| 822 | (concat "\n@printindex " index)))))) | ||
| 1076 | ;; Case 4: This is a deep sub-tree: export it as a list item. | 823 | ;; Case 4: This is a deep sub-tree: export it as a list item. |
| 1077 | ;; Also export as items headlines for which no section | 824 | ;; Also export as items headlines for which no section |
| 1078 | ;; format has been found. | 825 | ;; format has been found. |
| 1079 | ((or (not section-fmt) (org-export-low-level-p headline info)) | 826 | ((or (not section-fmt) (org-export-low-level-p headline info)) |
| 1080 | ;; Build the real contents of the sub-tree. | 827 | ;; Build the real contents of the sub-tree. |
| 1081 | (let ((low-level-body | 828 | (concat (and (org-export-first-sibling-p headline info) |
| 1082 | (concat | 829 | (format "@%s\n" (if numberedp 'enumerate 'itemize))) |
| 1083 | ;; If the headline is the first sibling, start a list. | 830 | "@item\n" full-text "\n" |
| 1084 | (when (org-export-first-sibling-p headline info) | 831 | contents |
| 1085 | (format "@%s\n" (if numberedp 'enumerate 'itemize))) | 832 | (if (org-export-last-sibling-p headline info) |
| 1086 | ;; Itemize headline | 833 | (format "@end %s" (if numberedp 'enumerate 'itemize)) |
| 1087 | "@item\n" full-text "\n" pre-blanks contents))) | 834 | "\n"))) |
| 1088 | ;; If headline is not the last sibling simply return | ||
| 1089 | ;; LOW-LEVEL-BODY. Otherwise, also close the list, before any | ||
| 1090 | ;; blank line. | ||
| 1091 | (if (not (org-export-last-sibling-p headline info)) low-level-body | ||
| 1092 | (replace-regexp-in-string | ||
| 1093 | "[ \t\n]*\\'" | ||
| 1094 | (format "\n@end %s" (if numberedp 'enumerate 'itemize)) | ||
| 1095 | low-level-body)))) | ||
| 1096 | ;; Case 5: Standard headline. Export it as a section. | 835 | ;; Case 5: Standard headline. Export it as a section. |
| 1097 | (t | 836 | (t (concat node (format section-fmt full-text contents)))))) |
| 1098 | (cond | 837 | |
| 1099 | ((not (and tags (eq (plist-get info :with-tags) 'not-in-toc))) | 838 | ;;;; Inline Src Block |
| 1100 | ;; Regular section. Use specified format string. | ||
| 1101 | (format (replace-regexp-in-string "%]" "%%]" section-fmt) full-text | ||
| 1102 | (concat pre-blanks contents))) | ||
| 1103 | ((string-match "\\`@\\(.*?\\){" section-fmt) | ||
| 1104 | ;; If tags should be removed from table of contents, insert | ||
| 1105 | ;; title without tags as an alternative heading in sectioning | ||
| 1106 | ;; command. | ||
| 1107 | (format (replace-match (concat (match-string 1 section-fmt) "[%s]") | ||
| 1108 | nil nil section-fmt 1) | ||
| 1109 | ;; Replace square brackets with parenthesis since | ||
| 1110 | ;; square brackets are not supported in optional | ||
| 1111 | ;; arguments. | ||
| 1112 | (replace-regexp-in-string | ||
| 1113 | "\\[" "(" | ||
| 1114 | (replace-regexp-in-string | ||
| 1115 | "\\]" ")" | ||
| 1116 | full-text-no-tag)) | ||
| 1117 | full-text | ||
| 1118 | (concat pre-blanks contents))) | ||
| 1119 | (t | ||
| 1120 | ;; Impossible to add an alternative heading. Fallback to | ||
| 1121 | ;; regular sectioning format string. | ||
| 1122 | (format (replace-regexp-in-string "%]" "%%]" section-fmt) full-text | ||
| 1123 | (concat pre-blanks contents)))))))) | ||
| 1124 | |||
| 1125 | ;;; Inline Src Block | ||
| 1126 | 839 | ||
| 1127 | (defun org-texinfo-inline-src-block (inline-src-block contents info) | 840 | (defun org-texinfo-inline-src-block (inline-src-block contents info) |
| 1128 | "Transcode an INLINE-SRC-BLOCK element from Org to Texinfo. | 841 | "Transcode an INLINE-SRC-BLOCK element from Org to Texinfo. |
| @@ -1132,7 +845,7 @@ contextual information." | |||
| 1132 | (separator (org-texinfo--find-verb-separator code))) | 845 | (separator (org-texinfo--find-verb-separator code))) |
| 1133 | (concat "@verb{" separator code separator "}"))) | 846 | (concat "@verb{" separator code separator "}"))) |
| 1134 | 847 | ||
| 1135 | ;;; Inlinetask | 848 | ;;;; Inlinetask |
| 1136 | 849 | ||
| 1137 | (defun org-texinfo-inlinetask (inlinetask contents info) | 850 | (defun org-texinfo-inlinetask (inlinetask contents info) |
| 1138 | "Transcode an INLINETASK element from Org to Texinfo. | 851 | "Transcode an INLINETASK element from Org to Texinfo. |
| @@ -1165,7 +878,7 @@ holding contextual information." | |||
| 1165 | "\n") | 878 | "\n") |
| 1166 | full-title contents))))) | 879 | full-title contents))))) |
| 1167 | 880 | ||
| 1168 | ;;; Italic | 881 | ;;;; Italic |
| 1169 | 882 | ||
| 1170 | (defun org-texinfo-italic (italic contents info) | 883 | (defun org-texinfo-italic (italic contents info) |
| 1171 | "Transcode ITALIC from Org to Texinfo. | 884 | "Transcode ITALIC from Org to Texinfo. |
| @@ -1173,18 +886,18 @@ CONTENTS is the text with italic markup. INFO is a plist holding | |||
| 1173 | contextual information." | 886 | contextual information." |
| 1174 | (org-texinfo--text-markup contents 'italic)) | 887 | (org-texinfo--text-markup contents 'italic)) |
| 1175 | 888 | ||
| 1176 | ;;; Item | 889 | ;;;; Item |
| 1177 | 890 | ||
| 1178 | (defun org-texinfo-item (item contents info) | 891 | (defun org-texinfo-item (item contents info) |
| 1179 | "Transcode an ITEM element from Org to Texinfo. | 892 | "Transcode an ITEM element from Org to Texinfo. |
| 1180 | CONTENTS holds the contents of the item. INFO is a plist holding | 893 | CONTENTS holds the contents of the item. INFO is a plist holding |
| 1181 | contextual information." | 894 | contextual information." |
| 1182 | (let* ((tag (org-element-property :tag item)) | 895 | (format "@item%s\n%s" |
| 1183 | (desc (org-export-data tag info))) | 896 | (let ((tag (org-element-property :tag item))) |
| 1184 | (concat "\n@item " (if tag desc) "\n" | 897 | (if tag (concat " " (org-export-data tag info)) "")) |
| 1185 | (and contents (org-trim contents)) "\n"))) | 898 | (or contents ""))) |
| 1186 | 899 | ||
| 1187 | ;;; Keyword | 900 | ;;;; Keyword |
| 1188 | 901 | ||
| 1189 | (defun org-texinfo-keyword (keyword contents info) | 902 | (defun org-texinfo-keyword (keyword contents info) |
| 1190 | "Transcode a KEYWORD element from Org to Texinfo. | 903 | "Transcode a KEYWORD element from Org to Texinfo. |
| @@ -1200,14 +913,14 @@ CONTENTS is nil. INFO is a plist holding contextual information." | |||
| 1200 | ((string= key "TINDEX") (format "@tindex %s" value)) | 913 | ((string= key "TINDEX") (format "@tindex %s" value)) |
| 1201 | ((string= key "VINDEX") (format "@vindex %s" value))))) | 914 | ((string= key "VINDEX") (format "@vindex %s" value))))) |
| 1202 | 915 | ||
| 1203 | ;;; Line Break | 916 | ;;;; Line Break |
| 1204 | 917 | ||
| 1205 | (defun org-texinfo-line-break (line-break contents info) | 918 | (defun org-texinfo-line-break (line-break contents info) |
| 1206 | "Transcode a LINE-BREAK object from Org to Texinfo. | 919 | "Transcode a LINE-BREAK object from Org to Texinfo. |
| 1207 | CONTENTS is nil. INFO is a plist holding contextual information." | 920 | CONTENTS is nil. INFO is a plist holding contextual information." |
| 1208 | "@*\n") | 921 | "@*\n") |
| 1209 | 922 | ||
| 1210 | ;;; Link | 923 | ;;;; Link |
| 1211 | 924 | ||
| 1212 | (defun org-texinfo-link (link desc info) | 925 | (defun org-texinfo-link (link desc info) |
| 1213 | "Transcode a LINK object from Org to Texinfo. | 926 | "Transcode a LINK object from Org to Texinfo. |
| @@ -1225,55 +938,69 @@ INFO is a plist holding contextual information. See | |||
| 1225 | ((and (string= type "file") (file-name-absolute-p raw-path)) | 938 | ((and (string= type "file") (file-name-absolute-p raw-path)) |
| 1226 | (concat "file:" raw-path)) | 939 | (concat "file:" raw-path)) |
| 1227 | (t raw-path))) | 940 | (t raw-path))) |
| 1228 | (email (if (string= type "mailto") | ||
| 1229 | (let ((text (replace-regexp-in-string | ||
| 1230 | "@" "@@" raw-path))) | ||
| 1231 | (concat text (if desc (concat "," desc)))))) | ||
| 1232 | protocol) | 941 | protocol) |
| 1233 | (cond | 942 | (cond |
| 1234 | ;; Links pointing to a headline: Find destination and build | 943 | ((equal type "radio") |
| 1235 | ;; appropriate referencing command. | 944 | (let ((destination (org-export-resolve-radio-link link info))) |
| 1236 | ((member type '("custom-id" "id")) | 945 | (if (not destination) desc |
| 1237 | (let ((destination (org-export-resolve-id-link link info))) | 946 | (format "@ref{%s,,%s}" |
| 947 | (org-texinfo--get-node destination info) | ||
| 948 | desc)))) | ||
| 949 | ((member type '("custom-id" "id" "fuzzy")) | ||
| 950 | (let ((destination | ||
| 951 | (if (equal type "fuzzy") | ||
| 952 | (org-export-resolve-fuzzy-link link info) | ||
| 953 | (org-export-resolve-id-link link info)))) | ||
| 1238 | (case (org-element-type destination) | 954 | (case (org-element-type destination) |
| 955 | ((nil) | ||
| 956 | (format org-texinfo-link-with-unknown-path-format | ||
| 957 | (org-texinfo--sanitize-content path))) | ||
| 1239 | ;; Id link points to an external file. | 958 | ;; Id link points to an external file. |
| 1240 | (plain-text | 959 | (plain-text |
| 1241 | (if desc (format "@uref{file://%s,%s}" destination desc) | 960 | (if desc (format "@uref{file://%s,%s}" destination desc) |
| 1242 | (format "@uref{file://%s}" destination))) | 961 | (format "@uref{file://%s}" destination))) |
| 1243 | ;; LINK points to a headline. Use the headline as the NODE target | ||
| 1244 | (headline | 962 | (headline |
| 1245 | (format "@ref{%s,%s}" | 963 | (format "@ref{%s,%s}" |
| 1246 | (org-texinfo--get-node destination info) | 964 | (org-texinfo--get-node destination info) |
| 1247 | (or desc ""))) | 965 | (cond |
| 966 | (desc) | ||
| 967 | ((org-export-numbered-headline-p destination info) | ||
| 968 | (org-export-data | ||
| 969 | (org-element-property :title destination) info)) | ||
| 970 | (t | ||
| 971 | (mapconcat | ||
| 972 | #'number-to-string | ||
| 973 | (org-export-get-headline-number destination info) "."))))) | ||
| 1248 | (otherwise | 974 | (otherwise |
| 1249 | (let ((path (org-export-solidify-link-text path))) | 975 | (let ((topic |
| 1250 | (if (not desc) (format "@ref{%s}" path) | 976 | (or desc |
| 1251 | (format "@ref{%s,,%s}" path desc))))))) | 977 | (if (and (eq (org-element-type destination) 'headline) |
| 1252 | ((member type '("info")) | 978 | (not (org-export-numbered-headline-p |
| 979 | destination info))) | ||
| 980 | (org-export-data | ||
| 981 | (org-element-property :title destination) info)) | ||
| 982 | (let ((n (org-export-get-ordinal destination info))) | ||
| 983 | (cond | ||
| 984 | ((not n) nil) | ||
| 985 | ((integerp n) n) | ||
| 986 | (t (mapconcat #'number-to-string n "."))))))) | ||
| 987 | (when topic | ||
| 988 | (format "@ref{%s,,%s}" | ||
| 989 | (org-texinfo--get-node destination info) | ||
| 990 | topic))))))) | ||
| 991 | ((equal type "info") | ||
| 1253 | (let* ((info-path (split-string path "[:#]")) | 992 | (let* ((info-path (split-string path "[:#]")) |
| 1254 | (info-manual (car info-path)) | 993 | (info-manual (car info-path)) |
| 1255 | (info-node (or (cadr info-path) "top")) | 994 | (info-node (or (cadr info-path) "top")) |
| 1256 | (title (or desc ""))) | 995 | (title (or desc ""))) |
| 1257 | (format "@ref{%s,%s,,%s,}" info-node title info-manual))) | 996 | (format "@ref{%s,%s,,%s,}" info-node title info-manual))) |
| 1258 | ((member type '("fuzzy")) | 997 | ((string= type "mailto") |
| 1259 | (let ((destination (org-export-resolve-fuzzy-link link info))) | 998 | (format "@email{%s}" |
| 1260 | (case (org-element-type destination) | 999 | (concat (org-texinfo--sanitize-content path) |
| 1261 | ;; Id link points to an external file. | 1000 | (and desc (concat "," desc))))) |
| 1262 | (plain-text | 1001 | ((let ((protocol (nth 2 (assoc type org-link-protocols)))) |
| 1263 | (if desc (format "@uref{file://%s,%s}" destination desc) | 1002 | (and (functionp protocol) |
| 1264 | (format "@uref{file://%s}" destination))) | 1003 | (funcall protocol (org-link-unescape path) desc 'texinfo)))) |
| 1265 | ;; LINK points to a headline. Use the headline as the NODE target | ||
| 1266 | (headline | ||
| 1267 | (format "@ref{%s,%s}" | ||
| 1268 | (org-texinfo--get-node destination info) | ||
| 1269 | (or desc ""))) | ||
| 1270 | (otherwise | ||
| 1271 | (let ((path (org-export-solidify-link-text path))) | ||
| 1272 | (if (not desc) (format "@ref{%s}" path) | ||
| 1273 | (format "@ref{%s,,%s}" path desc))))))) | ||
| 1274 | ;; Special case for email addresses | ||
| 1275 | |||
| 1276 | (format "@email{%s}" email)) | ||
| 1277 | ;; External link with a description part. | 1004 | ;; External link with a description part. |
| 1278 | ((and path desc) (format "@uref{%s,%s}" path desc)) | 1005 | ((and path desc) (format "@uref{%s,%s}" path desc)) |
| 1279 | ;; External link without a description part. | 1006 | ;; External link without a description part. |
| @@ -1282,27 +1009,97 @@ INFO is a plist holding contextual information. See | |||
| 1282 | (t (format org-texinfo-link-with-unknown-path-format desc))))) | 1009 | (t (format org-texinfo-link-with-unknown-path-format desc))))) |
| 1283 | 1010 | ||
| 1284 | 1011 | ||
| 1285 | ;;; Menu | 1012 | ;;;; Menu |
| 1286 | 1013 | ||
| 1287 | (defun org-texinfo-make-menu (info level) | 1014 | (defun org-texinfo-make-menu (scope info &optional master) |
| 1288 | "Create the menu for inclusion in the texifo document. | 1015 | "Create the menu for inclusion in the Texinfo document. |
| 1289 | 1016 | ||
| 1290 | INFO is the parsed buffer that contains the headlines. LEVEL | 1017 | SCOPE is a headline or a full parse tree. INFO is the |
| 1291 | determines whether to make the main menu, or the detailed menu. | 1018 | communication channel, as a plist. |
| 1292 | 1019 | ||
| 1293 | This is only used for generating the primary menu. In-Node menus | 1020 | When optional argument MASTER is non-nil, generate a master menu, |
| 1294 | are generated directly." | 1021 | including detailed node listing." |
| 1295 | (let ((parse (plist-get info :parse-tree))) | 1022 | (let ((menu (org-texinfo--build-menu scope info))) |
| 1296 | (cond | 1023 | (when (org-string-nw-p menu) |
| 1297 | ;; Generate the main menu | 1024 | (org-element-normalize-string |
| 1298 | ((eq level 'main) (org-texinfo--build-menu parse 1 info)) | 1025 | (format |
| 1299 | ;; Generate the detailed (recursive) menu | 1026 | "@menu\n%s@end menu" |
| 1300 | ((eq level 'detailed) | 1027 | (concat menu |
| 1301 | ;; Requires recursion | 1028 | (when master |
| 1302 | ;;(org-texinfo--build-detailed-menu parse top info) | 1029 | (let ((detailmenu |
| 1303 | (org-texinfo--build-menu parse 1 info 'detailed))))) | 1030 | (org-texinfo--build-menu |
| 1304 | 1031 | scope info | |
| 1305 | ;;; Paragraph | 1032 | (let ((toc-depth (plist-get info :with-toc))) |
| 1033 | (if (wholenump toc-depth) toc-depth | ||
| 1034 | org-texinfo-max-toc-depth))))) | ||
| 1035 | (when (org-string-nw-p detailmenu) | ||
| 1036 | (concat "\n@detailmenu\n" | ||
| 1037 | "--- The Detailed Node Listing ---\n\n" | ||
| 1038 | detailmenu | ||
| 1039 | "@end detailmenu\n")))))))))) | ||
| 1040 | |||
| 1041 | (defun org-texinfo--build-menu (scope info &optional level) | ||
| 1042 | "Build menu for entries within SCOPE. | ||
| 1043 | SCOPE is a headline or a full parse tree. INFO is a plist | ||
| 1044 | containing contextual information. When optional argument LEVEL | ||
| 1045 | is an integer, build the menu recursively, down to this depth." | ||
| 1046 | (cond | ||
| 1047 | ((not level) | ||
| 1048 | (org-texinfo--format-entries (org-texinfo--menu-entries scope info) info)) | ||
| 1049 | ((zerop level) nil) | ||
| 1050 | (t | ||
| 1051 | (org-element-normalize-string | ||
| 1052 | (mapconcat | ||
| 1053 | (lambda (h) | ||
| 1054 | (let ((entries (org-texinfo--menu-entries h info))) | ||
| 1055 | (when entries | ||
| 1056 | (concat | ||
| 1057 | (format "%s\n\n%s\n" | ||
| 1058 | (org-export-data (org-export-get-alt-title h info) info) | ||
| 1059 | (org-texinfo--format-entries entries info)) | ||
| 1060 | (org-texinfo--build-menu h info (1- level)))))) | ||
| 1061 | (org-texinfo--menu-entries scope info) ""))))) | ||
| 1062 | |||
| 1063 | (defun org-texinfo--format-entries (entries info) | ||
| 1064 | "Format all direct menu entries in SCOPE, as a string. | ||
| 1065 | SCOPE is either a headline or a full Org document. INFO is | ||
| 1066 | a plist containing contextual information." | ||
| 1067 | (org-element-normalize-string | ||
| 1068 | (mapconcat | ||
| 1069 | (lambda (h) | ||
| 1070 | (let* ((title (org-export-data | ||
| 1071 | (org-export-get-alt-title h info) info)) | ||
| 1072 | (node (org-texinfo--get-node h info)) | ||
| 1073 | (entry (concat "* " title ":" | ||
| 1074 | (if (string= title node) ":" | ||
| 1075 | (concat " " node ". ")))) | ||
| 1076 | (desc (org-element-property :DESCRIPTION h))) | ||
| 1077 | (if (not desc) entry | ||
| 1078 | (format (format "%%-%ds %%s" org-texinfo-node-description-column) | ||
| 1079 | entry desc)))) | ||
| 1080 | entries "\n"))) | ||
| 1081 | |||
| 1082 | (defun org-texinfo--menu-entries (scope info) | ||
| 1083 | "List direct children in SCOPE needing a menu entry. | ||
| 1084 | SCOPE is a headline or a full parse tree. INFO is a plist | ||
| 1085 | holding contextual information." | ||
| 1086 | (let* ((cache (or (plist-get info :texinfo-entries-cache) | ||
| 1087 | (plist-get (plist-put info :texinfo-entries-cache | ||
| 1088 | (make-hash-table :test #'eq)) | ||
| 1089 | :texinfo-entries-cache))) | ||
| 1090 | (cached-entries (gethash scope cache 'no-cache))) | ||
| 1091 | (if (not (eq cached-entries 'no-cache)) cached-entries | ||
| 1092 | (puthash scope | ||
| 1093 | (org-element-map (org-element-contents scope) 'headline | ||
| 1094 | (lambda (h) | ||
| 1095 | (and (not (org-not-nil (org-element-property :COPYING h))) | ||
| 1096 | (not (org-element-property :footnote-section-p h)) | ||
| 1097 | (not (org-export-low-level-p h info)) | ||
| 1098 | h)) | ||
| 1099 | info nil 'headline) | ||
| 1100 | cache)))) | ||
| 1101 | |||
| 1102 | ;;;; Paragraph | ||
| 1306 | 1103 | ||
| 1307 | (defun org-texinfo-paragraph (paragraph contents info) | 1104 | (defun org-texinfo-paragraph (paragraph contents info) |
| 1308 | "Transcode a PARAGRAPH element from Org to Texinfo. | 1105 | "Transcode a PARAGRAPH element from Org to Texinfo. |
| @@ -1310,32 +1107,27 @@ CONTENTS is the contents of the paragraph, as a string. INFO is | |||
| 1310 | the plist used as a communication channel." | 1107 | the plist used as a communication channel." |
| 1311 | contents) | 1108 | contents) |
| 1312 | 1109 | ||
| 1313 | ;;; Plain List | 1110 | ;;;; Plain List |
| 1314 | 1111 | ||
| 1315 | (defun org-texinfo-plain-list (plain-list contents info) | 1112 | (defun org-texinfo-plain-list (plain-list contents info) |
| 1316 | "Transcode a PLAIN-LIST element from Org to Texinfo. | 1113 | "Transcode a PLAIN-LIST element from Org to Texinfo. |
| 1317 | CONTENTS is the contents of the list. INFO is a plist holding | 1114 | CONTENTS is the contents of the list. INFO is a plist holding |
| 1318 | contextual information." | 1115 | contextual information." |
| 1319 | (let* ((attr (org-export-read-attribute :attr_texinfo plain-list)) | 1116 | (let* ((attr (org-export-read-attribute :attr_texinfo plain-list)) |
| 1320 | (indic (or (plist-get attr :indic) | 1117 | (indic (or (plist-get attr :indic) org-texinfo-def-table-markup)) |
| 1321 | org-texinfo-def-table-markup)) | ||
| 1322 | (type (org-element-property :type plain-list)) | ||
| 1323 | (table-type (plist-get attr :table-type)) | 1118 | (table-type (plist-get attr :table-type)) |
| 1324 | ;; Ensure valid texinfo table type. | 1119 | (type (org-element-property :type plain-list)) |
| 1325 | (table-type (if (member table-type '("ftable" "vtable")) table-type | ||
| 1326 | "table")) | ||
| 1327 | (list-type (cond | 1120 | (list-type (cond |
| 1328 | ((eq type 'ordered) "enumerate") | 1121 | ((eq type 'ordered) "enumerate") |
| 1329 | ((eq type 'unordered) "itemize") | 1122 | ((eq type 'unordered) "itemize") |
| 1330 | ((eq type 'descriptive) table-type)))) | 1123 | ((member table-type '("ftable" "vtable")) table-type) |
| 1331 | (format "@%s%s\n@end %s" | 1124 | (t "table")))) |
| 1332 | (if (eq type 'descriptive) | 1125 | (format "@%s\n%s@end %s" |
| 1333 | (concat list-type " " indic) | 1126 | (if (eq type 'descriptive) (concat list-type " " indic) list-type) |
| 1334 | list-type) | ||
| 1335 | contents | 1127 | contents |
| 1336 | list-type))) | 1128 | list-type))) |
| 1337 | 1129 | ||
| 1338 | ;;; Plain Text | 1130 | ;;;; Plain Text |
| 1339 | 1131 | ||
| 1340 | (defun org-texinfo-plain-text (text info) | 1132 | (defun org-texinfo-plain-text (text info) |
| 1341 | "Transcode a TEXT string from Org to Texinfo. | 1133 | "Transcode a TEXT string from Org to Texinfo. |
| @@ -1366,7 +1158,7 @@ contextual information." | |||
| 1366 | ;; Return value. | 1158 | ;; Return value. |
| 1367 | output)) | 1159 | output)) |
| 1368 | 1160 | ||
| 1369 | ;;; Planning | 1161 | ;;;; Planning |
| 1370 | 1162 | ||
| 1371 | (defun org-texinfo-planning (planning contents info) | 1163 | (defun org-texinfo-planning (planning contents info) |
| 1372 | "Transcode a PLANNING element from Org to Texinfo. | 1164 | "Transcode a PLANNING element from Org to Texinfo. |
| @@ -1402,7 +1194,7 @@ information." | |||
| 1402 | " ") | 1194 | " ") |
| 1403 | "@*")) | 1195 | "@*")) |
| 1404 | 1196 | ||
| 1405 | ;;; Property Drawer | 1197 | ;;;; Property Drawer |
| 1406 | 1198 | ||
| 1407 | (defun org-texinfo-property-drawer (property-drawer contents info) | 1199 | (defun org-texinfo-property-drawer (property-drawer contents info) |
| 1408 | "Transcode a PROPERTY-DRAWER element from Org to Texinfo. | 1200 | "Transcode a PROPERTY-DRAWER element from Org to Texinfo. |
| @@ -1412,7 +1204,7 @@ information." | |||
| 1412 | ;; lines nonetheless. | 1204 | ;; lines nonetheless. |
| 1413 | "") | 1205 | "") |
| 1414 | 1206 | ||
| 1415 | ;;; Quote Block | 1207 | ;;;; Quote Block |
| 1416 | 1208 | ||
| 1417 | (defun org-texinfo-quote-block (quote-block contents info) | 1209 | (defun org-texinfo-quote-block (quote-block contents info) |
| 1418 | "Transcode a QUOTE-BLOCK element from Org to Texinfo. | 1210 | "Transcode a QUOTE-BLOCK element from Org to Texinfo. |
| @@ -1424,7 +1216,7 @@ holding contextual information." | |||
| 1424 | (format " %s" title))))) | 1216 | (format " %s" title))))) |
| 1425 | (format "%s\n%s@end quotation" start-quote contents))) | 1217 | (format "%s\n%s@end quotation" start-quote contents))) |
| 1426 | 1218 | ||
| 1427 | ;;; Quote Section | 1219 | ;;;; Quote Section |
| 1428 | 1220 | ||
| 1429 | (defun org-texinfo-quote-section (quote-section contents info) | 1221 | (defun org-texinfo-quote-section (quote-section contents info) |
| 1430 | "Transcode a QUOTE-SECTION element from Org to Texinfo. | 1222 | "Transcode a QUOTE-SECTION element from Org to Texinfo. |
| @@ -1433,7 +1225,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." | |||
| 1433 | (org-element-property :value quote-section)))) | 1225 | (org-element-property :value quote-section)))) |
| 1434 | (when value (format "@verbatim\n%s@end verbatim" value)))) | 1226 | (when value (format "@verbatim\n%s@end verbatim" value)))) |
| 1435 | 1227 | ||
| 1436 | ;;; Radio Target | 1228 | ;;;; Radio Target |
| 1437 | 1229 | ||
| 1438 | (defun org-texinfo-radio-target (radio-target text info) | 1230 | (defun org-texinfo-radio-target (radio-target text info) |
| 1439 | "Transcode a RADIO-TARGET object from Org to Texinfo. | 1231 | "Transcode a RADIO-TARGET object from Org to Texinfo. |
| @@ -1444,15 +1236,17 @@ contextual information." | |||
| 1444 | (org-element-property :value radio-target)) | 1236 | (org-element-property :value radio-target)) |
| 1445 | text)) | 1237 | text)) |
| 1446 | 1238 | ||
| 1447 | ;;; Section | 1239 | ;;;; Section |
| 1448 | 1240 | ||
| 1449 | (defun org-texinfo-section (section contents info) | 1241 | (defun org-texinfo-section (section contents info) |
| 1450 | "Transcode a SECTION element from Org to Texinfo. | 1242 | "Transcode a SECTION element from Org to Texinfo. |
| 1451 | CONTENTS holds the contents of the section. INFO is a plist | 1243 | CONTENTS holds the contents of the section. INFO is a plist |
| 1452 | holding contextual information." | 1244 | holding contextual information." |
| 1453 | contents) | 1245 | (concat contents |
| 1246 | (let ((parent (org-export-get-parent-headline section))) | ||
| 1247 | (and parent (org-texinfo-make-menu parent info))))) | ||
| 1454 | 1248 | ||
| 1455 | ;;; Special Block | 1249 | ;;;; Special Block |
| 1456 | 1250 | ||
| 1457 | (defun org-texinfo-special-block (special-block contents info) | 1251 | (defun org-texinfo-special-block (special-block contents info) |
| 1458 | "Transcode a SPECIAL-BLOCK element from Org to Texinfo. | 1252 | "Transcode a SPECIAL-BLOCK element from Org to Texinfo. |
| @@ -1460,34 +1254,26 @@ CONTENTS holds the contents of the block. INFO is a plist used | |||
| 1460 | as a communication channel." | 1254 | as a communication channel." |
| 1461 | contents) | 1255 | contents) |
| 1462 | 1256 | ||
| 1463 | ;;; Src Block | 1257 | ;;;; Src Block |
| 1464 | 1258 | ||
| 1465 | (defun org-texinfo-src-block (src-block contents info) | 1259 | (defun org-texinfo-src-block (src-block contents info) |
| 1466 | "Transcode a SRC-BLOCK element from Org to Texinfo. | 1260 | "Transcode a SRC-BLOCK element from Org to Texinfo. |
| 1467 | CONTENTS holds the contents of the item. INFO is a plist holding | 1261 | CONTENTS holds the contents of the item. INFO is a plist holding |
| 1468 | contextual information." | 1262 | contextual information." |
| 1469 | (let* ((lang (org-element-property :language src-block)) | 1263 | (let ((lispp (org-string-match-p "lisp" |
| 1470 | (lisp-p (string-match-p "lisp" lang)) | 1264 | (org-element-property :language src-block))) |
| 1471 | (src-contents (org-texinfo--sanitize-content | 1265 | (code (org-texinfo--sanitize-content |
| 1472 | (org-export-format-code-default src-block info)))) | 1266 | (org-export-format-code-default src-block info)))) |
| 1473 | (cond | 1267 | (format (if lispp "@lisp\n%s@end lisp" "@example\n%s@end example") code))) |
| 1474 | ;; Case 1. Lisp Block | ||
| 1475 | (lisp-p | ||
| 1476 | (format "@lisp\n%s@end lisp" | ||
| 1477 | src-contents)) | ||
| 1478 | ;; Case 2. Other blocks | ||
| 1479 | (t | ||
| 1480 | (format "@example\n%s@end example" | ||
| 1481 | src-contents))))) | ||
| 1482 | 1268 | ||
| 1483 | ;;; Statistics Cookie | 1269 | ;;;; Statistics Cookie |
| 1484 | 1270 | ||
| 1485 | (defun org-texinfo-statistics-cookie (statistics-cookie contents info) | 1271 | (defun org-texinfo-statistics-cookie (statistics-cookie contents info) |
| 1486 | "Transcode a STATISTICS-COOKIE object from Org to Texinfo. | 1272 | "Transcode a STATISTICS-COOKIE object from Org to Texinfo. |
| 1487 | CONTENTS is nil. INFO is a plist holding contextual information." | 1273 | CONTENTS is nil. INFO is a plist holding contextual information." |
| 1488 | (org-element-property :value statistics-cookie)) | 1274 | (org-element-property :value statistics-cookie)) |
| 1489 | 1275 | ||
| 1490 | ;;; Subscript | 1276 | ;;;; Subscript |
| 1491 | 1277 | ||
| 1492 | (defun org-texinfo-subscript (subscript contents info) | 1278 | (defun org-texinfo-subscript (subscript contents info) |
| 1493 | "Transcode a SUBSCRIPT object from Org to Texinfo. | 1279 | "Transcode a SUBSCRIPT object from Org to Texinfo. |
| @@ -1495,7 +1281,7 @@ CONTENTS is the contents of the object. INFO is a plist holding | |||
| 1495 | contextual information." | 1281 | contextual information." |
| 1496 | (format "@math{_%s}" contents)) | 1282 | (format "@math{_%s}" contents)) |
| 1497 | 1283 | ||
| 1498 | ;;; Superscript | 1284 | ;;;; Superscript |
| 1499 | 1285 | ||
| 1500 | (defun org-texinfo-superscript (superscript contents info) | 1286 | (defun org-texinfo-superscript (superscript contents info) |
| 1501 | "Transcode a SUPERSCRIPT object from Org to Texinfo. | 1287 | "Transcode a SUPERSCRIPT object from Org to Texinfo. |
| @@ -1503,96 +1289,47 @@ CONTENTS is the contents of the object. INFO is a plist holding | |||
| 1503 | contextual information." | 1289 | contextual information." |
| 1504 | (format "@math{^%s}" contents)) | 1290 | (format "@math{^%s}" contents)) |
| 1505 | 1291 | ||
| 1506 | ;;; Table | 1292 | ;;;; Table |
| 1507 | ;; | ||
| 1508 | ;; `org-texinfo-table' is the entry point for table transcoding. It | ||
| 1509 | ;; takes care of tables with a "verbatim" attribute. Otherwise, it | ||
| 1510 | ;; delegates the job to either `org-texinfo-table--table.el-table' or | ||
| 1511 | ;; `org-texinfo-table--org-table' functions, depending of the type of | ||
| 1512 | ;; the table. | ||
| 1513 | ;; | ||
| 1514 | ;; `org-texinfo-table--align-string' is a subroutine used to build | ||
| 1515 | ;; alignment string for Org tables. | ||
| 1516 | 1293 | ||
| 1517 | (defun org-texinfo-table (table contents info) | 1294 | (defun org-texinfo-table (table contents info) |
| 1518 | "Transcode a TABLE element from Org to Texinfo. | 1295 | "Transcode a TABLE element from Org to Texinfo. |
| 1519 | CONTENTS is the contents of the table. INFO is a plist holding | 1296 | CONTENTS is the contents of the table. INFO is a plist holding |
| 1520 | contextual information." | 1297 | contextual information." |
| 1521 | (cond | 1298 | (if (eq (org-element-property :type table) 'table.el) |
| 1522 | ;; Case 1: verbatim table. | 1299 | (format "@verbatim\n%s@end verbatim" |
| 1523 | ((or org-texinfo-tables-verbatim | 1300 | (org-element-normalize-string |
| 1524 | (let ((attr (mapconcat 'identity | 1301 | (org-element-property :value table))) |
| 1525 | (org-element-property :attr_latex table) | 1302 | (let* ((col-width (org-export-read-attribute :attr_texinfo table :columns)) |
| 1526 | " "))) | 1303 | (columns |
| 1527 | (and attr (string-match "\\<verbatim\\>" attr)))) | 1304 | (if col-width (format "@columnfractions %s" col-width) |
| 1528 | (format "@verbatim \n%s\n@end verbatim" | 1305 | (org-texinfo-table-column-widths table info)))) |
| 1529 | ;; Re-create table, without affiliated keywords. | 1306 | (format "@multitable %s\n%s@end multitable" |
| 1530 | (org-trim | 1307 | columns |
| 1531 | (org-element-interpret-data | 1308 | contents)))) |
| 1532 | `(table nil ,@(org-element-contents table)))))) | ||
| 1533 | ;; Case 2: table.el table. Convert it using appropriate tools. | ||
| 1534 | ((eq (org-element-property :type table) 'table.el) | ||
| 1535 | (org-texinfo-table--table.el-table table contents info)) | ||
| 1536 | ;; Case 3: Standard table. | ||
| 1537 | (t (org-texinfo-table--org-table table contents info)))) | ||
| 1538 | 1309 | ||
| 1539 | (defun org-texinfo-table-column-widths (table info) | 1310 | (defun org-texinfo-table-column-widths (table info) |
| 1540 | "Determine the largest table cell in each column to process alignment. | 1311 | "Determine the largest table cell in each column to process alignment. |
| 1541 | |||
| 1542 | TABLE is the table element to transcode. INFO is a plist used as | 1312 | TABLE is the table element to transcode. INFO is a plist used as |
| 1543 | a communication channel." | 1313 | a communication channel." |
| 1544 | (let* ((rows (org-element-map table 'table-row 'identity info)) | 1314 | (let ((widths (make-vector (cdr (org-export-table-dimensions table info)) 0))) |
| 1545 | (collected (loop for row in rows collect | 1315 | (org-element-map table 'table-row |
| 1546 | (org-element-map row 'table-cell 'identity info))) | 1316 | (lambda (row) |
| 1547 | (number-cells (length (car collected))) | 1317 | (let ((idx 0)) |
| 1548 | cells counts) | 1318 | (org-element-map row 'table-cell |
| 1549 | (loop for row in collected do | 1319 | (lambda (cell) |
| 1550 | (push (mapcar (lambda (ref) | 1320 | ;; Length of the cell in the original buffer is only an |
| 1551 | (let* ((start (org-element-property :contents-begin ref)) | 1321 | ;; approximation of the length of the cell in the |
| 1552 | (end (org-element-property :contents-end ref)) | 1322 | ;; output. It can sometimes fail (e.g. it considers |
| 1553 | (length (- end start))) | 1323 | ;; "/a/" being larger than "ab"). |
| 1554 | length)) row) cells)) | 1324 | (let ((w (- (org-element-property :contents-end cell) |
| 1555 | (setq cells (org-remove-if 'null cells)) | 1325 | (org-element-property :contents-begin cell)))) |
| 1556 | (push (loop for count from 0 to (- number-cells 1) collect | 1326 | (aset widths idx (max w (aref widths idx)))) |
| 1557 | (loop for item in cells collect | 1327 | (incf idx)) |
| 1558 | (nth count item))) counts) | 1328 | info))) |
| 1559 | (mapconcat (lambda (size) | 1329 | info) |
| 1560 | (make-string size ?a)) (mapcar (lambda (ref) | 1330 | (format "{%s}" (mapconcat (lambda (w) (make-string w ?a)) widths "} {")))) |
| 1561 | (apply 'max `(,@ref))) (car counts)) | 1331 | |
| 1562 | "} {"))) | 1332 | ;;;; Table Cell |
| 1563 | |||
| 1564 | (defun org-texinfo-table--org-table (table contents info) | ||
| 1565 | "Return appropriate Texinfo code for an Org table. | ||
| 1566 | |||
| 1567 | TABLE is the table type element to transcode. CONTENTS is its | ||
| 1568 | contents, as a string. INFO is a plist used as a communication | ||
| 1569 | channel. | ||
| 1570 | |||
| 1571 | This function assumes TABLE has `org' as its `:type' attribute." | ||
| 1572 | (let* ((attr (org-export-read-attribute :attr_texinfo table)) | ||
| 1573 | (col-width (plist-get attr :columns)) | ||
| 1574 | (columns (if col-width | ||
| 1575 | (format "@columnfractions %s" | ||
| 1576 | col-width) | ||
| 1577 | (format "{%s}" | ||
| 1578 | (org-texinfo-table-column-widths | ||
| 1579 | table info))))) | ||
| 1580 | ;; Prepare the final format string for the table. | ||
| 1581 | (cond | ||
| 1582 | ;; Longtable. | ||
| 1583 | ;; Others. | ||
| 1584 | (t (concat | ||
| 1585 | (format "@multitable %s\n%s@end multitable" | ||
| 1586 | columns | ||
| 1587 | contents)))))) | ||
| 1588 | |||
| 1589 | (defun org-texinfo-table--table.el-table (table contents info) | ||
| 1590 | "Returns nothing. | ||
| 1591 | |||
| 1592 | Rather than return an invalid table, nothing is returned." | ||
| 1593 | 'nil) | ||
| 1594 | |||
| 1595 | ;;; Table Cell | ||
| 1596 | 1333 | ||
| 1597 | (defun org-texinfo-table-cell (table-cell contents info) | 1334 | (defun org-texinfo-table-cell (table-cell contents info) |
| 1598 | "Transcode a TABLE-CELL element from Org to Texinfo. | 1335 | "Transcode a TABLE-CELL element from Org to Texinfo. |
| @@ -1609,7 +1346,7 @@ a communication channel." | |||
| 1609 | contents) | 1346 | contents) |
| 1610 | (when (org-export-get-next-element table-cell info) "\n@tab "))) | 1347 | (when (org-export-get-next-element table-cell info) "\n@tab "))) |
| 1611 | 1348 | ||
| 1612 | ;;; Table Row | 1349 | ;;;; Table Row |
| 1613 | 1350 | ||
| 1614 | (defun org-texinfo-table-row (table-row contents info) | 1351 | (defun org-texinfo-table-row (table-row contents info) |
| 1615 | "Transcode a TABLE-ROW element from Org to Texinfo. | 1352 | "Transcode a TABLE-ROW element from Org to Texinfo. |
| @@ -1618,21 +1355,15 @@ a communication channel." | |||
| 1618 | ;; Rules are ignored since table separators are deduced from | 1355 | ;; Rules are ignored since table separators are deduced from |
| 1619 | ;; borders of the current row. | 1356 | ;; borders of the current row. |
| 1620 | (when (eq (org-element-property :type table-row) 'standard) | 1357 | (when (eq (org-element-property :type table-row) 'standard) |
| 1621 | (let ((rowgroup-tag | 1358 | (let ((rowgroup-tag |
| 1622 | (cond | 1359 | (if (and (= 1 (org-export-table-row-group table-row info)) |
| 1623 | ;; Case 1: Belongs to second or subsequent rowgroup. | 1360 | (org-export-table-has-header-p |
| 1624 | ((not (= 1 (org-export-table-row-group table-row info))) | 1361 | (org-export-get-parent-table table-row) info)) |
| 1625 | "@item ") | 1362 | "@headitem " |
| 1626 | ;; Case 2: Row is from first rowgroup. Table has >=1 rowgroups. | 1363 | "@item "))) |
| 1627 | ((org-export-table-has-header-p | 1364 | (concat rowgroup-tag contents "\n")))) |
| 1628 | (org-export-get-parent-table table-row) info) | 1365 | |
| 1629 | "@headitem ") | 1366 | ;;;; Target |
| 1630 | ;; Case 3: Row is from first and only row group. | ||
| 1631 | (t "@item ")))) | ||
| 1632 | (when (eq (org-element-property :type table-row) 'standard) | ||
| 1633 | (concat rowgroup-tag contents "\n"))))) | ||
| 1634 | |||
| 1635 | ;;; Target | ||
| 1636 | 1367 | ||
| 1637 | (defun org-texinfo-target (target contents info) | 1368 | (defun org-texinfo-target (target contents info) |
| 1638 | "Transcode a TARGET object from Org to Texinfo. | 1369 | "Transcode a TARGET object from Org to Texinfo. |
| @@ -1641,7 +1372,7 @@ information." | |||
| 1641 | (format "@anchor{%s}" | 1372 | (format "@anchor{%s}" |
| 1642 | (org-export-solidify-link-text (org-element-property :value target)))) | 1373 | (org-export-solidify-link-text (org-element-property :value target)))) |
| 1643 | 1374 | ||
| 1644 | ;;; Timestamp | 1375 | ;;;; Timestamp |
| 1645 | 1376 | ||
| 1646 | (defun org-texinfo-timestamp (timestamp contents info) | 1377 | (defun org-texinfo-timestamp (timestamp contents info) |
| 1647 | "Transcode a TIMESTAMP object from Org to Texinfo. | 1378 | "Transcode a TIMESTAMP object from Org to Texinfo. |
| @@ -1656,7 +1387,7 @@ information." | |||
| 1656 | (format org-texinfo-inactive-timestamp-format value)) | 1387 | (format org-texinfo-inactive-timestamp-format value)) |
| 1657 | (t (format org-texinfo-diary-timestamp-format value))))) | 1388 | (t (format org-texinfo-diary-timestamp-format value))))) |
| 1658 | 1389 | ||
| 1659 | ;;; Verbatim | 1390 | ;;;; Verbatim |
| 1660 | 1391 | ||
| 1661 | (defun org-texinfo-verbatim (verbatim contents info) | 1392 | (defun org-texinfo-verbatim (verbatim contents info) |
| 1662 | "Transcode a VERBATIM object from Org to Texinfo. | 1393 | "Transcode a VERBATIM object from Org to Texinfo. |
| @@ -1664,26 +1395,13 @@ CONTENTS is nil. INFO is a plist used as a communication | |||
| 1664 | channel." | 1395 | channel." |
| 1665 | (org-texinfo--text-markup (org-element-property :value verbatim) 'verbatim)) | 1396 | (org-texinfo--text-markup (org-element-property :value verbatim) 'verbatim)) |
| 1666 | 1397 | ||
| 1667 | ;;; Verse Block | 1398 | ;;;; Verse Block |
| 1668 | 1399 | ||
| 1669 | (defun org-texinfo-verse-block (verse-block contents info) | 1400 | (defun org-texinfo-verse-block (verse-block contents info) |
| 1670 | "Transcode a VERSE-BLOCK element from Org to Texinfo. | 1401 | "Transcode a VERSE-BLOCK element from Org to Texinfo. |
| 1671 | CONTENTS is verse block contents. INFO is a plist holding | 1402 | CONTENTS is verse block contents. INFO is a plist holding |
| 1672 | contextual information." | 1403 | contextual information." |
| 1673 | ;; In a verse environment, add a line break to each newline | 1404 | (format "@display\n%s@end display" contents)) |
| 1674 | ;; character and change each white space at beginning of a line | ||
| 1675 | ;; into a space of 1 em. Also change each blank line with | ||
| 1676 | ;; a vertical space of 1 em. | ||
| 1677 | (progn | ||
| 1678 | (setq contents (replace-regexp-in-string | ||
| 1679 | "^ *\\\\\\\\$" "\\\\vspace*{1em}" | ||
| 1680 | (replace-regexp-in-string | ||
| 1681 | "\\(\\\\\\\\\\)?[ \t]*\n" " \\\\\\\\\n" contents))) | ||
| 1682 | (while (string-match "^[ \t]+" contents) | ||
| 1683 | (let ((new-str (format "\\hspace*{%dem}" | ||
| 1684 | (length (match-string 0 contents))))) | ||
| 1685 | (setq contents (replace-match new-str nil t contents)))) | ||
| 1686 | (format "\\begin{verse}\n%s\\end{verse}" contents))) | ||
| 1687 | 1405 | ||
| 1688 | 1406 | ||
| 1689 | ;;; Interactive functions | 1407 | ;;; Interactive functions |
| @@ -1797,29 +1515,21 @@ Return INFO file name or an error if it couldn't be produced." | |||
| 1797 | errors) | 1515 | errors) |
| 1798 | (message (format "Processing Texinfo file %s..." file)) | 1516 | (message (format "Processing Texinfo file %s..." file)) |
| 1799 | (save-window-excursion | 1517 | (save-window-excursion |
| 1800 | (cond | 1518 | ;; Replace %b, %f and %o with appropriate values in each command |
| 1801 | ;; A function is provided: Apply it. | 1519 | ;; before applying it. Output is redirected to "*Org INFO |
| 1802 | ((functionp org-texinfo-info-process) | 1520 | ;; Texinfo Output*" buffer. |
| 1803 | (funcall org-texinfo-info-process (shell-quote-argument file))) | 1521 | (let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*"))) |
| 1804 | ;; A list is provided: Replace %b, %f and %o with appropriate | 1522 | (dolist (command org-texinfo-info-process) |
| 1805 | ;; values in each command before applying it. Output is | 1523 | (shell-command |
| 1806 | ;; redirected to "*Org INFO Texinfo Output*" buffer. | 1524 | (replace-regexp-in-string |
| 1807 | ((consp org-texinfo-info-process) | 1525 | "%b" (shell-quote-argument base-name) |
| 1808 | (let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*"))) | 1526 | (replace-regexp-in-string |
| 1809 | (mapc | 1527 | "%f" (shell-quote-argument full-name) |
| 1810 | (lambda (command) | 1528 | (replace-regexp-in-string |
| 1811 | (shell-command | 1529 | "%o" (shell-quote-argument out-dir) command t t) t t) t t) |
| 1812 | (replace-regexp-in-string | 1530 | outbuf)) |
| 1813 | "%b" (shell-quote-argument base-name) | 1531 | ;; Collect standard errors from output buffer. |
| 1814 | (replace-regexp-in-string | 1532 | (setq errors (org-texinfo-collect-errors outbuf))) |
| 1815 | "%f" (shell-quote-argument full-name) | ||
| 1816 | (replace-regexp-in-string | ||
| 1817 | "%o" (shell-quote-argument out-dir) command t t) t t) t t) | ||
| 1818 | outbuf)) | ||
| 1819 | org-texinfo-info-process) | ||
| 1820 | ;; Collect standard errors from output buffer. | ||
| 1821 | (setq errors (org-texinfo-collect-errors outbuf)))) | ||
| 1822 | (t (error "No valid command to process to Info"))) | ||
| 1823 | (let ((infofile (concat out-dir base-name ".info"))) | 1533 | (let ((infofile (concat out-dir base-name ".info"))) |
| 1824 | ;; Check for process failure. Provide collected errors if | 1534 | ;; Check for process failure. Provide collected errors if |
| 1825 | ;; possible. | 1535 | ;; possible. |
diff --git a/lisp/org/ox.el b/lisp/org/ox.el index faa2e0541b4..dd81ad13d1d 100644 --- a/lisp/org/ox.el +++ b/lisp/org/ox.el | |||
| @@ -814,7 +814,7 @@ This variable can be either set to `buffer' or `subtree'." | |||
| 814 | 814 | ||
| 815 | (defcustom org-export-show-temporary-export-buffer t | 815 | (defcustom org-export-show-temporary-export-buffer t |
| 816 | "Non-nil means show buffer after exporting to temp buffer. | 816 | "Non-nil means show buffer after exporting to temp buffer. |
| 817 | When Org exports to a file, the buffer visiting that file is ever | 817 | When Org exports to a file, the buffer visiting that file is never |
| 818 | shown, but remains buried. However, when exporting to | 818 | shown, but remains buried. However, when exporting to |
| 819 | a temporary buffer, that buffer is popped up in a second window. | 819 | a temporary buffer, that buffer is popped up in a second window. |
| 820 | When this variable is nil, the buffer remains buried also in | 820 | When this variable is nil, the buffer remains buried also in |
| @@ -1317,6 +1317,10 @@ The back-end could then be called with, for example: | |||
| 1317 | ;; - category :: tree | 1317 | ;; - category :: tree |
| 1318 | ;; - type :: list of elements and objects | 1318 | ;; - type :: list of elements and objects |
| 1319 | ;; | 1319 | ;; |
| 1320 | ;; + `:input-buffer' :: Name of input buffer. | ||
| 1321 | ;; - category :: option | ||
| 1322 | ;; - type :: string | ||
| 1323 | ;; | ||
| 1320 | ;; + `:input-file' :: Full path to input file, if any. | 1324 | ;; + `:input-file' :: Full path to input file, if any. |
| 1321 | ;; - category :: option | 1325 | ;; - category :: option |
| 1322 | ;; - type :: string or nil | 1326 | ;; - type :: string or nil |
| @@ -1329,6 +1333,10 @@ The back-end could then be called with, for example: | |||
| 1329 | ;; - category :: option | 1333 | ;; - category :: option |
| 1330 | ;; - type :: string | 1334 | ;; - type :: string |
| 1331 | ;; | 1335 | ;; |
| 1336 | ;; + `:output-file' :: Full path to output file, if any. | ||
| 1337 | ;; - category :: option | ||
| 1338 | ;; - type :: string or nil | ||
| 1339 | ;; | ||
| 1332 | ;; + `:parse-tree' :: Whole parse tree, available at any time during | 1340 | ;; + `:parse-tree' :: Whole parse tree, available at any time during |
| 1333 | ;; transcoding. | 1341 | ;; transcoding. |
| 1334 | ;; - category :: option | 1342 | ;; - category :: option |
| @@ -1765,17 +1773,19 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored." | |||
| 1765 | (when (stringp value) | 1773 | (when (stringp value) |
| 1766 | (setq plist | 1774 | (setq plist |
| 1767 | (plist-put plist property | 1775 | (plist-put plist property |
| 1768 | (org-element-parse-secondary-string | 1776 | (or (org-element-parse-secondary-string |
| 1769 | value (org-element-restriction 'keyword)))))))))) | 1777 | value (org-element-restriction 'keyword)) |
| 1778 | ;; When TITLE keyword sets an empty | ||
| 1779 | ;; string, make sure it doesn't | ||
| 1780 | ;; appear as nil in the plist. | ||
| 1781 | (and (eq property :title) "")))))))))) | ||
| 1770 | 1782 | ||
| 1771 | (defun org-export--get-buffer-attributes () | 1783 | (defun org-export--get-buffer-attributes () |
| 1772 | "Return properties related to buffer attributes, as a plist." | 1784 | "Return properties related to buffer attributes, as a plist." |
| 1773 | ;; Store full path of input file name, or nil. For internal use. | 1785 | ;; Store full path of input file name, or nil. For internal use. |
| 1774 | (let ((visited-file (buffer-file-name (buffer-base-buffer)))) | 1786 | (let ((visited-file (buffer-file-name (buffer-base-buffer)))) |
| 1775 | (list :input-file visited-file | 1787 | (list :input-file visited-file |
| 1776 | :title (if (not visited-file) (buffer-name (buffer-base-buffer)) | 1788 | :input-buffer (buffer-name (buffer-base-buffer))))) |
| 1777 | (file-name-sans-extension | ||
| 1778 | (file-name-nondirectory visited-file)))))) | ||
| 1779 | 1789 | ||
| 1780 | (defun org-export--get-global-options (&optional backend) | 1790 | (defun org-export--get-global-options (&optional backend) |
| 1781 | "Return global export options as a plist. | 1791 | "Return global export options as a plist. |
| @@ -1788,23 +1798,22 @@ process." | |||
| 1788 | (all (append (and backend (org-export-get-all-options backend)) | 1798 | (all (append (and backend (org-export-get-all-options backend)) |
| 1789 | org-export-options-alist))) | 1799 | org-export-options-alist))) |
| 1790 | (dolist (cell all plist) | 1800 | (dolist (cell all plist) |
| 1791 | (let ((prop (car cell)) | 1801 | (let ((prop (car cell))) |
| 1792 | (default-value (nth 3 cell))) | 1802 | (unless (plist-member plist prop) |
| 1793 | (unless (or (not default-value) (plist-member plist prop)) | ||
| 1794 | (setq plist | 1803 | (setq plist |
| 1795 | (plist-put | 1804 | (plist-put |
| 1796 | plist | 1805 | plist |
| 1797 | prop | 1806 | prop |
| 1798 | ;; Eval default value provided. If keyword is | 1807 | ;; Evaluate default value provided. If keyword is |
| 1799 | ;; a member of `org-element-document-properties', | 1808 | ;; a member of `org-element-document-properties', |
| 1800 | ;; parse it as a secondary string before storing it. | 1809 | ;; parse it as a secondary string before storing it. |
| 1801 | (let ((value (eval (nth 3 cell)))) | 1810 | (let ((value (eval (nth 3 cell)))) |
| 1802 | (if (not (stringp value)) value | 1811 | (if (and (stringp value) |
| 1803 | (let ((keyword (nth 1 cell))) | 1812 | (member (nth 1 cell) |
| 1804 | (if (member keyword org-element-document-properties) | 1813 | org-element-document-properties)) |
| 1805 | (org-element-parse-secondary-string | 1814 | (org-element-parse-secondary-string |
| 1806 | value (org-element-restriction 'keyword)) | 1815 | value (org-element-restriction 'keyword)) |
| 1807 | value))))))))))) | 1816 | value))))))))) |
| 1808 | 1817 | ||
| 1809 | (defun org-export--list-bound-variables () | 1818 | (defun org-export--list-bound-variables () |
| 1810 | "Return variables bound from BIND keywords in current buffer. | 1819 | "Return variables bound from BIND keywords in current buffer. |
| @@ -1843,6 +1852,13 @@ an alist where associations are (VARIABLE-NAME VALUE)." | |||
| 1843 | ;; Return value in appropriate order of appearance. | 1852 | ;; Return value in appropriate order of appearance. |
| 1844 | (nreverse (funcall collect-bind nil nil))))) | 1853 | (nreverse (funcall collect-bind nil nil))))) |
| 1845 | 1854 | ||
| 1855 | ;; defsubst org-export-get-parent must be defined before first use, | ||
| 1856 | ;; was originally defined in the topology section | ||
| 1857 | |||
| 1858 | (defsubst org-export-get-parent (blob) | ||
| 1859 | "Return BLOB parent or nil. | ||
| 1860 | BLOB is the element or object considered." | ||
| 1861 | (org-element-property :parent blob)) | ||
| 1846 | 1862 | ||
| 1847 | ;;;; Tree Properties | 1863 | ;;;; Tree Properties |
| 1848 | ;; | 1864 | ;; |
| @@ -2146,9 +2162,8 @@ INFO is a plist containing export directives." | |||
| 2146 | DATA is a parse tree, an element or an object or a secondary | 2162 | DATA is a parse tree, an element or an object or a secondary |
| 2147 | string. INFO is a plist holding export options. | 2163 | string. INFO is a plist holding export options. |
| 2148 | 2164 | ||
| 2149 | Return transcoded string." | 2165 | Return a string." |
| 2150 | (let ((memo (gethash data (plist-get info :exported-data) 'no-memo))) | 2166 | (or (gethash data (plist-get info :exported-data)) |
| 2151 | (if (not (eq memo 'no-memo)) memo | ||
| 2152 | (let* ((type (org-element-type data)) | 2167 | (let* ((type (org-element-type data)) |
| 2153 | (results | 2168 | (results |
| 2154 | (cond | 2169 | (cond |
| @@ -2174,9 +2189,9 @@ Return transcoded string." | |||
| 2174 | ;; Secondary string. | 2189 | ;; Secondary string. |
| 2175 | ((not type) | 2190 | ((not type) |
| 2176 | (mapconcat (lambda (obj) (org-export-data obj info)) data "")) | 2191 | (mapconcat (lambda (obj) (org-export-data obj info)) data "")) |
| 2177 | ;; Element/Object without contents or, as a special case, | 2192 | ;; Element/Object without contents or, as a special |
| 2178 | ;; headline with archive tag and archived trees restricted | 2193 | ;; case, headline with archive tag and archived trees |
| 2179 | ;; to title only. | 2194 | ;; restricted to title only. |
| 2180 | ((or (not (org-element-contents data)) | 2195 | ((or (not (org-element-contents data)) |
| 2181 | (and (eq type 'headline) | 2196 | (and (eq type 'headline) |
| 2182 | (eq (plist-get info :with-archived-trees) 'headline) | 2197 | (eq (plist-get info :with-archived-trees) 'headline) |
| @@ -2201,16 +2216,16 @@ Return transcoded string." | |||
| 2201 | (lambda (element) (org-export-data element info)) | 2216 | (lambda (element) (org-export-data element info)) |
| 2202 | (org-element-contents | 2217 | (org-element-contents |
| 2203 | (if (or greaterp objectp) data | 2218 | (if (or greaterp objectp) data |
| 2204 | ;; Elements directly containing objects | 2219 | ;; Elements directly containing |
| 2205 | ;; must have their indentation normalized | 2220 | ;; objects must have their indentation |
| 2206 | ;; first. | 2221 | ;; normalized first. |
| 2207 | (org-element-normalize-contents | 2222 | (org-element-normalize-contents |
| 2208 | data | 2223 | data |
| 2209 | ;; When normalizing contents of the first | 2224 | ;; When normalizing contents of the |
| 2210 | ;; paragraph in an item or a footnote | 2225 | ;; first paragraph in an item or |
| 2211 | ;; definition, ignore first line's | 2226 | ;; a footnote definition, ignore |
| 2212 | ;; indentation: there is none and it | 2227 | ;; first line's indentation: there is |
| 2213 | ;; might be misleading. | 2228 | ;; none and it might be misleading. |
| 2214 | (when (eq type 'paragraph) | 2229 | (when (eq type 'paragraph) |
| 2215 | (let ((parent (org-export-get-parent data))) | 2230 | (let ((parent (org-export-get-parent data))) |
| 2216 | (and | 2231 | (and |
| @@ -2227,10 +2242,10 @@ Return transcoded string." | |||
| 2227 | (puthash | 2242 | (puthash |
| 2228 | data | 2243 | data |
| 2229 | (cond | 2244 | (cond |
| 2230 | ((not results) nil) | 2245 | ((not results) "") |
| 2231 | ((memq type '(org-data plain-text nil)) results) | 2246 | ((memq type '(org-data plain-text nil)) results) |
| 2232 | ;; Append the same white space between elements or objects as in | 2247 | ;; Append the same white space between elements or objects |
| 2233 | ;; the original buffer, and call appropriate filters. | 2248 | ;; as in the original buffer, and call appropriate filters. |
| 2234 | (t | 2249 | (t |
| 2235 | (let ((results | 2250 | (let ((results |
| 2236 | (org-export-filter-apply-functions | 2251 | (org-export-filter-apply-functions |
| @@ -2240,10 +2255,10 @@ Return transcoded string." | |||
| 2240 | (if (memq type org-element-all-elements) | 2255 | (if (memq type org-element-all-elements) |
| 2241 | (concat (org-element-normalize-string results) | 2256 | (concat (org-element-normalize-string results) |
| 2242 | (make-string post-blank ?\n)) | 2257 | (make-string post-blank ?\n)) |
| 2243 | (concat results (make-string post-blank ? )))) | 2258 | (concat results (make-string post-blank ?\s)))) |
| 2244 | info))) | 2259 | info))) |
| 2245 | results))) | 2260 | results))) |
| 2246 | (plist-get info :exported-data)))))) | 2261 | (plist-get info :exported-data))))) |
| 2247 | 2262 | ||
| 2248 | (defun org-export-data-with-backend (data backend info) | 2263 | (defun org-export-data-with-backend (data backend info) |
| 2249 | "Convert DATA into BACKEND format. | 2264 | "Convert DATA into BACKEND format. |
| @@ -3011,6 +3026,14 @@ Return code as a string." | |||
| 3011 | (org-export-install-filters | 3026 | (org-export-install-filters |
| 3012 | (org-combine-plists | 3027 | (org-combine-plists |
| 3013 | info (org-export-get-environment backend subtreep ext-plist)))) | 3028 | info (org-export-get-environment backend subtreep ext-plist)))) |
| 3029 | ;; Special case: provide original file name or buffer name as | ||
| 3030 | ;; default value for :title property. | ||
| 3031 | (unless (plist-get info :title) | ||
| 3032 | (plist-put | ||
| 3033 | info :title | ||
| 3034 | (let ((file (plist-get info :input-file))) | ||
| 3035 | (if file (file-name-sans-extension (file-name-nondirectory file)) | ||
| 3036 | (plist-get info :input-buffer))))) | ||
| 3014 | ;; Expand export-specific set of macros: {{{author}}}, | 3037 | ;; Expand export-specific set of macros: {{{author}}}, |
| 3015 | ;; {{{date}}}, {{{email}}} and {{{title}}}. It must be done | 3038 | ;; {{{date}}}, {{{email}}} and {{{title}}}. It must be done |
| 3016 | ;; once regular macros have been expanded, since document | 3039 | ;; once regular macros have been expanded, since document |
| @@ -5106,11 +5129,7 @@ Return the new string." | |||
| 5106 | ;; `org-export-get-genealogy' returns the full genealogy of a given | 5129 | ;; `org-export-get-genealogy' returns the full genealogy of a given |
| 5107 | ;; element or object, from closest parent to full parse tree. | 5130 | ;; element or object, from closest parent to full parse tree. |
| 5108 | 5131 | ||
| 5109 | (defsubst org-export-get-parent (blob) | 5132 | ;; defsubst org-export-get-parent must be defined before first use |
| 5110 | "Return BLOB parent or nil. | ||
| 5111 | BLOB is the element or object considered." | ||
| 5112 | (org-element-property :parent blob)) | ||
| 5113 | |||
| 5114 | (defun org-export-get-genealogy (blob) | 5133 | (defun org-export-get-genealogy (blob) |
| 5115 | "Return full genealogy relative to a given element or object. | 5134 | "Return full genealogy relative to a given element or object. |
| 5116 | 5135 | ||
| @@ -5638,7 +5657,8 @@ The function returns either a file name returned by POST-PROCESS, | |||
| 5638 | or FILE." | 5657 | or FILE." |
| 5639 | (declare (indent 2)) | 5658 | (declare (indent 2)) |
| 5640 | (if (not (file-writable-p file)) (error "Output file not writable") | 5659 | (if (not (file-writable-p file)) (error "Output file not writable") |
| 5641 | (let ((encoding (or org-export-coding-system buffer-file-coding-system))) | 5660 | (let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist)) |
| 5661 | (encoding (or org-export-coding-system buffer-file-coding-system))) | ||
| 5642 | (if async | 5662 | (if async |
| 5643 | (org-export-async-start | 5663 | (org-export-async-start |
| 5644 | `(lambda (file) | 5664 | `(lambda (file) |