* contrib/lisp/org-export.el (org-export-define-derived-backend): Add
`:parent' property to derived backend.
(org-export-derived-backend-p): New function.
* testing/lisp/test-org-export.el: Add tests.
This function can be useful in filters implemation. I.e.
(defun my-filter (contents backend info)
(when (memq backend '(e-latex e-beamer some-derived-backend-from-latex))
...))
can be replaced with:
(defun my filter (contents backend info)
(when (org-export-derived-backend-p backend 'e-latex)
...))
* contrib/lisp/org-export.el (org-export-registered-backends): New
variable.
(org-export-define-backend, org-export-define-derived-backend): Use
new variable. Also redefine how sub-menus are defined.
(org-export-backend-filters, org-export-backend-menu,
org-export-backend-options, org-export-backend-translate-table): New
functions.
(org-export-get-environment, org-export--parse-option-keyword,
org-export--get-subtree-options, org-export--get-inbuffer-options,
org-export--get-global-options, org-export-install-filters,
org-export-with-backend): Access to data stored in new variable.
(org-export-dispatch-ui): Display sub-menus according to new
definition.
(org-export-dispatch-menu-entries): Removed variable.
* contrib/lisp/org-e-beamer.el: Use new sub-menu definition.
(org-e-beamer--format-section, org-e-beamer-item,
org-e-beamer-keyword): Use `org-export-with-backend' instead of
relying on removed variables.
* testing/lisp/test-org-export.el: Update tests.
This patch gets rid of "invisible" variables, that is variables
defvar'ed within a macro.
* lisp/org-list.el (org-list-separating-blank-lines-number): When
computing number of blank lines separating items, also count those
in unparsed blocks, like example blocks.
* testing/lisp/test-org-list.el: Add tests.
In the following situation, with `org-blank-before-new-entry' set to
`auto' for `plain-list-item, a blank line should be inserted when
inserting the following item:
- item1
#+BEGIN_EXAMPLE
contents
#+END_EXAMPLE
* lisp/org.el (org-beginning-of-line): check `visual-line-mode'
instead of `line-visual-mode' to determine whether to move by visual
lines.
* lisp/org.el (org-kill-line): use of org-bound-and-true-p macro.
* testing/lisp/test-org.el: Add test
* lisp/org.el (org-end-of-line): On a hidden block make sure to
delegate motion to `end-of-line' instead of `move-end-of-line' in
order to stay on the current line.
* testing/lisp/test-org.el: Update test.
* contrib/lisp/org-export.el (org-export-before-processing-hook): New
variable.
(org-export-as): Run a hook just before expanding include keywords and
macros, and evaluating Babel blocks.
* testing/lisp/test-org-export.el: Add test.
* contrib/lisp/org-export.el (org-export-get-previous-element,
org-export-get-next-element): Correctly retrieve previous and next
object, if any, in secondary strings.
* testing/lisp/test-org-export.el: Add tests.
* lisp/org.el (org-macro-replace-all): Signal an error when a circular
macro expansion happens.
(org-macro-initialize-templates): Fix docstring.
* testing/lisp/test-org.el: Add test.
* contrib/lisp/org-export.el (org-export-as): Expand correctly
{{{title}}} and such when they already contain a regular macro.
This is done by expanding macros in two steps: at first regular
macros, then document specific macros.
(org-export-expand-macro): Remove function.
* testing/lisp/test-org-export.el: Add test.
* 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/ob.el (org-babel-where-is-src-block-result): Insert new results
keyword in current narrowed part of buffer, if necessary. Small
refactoring.
(org-babel-insert-result): Do not widen buffer when new results have
to be inserted. Therefore, results inserted after the last block of
a narrowed buffer still belong to the narrowed part of the buffer.
* testing/lisp/test-ob.el: Add tests.
* testing/lisp/test-ob-exp.el: Move test to test-ob.el
* contrib/lisp/org-export.el (org-export-as):
`org-current-export-file' should refer to current, temporary, buffer
containing included contents, not to original buffer with include
keywords.
(org-export-with-current-buffer-copy): Buffer copy must contain the
whole buffer, possibly narrowed to a proper part, not only the
narrowed part.
* testing/lisp/test-org-export.el: Tweak 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.
* contrib/lisp/org-export.el (org-export-options-alist): Add an option
item to toggle smart quotes during export.
(org-export-with-smart-quotes, org-export-smart-quotes-alist,
org-export-smart-quotes-regexps): New variables.
(org-export-activate-smart-quotes): New function.
(org-export-data): Remove residual text properties.
* testing/lisp/test-org-export.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.el (org-auto-fill-function): Make sure `adaptive-fill-mode'
mode is nil when pre-computed `fill-prefix' is the empty string.
Otherwise filling functions from fill.el think it has to be computed
again and overwrite it.
* lisp/org.el (org-end-of-line): Do not call `end-of-visual-line' when
moving to the end of line. Also improve behaviour on elements that
can be hidden.
* testing/lisp/test-org.el: Add tests.
* lisp/ob-exp.el (org-export-blocks-preprocess): Results of an
evaluated code block can be inserted within the blank lines after
the block. Hence, if the block has to be removed, delete everything
down to the first non-blank line after the end of block closing
string, instead of removing everything down to the very end of the
block.
* testing/lisp/test-ob-exp.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.
* contrib/lisp/org-export.el (org-export-as): Expand include keywords
before macros. This allows to specify macro templates in the
included file.
* testing/examples/macro-templates.org: New file for testing purposes.
* testing/lisp/test-org-export.el: Add test.
* contrib/lisp/org-export.el (org-export-expand-macro): New function.
(org-export-as): Use new function.
* lisp/org.el (org-macro-expand, org-macro-replace-all): Change
signature. The function now accepts an alist of templates so it
doesn't have to rely only on `org-macro-templates'.
(org-macro-initialize-templates): {{{date}}} is not anymore an alias
for {{{time}}}. During export, it will provide the value stored in
DATE keyword instead.
* testing/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org.el: Update tests.
* 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-src.el (org-escape-code-in-string,
org-unescape-code-in-string, org-escape-code-in-region,
org-unescape-code-in-region): New functions.
(org-edit-src-code, org-edit-src-exit): Use new functions.
* lisp/org.el (org-strip-protective-commas): Removed function.
* lisp/org-exp.el (org-export-select-backend-specific-text): Use new
function.
* lisp/ob.el (org-babel-parse-src-block-match,
org-babel-parse-inline-src-block-match, org-babel-insert-result):
Always escape produced blocks, independently on the language of the
block, if any. Use new functions.
* doc/org.texi: Update documentation.
* testing/lisp/test-ob.el: Update test.
This reverts the last part of commit 22c3080830.
* testing/lisp/test-ob.el (test-ob/results-do-not-replace-code-blocks):
These two whitespace errors are intentional. Do not remove them.
* 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.
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-org):
BEGIN_ORG / END_ORG has been replaced by BEGIN_SRC org / END_SRC.
Change test comparison template accordingly.
* testing/lisp/test-ob.el (test-ob/org-babel-remove-result--results-*):
These tests had duplicate definitions, removed the first one of each.
* 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/ob-R.el (org-babel-R-initiate-session): Protect against use of
unbound variable `ess-ask-for-ess-directory´. The default for this
variable is true, so act accordingly if it is found unbound.
* lisp/ob-R.el: Remove initialization with `nil´ from
`ess-ask-for-ess-directory´ and `ess-local-process-name´. Remove
second declaration for `ess-local-process-name´.
* testing/lisp/test-ob-R.el (test-ob-R/simple-session): Bind
`ess-ask-for-ess-directory´ to nil to facilitate batch testing.
* 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.
* contrib/lisp/org-export.el (org-export--install-letbind-maybe): If
a variable is bound two times in the buffer, be sure to set its
value to the last bound. Use correct function to confirm binding.
Allow keyword to start on any column.
* testing/lisp/test-org-export.el: Add tests.
* contrib/lisp/org-export.el (org-export-define-backend): Update
docstring.
(org-export-special-keywords): Remove "MACRO".
(org-export--get-inbuffer-options, org-export--get-buffer-attributes):
Remove internal macro handling.
(org-export-as): Use external tool instead.
(org-export-expand-macro): Remove function.
* contrib/lisp/org-e-ascii.el (org-e-ascii-macro): Remove function.
* contrib/lisp/org-e-groff.el (org-e-groff-macro): Remove function.
* contrib/lisp/org-e-html.el (org-e-html-macro): Remove function.
* contrib/lisp/org-e-latex.el (org-e-latex-macro): Remove function.
* contrib/lisp/org-e-man.el (org-e-man-macro): Remove function.
* contrib/lisp/org-e-odt.el (org-e-odt-macro): Remove function.
* contrib/lisp/org-e-texinfo.el (org-e-texinfo-macro): Remove
function.
* testing/lisp/test-org-export.el: Remove tests.
Since macros are now expanded before parsing (and produce Org syntax),
back-ends will never see them (unless NO-EXPAND argument from
`org-export-as' is non-nil, which isn't the case for any back-end so
far).
* contrib/lisp/org-export.el (org-export-with-statistics-cookies): New
variable.
(org-export-options-alist): Use new variable.
(org-export--skip-p): Handle new option.
* testing/lisp/test-org-export.el: Add test.
* lisp/org.el (org-backward-element): When called at the beginning of
first element in section, the function shouldn't return an error but
move point to headline or point-min instead.
* testing/lisp/test-org.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.el (org-fill-context-prefix, org-fill-paragraph): Do not
fill verse blocks contents. Verse blocks can be used to format
free-form poetry, so filling has to be done manually.
* testing/lisp/test-org.el: Remove unnecessary tests.
The current Emacs trunk bumped to version >24.2.50 because a new
release Emacs 24.2 has been decided. `cl-map' is not an alias for
`map' in Emacs < 24.2.50 -- so take this into account in some tests.
* lisp/org.el (org-fill-paragraph): Fix filling in a narrowed buffer.
(org-fill-context-prefix): Fill prefix doesn't depend on current
narrowing.
* testing/lisp/test-org.el: Add test.
* 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-list.el (org-list-automatic-rules): Remove `bullet' rule,
which is now hard-coded.
(org-cycle-list-bullet): Hard code `bullet' rule.
(org-list-get-list-type): Make sure a list with numbered bullets
cannot have `descriptive' type.
* testing/lisp/test-org-list.el: Add tests.
* 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.
* 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.
* lisp/org.el (org-mark-subtree): Do not make a special case for
inlinetasks when marking a subtree. These are handled by
`org-element-mark-element'.
* testing/lisp/test-org.el: Add test.
* lisp/org.el (org-mode): Set comments related variables.
(org-insert-comment, org-comment-or-uncomment-region): New functions.
* testing/lisp/test-org.el: Add test.
* 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.
* contrib/lisp/org-export.el (org-export-get-environment,
org-export-collect-tree-properties, org-export-data,
org-export-expand-include-keyword): Use new names.
(org-export--parse-option-keyword): Renamed from
`org-export-parse-option-keyword'.
(org-export--get-subtree-options): Renamed from
`org-export-get-subtree-options'.
(org-export--get-inbuffer-options): Renamed from
`org-export-get-inbuffer-options'.
(org-export--get-buffer-attributes): Renamed from
`org-export-get-buffer-attributes'.
(org-export--get-global-options): Renamed from
`org-export-get-global-options'.
(org-export--allow-BIND-local): Renamed from
`org-export-allow-BIND-local'.
(org-export--confirm-letbind): Renamed from
`org-export-confirm-letbind'.
(org-export--install-letbind-maybe): Renamed from
`org-export-install-letbind-maybe'.
(org-export--get-min-level): Renamed from `org-export-get-min-level'.
(org-export--collect-headline-numbering): Renamed from
`org-export-collect-headline-numbering'.
(org-export--populate-ignore-list): Renamed from
`org-export-populate-ignore-list'.
(org-export--interpret-p): Renamed from `org-export--interpret-p'.
(org-export--prepare-file-contents): Renamed from
`org-export-prepare-file-contents'.
* contrib/lisp/org-e-publish.el (org-e-publish-find-date): Use new
names.
* testing/lisp/test-org-export.el: Update tests.
* contrib/lisp/org-export.el (org-export-define-backend): New macro.
* contrib/lisp/org-e-ascii.el: Use new macro.
* contrib/lisp/org-e-html.el: Use new macro.
* contrib/lisp/org-e-latex.el: Use new macro.
* contrib/lisp/org-e-odt.el: Use new macro.
* contrib/lisp/org-element.el (org-element-block-name-alist): Remove
hard-coded export block names from variable, since they are added
automatically by `org-export-define-backend'.
* testing/lisp/test-org-element.el: Update test.
* contrib/lisp/org-element.el (org-element-planning-parser): Store
parsed timestamps without the bracket markers.
(org-element-timestamp-interpreter): Store parsed timestamps without
the bracket markers. Also provide a new property: `:range-end'.
(org-element-planning-interpreter, org-element-timestamp-interpreter):
Apply changes to parsers.
* testing/lisp/test-org-element.el: Add test.
* contrib/lisp/org-export.el (org-export-get-subtree-options): Add
a subtree property for each export option.
* testing/lisp/test-org-export.el: Add tests.
Properties names are obtained by adding "EXPORT_" prefix to buffer
keywords.
* contrib/lisp/org-export.el (org-export-get-global-options): Parse
default value from parsed keywords, too.
* testing/lisp/test-org-export.el: Change test accordingly.
* contrib/lisp/org-export.el (org-export-get-subtree-options): Make
sure point is at an headline and buffer isn't narrowed before
looking for EXPORT_TITLE property.
* testing/lisp/test-org-export.el: Add test.
* contrib/lisp/org-element.el (org-element-parse-buffer): Correctly
set original parent.
(org-element-parse-elements, org-element-parse-objects): Set `:parent'
property of each element/object.
* testing/lisp/test-org-element.el: Add tests.
* contrib/lisp/org-export.el (org-export-get-buffer-attributes):
Retrieve footnote definitions and id in buffer.
(org-export-store-footnote-definitions): Removed function.
(org-export-collect-tree-properties): Update docstring.
(org-export-as): Do not call `org-export-store-footnote-definitions'.
(org-export-resolve-id-link): Return external file name when there's
no match for id in current parse tree.
* contrib/lisp/org-e-latex.el (org-e-latex-link): Handle external id
links.
* testing/lisp/test-org-export.el: Add tests.
* contrib/lisp/org-export.el (org-export-get-tags): New function.
* contrib/lisp/org-e-ascii.el (org-e-ascii--build-title): Use new function.
* contrib/lisp/org-e-html.el (org-e-html-format-headline--wrap,
org-e-html-headline): Use new function.
* contrib/lisp/org-e-latex.el (org-e-latex-headline,
org-e-latex-inlinetask): Use new function.
* contrib/lisp/org-e-odt.el (org-e-odt-format-headline--wrap): Use new
function.
* testing/lisp/test-org-export.el: Add tests.
* contrib/lisp/org-export.el (org-export-populate-ignore-list): Fix
docstring.
(org-export--selected-trees): Correctly search for headlines with
a select tag.
(org-export--skip-p): Fix selective export when a select tag is
present in the buffer.
* testing/lisp/test-org-export.el: Update tests.
* contrib/lisp/org-export.el (org-export-get-inbuffer-options): Return
an "eval" macro as a regular secondary string instead of a plain
string.
(org-export-expand-macro): Replace arguments before exporting
them (and possibly protecting dollar signs). Refactor code.
* testing/lisp/test-org-export.el: Add tests.
* contrib/lisp/org-export.el (org-export-resolve-coderef): New function.
* contrib/lisp/org-e-ascii.el (org-e-ascii-link): Use new function.
* contrib/lisp/org-e-html.el (org-e-html-link): Use new function.
* contrib/lisp/org-e-latex.el (org-e-latex-link): Use new function.
* contrib/lisp/org-e-odt.el (org-e-odt-link): Use new function.
* testing/lisp/test-org-export.el: Add tests.