* lisp/org-element.el (org-element--current-element): Fix
org-meta-return error at the end of buffer.
* testing/lisp/test-org-element.el: Add test.
Thanks to Nicolas Richard for reporting this.
* lisp/org-element.el (org-element-special-block-parser): Fix typo in
regexp matching block type. Also quote the type so it can contain
special characters.
* testing/lisp/test-org-element.el: Add test.
* lisp/org.el (org-property-re): Improve definition so that this regex
can be used in all situations. Extend docstring with explanation of
matching groups.
(org-at-property-p): Implement using `org-element-at-point'.
(org-entry-properties, org-buffer-property-keys, org-indent-line):
Use `org-property-re' and adjust match group numbers accordingly.
* lisp/org-element.el (org-element-node-property-parser): Use
`org-property-re' and adjust match group numbers accordingly. Move
`looking-at' out of the let clause to not rely on the unspecified
evaluation order inside the let.
* lisp/org-element.el (org-element--list-struct): New function.
(org-element-plain-list-parser, org-element--current-element): Use new
function.
This patch removes dependency on org-list.el to parsing lists. For
now, it leads to code duplication, but, ultimately (i.e., when parsing
will be faster), org-list.el will delegate the parsing job to
org-element. The new implementation is also faster than the previous one.
* lisp/org-element.el (org-element--remove-indentation): New function.
(org-element-example-block-parser, org-element-src-block-parser): Use
new function.
(org-element-src-block-interpreter): Update function according to
change.
* lisp/ox.el (org-export-unravel-code): Do not remove any indentation
since it now happens at the parser level.
* testing/lisp/test-org-element.el: Add tests.
* testing/lisp/test-ox.el: Refactor tests.
* lisp/org-element.el (org-element--current-element): Be stricter when
matching arguments in LaTeX environments. In particular, do not
allow anything else than options and arguments in the opening line.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element--current-element): Allow the
opening string of a LaTeX environment to contain additional
arguments.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-fixed-width-interpreter): Fix
interpretation of fixed-width elements with a nil or empty string
value.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-macro-parser): Allow to escape
escaping character before a comma. Also do not trim spaces at
argument boundaries.
* doc/org.texi (Macro replacement): Update documentation about
possible locations and escaping mechanism.
* testing/lisp/test-org-element.el: Add tests.
With this patch, macro's arguments are read as the following:
"a,b" -> '("a" "b")
"a\,b" -> '("a,b")
"a\\,b" -> '("a\" "b")
"a\\\,b" -> '("a\,b")
"a\\\\,b" -> '(a"\\" "b")
Note that with the patch, you only need to escape backslashes before
a comma:
"a\\b\,c" -> '("a\\b,c")
* org-element.el (org-element-paragraph-separate): Use
new name `org-list-allow-alphabetical'.
* org-list.el (org-list-allow-alphabetical): Rename from
`org-alphabetical-lists'.
(org-list-empty-line-terminates-plain-lists): Rename from
`org-empty-line-terminates-plain-lists'.
(org-checkbox-hierarchical-statistics): Rename from
`org-hierarchical-checkbox-statistics'.
* org.texi (Plain lists, Checkboxes): Use non-obsolete
variable names.
* lisp/org-element.el (org-element-all-successors): Add `plain-link'
successor.
(org-element-object-restrictions): Remove `link' within `link'. Allow
`plain-link' instead.
(org-element-plain-link-successor): New function.
* testing/lisp/test-org-element.el: Add test.
Plain links within links are needed for the following kind of syntax:
[[http://orgmode.org][file:unicorn.png]]
No other link type is allowed within links.
* lisp/org-element.el (org-element-footnote-definition-parser):
Require 2 blank lines to separate footnote definition.
* lisp/org-footnote.el (org-footnote-at-definition-p): Require 2 blank
lines to separate footnote definition.
* doc/org.texi: Update documentation for footnotes.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-org-footnote.el: Add tests.
Footnote definitions can still be separated with other footnote
definitions and headlines. This change allows to have multiple
paragraphs in a footnote definition without resorting to the "\par"
trick.
* lisp/org-element.el (org-element-headline-parser): Node
property :OPTIONAL_TITLE: in a headline will be parsed and stored
under :optional-title property.
* lisp/ox.el (org-export-get-optional-title): New function.
* lisp/org-element.el (org-element-headline-parser,
org-element-inlinetask-parser): Upcase properties. This is done to
avoid confusion between properties from parser (e.g. `:end') and
properties from the property drawer (e.g. :END:).
In particular, it means that :CUSTOM_ID: property is accessed through:
(org-element-property :CUSTOM_ID headline)
* lisp/ox.el (org-export-resolve-fuzzy-link): Whitespaces are not
significant when matching a fuzzy link.
* lisp/org-element.el (org-element-link-parser): Do not remove
newlines characters in paths anymore, since this is not required.
* testing/lisp/test-org-element.el: Update tests.
* testing/lisp/test-ox.el: Add test.
* lisp/org-element.el (org-element-at-point): Return nil when in the
first empty lines of the buffer. Return headline when in empty
lines just after the headline.
* lisp/org-element.el (org-element--current-element): Add a limit
argument.
(org-element--collect-affiliated-keywords): Fix parsing of orphaned
keyword at the end of an element.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-macro-parser): Fix error when last
argument ends with a protected comma.
* testing/lisp/test-org-element.el (test-org-element/macro-parser):
Add tests.
* lisp/org-element.el (org-element-parse-buffer, org-element-map,
org-element-at-point, org-element-context): Be more verbose in
docstrings. Also fix typos.
* lisp/org-element.el (org-element-at-point): When point is before any
element, in the first blank lines of the buffer, return nil. When
point is within blank lines just after a headline, return that
headline.
(org-element-context): Return nil when point is within the blank at
the beginning of the buffer.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-context): Add an optional argument
so (org-element-context)
and (org-element-context (org-element-at-point)) are equivalent.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-object-variables): New variable.
(org-element-parse-secondary-string): Copy some buffer-local variables
to the temporary buffer created to parse the string so links can still
be properly expanded.
(org-element-link-parser): Link expansion and translation are applied
transparently for the parser.
* lisp/org-element.el (org-element--parse-elements,
org-element-at-point): Fix parsing of a list in a block in a list.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-line-break-parser): Line break
includes the newline character following the backslashes.
(org-element-line-break-interpreter): Apply changes to line break
parsing.
* lisp/org-element.el (org-element-timestamp-interpreter): Fix
timestamp interpreter when raw value isn't available.
* testing/lisp/test-org-element.el: Update test.
* lisp/org-element.el (org-element-context): When point is between two
objects, be sure to return the second one.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-timestamp-parser): Timestamp with
time range has active/inactive-range type.
* testing/lisp/test-org-element.el: Add test.
In order to know if starting date/time is really the same as ending
date/time, this patch permits to use the following:
(memq (org-element-property :type timestamp) '(active inactive))
* lisp/org-element.el (org-element-headline-parser,
org-element-inlinetask-parser): Remove :clockedp property.
This property isn't even remotely related to the structure of the
document and, as such, doesn't belong to Org element.
* lisp/org-element.el (org-element-center-block-parser,
org-element-drawer-parser, org-element-dynamic-block-parser,
org-element-footnote-definition-parser,
org-element-plain-list-parser, org-element-property-drawer-parser,
org-element-quote-block-parser, org-element-special-block-parser,
org-element-babel-call-parser, org-element-comment-parser,
org-element-comment-block-parser, org-element-diary-sexp-parser,
org-element-example-block-parser, org-element-export-block-parser,
org-element-fixed-width-parser, org-element-horizontal-rule-parser,
org-element-keyword-parser, org-element-latex-environment-parser,
org-element-paragraph-parser, org-element-src-block-parser,
org-element-table-parser, org-element-verse-block-parser): Add
`:post-affiliated' property to elements.
(org-element-inlinetask-parser): Remove affilated keywords.
* lisp/org.el (org-adaptive-fill-function): Use new property.
This property is cheap to compute during parsing and allows to
determine if point is on an affiliated keyword or not by checking if
it is between :begin and :post-affiliated positions.
* lisp/org-element.el (org-element--collect-affiliated-keywords):
Allow duals keywords with only secondary value.
* testing/lisp/test-org-element.el: Add test.
This patch allows to parse correctly the following:
#+CAPTION[short caption]:
#+CAPTION: Very long caption
Some paragraph.
* lisp/org-element.el (org-element-timestamp-parser): Modify timestamp
objects properties.
(org-element-headline-parser, org-element-inlinetask-parser): Remove
`:timestamp' and `:clock' property. Add `:clockedp' property. Also,
set `:closed', `:deadline' and `:scheduled' values to timestamp
objects, not strings. Small refactoring.
(org-element-clock-parser): Rename `:time' property into `:duration'.
Also, set `:value' value as a timestamp object, not a string.
(org-element-planning-parser): Set `:closed', `:deadline' and
`:scheduled' values to timestamp objects, not strings.
(org-element-clock-interpreter, org-element-planning-interpreter)
(org-element-timestamp-interpreter): Update interpreters.
(org-element--current-element): Tiny refactoring.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-paragraph-separate): Diary-sexp
elements can separate paragraphs.
(org-element-all-elements): Install new `diary-sexp' type.
(org-element--current-element): Recognize new `diary-sexp' elements.
(org-element-diary-sexp-parser, org-element-diary-sexp-interpreter):
New functions.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-property): Access to text
properties when argument is a string.
(org-element-put-property): Correctly set property when target is
a string.
(org-element-adopt-elements): Also put :parent properties on strings.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element--get-next-object-candidates): Fix
parsing of objects of the same type in a single paragraph.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-sub/superscript-successor): Fix
parsing of sub/superscript at beginning of item.
(org-element-latex-or-entity-successor): Fix parsing of latex
fragments at beginning of item.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-context,
org-element--get-next-object-candidates): Fix `org-element-context'.
In particular, the restrictions for an object may be different from
those of its container (i.e. table rows and table cells).
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-example-block-parser,
org-element-src-block-parser): Store value of example-blocks and
src-blocks unescaped.
(org-element-example-block-interpreter,
org-element-src-block-interpreter): Escape value again when storing
it.
* contrib/lisp/org-export.el (org-export-unravel-code): Don't clean
commas from code since org-element already took care of it.
* testing/lisp/test-org-export.el: Update test.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-object-restrictions): Allow links
in caption. Also allow inline-src-blocks and inline-babel-calls.
* contrib/lisp/org-e-ascii.el (org-e-ascii--unique-links): Handle
links in captions.
(org-e-ascii--describe-links): Small refactoring.
(org-e-ascii-template--document-title): Handle links in document
properties.
* lisp/org-element.el (org-element-parsed-keywords): Remove document
properties from the value.
(org-element-dual-keywords): Fix docstring.
(org-element-document-properties): New variable
* contrib/lisp/org-export.el (org-export--get-subtree-options,
org-export--get-inbuffer-options, org-export--get-global-options):
Use new variable instead of parsed keywords.
* lisp/org-element.el (org-element-headline-parser): Fix parsing for
headlines with a single COMMENT or QUOTE keyword.
* testing/lisp/test-org-element.el: Add tests.
Mention COPYING in READMEs.
Fix the header of ob-fortran.el (see this fix in Emacs trunk:
http://lists.gnu.org/archive/html/emacs-diffs/2012-09/msg00365.html)
Specify that org-colview-xemacs.el is *not* part of Emacs.
Specify that org-element.el is part of Emacs (prepare the sync.)
Add COPYING in the release (mk/server.mk).
* lisp/org-element.el (org-element-all-elements): Add `node-property'
as a new element type.
(org-element-greater-elements): Add property-drawer element to greater
elements since they now contain node-property elements.
(org-element-drawer-parser): Small refactoring.
(org-element-property-drawer-parser): Move into Greater Elements file
section.
(org-element-node-property-parser,
org-element-node-property-interpreter): New functions.
(org-element--current-element, org-element-at-point,
org-element--parse-elements): Handle new element type.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-center-block-parser,
org-element-drawer-parser, org-element-dynamic-block-parser,
org-element-footnote-definition-parser,
org-element-plain-list-parser, org-element-quote-block-parser,
org-element-special-block-parser, org-element-babel-call-parser,
org-element-comment-parser, org-element-comment-block-parser,
org-element-example-block-parser, org-element-export-block-parser,
org-element-fixed-width-parser, org-element-horizontal-rule-parser,
org-element-keyword-parser, org-element-latex-environment-parser,
org-element-paragraph-parser, org-element-property-drawer-parser,
org-element-src-block-parser, org-element-table-parser,
org-element-verse-block-parser): Change signature. Now use an
additional argument: affiliated.
(org-element--current-element): Skip affiliated keywords and pass them
as an argument to parsers. It prevents to walk through these
keywords twice: the first time to get to the first line of the
element, and a second time to collect the affiliated keywords.
* contrib/lisp/org-export.el (org-export-get-caption): Update function
since multiple affiliated keywords are now reversed.
* testing/lisp/test-org-element.el: Update tests.
* lisp/org-element.el (org-element-inline-src-block-successor): Fix
inline-src-block parsing at the beginning of an item.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element--current-element): At the very
beginning of a footnote definition or an item, next element is
always a paragraph.
* testing/lisp/test-org-element.el: Add tests.
This patch fixes parsing for following cases:
- - text
or
[fn:1] # Some text
* lisp/org-element.el (org-element-section-parser): Make sure section
cannot contain an headline.
(org-element--current-element): Fix bug requiring to parse a quote
section even when point is at an headline.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-paragraph-parser): Fix parsing of
paragraph at the beginning of an item.
* testing/lisp/test-org-element.el: Add test.
* lisp/org-element.el (org-element-link-type-is-file): New variable.
(org-element-link-parser): Extract search option and application in
"file"-type links.
* contrib/lisp/org-e-html.el (org-e-html-link): Remove components
extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-e-odt.el: Remove components extraction since this
in now done in `org-element-link-parser'.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-link): Remove
components extraction since this in now done in
`org-element-link-parser'.
* contrib/lisp/org-e-latex.el (org-e-latex-link): Remove components
extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-e-man.el (org-e-man-link): Remove components
extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-e-groff.el (org-e-groff-link): Remove components
extraction since this in now done in `org-element-link-parser'.
* contrib/lisp/org-md.el (org-md-link): Remove components extraction
since this in now done in `org-element-link-parser'.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-paragraph-separate): Since this
variable is meant to be searched forward, \end{...} shouldn't
trigger the end of a paragraph before checking if it is the end of
a complete environment.
(org-element-latex-environment-parser): Slight change to the regexp
matching the beginning of a latex environment.
(org-element-paragraph-parser): Paragraphs don't end at incomplete
latex environments.
(org-element-latex-or-entity-successor): Remove paragraph environments
from latex fragment search.
* lisp/org-element.el (org-element-item-parser): Do not remove tag
from body if list isn't descriptive.
* lisp/org-list.el (org-insert-item): Only ask about a term for
descriptive lists.
(org-list-struct, org-list-insert-item): Do not recognize a tag in an
ordered list.
* testing/lisp/test-org-element.el: Add test.
* lisp/org.el (org-fill-paragraph): No need to use
`org-element-paragraph-separate' in a verse block since blank lines
only can end a "paragraph".
* lisp/org-element.el (org-element-paragraph-separate): Apply changes
to comments.
(org-element-paragraph-parser): Correctly find end of paragraphs.
(org-element--current-element): Require colons for Babel calls.
(org-element-center-block-parser, org-element-dynamic-block-parser,
org-element-quote-block-parser, org-element-special-block-parser,
org-element-comment-block-parser, org-element-example-block-parser,
org-element-export-block-parser, org-element-src-block-parser,
org-element-verse-block-parser): Fall-back to paragraph parsing when
incomplete or ill-formed.
* testing/lisp/test-org-element.el: Update tests.
* lisp/org-element.el (org-element-at-point): Return consistent value
when function is called on a blank line within a plain list.
* testing/lisp/test-org-element.el: Add test.
* org.el (org-forward-element): Rename from
`org-element-forward'.
(org-backward-element): Rename from `org-element-backward'.
(org-up-element): Rename from `org-element-up'.
(org-down-element): Rename from `org-element-down'.
(org-drag-element-backward): Rename from
`org-element-drag-backward'.
(org-drag-element-forward): Rename from
`org-element-drag-forward'.
(org-mark-element): Rename from `org-element-mark-element'.
(org-transpose-element): Rename from `org-element-transpose'.
(org-unindent-buffer): Rename from
`org-element-unindent-buffer'.
(org-mode-map): Update the names of a commands.
Remove useless declarations.
* org-element.el (org-element-forward, org-element-backward)
(org-element-up, org-element-down)
(org-element-drag-backward, org-element-drag-forward)
(org-element-mark-element, org-narrow-to-element)
(org-element-transpose, org-element-unindent-buffer): Move to
org.el.
* lisp/org-element.el (org-element-item-parser,
org-element-plain-list-parser): Make sure that the element ends at
the beginning of a line if possible.
(org-element-at-point): Return expected element when point is at an
element's end or at its contents' end.
* testing/lisp/test-org-element.el: Add test.
* testing/lisp/test-org.el: Add test.
* org.el (org-mode-map): Use `M-h' for
`org-element-mark-element'.
(org-mark-subtree): Allow a numeric prefix argument to move up
into the hierarchy of headlines.
* org-element.el (org-element-up, org-element-down): Autoload.
* lisp/org-element.el (org-element-item-interpreter): Simplify bullet
creation.
(org-element-plain-list-interpreter): Fix wrong bullets, if needed.
This change allows to intrepret plain lists without providing list's
structure, which can be a bit hairy. For example, the following
snippet now suffices to create a list programmatically:
(org-element-interpret-data
'(plain-list nil
(item (:bullet "-") (paragraph nil "a"))
(item (:bullet "-") (paragraph nil "b"))))
* org.el: Update a few keybindings.
Use [(control down)] and "\M-}" for `org-element-forward'.
Use [(control up)] and "\M-{ `org-element-backward'.
Use "\C-c\C-^" for `org-element-up'.
Use "\C-c\C-_" for `org-element-down'.
Use "\C-c\C-@" for `org-element-mark-element'.
* org-element.el (org-element-down): Throw an error when the
element has no content.
* lisp/org-element.el (org-element-at-point): Add :parent property to
output.
(org-element-context): Add :parent property to output. Also return
a single element or object instead of a list of parents.
(org-element-forward, org-element-up): Apply changes.
* testing/lisp/test-org-element.el: Add tests.
* lisp/org-element.el (org-element-at-point): Fix function when buffer
starts with an inlinetask. Also fix it when called on the last
element in a greater element or the buffer.
* org.el (org-mode-map): Add keybindings to
`org-element-transpose' and `org-narrow-to-element'.
(org-metaup): Fall back on `org-element-drag-backward'.
(org-metadown): Fall back on `org-element-drag-forward'.
Also move chunks of declarations and require statements to
get rid of compiler warnings.
* org-exp-blocks.el (org): Don't require org. Add declarations.
* org-clock.el (org): Don't require org.
* ob-exp.el (org-list-forbidden-blocks): Add declarations.