* contrib/lisp/org-export.el (org-export-get-footnote-definition):
Provide a fallback definition when none can be found.
* contrib/lisp/org-e-latex.el (org-e-latex-footnote-reference): Revert
change made in 30ef385ee0 since it is
now handled at the export framework level.
* testing/lisp/test-org-export.el: Add test.
* contrib/lisp/org-export.el (org-export--get-subtree-options): When
point is at an headline and subtree export is called, make sure
export properties are extracted from parent headline.
* testing/lisp/test-org-export.el: Add test.
* 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.
* org-agenda.el (org-float): Don't alias `org-float'.
* org.texi (Timestamps, Deadlines and scheduling): Use
`diary-float' instead of the now obsolete alias `org-float'.
* test-org-element.el
(test-org-element/timestamp-interpreter): Ditto.
* org.el (org-parse-time-string): Allow strings supported by
tags/properties matcher (eg <now>, <yesterday>, <-7d>).
* test-org.el (test-org/org-parse-time-string): New test.
This is based on Ilya's commit 001bcb9. This commit was
wrong because active timestamps were not parsed correctly
anymore. This commit handles them correctly.
Thanks to Ivan Vilata i Balaguer for pushing this forward.
* doc/org.texi (Formula syntax for Calc): Add explanation and example
for empty field.
* lisp/org-table.el (org-table-eval-formula): Use `keep-empty' in more
places.
(org-table-make-reference): Use nan (not a number) for empty fields in
Calc formulas.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
(test-org-table/empty-field): New examples dealing with empty fields.
(test-org-table/copy-field): New ert-deftest with examples dealing with
empty fields.
This makes it possible to write spreadsheet Calc formulas that check
for empty fields: To sum the first two columns unless one or both
empty:
$3 = if("$1" = "nan" || "$2" = "nan", string(""), $1 + $2); E
* lisp/org-table.el (org-table-eval-formula): Keep empty fields during
preprocessing.
(org-table-make-reference): A range with only empty fields should not
always return 0 but also empty string, consistent with field reference
of an empty field. Use future design for nan but replicate current
behavior.
* testing/lisp/test-org-table.el: Adapt expected for several
ert-deftest.
The range len bugs may lead to wrong calculations for range references
with empty fields when the range len is relevant. Affects typically
Calc vmean on simple range and without format specifier EN. Also
Lisp with e. g. `length' on simple range or with L.
* doc/org.texi (Formula syntax for Calc): Extend explanations of
format specifiers.
* testing/lisp/test-org-table.el: Various new ert-deftest, mark with
TODO what needs to be fixed.
* testing/lisp/test-org-table.el (test-org-table/align): New
ert-deftest for table alignment within Org buffer.
* testing/org-test.el (org-test-table-target-expect): New defun.
The new function org-test-table-target-expect is to simplify writing
spreadsheet ERT by providing just a target table to apply the formula
to, the expected result table and the table formula with optionally
additional variants. The variants typically are to check the same
result with a Lisp formula and a Calc formula. test-org-table.el is
also a howto example collection as a user documentation.
* 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.
* org-test.el (org-test-with-temp-text-in-file): Wrap ,@body
into (progn ...) so that tests don't have to wrap it themselves.
Fix the testing suite to use this.
Also fix formatting and trailing whitespaces.
Fix test-org-src/blank-line-block so that it
checks editing of a code block with a whitespace
with point on the #+begin_src line.
Thanks to Michael Brand for spotting the (progn ...) problem.
* lisp/test-org-src.el (test-org-src/blank-line-block): Use
`org-test-with-temp-text-in-file' because `org-in-src-block-p'
checks against an Org mode text property. Don't check for the
word at point.
Thanks to Nick Dokos for reporting this failed test.
* org-test.el (org-test-with-temp-text): No need to kill a
temporary buffer. Don't use (prog1 ,@body ...), only expand
,@body.
Thanks to Nick Dokos for pointing this.
* contrib/lisp/org-export.el (org-export-get-previous-element,
org-export-get-next-element): Allow to retrieve all previous/next
exportable objects by specifying a non-nil, non positive integer
argument.
* testing/lisp/test-org-export.el: Add tests.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable): The last test
for clocktables introduced in commit 6642177 did not work if the test was
run before 15:00 due to the end time being specified as "<now>" (which
includes the current time of day and not just the date). The obvious
"<today>" does also not work since it means 0:00 of the current day. The
correct specification to use is "<tomorrow>", which is 0:00 the following
day or equivalently the end of today, 24:00.
* lisp/org.el (org-all-targets): Fix radio targets detection when
object is directly followed by a non-whitespace character.
* testing/lisp/test-org.el: Add test.
* 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))
* contrib/lisp/org-export.el (org-export--get-subtree-options): Store
value of options with `split' behaviour as a list of strings, not
simply as a string. Small refactoring.
* testing/lisp/test-org-export.el: Add tests.
* 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.