* lisp/org-element.el (org-element--list-struct): Correctly handle end
of sub-lists and end of last item.
* testing/lisp/test-org-element.el (test-org-element/item-parser):
(test-org-element/plain-list-parser): Add tests.
* lisp/org-element.el (org-element-latex-fragment-parser): Also check
border character right after opening "$" sign.
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
Add tests.
Reported-by: thomas <thomas@friendlyvillagers.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/114285>
* lisp/org-element.el (org-element-context): Do not parse timestamps
within planning line.
* testing/lisp/test-org-element.el (test-org-element/context): Remove test.
Strictly speaking, timestamps within planning lines are parameters
values that use timestamp syntax, not real timestamps belonging to the
document contents.
* lisp/org-element.el (org-element-latex-fragment-parser):
* lisp/org.el (org-latex-regexps): Allow an apostrophe right after
a fragment.
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
Add test.
In Text mode, and, as a consequence, in Org mode, "'" is not treated
as punctuation, but as word constituent. The apostrophe isn't caught
by "\s." regexp.
Reported-by: Joe Corneli <holtzermann17@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113464>
* lisp/org-element.el (org-element--object-lex): Fix parsing of radio
links within emphasis.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
test.
Reported-by: R C <recifx@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113063>
* lisp/org-element.el (org-element-link-parser):
Handle drive names in uri like file:///c:/dir/file
* lisp/ox.el (org-export-file-uri):
Handle drive names in uri like file:///c:/dir/file
* testing/lisp/test-ox.el (test-org-export/file-uri):
Generate the right uri to be tested against link exporter.
* lisp/org-element.el (org-element-insert-before): Do not call
`reverse' as contents might use `eq' objects.
* testing/lisp/test-ox.el (test-org-export/uninterpreted): Add test
Reported-by: Justin Kirby <justinkirby@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/112065>
* lisp/org-element.el (org-element-use-cache): Set default value to
nil.
Using cache introduces Emacs' freezes under not well known
circumstances. Until this is sorted out, this variable should be nil,
at least on "maint" branch.
* lisp/org-element.el (org-element--cache-objects): Remove variable.
(org-element--cache-put):
(org-element--cache-remove):
(org-element--cache-process-request):
(org-element-cache-reset):
(org-element-context): Apply removal.
Caching objects is complicated and doesn't buy much in most cases,
since a change in an element reset the whole objects cache for that
element.
* lisp/org-element.el (org-element-normalize-contents): Fix return
value when any line after the first has no indentation.
* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
Add test.
* lisp/org-element.el (org-element-class): Make it a defsubst.
* lisp/org-table.el (orgtbl-to-generic): Do not use cache when
building Org table. Factor out calls to Org Export functions when
they are not necessary.
(org-table--to-generic-row): Factor out calls to Org Export functions
when they are not necessary.
* lisp/ox.el (org-export-resolve-fuzzy-link):
(org-export-table-has-header-p):
(org-export-table-row-group):
(org-export-table-cell-width):
(org-export-table-cell-alignment): Small refactoring.
(org-export-table-row-number): Add caching.
* testing/lisp/test-org-element.el (test-org-element/class): Remove
test.
* lisp/org.el (org-set-emph-re): Refactor code. Rip "~" and "="
markers off `org-emph-re'.
(org-do-emphasis-faces):
(org-sort-remove-invisible): Handle both `org-emph-re' and
`org-verbatim-re'.
(org-in-verbatim-emphasis): Use `org-verbatim-re' instead of
`org-emph-re'.
* lisp/org-element.el (org-element-code-parser):
(org-element-verbatim-parser): Use `org-verbatim-re' instead of
`org-emph-re'.
* testing/lisp/test-org-element.el (test-org-element/bold-parser):
(test-org-element/code-parser):
(test-org-element/italic-parser):
(test-org-element/strike-through-parser):
(test-org-element/underline-parser):
(test-org-element/verbatim-parser): Update tests, which no longer need
to bind `org-emph-re'.
* lisp/org-element.el (org-element--current-element): Check that
planning info and property drawers are correctly located before
parsing them.
* testing/lisp/test-org-element.el (test-org-element/planning-parser):
(test-org-element/property-drawer-parser): Add tests.
* lisp/org-element.el (org-element--object-lex): Do not re-match past
1-character long radio links.
* testing/lisp/test-org-element.el (test-org-element/link-parser): Add
test.
Reported-by: Daniel Clemente <n142857@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109861>
* lisp/org-element.el (org-element-class): New function.
(org-element-map):
(org-element-interpret-data):
* lisp/org-footnote.el (org-footnote--allow-reference-p):
* lisp/org-src.el (org-src--on-datum-p):
* lisp/ox-odt.el (org-odt-footnote-reference):
(org-odt-table-cell):
* lisp/ox.el (org-export-data):
(org-export-expand): Use new function.
* testing/lisp/test-org-element.el (test-org-element/class): New test.
Using generic `org-element-class' allows to handle unknown, i.e.,
pseudo, object or element types. It also reduces code duplication in
`org-element-interpret-data' and `org-export-data', preventing, e.g.,
bugs as the one fixed in c58e1b5.
* lisp/org-element.el (org-element-link-interpreter): % in description
are confused with format string placeholders. Escape them so as to
fix the error.
* testing/lisp/test-org-element.el (test-org-element/link-interpreter):
Add test.
Reported-by: Daniel Clemente <n142857@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109878>
* lisp/org-element.el (org-element-interpret-data):
* lisp/ox.el (org-export-data): Correctly guess if a pseudo element or
object should be followed by spaces or blank lines.
* testing/lisp/test-ox.el (test-org-export/pseudo-objects):
(test-org-export/pseudo-elements): New tests.
* lisp/org-element.el (org-element-link-parser): Add :format property.
Tiny refactoring.
* testing/lisp/test-org-element.el (test-org-element/link-interpreter):
Add one test. Update some others.
Since the link format is lost during parsing, the interpreter can hardly
handle nested links. Indeed, in that case, the inner link is
interpreted as a bracket link, thus breaking the outer link.
Another option could be to guess a safe format for the link to be
interpreted. E.g.,
- any inner link could default to angle format unless it contains ">",
it which case it would become a plain link;
- other links would have the bracket format, unless they contain "][" or
"]]".
In any case, defining :format is less error prone and is similar to what
entities and sub/super-scripts have for curly brackets.
Reported-by: Thibault Marin <thibault.marin@gmx.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/109623>
* lisp/org-element.el (org-element-interpret-data): Elements and objects
are compared with `eq' instead of `equal'. Also remove useless symbol
prefix since move to lexical binding.
* lisp/org-element.el: Replace `org-link-types' variable with
`org-link-types' function.
* lisp/org.el: Replace the `org-link-types' variable with
`org-link-types' function. Create `org-link-get-parameter' and
`org-link-set-parameters' functions. Remove `org-add-link-type'. Add
`org-store-link-functions' function and remove
`org-store-link-functions' variable. Add `org--open-file-link' for use
as a :follow function for file type links.
* lisp/org.el: Set :follow functions for file links in `org-link-parameters.
Define `org-open-file-link' that opens a file link with an app.
* testing/lisp/test-ox.el: Remove usage of the `org-link-types'
variable.
* lisp/org-compat.el: Move `org-add-link-type' and mark it as obsolete.
* lisp/ox.el: Change org-add-link-type comment in ox.el.
* lisp/org-element.el (org-element-inline-babel-call-parser): Empty
arguments return nil instead of the empty string, so as to be on par
with `org-element-babel-call-parser'.
* lisp/org-element.el (org-element--parse-paired-brackets): New function.
(org-element-inline-babel-call-parser):
(org-element-inline-src-block-parser): Use new function.
* testing/lisp/test-org-element.el (test-org-element/inline-src-block-parser):
Add test.
Reported-by: Charles Millar <millarc@verizon.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/107629>
* lisp/org-element.el (org-element-example-block-parser): Use cons cell
for :number-lines specifying offset in addition to type (new/continue).
('continue . offset) for :number-lines will add this offset count to
the last line number. ('new . offset) for :number-lines will reset the
line number counting starting at offset
(org-element-src-block-parser): same for SRC block as EXAMPLE block
* lisp/ox-html.el (org-html-format-code):
* lisp/ox-latex.el (org-latex-src-block):
* lisp/ox-odt.el (org-odt-format-code):
* lisp/ox.el (org-export-resolve-coderef):
(org-export-get-loc):
(org-export-format-code-default):
* contrib/lisp/ox-groff.el (org-groff-src-block): Use new cons cell
for :number-lines.
* testing/lisp/test-ox.el (ert-deftest test-org-export/get-loc): Tests for
changes
(test-org-gen-loc-list): Helper function for `test-org-export/get-loc'.
* lisp/org-element.el (org-element-context): Make sure point is on tag
line before searching for it.
* testing/lisp/test-org-element.el (test-org-element/context): Add test.
Small refactoring.
Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/105018>
* lisp/org-element.el (org-element-src-block-parser):
(org-element-example-block-parser): Do not remove any indentation when
parsing the element.
* testing/lisp/test-org-element.el (test-org-element/src-block-parser):
* testing/lisp/test-org-element.el (test-org-element/src-block-parser):
Update test.
Properly handling indentation requires knowing about
`org-src-preserve-indentation''s value. This is out of the scope of the
parser.
* lisp/org-element.el (org-element--cache-active-p):
(org-element-cache-reset): Do not activate cache outside Org buffers,
even if using "orgstruct-mode".
Reported-by: "Mark A. Hershberger" <mah@nichework.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/104648>
* lisp/org-element.el (org-element--parse-objects): Add an optional
argument to avoid walking a secondary string twice. Make less
consing.
(org-element--parse-elements): Make less consing.
(org-element-headline-parser):
(org-element-inlinetask-parser):
(org-element-item-parser):
(org-element-parse-secondary-string): Apply changes.
Expunge "allow" + infinitive without direct object from source and doc.
fbce4757a874cc43806eb41b8637538b101c3c69
Alan Mackenzie
Sun Jan 24 20:30:39 2016 +0000
* lisp/org-element.el (org-element-context): Do not look for objects
within TODO keyword, priority cookie, comment keyword or tags.
* lisp/org.el (org-activate-tags): Fix regexp.
* testing/lisp/test-org-element.el (test-org-element/context): Add test.
Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
* lisp/org-element.el (org-element-export-block-parser): Type is always
stored in capitals.
* testing/lisp/test-ox.el (test-org-export/export-block): Add test.
Reported-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/103921>
* lisp/org-element.el (org-element--set-regexps):
(org-element-footnote-definition-interpreter):
(org-element-footnote-reference-parser):
(org-element-footnote-reference-interpreter): Do not consider [1]-like
constructs as footnotes anymore.
* lisp/ox.el (org-export-expand-include-keyword):
(org-export--prepare-file-contents): Apply changes to footnotes.
* doc/org.texi (Footnotes): Remove references to plain footnotes.
* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
(test-org-element/footnote-reference-interpreter):
* testing/lisp/test-ox.el (test-org-export/expand-include):
(test-org-export/expand-macro):
(test-org-export/get-footnote-number):
(test-org-export/collect-footnote-definitions):
(test-org-export/footnotes):
(test-org-export/fuzzy-link): Update tests.
Since it is possible to refer unambiguously to a label without the "fn:"
prefix, the latter becomes part of the syntax and no longer part of the
label. In particular [fn:1] and [fn:label] are labelled, respectively,
"1" and "label".
* lisp/org-element.el (org-element-export-block-parser):
(org-element--current-element): Use new syntax for export blocks.
(org-element-block-name-alist): Remove.
* lisp/ox.el (org-export-register-backend):
(org-export-define-derived-backend): Remove :export-block keyword from
back-end's definition.
(org-export-expand-include-keyword): Use new syntax for include
keywords.
* lisp/ox-ascii.el (ascii):
* lisp/ox-beamer.el (beamer):
* lisp/ox-html.el (html):
* lisp/ox-latex.el (latex):
(org-latex-prefer-user-labels):
* lisp/ox-man.el (man):
* lisp/ox-md.el (md):
* lisp/ox-odt.el (odt):
* lisp/ox-texinfo.el (texinfo): Propagate changes to "ox.el".
* lisp/ob-core.el (org-babel-insert-result):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use new syntax.
* lisp/org.el (org-structure-template-alist): Use new syntax.
(org-protecting-blocks): Add "export" to protected blocks. Remove
back-ends blocks, which are now special blocks.
(org-fontify-meta-lines-and-blocks-1): Fontify correctly new blocks.
* lisp/org-footnote.el (org-footnote-forbidden-blocks):
* lisp/org-list.el (org-list-forbidden-blocks): Add "export" to
forbidden blocks. Remove back-ends blocks, which are now special
blocks.
* contrib/lisp/ox-extra.el: Update comments.
* testing/lisp/test-org-element.el (test-org-element/export-block-parser):
(test-org-element/export-block-interpreter):
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-html):
(test-ob/org-babel-remove-result--results-latex):
* testing/lisp/test-ox.el (test-org-export/expand-include): Update tests.
Export blocks are explicitly marked as such at the syntax level to
disambiguate their parsing from special blocks. The new syntax is
#+BEGIN_EXPORT backend
...
#+END_EXPORT
instead of
#+BEGIN_backend
...
#+END_backend
As a consequence, =INCLUDE= keywords syntax is modified, e.g.,
#+INCLUDE: "file.org" HTML
becomes
#+INCLUDE: "file.org" export html
* lisp/org-element.el (org-element--next-mode): Line following an
inlinetask can be a planning.
* testing/lisp/test-org-element.el (test-org-element/inlinetask-parser):
Update test.
Reported-by: Gregor Zattler <telegraph@gmx.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/101958>
* lisp/org-element.el (org-element-remove-indentation): Mark as
an obsolete replacement for `org-remove-indentation'.
(org-element-example-block-parser):
(org-element-example-block-interpreter):
(org-element-src-block-parser):
* lisp/ox.el (org-export-unravel-code): Apply obsolescence.
These changes are the combination of the commits below (in order
applied). Unlike other backports, these are applied in one commit
because they are closely related and because some of the later commits
reverse changes in earlier commits. Changes to message and help quote
display for Emacs 25 seem to be here to stay. The quote protections are
required to ensure grave accents and apostrophes are displayed as
intended in Emacs 25, and they should not affect earlier versions.
Quoting fixes in lisp/org
6cd2629bd1b3ce77d29ac28e29237c94a4197116
Paul Eggert
Mon Aug 31 00:29:40 2015 -0700
More-conservative ‘format’ quote restyling
fbb5531fa11d13854b274d28ccd329c9b6652cfc
Paul Eggert
Sun Aug 23 22:39:06 2015 -0700
Prefer directed to neutral quotes
875a5d0ead827d3da32ecbd30e739a29f07bbc87
Paul Eggert
Mon Aug 24 23:57:25 2015 -0700
Escape ` and ' in doc
19532d147b431a4fe34f088d6de07891c48e2c5c
Paul Eggert
Tue Sep 1 18:23:21 2015 -0700
Fix some more docstring etc. quoting problems
26bd978d87dfbf9baa115cd961a67d42b416c4bf
Paul Eggert
Thu Sep 3 15:32:54 2015 -0700
Go back to grave quoting in source-code docstrings etc.
6afef3f6ca2f3009c722b84e249903b7f807b044
Paul Eggert
Mon Sep 7 16:09:27 2015 -0700
* lisp/org-element.el (org-element-link-parser): Call
`org-link-translation-function' if required.
(org-element-link-interpreter): Build link from type and path instead of
simply pasting raw value.
* lisp/org.el (org-translate-link): Call parser to extract proper path
and type.
* testing/lisp/test-org-element.el (test-org-element/link-interpreter):
Add test.
Reported-by: Sergei Nosov <sergei.nosov@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/100227>
* lisp/org-element.el (org-element-link-parser): Correctly parse links
with newline characters.
* lisp/org.el (org-make-link-regexps): Allow newline characters within
angle links.
(org-activate-angle-links): Support multiline angle links.
* testing/lisp/test-org-element.el (test-org-element/link-parser):
Update tests.
As a rule of thumb, any newline character and all surrounding
whitespaces are treated as a single space in a bracket link. They are
removed in angle links.
* lisp/org-element.el (org-element-table-parser): Properly parse an
Org table followed by a line starting with a "+".
* testing/lisp/test-org-element.el (test-org-element/context): Fix
test.
* lisp/org-element.el (org-element--cache-sync-requests): Remove a now
useless element from requests
(org-element--cache-submit-request): Apply change to sync request.
(org-element--cache-process-request): Apply change to sync requests.
Fix removal of orphaned elements, i.e., elements not affected by
a change, but with an ancestor that was.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test.
Reported-by: Suvayu Ali <fatkasuvayu+linux@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/98260>
* org-element.el (org-element-latex-fragment-parser):
* org.el (org-latex-regexps): Fix the detection of latex
fragments. Uses syntax tables to detect whitespaces and punctuation
marks following the final $ sign.
In order to qualify as a math delimiter, the final $ sign of a LaTeX
fragment has to be followed by a whitespace or punctuation mark but the
regexp used in the previous code matched only a small number of
punctuation marks and therefore missed some latex fragments.
* lisp/org-element.el (org-element--set-regexps): Refine
`org-element-paragraph-separate'.
(org-element-paragraph-parser): Fix paragraph parsing when followed by
a dual keyword or an ill-formed latex environment.
* testing/lisp/test-org-element.el (test-org-element/paragraph-parser):
Add tests.
Reported-by: Jacob Gerlach <jacobgerlach@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/97256>
* lisp/org-element.el (org-element--cache-for-removal): Be more
careful when altering a properties drawer.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test.
* lisp/org-element.el (org-element-document-properties): Remove
variable.
(org-element-context): Ignore ex-"document keywords".
* testing/lisp/test-org-element.el (test-org-element/context): Remove
no longer applicable tests.
Parsed keywords are no longer hard-coded and can be set per export
back-end.
As a consequence, `org-element-context' no longer returns objects in
"TITLE", "DATE" or "AUTHOR" keywords. This makes sense as these
objects would only make sense during export, and only if the chosen
back-end actually uses them.
* lisp/org-element.el (org-element--set-regexps):
(org-element-entity-parser): Update regexps for entities.
* lisp/org-entities.el (org-entities): Add new entities.
* lisp/org.el (org-fontify-entities): Add comment.
* etc/ORG-NEWS (title): Introduce new entities.
"\..." are used to insert an arbitrary number of spaces in various
back-ends. In particular, this family can be used to introduce
leading spaces within table cells.
Also, unlike to other entities, these can be used mid-word, e.g.,
wo\....rd
Curly brackets can still be added before a dot, e.g.,
This is the end\...{}.
* lisp/org-element.el (org-element-line-break-parser): Tiny
refactoring.
(org-element-normalize-contents): Take into consideration line breaks
when removing common indentation. Small refactoring.
* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
Add tests.
* lisp/org-element.el (org-element-object-restrictions): Forbid
footnote references in parsed keywords.
Inserting footnote references in parsed keywords (e.g., TITLE or
CAPTION) can lead to subtle bugs. Indeed, it is impossible to know in
time if that particular footnote is going to be used in the output,
and, therefore, if it should count, e.g., in
`org-export-get-footnote-number'.
* lisp/org-element.el (org-element-object-containers): New variable
(org-element-interpret-data): Remove optional argument.
(org-element--interpret-data-1): Remove optional argument. Guess when
a given element or object has a pseudo type.
* lisp/ox-latex.el (org-latex-pseudo-objects): Remove variable.
(org-latex-table, org-latex--math-table): Apply signature change above.
* testing/lisp/test-org-element.el (test-org-element/interpret-data):
Update test.
* lisp/org-element.el (org-element-link-type-is-file): Remove.
(org-element-link-parser): Do not treat specially anymore "docview"
link type.
* testing/lisp/test-org-element.el (test-org-element/link-parser):
Update test.
* lisp/org-docview.el (org-docview-export): Fix path.
"docview" is a custom link type handled in its own library. There is
no reason to include it in core parser.
* lisp/org-element.el (org-element-swap-A-B):
* lisp/org-list.el (org-list-swap-items):
(org-list-send-item): In order to preserve visibility of moved items
or elements, only consider inner overlays.
Reported-by: Michael Brand <michael.ch.brand@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/94320>
* lisp/org-element.el (org-element-headline-parser): Remove :alt-title.
* lisp/ox.el (org-export-get-alt-title): Check regular :ALT_TITLE
property instead of :alt-title.
`:alt-title' is an export-specific property. As a consequence, it's
value doesn't need to be parsed at "org-element.el"'s level. There, it
is treated as a regular property : `ALT_TITLE'.
This also removes the last call to
`org-element-parse-secondary-string' from "org-element.el".
* lisp/org-element.el (org-element-headline-parser,
org-element-inlinetask-parser, org-element-item-parser,
org-element--collect-affiliated-keywords): Use
`org-element--parse-objects' instead of
`org-element-parse-secondary-string' when parsing live objects in
secondary strings.
`org-element-parse-secondary-string' parses a given string in
a temporary buffer, rendering buffer position related
properties (e.g., :begin) invalid.
Reported-by: John Kitchin <johnrkitchin@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/94397>
* lisp/org-element.el (org-element-headline-interpreter,
org-element-inlinetask-interpreter): Use format control string
instead of calling `char-to-string'.
* lisp/org-element.el (org-element--parsed-properties-alist): New
variable.
(org-element-map): Remove unnecessary funcalls. Externalize some
computations in the variable above.
* lisp/org-macro.el (org-macro-escape-arguments,
org-macro-extract-arguments): New functions.
* lisp/org-element.el (org-element-macro-parser): Use new function.
* testing/lisp/test-org-macro.el (test-org-macro/escape-arguments,
test-org-macro/extract-arguments): New tests.
* lisp/org-element.el (org-element-context): Fix 'search failed ":"'
error when point is on a blank line after a keyword.
* testing/lisp/test-org-element.el (test-org-element/context): Add
tests.
* lisp/org-element.el (org-element-paragraph-separate,
org-element--object-regexp): Turn defconst into defvar.
(org-element--set-regexps): Properly set previous variables.
(org-element-update-syntax): New function.
* lisp/org-list.el (org-plain-list-ordered-item-terminator,
org-list-allow-alphabetical): Call new function whenever these
variables are modified and Org is already loaded.
* lisp/org.el (org-add-link-type): Call new function since a new link
type triggers a rebuild of syntax regexps, possibly invalidating
cache in all Org buffers.
Reported-by: Christopher Dannheim <ch.dannheim@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/92487>
* lisp/org-element.el (org-element--get-node-properties,
org-element--get-time-properties): New functions.
(org-element-headline-parser, org-element-inlinetask-parser): Use new
functions.
(org-element-property-drawer-parser): Change signature. Simplify
parsing.
drawer.
(org-element--current-element, org-element--next-mode): Property
drawers are located right after a headline or a planning element.
* testing/lisp/test-org-element.el (test-org-element/drawer-parser,
test-org-element/node-property,
test-org-element/property-drawer-interpreter): Update tests.
(test-org-element/property-drawer-parser): Add tests.
* testing/lisp/test-org.el (test-org/indent-line,
test-org/indent-region, test-org/forward-paragraph,
test-org/backward-paragraph): Update tests.
* lisp/org-element.el (org-element--cache-for-removal): Do not
consider property drawers as robusts: if contents are modified,
remove the whole drawer from cache.
* lisp/org-element.el (org-element--current-element): Only look after
planning lines right after parsing a section.
(org-element--next-mode): New function.
(org-element--parse-elements, org-element--parse-to): Use new
function.
* lisp/org.el (org-planning-line-re): New variable. Renamed from
`org-planning-or-clock-line-re'.
* lisp/org-element.el (org-element-paragraph-separate,
org-element-headline-parser, org-element-inlinetask-parser, ,
org-element--current-element): Use new variable.
(org-element-planning-parser): Check previous line before parsing
planning info. When right after a headline, fallback to paragraph
parsing.
* testing/lisp/test-org-element.el (test-org-element/planning-parser):
Add a test. Update others.
(test-org-element/timestamp): Remove a test.
* testing/lisp/test-ox.el (test-org-export/handle-options): Update
test.
* lisp/org-element.el (org-element-property-drawer-parser,
org-element-node-property-parser): Ignore lines that are not node
properties.
(org-element-node-property-interpreter): Allow nil properties.
* lisp/org.el (org-re-property): Fix regexp to match properties with
empty values.
* testing/lisp/test-org-element.el (test-org-element/node-property):
Add tests.
Thanks to Eike for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/90293
* lisp/org-element.el (org-element-headline-interpreter): Take into
consideration `org-odd-levels-only' value. Small refactoring.
* testing/lisp/test-org-element.el (test-org-element/headline-interpreter):
Add test.
* lisp/org-element.el (org-element-headline-parser,
org-element-inlinetask-parser, org-element-item-parser,
org-element-section-parser, org-element-clock-parser,
org-element-node-property-parser, org-element-planning-parser,
org-element-table-row-parser): Add dummy :post-affiliated property.
* lisp/org.el (org--get-expected-indentation, org-indent-line,
org-indent-region, org-adaptive-fill-function,
org-toggle-fixed-width, org-forward-paragraph,
org-backward-paragraph, org-mode-flyspell-verify): Remove nullity
checks for :post-affiliated.
Even though these elements cannot have affiliated keywords, beginning
of element is a logical default value. It makes checking the nullity
of the unnecessary.
* lisp/org-element.el (org-element-normalize-contents): Fix
indentation removal when there is an empty line within a verse block.
* testing/lisp/test-org-element.el (test-org-element/normalize-contents):
Add test.
* lisp/org-element.el (org-element-comment-block-interpreter,
org-element-example-block-interpreter,
org-element-src-block-interpreter): Handle values with missing final
newline, e.g., when built by the user.
* testing/lisp/test-org-element.el (test-org-element/comment-block-interpreter,
test-org-element/example-block-interpreter,
test-org-element/src-block-interpreter): Add tests
Thanks to Thorsten Jolitz for suggesting the idea.
http://permalink.gmane.org/gmane.emacs.orgmode/89602
* lisp/org-element.el (org-element-all-elements): Remove
`export-block' type.
(org-element-block-name-alist): Make it a defconst since it is not
meant to be changed anymore.
(org-element-export-block-parser,
org-element-export-block-interpreter): Remove functions.
* lisp/ox.el (org-export-filters-alist): Remove export block filter.
(org-export-register-backend): Do not alter
`org-export-block-name-alist' anymore.
(org-export-define-backend, org-export-define-derived-backend): Update
docstring.
(org-export-filter-export-block-functions): Remove variable.
* testing/lisp/test-org-element.el (test-org-element/export-block-parser,
test-org-element/export-block-interpreter): Remove tests.
* testing/lisp/test-ox.el (test-org-export/define-backend): Update test.
* lisp/org-element.el (org-element-parse-secondary-string): Clone all
local variables from current buffer before parsing a secondary
string. Small refactoring.
(org-element-object-variables): Remove variable.
* testing/lisp/test-org-element.el (test-org-element/secondary-string-parsing):
Add test.
Thanks to Thomas S. Dye for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88850
* org-element.el (org-element--latex-begin-environment,
org-element--latex-end-environment): New format strings to identify
beginning and ending of LaTeX environments.
(org-element-latex-environment-parser, org-element-paragraph-parser,
org-element--current-element): Use `org-element--latex-begin-environment'
and `org-element--latex-end-environment'.
* test-org-element.el (test-org-element/latex-environment-parser):
Add tests.
* lisp/org-element.el (org-element--cache-for-removal): Do not remove
a robust element whenever only its contents are modified. Remove
inlinetasks as robust elements since modifying a node property inside
implies to parse the task again.
* lisp/org-element.el (org-element--cache-process-request): Take into
consideration changes to come so as to avoid parsing elements with
false beginning positions.
(org-element--cache-sync): Change signature.
Thanks to Thorsten Jolitz for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88673
* lisp/org-element.el (org-element--cache-process-request): Correctly
re-parent elements in cache in some corner cases.
* testing/lisp/test-org-element.el (test-org-element/cache): Add tests.
* lisp/org-element.el (org-element--cache-submit-request): When
changes happen before first know element, start from phase 1 instead
of phase 2 in order to properly re-parent subsequent elements, if
needed.
(org-element--cache-process-request): Do not propagate beginning
position since it is already available to the request.
* lisp/org-element.el (org-element--cache-sync): Do not copy phase
number into next request. This is a special case that deserves to
be handled locally. See below.
(org-element--cache-process-request): Properly transfer phase in
a special case, which is now commented. Also fix phase numbers in
comments. Small refactoring.
Thanks to Alan Schmitt for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88406
* lisp/org-element.el (org-element-latex-fragment-parser): Avoid
matching twice regexps in some cases.
(org-element--object-lex): Avoid making a funcall if a line break
isn't possible.
This patch also removes the limit on the number of lines a latex
fragment with a single dollar can span over.
* lisp/org-element.el (org-element-recursive-objects): Add
`footnote-reference'.
(org-element-secondary-value-alist): Remove reference to
`footnote-reference'.
(org-element-footnote-reference-parser): Definition for inline
references is stored as the contents of the reference, not in
a secondary string.
(org-element-footnote-reference-interpreter): Apply changes from
parser.
* lisp/ox.el (org-export-get-footnote-definition,
org-export-get-environment): Apply changes from parser.
* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
Update test.
(test-org-element/context): Add test.
Storing definition in a secondary string was a poor design choice as
there is no "primary" string anyway. This also prevents
`org-element-context' from finding objects within the inline
definition.
* lisp/org-element.el (org-element--cache-sync-requests): Change
pattern.
(org-element--cache-sync, org-element--cache-submit-request): Update
request pattern.
(org-element--cache-process-request): Remove orphaned elements during
first phase.
An orphaned element is an element not directly altered by changes to
buffer but with one of its parent removed.
* lisp/org-element.el (org-element--cache-submit-request): Correctly
compute buffer positions where cache is missing, taking into account
the request not yet applied.
* lisp/org-element.el (org-element--cache-for-removal): Fix corner
case when changes happen in a robust element (e.g., a center block)
within a fragile element (e.g., a plain list). Do not assume that
all parents from a robust element are also robust.
* lisp/org-element.el (org-element--cache-submit-request): Store
parent of first element to delete, if any. This saves a call to
`org-element--cache-find' in a very common use case.
(org-element--cache-sync-requests): Update docstring accordingly.
* lisp/org-element.el (org-element--cache-process-request): Threshold
is based off beginning of the first element to shift instead of the
end of the changes.
* lisp/org-element.el (org-element--cache-submit-request): Do not
trust a stored request after calling `org-element--cache-sync' since
it may as well not exist anymore (i.e., the synchronization was
complete).
* lisp/org-element.el (org-element--cache-submit-request): Fix off by
one error when updating cache. Changes happening at the beginning
to the previous ones, which are always located at the beginning of
an element, imply to delete previous element. Also do not call
`org-element--cache-sync' if there's nothing to synchronize.
* lisp/org-element.el (org-element-inlinetask-parser): Do not infloop
when parsing property drawer in an inlinetask.
* testing/lisp/test-org-element.el (test-org-element/headline-properties):
Add test.
Thanks to Aaron Ecay for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88133
* lisp/org-element.el (org-element--cache-submit-request): Correctly
update cache when changes alter the contents of a greater
element (e.g. a property drawer).
Thanks to Alan Schmitt for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/88086
* lisp/org-element.el (org-element-link-parser): Do not prepend "//"
to paths starting with "~".
Since b1dcd0fb0b, link parser doesn't
expand file names anymore. We need to prevent it from "fixing" paths
starting with "~", as it can cause trouble to some
exporters (e.g. latex).
* lisp/org-element.el (org-element-cache-sync-idle-time,
org-element-cache-sync-break): Increase values as synchronizing
cache too makes editing somewhat sluggish without any benefit.
* lisp/org-element.el (org-element--cache-for-removal): New function.
(org-element--cache-submit-request): Do not synchronize cache when
changes can be merged with next request.
This shortcut is particularly useful when many changes happen in the
same area, which is expensive to parse (e.g., a large list).
* lisp/org-element.el (org-element--cache-sync,
org-element--cache-process-request): Change signature.
(org-element--cache-before-change): Do not synchronize cache
preemptively.
(org-element--cache-submit-request): Synchronize cache preemptively.
This change makes possible to skip cache preemptive synchronization
under some circumstances.
* lisp/org-element.el (org-element--cache-sync-requests): Also store
beginning position for buffer modifications.
(org-element--cache-sync, org-element--cache-process-request)
(org-element--cache-submit-request): Adapt to new request template.
This change is required for a future cache optimization.
* lisp/org-element.el (org-element--cache-sync): Do not check return
value from `org-element--cache-process-request'.
(org-element--cache-process-request): Throw `interrupt' when the
request cannot be processed.
(org-element--cache-process-request): Do not catch interruption from
`org-element--parse-to'.
(org-element--parse-to): Throw `interrupt' when the process stops
before finding the result.
* lisp/org-element.el (org-element-headline-parser,
org-element-inlinetask-parser): First find appropriate property
drawer in order to read properties.
* testing/lisp/test-org-element.el (test-org-element/headline-properties):
Add tests.
Thanks to Sébastien Vauban for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/87701
* lisp/org-element.el (org-element-link-parser): Do not expand file
name when parsing links so that Tramp doesn't kick in.
Thanks to Sébastien Vauban for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/87696
* lisp/org-element.el (org-element--cache-generate-key): Small fix.
Check if UPPER is non nil before comparing its car with 1. This is
a safety feature, though, as a key shouldn't end on 0 anyway.
* lisp/org-element.el (org-element--cache-remove): New function.
(org-element--cache-process-request): Use new function.
(org-element-cache-reset): Do not rely on a weak hash table to handle
objects cache.
Elements used as keys in object cache cannot be garbage collected
since they appear in the :parent hierarchy in objects. Instead we
remove entries from the objects cache whenever an element is removed
from the element cache.
* lisp/org-element.el (org-element-cache-refresh): New function.
* lisp/org.el (org-update-radio-target-regexp): Make it standalone.
Also refresh fontification only when necessary.
(org-all-targets, org-make-target-link-regexp): Remove functions.
* testing/lisp/test-org.el (test-org/update-radio-target-regexp): New
test
(test-org/all-targets): Remove test.
We need to manually reset cache on radio links as re-fontification
doesn't trigger a buffer change, and, as a consequence, a cache reset.
* lisp/org-element.el (org-element-context): Fix infloop. Be more
cautious when point is at the end of buffer.
* testing/lisp/test-org-element.el (test-org-element/context): Add
test.
* lisp/org-element.el (org-element-link-parser): Fix ill-defined
"file" type links. Expand absolute file names in the process.
Org accepts invalid URI syntax for absolute "file" links, e.g.,
file:/home/user/file.txt. This patch normalizes them.
* lisp/org.el (org-make-target-link-regexp): Change regexp so
alphanumeric characters cannot be found next to a radio link.
(org-activate-target-links): Apply changes to radio link regexp.
* lisp/org-element.el (org-element--object-lex,
org-element-link-parser): Apply changes to radio link regexp.
* testing/lisp/test-org-element.el (test-org-element/link-parser):
Update test.
Patch suggested by Daniel Clemente.
http://permalink.gmane.org/gmane.emacs.orgmode/84461
* lisp/org-element.el (org-element-table-cell-parser,
org-element-table-cell-successor): Recognize cell even when last
vertical bar is missing.
* testing/lisp/test-org-element.el (test-org-element/table-cell-parser):
Add test.
Thanks to Thorsten Jolitz for reporting it.
http://permalink.gmane.org/gmane.emacs.orgmode/84713
* lisp/org-element.el (org-element--cache-objects):
(org-element-context): Simplify structure of object cache.
This change avoids relying on buffer positions and artificial keys.
* lisp/org-element.el (org-element-all-successors,
org-element-object-successor-alist): Remove variables.
(org-element-object-restrictions): Update value.
(org-element-bold-parser, org-element-code-parser,
org-element-entity-parser, org-element-export-snippet-parser,
org-element-footnote-reference-parser,
org-element-inline-babel-call-parser,
org-element-inline-src-block-parser, org-element-italic-parser,
org-element-latex-fragment-parser, org-element-line-break-parser,
org-element-link-parser, org-element-macro-parser,
org-element-radio-target-parser, org-element-statistics-cookie-parser,
org-element-strike-through-parser, org-element-subscript-parser,
org-element-superscript-parser, org-element-target-parser,
org-element-timestamp-parser, org-element-underline-parser,
org-element-verbatim-parser): Return nil when syntax at point is not
of the expected type.
(org-element-text-markup-successor,
org-element-latex-or-entity-successor,
org-element-export-snippet-successor,
org-element-footnote-reference-successor,
org-element-inline-babel-call-successor,
org-element-inline-src-block-successor,
org-element-line-break-successor, org-element-link-successor,
org-element-macro-successor, org-element-radio-target-successor,
org-element-statistics-cookie-successor,
org-element-sub/superscript-successor,
org-element-table-cell-successor, org-element-target-successor,
org-element-timestamp-successor,
org-element--get-next-object-candidates): Remove functions.
(org-element-timestamp-regexp, org-element--object-regexp): New
variables.
(org-element--object-lex): New function.
(org-element--parse-objects, org-element-context): Make use of new
tools.
This patch simplifies a lot object parsing and should improve
significantly `org-element-context''s speed.
http://permalink.gmane.org/gmane.emacs.orgmode/83872
* lisp/org-element.el (org-element-all-successors,
org-element-object-restrictions): Prioritize `link' over other
successors in order to find radio links starting with another syntax
object (e.g., an entity). Also allow text markup within radio
targets.
(org-element-link-parser): Add contents to radio targets.
* lisp/org.el (org-make-target-link-regexp): Fix regexp so it can
match targets starting with an Org object (e.g., an entity).
(org-ctrl-c-ctrl-c): Fix function when applied on an object contained
within a radio target.
* testing/lisp/test-org-element.el (test-org-element/radio-target-parser): Add test.
* testing/lisp/test-ox.el (test-org-export/resolve-radio-link): Add test.