Commit Graph

2531 Commits

Author SHA1 Message Date
Ihor Radchenko 26f1cb77a9
org-ascii-item: Fix for alphabetical bullets
* lisp/ox-ascii.el (org-ascii-item): Fix setting [@X] counter for
alphabetical lists.
* testing/lisp/test-ox-ascii.el:
(test-ox-ascii/list):  Add new test.
* testing/lisp/test-ox-latex.el (org-test-with-exported-text):
* testing/org-test.el (org-test-with-exported-text): Move macro to be
available across multiple test files.

Reported-by: Tom Alexander <tom@fizz.buzz>
Link: https://orgmode.org/list/36a62fbf-6484-456f-9537-a7aa40530068@app.fastmail.com
2023-10-07 13:22:09 +03:00
Leo Butler 2ba45fcb78
* lisp/ob-maxima.el: enable use of `batch' loader and `draw'
* (org-babel-header-args:maxima): Document the two new header
arguments (batch and graphics-pkg) that are specific to ob-maxima.
* (org-babel-maxima--command-arguments-default): A new variable
storing the default command-line argument(s).  This value was
hard-coded in `org-babel-maxima:execute'.
* (org-babel-maxima--graphic-package-options): A new variable that
stores an alist of Maxima graphics packages and the Maxima code to set
up that package.
* (org-babel-maxima--default-epilogue): A new variable that stores an
alist of the clean-up code that is run at end of a `graphical-output'
or `non-graphical-output' source block.
* (org-babel-maxima--output-filter-regexps): A new variable that
stores a list of regexps to identify "bad" output lines to be removed
from Maxima's output.  Source-code comments document each regexp's
purpose.  Two additional regexps have been added: one filters
un-wanted output from `batch' and the other removes empty input lines
that `batch'-ed output may spuriously produce (actual empty input
lines are syntax errors, see the new tests below).
* (org-babel-maxima--output-filter): A new function that takes a
single line of Maxima output.  It returns nil if the line has zero
length or matches a regexp in
`org-babel-maxima--output-filter-regexps'; otherwise, it returns the
line.  This function and regexp replace the hard-coded filter in
`org-babel-execute:maxima'.
* (org-babel-maxima-expand): Prepare the source block for execution,
depending on whether it is producing graphical output or not.  In case
of graphical output, use the `graphics-pkg' header to set the graphics
package and use `org-babel-maxima--graphic-package-options' to set-up
the package.  Grovel the graphics terminal from the output filename.
* (org-babel-execute:maxima): Use the :batch header argument and
`org-babel-maxima--command-arguments-default' to execute the source
block.  Replace the existing, in-line output filter and its regexps
with `org-babel-maxima--output-filter' and
`org-babel-maxima--output-filter-regexps'.

* testing/examples/ob-maxima-test.org: Add test examples.

Include examples of the batch-related tests from
testing/lisp/test-ob-maxima.el.  Provide an example of the
`:graphics-pkg' header argument with the `draw' package.

* testing/lisp/test-ob-maxima.el: Introduce six new, batch-related
test functions.  Each test exercises the :batch header argument.  The
response to unusual inputs is tested (empty strings, strings with just
whitespace, input with the `:lisp' reader, and two syntax-related
errors).

link: https://list.orgmode.org/87cyz1ivzw.fsf@t14.reltub.ca/
2023-10-04 11:27:46 +03:00
Ilya Chernyshov e203b5a659
testing: Delete useless ert tests
* testing/lisp/test-ob-C.el: Delete useless test.

* testing/lisp/test-ob-fortran.el: Delete useless test.

* testing/lisp/test-ob-lilypond.el: Delete useless test.

* testing/lisp/test-ob-maxima.el: Delete useless test.
2023-09-17 12:48:36 +03:00
Ihor Radchenko 1d35ebd93c
test-org-clok/org-clock-update-time-maybe: Fix test for non-English LANG
* testing/lisp/test-org-clock.el (test-org-clok/org-clock-update-time-maybe):
Do not assert English day names.

Reported-by: emacs@supporter.mailer.me
2023-09-15 12:00:06 +03:00
Ihor Radchenko 20162f5a5c
org-element-dynamic-block-open-re-nogroup: Demand block name
* lisp/org-element.el (org-element-dynamic-block-open-re-nogroup): Fix
inconsistency with `org-element-dynamic-block-open-re' - block name is
mandatory.
*
testing/lisp/test-org-element.el (test-org-element/dynamic-block-parser):
Add test.
2023-09-12 11:15:17 +03:00
Bruno BARBIER 3674e40247
* testing/lisp/test-ob-haskell-ghci.el: Test output without EOL
(ob-haskell/output-without-eol-1):
(ob-haskell/output-without-eol-2):
(ob-haskell/output-without-eol-3): New tests.
2023-09-08 10:59:46 +03:00
Bruno BARBIER 36a786f7f9
ob-haskell: Implement sessions
* lisp/ob-haskell.el (org-babel-haskell-initiate-session): Implement
sessions.
(org-babel-haskell-with-session): New macro to manage sessions.
(org-babel-interpret-haskell): Refactor code.  Use
`org-babel-haskell-with-session` to manage sessions.

* testing/lisp/test-ob-haskell-ghci.el: Update tests related to
sessions.
2023-09-08 10:59:45 +03:00
Bruno BARBIER 924c2dd836
lisp/ob-haskell: Request the last value from GHCi
* lisp/ob-haskell.el (org-babel-interpret-haskell): When the result
type is 'value, use the last value as defined by GHCi.
(org-babel-haskell-eoe): New default value.
(org-babel-interpret-haskell): Update for the new value of `org-babel-haskell-eoe'.

* testing/lisp/test-ob-haskell-ghci.el: Update tests related to output/value.
2023-09-08 10:59:44 +03:00
Ihor Radchenko b852172170
* testing/lisp/test-ob-haskell-ghci.el: Enable fixed tests
(ob-haskell/hello-world-output-multilines):
(ob-haskell/let-multilines-1):
(ob-haskell/let-multilines-2):
(ob-haskell/primes):
(ob-haskell/not-defined-then-defined-1-fixed): Re-enable tests.
2023-09-08 10:59:43 +03:00
Ihor Radchenko d6dd92d442
* testing/lisp/test-ob-haskell-ghci.el: Fix some tests
(ob-haskell/2D-lists-multilines):
(ob-haskell/ghci-info): Fix incorrect test assertions.
2023-09-08 10:59:43 +03:00
Bruno BARBIER 91c52e2ab6
ob-haskell: Add tests for GHCi
testing/lisp/test-ob-haskell-ghci.el: New file.
2023-09-08 10:59:41 +03:00
Nicholas Vollmer 4fe52fc8ac
lisp/ob-lilypond.el: refactor org-babel-lilypond-compile-lilyfile
* ob-lilypond.el (org-babel-lilypond-compile-lilyfile):
Correct compilation message.
Remove superfluous local variables.
Remove unused ad-hoc debugging TEST parameter.

* test-ob-lilypond.el (ob-lilypond/ly-compile-lilyfile):
Locally bind variables which may generate output files.
Refactor to account for removed TEST parameter.
2023-09-06 12:33:35 +03:00
Ihor Radchenko 13e4ee7371
org-babel-comint-with-output: Fix for edge case of `comint-prompt-regexp'
* lisp/ob-comint.el (org-babel-comint-with-output): Implement more
universal algorithm catching agglomerated prompts.  The new approach
works for regexps that match ^, but not as the first char in the
regexp string.
* testing/lisp/test-ob-octave.el (ob-octave/session-multiline): Add
new test.

Reported-by: Paul Stansell <paulstansell@gmail.com>
Link: https://orgmode.org/list/CAMJKaZwuTV-06pPz5nv87CNcoVcqCwFjEodubXTzXs15Q=OFug@mail.gmail.com
2023-09-06 12:19:14 +03:00
Jens Schmidt 234650af2e
org-make-tags-matcher: Re-add quoting of property names
* lisp/org.el (org-make-tags-matcher):
* testing/lisp/test-org.el (test-org/map-entries): Move special cased
handling of LEVEL properties.  Add tests for other special cased
properties TODO and CATEGORY.

* lisp/org.el (org-make-tags-matcher):
* doc/org-manual.org (Matching tags and properties):
* testing/lisp/test-org.el (test-org/map-entries): Re-add and extend
quoting of property names in search strings.

Link: https://orgmode.org/list/87h6oq2nu1.fsf@gmail.com
2023-09-03 09:48:41 +03:00
Jack Kamm 8000b11209 test-ob-python: Unit test for restarting session
See: https://list.orgmode.org/87ttsnh5bx.fsf@localhost/T/#t

* testing/lisp/test-ob-python.el (test-ob-python/session-restart): New
test for restarting ob-python session process.
2023-08-30 21:48:36 -07:00
Ihor Radchenko 21171d1366
* testing/lisp/test-org.el (test-org/insert-heading): Fix test
The test itself is wrong - `org-insert-heading' was correctly obeying
blank before the entry at point when inserting a new heading.
2023-08-27 11:18:49 +03:00
Ihor Radchenko fcca762741
* testing/lisp/test-ob-clojure.el: Remove incorrect tests (all the tests)
("cider"): Remove assertions for cider.  Clojure supports more than cider.
(ob-clojure/simple-session):
(ob-clojure/initiate-session):
(ob-clojure/initiate-session-with-var): Remove session tests -
ob-clojure has no session support.
(ob-clojure/tangle-without-ns): Remove tangle test - it has no
relation to ob-clojure.

Add FIXME to implement some tests, as we end up with 0 ob-clojure
tests after this commit.

Link: https://orgmode.org/list/87v8d4ivqh.fsf@localhost
2023-08-25 10:46:36 +03:00
Ihor Radchenko 53c9d91d3c
org-element: Fix post-blank shared between items
* lisp/org-element.el (org-element-item-parser): Do not parse beyond
LIMIT - they may extend :post-blank beyond parent list contents.
(org-element-plain-list-parser): Make sure that plain list always owns
the trailing blank lines.
(org-element-cache-version): Bump cache version.
* testing/lisp/test-org-element.el (test-org-element/item-parser): Add
test.

Reported-by: Tom Alexander <tom@fizz.buzz>
Link: https://orgmode.org/list/1c833eb8-c556-437b-ac5b-be360ebcc869@app.fastmail.com
2023-08-22 11:25:59 +03:00
Ihor Radchenko 680138d7ff
fixup! test-org-colview/...: Fix Emacs 28 compatibility 2023-08-21 12:58:44 +03:00
Ihor Radchenko 8b35734b49
test-org-colview/...: Fix Emacs 28 compatibility
*
testing/lisp/test-org-colview.el (test-org-colview/columns--move-row-stay-at-the-same-column):
Skip the test in Emacs <29 where it is not possible to determine
visual column.
2023-08-21 10:21:33 +03:00
Sławomir Grochowski 650e42996e
lisp/org-colview.el: Add new commands to move column view table row
* doc/org-manual.org (org-columns-move-row-up,
org-columns-move-row-down, org-columns-move-left,
org-columns-move-right): Document two new and two old commands.
* etc/ORG-NEWS (New commands to move rows up & down): Document the new
feature.
* lisp/org-colview.el (org-columns--move-row, org-columns-move-row-up,
org-columns-move-row-down): New functions.
* testing/lisp/test-org-colview.el (test-org-colview/columns-move-row-down,
test-org-colview/columns-move-row-up,
test-org-colview/columns--move-row-stay-at-the-same-column,
test-org-colview/columns-move-row-down-with-subheading): New tests.
2023-08-20 13:39:47 +03:00
Ihor Radchenko dd2f05f592
fixup! fixup! org-insert-heading: Fix when folded text is kept right at the new heading 2023-08-20 09:43:25 +03:00
Ihor Radchenko e17ca87994
Merge branch 'bugfix' 2023-08-20 09:30:59 +03:00
Ihor Radchenko 7b38670e69
fixup! org-insert-heading: Fix when folded text is kept right at the new heading
* lisp/org.el (org-insert-heading): Fix missing newline when inserting
before existing heading.
* testing/lisp/test-org.el (test-org/insert-heading): Add test
checking for the fixed failure.  Update tests.
(test-org/insert-todo-heading-respect-content): Update tests.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/ubrugh$be1$1@ciao.gmane.io
2023-08-20 09:28:15 +03:00
Ihor Radchenko bbdf9781c2
test-org/insert-todo-heading-respect-content: Fix tests
*
testing/lisp/test-org.el (test-org/insert-todo-heading-respect-content):
Do not assert newline after newly added heading.  See 52bc95676.
2023-08-19 12:16:36 +03:00
Ihor Radchenko 54f8b0bfd0
Merge branch 'bugfix' 2023-08-19 10:55:08 +03:00
Ihor Radchenko 52bc95676c
org-insert-heading: Fix when folded text is kept right at the new heading
* lisp/org.el (org-insert-heading): Do not slurp blank lines after
previous heading into the contents of the newly added one.  These
blank lines might be folded and we end up with point before folded
spaces * <point>...
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
(test-org/insert-todo-heading-respect-content): Do not expect trailing
newline after the newly added heading.  The test did not intentionally
test this particular behavior (other tests do not expect trailing
newlines to be _always_ added).

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/ubpcoi$f7n$1@ciao.gmane.io
2023-08-19 10:52:25 +03:00
Ihor Radchenko b3660cf135
* testing/lisp/test-org-attach-git.el: Avoid using global git config
(test-org-attach-git/with-annex): Disable global git config during
testing.
2023-08-18 12:03:58 +03:00
Juan Manuel Macias 2eb4fd8900
lisp/ox-latex.el: Add the `:literal' attribute to verse block.
* (org-latex-verse-block): Now the treatment of blank lines is
consistent with the syntax of the LaTeX `verse' environment, and the
one provided by the `verse' package.  If the `:literal' attribute is
used, all blank lines are preserved and exported as
`\vspace*{\baselineskip}', including the blank lines before or after
contents.  The rx code has been suggested by Ihor Radchenko, to
improve readability.

* doc/org-manual.org (Verse blocks in LaTeX export): The new feature
is documented.

* testing/lisp/test-ox-latex.el (test-ox-latex/verse): Updated.
2023-08-18 11:41:24 +03:00
Ihor Radchenko f1359546ad
org-element-at-point: Throw an error when not in org-mode
* lisp/org-element.el (org-element-at-point): Explicitly throw an
error when not in org-mode buffer.  The parser expects certain
buffer-local constants and may fail otherwise.  It is better to
indicate the problem explicitly instead of dealing with cryptic
generic errors.
(org-element-plain-list-interpreter):
* testing/lisp/test-ox.el (test-org-export/expand-include/links): Make
sure that we never invoke parser in non-Org buffers.
2023-08-18 11:11:17 +03:00
Ihor Radchenko 9e40208547
test-org-agenda/todo-selector: Remove stray `message' call
* testing/lisp/test-org-agenda.el: Remove leftover message call.
2023-08-18 11:08:12 +03:00
Ihor Radchenko f285ae37b3
org-agenda-get-todos: Fix for todo keywords that can be interpreted as regexp
* lisp/org-agenda.el (org-agenda-get-todos): Use `regexp-quote' to
match keywords.
(org-select-this-todo-keyword): Add docstring, clarifying the allowed
values.
* testing/lisp/test-org-agenda.el (test-org-agenda/todo-selector): Add
new test.

Reported-by: spookygostee@gmail.com
Link: https://orgmode.org/list/87jztuzzpl.fsf@gmail.com
2023-08-17 14:15:14 +03:00
Ihor Radchenko e4504853b5
Merge branch 'bugfix' 2023-08-16 11:43:12 +03:00
Ihor Radchenko 27a41d418d
org-element--cache-before-change: Fix edge case creating heading
* lisp/org-element.el (org-element--cache-before-change): Fix edge
case when a heading is created because we insert a newline right
before ****.
* testing/lisp/test-org-element.el (test-org-element/cache-headline):
Add tests.

Reported-by: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Link: https://orgmode.org/list/CAGxMbPbbqc33iaqJ=EceyKrLaf4maJAxaUmJGaPOvG_Rpw+xcQ@mail.gmail.com
2023-08-16 11:41:31 +03:00
Ihor Radchenko 9fd547dd3a
org-babel-where-is-src-block-result: Fix inside affiliated parsed keyword
* lisp/ob-core.el (org-babel-where-is-src-block-result): Do not assume
that parent has contents-end and that we are inside contents, but not
inside secondary object/affiliated keyword.
*
testing/lisp/test-ob.el (test-ob/inline-src_blk-default-results-replace-line-1):
Add tests.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
Link: https://orgmode.org/list/CA+G3_PNt7WqkCzChV+dx1FeSPgTEVkNSE41a3qC5wv3g+jTwrQ@mail.gmail.com
2023-08-16 11:07:20 +03:00
Ihor Radchenko e340dde63e
org-element-export-snippet-parser: Fix when no closing @@
* lisp/org-element.el (org-element-export-snippet-parser): Return nil
when there is no closing @@.
* testing/lisp/test-org-element.el (test-org-element/context): Add
test.

Reported-by: Tom Alexander <tom@fizz.buzz>
Link: https://orgmode.org/list/fb61ea28-f004-4c25-adf7-69fc55683ed4@app.fastmail.com
2023-08-15 11:37:37 +03:00
Ihor Radchenko a0830f94ea
* testing/org-test.el: Avoid looking into .emacs.d when ran non-interactively
(org-test-load):
(org-test-update-id-locations): Set `org-id-locations-file' inside
test dir, but only when running in batch mode.

Reported-by: Morgan Smith <Morgan.J.Smith@outlook.com>
Link: https://orgmode.org/list/ub84qp$6pu$1@ciao.gmane.io
2023-08-13 11:28:32 +03:00
Rudolf Adamkovič 68aa438857
ob-sqlite: Use a transient in-memory database by default
* etc/ORG-NEWS (New features): Add a news entry.
* lisp/ob-sqlite.el (org-babel-execute:sqlite): Default ':db' to
":memory:" instead of throwing an error.
* testing/lisp/test-ob-sqlite.el (ob-sqlite/in-file): Test the old behavior.
* testing/lisp/test-ob-sqlite.el (ob-sqlite/in-memory): Test the new behavior.
2023-08-12 11:00:48 +03:00
Ihor Radchenko 695fbc9086
fixup! test-ox-html: Add new tests for checkboxes: ascii, html & unicode
* testing/lisp/test-ox-html.el (ox-html/checkbox-ascii):
(ox-html/checkbox-html):
(ox-html/checkbox-unicode): Pass BEG and END arguments to
`libxml-parse-xml-region'.  They are mandatory in Emacs <29.
2023-08-10 15:47:30 +03:00
Hraban Luyat 39ae2eda5b
test-ox-html: Add new tests for postamble format
* testing/lisp/test-ox-html.el (ox-html/postamble-default):
(ox-html/postamble-custom):
(ox-html/postamble-custom-format):
(ox-html/postamble-none):
(ox-html/postamble-format-wrong-config):
(ox-html/postamble-format-proper-config):
(ox-html/postamble-format-conflict):
(ox-html/postamble-format-author): New tests.
2023-08-10 12:41:35 +03:00
Hraban Luyat 003927a594
test-ox-html: Add new tests for checkboxes: ascii, html & unicode
* testing/lisp/test-ox-html.el (ox-html/checkbox-ascii):
(ox-html/checkbox-html):
(ox-html/checkbox-unicode): New tests.
2023-08-10 12:35:34 +03:00
Ihor Radchenko 173b5de0ec
testing: Re-introduce more useful new tests instead of deleted dupllicates
* testing/lisp/test-ol.el (test-org-link/store-link):
* testing/lisp/test-org-table.el (test-org-table/get-field):
* testing/lisp/test-org.el (test-org/auto-fill-function): Add modified
version of the removed test duplicates, according to their likely
original intention.

Link: https://orgmode.org/list/87cz0wyw9m.fsf@localhost
2023-08-08 15:40:59 +03:00
Ilya Chernyshov fe85d61a92
testing: Delete duplicate tests
* testing/lisp/test-ol.el (test-org-link/store-link): Delete a duplicate test.

* testing/lisp/test-org-clock.el (test-org-clock/clocktable/properties): Delete a duplicate test.

* testing/lisp/test-org-element.el (test-org-element/link-parser,
test-org-element/timestamp-parser): Delete duplicate tests.

* testing/lisp/test-org-table.el (test-org-table/get-field): Delete a duplicate test.

* testing/lisp/test-org.el (test-org/auto-fill-function): Delete a duplicate test.
2023-08-08 15:33:06 +03:00
Jens Schmidt f689eb44f1
org-make-tags-matcher: Add starred property operators, fix quoting
* lisp/org.el (org-make-tags-matcher): Add starred property operators.
Recognize additional operators "==", "!=", "/=".  Clean up and
document match term parsing.  Remove needless and buggy unquoting of
minus characters in property and tag names.
(org-op-to-function): Recognize additional inequality operator "/=".

* doc/org-manual.org (Matching tags and properties): Add documentation
on starred and additional operators.  Document allowed characters in
property names and handling of minus characters in property names.

* testing/lisp/test-org.el (test-org/map-entries): Add tests for
starred and additional operators.  Add tests for property names
containing minus characters.

* etc/ORG-NEWS: (~org-tags-view~ supports more property operators):
Add announcement on starred and additional operators.

Link: https://orgmode.org/list/9132e58f-d89e-f7df-bbe4-43d53a2367d2@vodafonemail.de
2023-08-08 10:01:00 +03:00
Ihor Radchenko f9e083086f
Merge branch 'bugfix' 2023-08-07 14:59:17 +03:00
Ihor Radchenko 168ba7e6cf
test-ob-scheme.el: Disable testing for older Emacs unsupported by Geiser
* testing/lisp/test-ob-scheme.el (version<=): Throw
'missing-test-dependency unless minimum Emacs version required by
Geiser is used.

Link: https://orgmode.org/list/87r0og2dz7.fsf@mail.jao.io
2023-08-07 14:57:17 +03:00
Ihor Radchenko c7e1f78326
Merge branch 'bugfix' 2023-08-05 16:17:35 +03:00
Ihor Radchenko e4f1274378
test-org-export/activate-smart-quotes: Update tests
* testing/lisp/test-ox.el: Fix inner French quotes.  See f099f84.
2023-08-05 16:16:31 +03:00
Ihor Radchenko 8d6ec48b84
org-end-of-subtree: Fix when inside inlinetask
* lisp/org.el (org-end-of-subtree): Do not consider inlinetasks as
dedicated subtrees.
* testing/lisp/test-org.el (test-org/end-of-subtree): New test.
2023-08-05 09:48:10 +03:00
Ihor Radchenko 63e8cac2ca
org-goto-sibling: Fix when called from inlinetask
* lisp/org.el (org-goto-sibling): Do not try to find inlinetask
siblings.  Clarify the docstring.
* testing/lisp/test-org.el (test-org/goto-sibling): New test.
2023-08-02 16:06:02 +03:00
Ihor Radchenko 410cecc0e7
ob-tangle/collect-blocks: Small refactoring and extra commentary
* testing/lisp/test-ob-tangle.el (ob-tangle/collect-blocks): Use
`format-spec' instead of `format' for better readability.  Add extra
comments explaining the logic of testing.  Add "." at the end of
`lambda' docstrings.
2023-07-28 10:27:27 +03:00
Evgenii Klimov fcac0039aa
testing/lisp/test-ob-tangle.el: Test block collection into groups for tangling
* testing/lisp/test-ob-tangle.el (ob-tangle/collect-blocks): Test
block collection into groups for tangling.
2023-07-28 10:16:35 +03:00
Ihor Radchenko dc78f09465
org-up-heading-safe: Fix when parent is not a heading
* lisp/org.el (org-up-heading-safe): Do not assume that
`org-element-parent' is always a heading.  Use `org-element-lineage'
to get parent heading specifically.  Move point to current heading
even when no parent heading is available, as expected by some of the
other Org routines.  Document moving point when no parent.
* testing/lisp/test-org.el (test-org/up-heading-safe): Add tests.

Reported-by: Daniel Liden <djliden91@gmail.com>
Link: https://orgmode.org/list/CAG=u__pAT9k_AsRG6cpyPPUt0__5S7o=3a8WWkAijuPPuGc7Cg@mail.gmail.com
2023-07-26 11:01:34 +03:00
Evgenii Klimov d6f3aed7b1
testing/lisp/test-ob-tangle.el: Avoid interaction in test
* testing/lisp/test-ob-tangle.el (ob-tangle/detangle-false-positive):
Unset modification flag from buffer to kill
(testing/examples/babel.org) in tear down step of test to avoid Emacs
asking for confirmation during interactive testing from within Emacs.
2023-07-21 19:58:43 +03:00
Ihor Radchenko 6a2d84e501
ob-lilypond: Resolve FIXME
* lisp/ob-lilypond.el: Use `org-src-lang-modes' to inform Org babel
about non-standard mode name instead of using `defalias'.
* testing/lisp/test-ob-lilypond.el (ob-lilypond/check-lilypond-alias):
Remove test.
2023-07-20 10:02:07 +03:00
Morgan Smith 27b5de4d02
Testing: Test ignoring todo items in 'org-agenda' based on timestamp
* testing/lisp/test-org-agenda.el
(test-org-agenda/timestamp-ignore-todo-item): New test.
2023-07-19 10:48:52 +03:00
Ihor Radchenko 26440689aa
org-test-without-dow: Make name consistent with what the macro does
* testing/lisp/test-org.el (org-test-without-dow): Do not implicitly
call `org-test-with-result'.

Update all the callers.
2023-07-17 11:35:04 +03:00
Ihor Radchenko 9730f408c2
testing/org-test.el: New helper function `org-test-get-day-name'
* testing/org-test.el (org-test-get-day-name): New function to convert
English day name to current locale.
* testing/lisp/test-org-clock.el (test-org-clock/org-clock-timestamps-change):
(test-org-clock/clock-drawer-dwim): Use the new function instead of
direct `aref'.
2023-07-17 11:34:19 +03:00
Ruijie Yu 8739a95782
Let org-columns correctly detect string-widths in code
TODO: maybe I should also make a test directly on
`org-columns-add-ellipses'.  Will do in next iteration unless
objections.

* lisp/org-colview.el (org-columns--truncate-below-width): add a
helper function that will trim off just enough data from string to
fit into expected width.
(org-columns-add-ellipses): make sure to do truncation correctly
even in CJK locales (where an ellipsis character takes two
spaces).

* testing/lisp/test-org-colview.el
(test-org-colview/substring-below-width): add test to make sure
helper function is correct.
(test-org-colview/columns-width): fix incorrect expectations for
CJK locales about ellipses.
2023-07-17 11:06:32 +03:00
Ruijie Yu ab9c9732ea
Fix dependence on locale in org testing facilities
* testing/org-test.el org-test-day-of-weeks-seconds: add values of
seconds that yield different days of week (by trial-and-error).
org-test-day-of-weeks-abbrev: add a vector of abbreviated DoW
names for testing.
org-test-day-of-weeks-full: add a vector of full DoW names for
testing.

* testing/lisp/test-org-clock.el
(test-org-clock/clock-drawer-dwim): make use of the pre-generated
DoW names in the testing to remove assumptions on LANG=C.
(test-org-clock/org-clock-timestamps-change): renamed from
test-org-clok/org-clock-timestamps-change; used DoW pre-generated
names.

* testing/lisp/test-org.el (org-test-with-result):
(org-test-without-dow): add two macros to combat the 40-time
repetition of "do not add day-of-week, do something, and return
buffer string".
(test-org/clone-with-time-shift): (test-org/add-planning-info):
(test-org/deadline): (test-org/schedule): rewrite the
day-of-week-removal portion to avoid generating day-of-week names
altogether, using the new macro `org-test-without-dow'.
2023-07-17 11:04:23 +03:00
Morgan Smith a1ef64f3d1
Testing: Add tests for 'org-agenda-skip-if'
* testing/lisp/test-org-agenda.el (test-org-agenda/skip-if): New test.
(test-org-agenda/non-scheduled-re-matces): Fix typo by changing name
to 'test-org-agenda/non-scheduled-re-matches'.
2023-07-16 13:02:21 +03:00
Liu Hui 5e31dcdd9a ob-python: Fix async evaluation
* lisp/ob-python.el (org-babel-python-async-evaluate-session): Bind
`python-shell-buffer-name' inside the temp buffer.
* testing/lisp/test-ob-python.el (test-ob-python/async-local-python-shell):
Add test.
2023-07-13 17:24:41 -07:00
Ilya Chernyshov c74c4ab18d
lisp/org-element.el: Add new timestamp property :range-type
The new property is needed to reduce ambiguity when interpreting the
parsed data.

* lisp/org-element.el (org-element-timestamp-interpreter): Preserve old
behavior when :range-type is `nil'.  Take into account :range-type
value when interpreting ranges.  When :range-type is `timerange',
return a timerange (<YYYY-mm-DD HH:MM-HH:MM>).  If :range-type is
`daterange' return a daterange (<...>--<...>).  When :range-type is
nil, return a daterange (as it was before).  When :range-type is
`daterange' or `timerange' and :type is `active'/`inactive', throw an
error.
(org-element-timestamp-parser): Add :range-type property.

* lisp/org.el (org-timestamp-split-range): Make sure that :range-type
is nil for a split timestamp.

* testing/lisp/test-org-element.el
(test-org-element/timestamp-interpreter): Add new tests.
(test-org-element/timestamp-parser): Add tests for :range-type
property.

* etc/ORG-NEWS (Major changes and additions to Org API): Add news about this property.

Link: https://list.orgmode.org/orgmode/87y1ot6dqz.fsf@gmail.com/
2023-07-12 11:12:46 +03:00
Sébastien Miquel 67e819d6ee
test-org-src.el: Work around `current-column' bug in older emacs
* testing/lisp/test-org-src.el (test-org-src/indented-blocks): Work
around `current-column' not working in the presence of display strings
in older emacs.
2023-07-10 11:19:31 +03:00
Sébastien Miquel 2e2ed40553
org-src.el: Use native value of `indent-tabs-mode' for indentation
* lisp/org.el (org-indent-line): Simplify native indentation inside
src block.  Ensure we add the org indentation if the line is empty.
* lisp/org-macs.el (org-do-remove-indentation): Preserve
indentation (spaces vs tabs) past the common indentation to remove.
Do not empty blank lines.
* lisp/org-src.el (org-src--contents-for-write-back): Preserve the
native indentation (spaces vs tabs).  If necessary, add a common org
indentation to the block according to org's `indent-tabs-mode'.
(org-src-font-lock-fontify-block): Display the native indentation tab
characters with a fixed width, according to the native tab width
value, to preserve vertical alignement in the org buffer.
* testing/lisp/test-org-src.el (test-org-src/indented-blocks): Update
tests.  Indentation no longer obeys `indent-tabs-mode' from the org
buffer, but is separated in an eventual org part, and the native part.

Link: https://list.orgmode.org/87a5wcez7e.fsf@localhost/T/#t
2023-07-07 11:58:43 +03:00
Ihor Radchenko 948c896448
Rename `org-element-property-1' to `org-element-property-raw'
The new name is more readable.

Link: https://orgmode.org/list/87sfail69e.fsf@localhost
2023-07-01 14:36:32 +03:00
Ihor Radchenko fcde1f779d
test-org-element/at-point: Add new test
* testing/lisp/test-org-element.el (test-org-element/at-point): Test
when point is not in current buffer.
2023-07-01 14:36:24 +03:00
Ihor Radchenko b2482d9cc4
* testing/lisp/test-org-element.el: Add new tests
(test-org-element/type):
(test-org-element/type-p):
(test-org-element/org-element-property-1):
(test-org-element/property):
(test-org-element/properties-resolve):
(test-org-element/secondary-p):
(test-org-element/class):
(test-org-element/ast-map):
(test-org-element/properties-mapc):
(test-org-element/properties-map):
(test-org-element/org-element-create):
(test-org-element/put-property):
(test-org-element/set):
(test-org-element/lineage-map): add new and extend tests according to
the new API.
2023-07-01 14:36:09 +03:00
Ihor Radchenko 5c05ac198a
testing: Test with and without cache in more cases 2023-07-01 14:36:08 +03:00
Ihor Radchenko eb0a293a02
Remove 'org-category text property cache
* lisp/org.el (org-get-category): Update useing
`org-entry-get-with-inheritance'.
(org-agenda-ignore-properties): Update docstring.
(org-refresh-category-properties):
(org-check-agenda-file): Do not call
`org-refresh-category-properties'.
* lisp/org-compat.el (org-refresh-category-properties): Obsolete.
* doc/org-manual.org (Speeding Up Your Agendas): Update the manual.
* testing/lisp/test-org.el (test-org/get-category): Update tests, not
calling the obsolete function.
2023-07-01 14:35:51 +03:00
Ihor Radchenko bc29f5de41
org-element: New `org-element-*property*' functions
* lisp/org-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties.  The functions are `setf'-able.

Update all the relevant code in Org to use the new functions instead
of genetic property queries.
2023-07-01 14:35:43 +03:00
Ihor Radchenko 81a7e8c836
org-element-lineage: Allow TYPES to be a symbol
* lisp/org-element-ast.el (org-element-lineage): Allow TYPES argument
to be a symbol.
* lisp/ox-ascii.el (org-ascii--current-text-width):
(org-ascii-format-inlinetask-default):
(org-ascii-section):
* lisp/ox-beamer.el (org-beamer--format-block):
* lisp/ox-html.el (org-html-section):
(org-html-table-cell):
(org-html-table-row):
* lisp/ox-latex.el (org-latex-table-cell):
(org-latex-table-row):
* lisp/ox-odt.el (org-odt-headline):
(org-odt-table-style-spec):
(org-odt-get-table-cell-styles):
(org-odt-table-cell):
(org-odt-table-row):
* lisp/ox-org.el (org-org-section):
* lisp/ox-publish.el (org-publish-collect-index):
* lisp/ox-texinfo.el (org-texinfo--get-node):
(org-texinfo-section):
(org-texinfo-table-row):
* lisp/ox.el (org-export--skip-p):
(org-export-get-node-property):
(org-export-table-cell-borders):
(org-export-table-row-in-header-p):
(org-export-table-row-number):
(org-export-collect-headlines): Update all the callers.
2023-07-01 14:35:43 +03:00
Ihor Radchenko a06dc07cc0
org-element: Defer more when parsing headings and inlinetasks
* lisp/org-element.el (org-element-headline-parser--deferred):
(org-element--headline-deferred): Rename.
(org-element--headline-archivedp):
(org-element--headline-footnote-section-p):
(org-element--headline-parse-title): New internal helpers.
(org-element-headline-parser):
(org-element-inlinetask-parser): Defer parsing headline components.
*
testing/lisp/test-org-attach.el (test-org-attach/dired-attach-to-next-best-subtree/1):
Use property API instead of relying upon internal syntax node representation.
2023-07-01 14:35:36 +03:00
Ihor Radchenko a7d1dfa171
Use `org-element-type-p'
Use `org-element-type-p' across Org source, except some tests, where `eq' can
produce more meaningful failure explanations.
2023-07-01 14:35:35 +03:00
Ihor Radchenko c22697f472
Use new function names `org-element-extract' and `org-element-set' 2023-07-01 14:35:32 +03:00
Ihor Radchenko 55ba9f05a7
org-element-map: Refactor using `org-element-ast-map'
* lisp/org-element.el (org-element-map): Use `org-element-ast-map' to
traverse the AST.  Update the docstring adding new features from
`org-element-ast-map' - FUN can now throw `:org-element-skip' signal
to skip current node and its child nodes.  Clarify the structure of
INFO argument.  Reverse the traverse order for dual keywords -
secondary value is now traversed after the main value.
* testing/lisp/test-org-element.el (test-org-element/map): Update the test
reflecting the change in dual keyword traversal order.
2023-07-01 14:35:28 +03:00
Ihor Radchenko f4aa3747e1
org-element: Preserve order of multiple affiliated keywords
* lisp/org-element.el: Do not reverse affiliated keyword order.
(org-element-map): Remove special arrangement to restore keyword
ordering.
(org-element--interpret-affiliated-keywords): Obey the new keyword order.
* lisp/ox.el (org-export-get-caption):
* testing/lisp/test-org-element.el (test-org-element/affiliated-keywords-parser):
* testing/lisp/test-org-element.el (test-org-element/interpret-data):
Do not assume reverse order.

This is one of the undocumented conventions that is inconsistent with
other aspects of the parser.
2023-07-01 14:35:25 +03:00
Ihor Radchenko 924a64da39
org-element: Use the new org-element-ast library
* lisp/org-element.el (org-element-class):
(org-element-interpret-data): Explicitly consider anonymous syntax
node type.
* lisp/org-element.el (org-element-put-property):
(org-element-set-contents):
(org-element-secondary-p):
(org-element-adopt-elements):
(org-element-extract-element):
(org-element-insert-before):
(org-element-set-element):
(org-element-create):
(org-element-copy):
(org-element-lineage): Remove from org-element.el, using
org-element-ast function versions.
* lisp/org-element.el (org-element-headline-parser):
(org-element-inlinetask-parser):
(org-element-item-parser):
(org-element-citation-parser):
(org-element-citation-reference-parser): Assign :secondary property.
(org-element-parse-buffer):
(org-element-parse-secondary-string): Resolve deferred properties.
(org-element--cache-shift-positions): Use the new AST API.
(org-element--cache-for-removal): Use optional argument for
`org-element-set-element' to keep the needed property values.
(org-element--cache-gapless): Bump element cache version when persisting.
* testing/lisp/test-org-element.el (test-org-element/class): Update
test using the new :secondary property convention.
* lisp/ox-man.el (org-man-paragraph): Use the new AST API.
2023-07-01 14:35:24 +03:00
Sébastien Miquel 73134cfbf1 test-org-src.el: Add two tests
* testing/lisp/test-org-src.el (test-org-src/preserve-empty-lines):
Test that empty lines are not indented.
(test-org-src/indented-latex-fragments): Test special edit of
multiline indented LaTeX fragment.
2023-06-26 12:10:26 +02:00
Ihor Radchenko 18f003a164
Merge branch 'bugfix' 2023-06-24 15:36:34 +03:00
Ihor Radchenko f56ca5009e
fixup! org-babel-tangle-single-block: Do not rely on match-data from `org-back-to-heading' 2023-06-24 15:32:40 +03:00
Ihor Radchenko 200d168275
Merge branch 'bugfix' 2023-06-22 12:54:51 +03:00
Ihor Radchenko 79ec91584c
org-babel-tangle-single-block: Do not rely on match-data from `org-back-to-heading'
* lisp/ob-tangle.el (org-babel-tangle-single-block): Explicitly move
to the beginning of title instead of assuming that
`org-back-to-heading' sets match data appropriately (it is not
documented to do so).
* testing/lisp/test-ob-tangle.el (ob-tangle/comment-org): Add test.

Reported-by: Nick Dokos <ndokos@redhat.com>
Link: https://orgmode.org/list/87bkh8k3at.fsf@alphaville.usersys.redhat.com
2023-06-22 12:54:23 +03:00
Jack Kamm 294a4d2fe2 ox-icalendar: Add support for unscheduled and repeating TODOs
* lisp/ox-icalendar.el (org-icalendar-todo-unscheduled-start): New
customization to control the exported start time of unscheduled tasks.
(org-icalendar--rrule): Helper function for RRULE export.
(org-icalendar--vevent): Use the new helper function for RRULE.
(org-icalendar--repeater-type): Helper function to get the repeater
type, and display warning if not supported.
(org-icalendar--vtodo): Change how unscheduled TODOs are handled using
the new customization option.  Export SCHEDULED and DEADLINE
repeaters.  In case of SCHEDULED repeater and a DEADLINE without
repeater, treat DEADLINE as RRULE UNTIL.  Emit a warning for tricky
edge cases that are not yet implemented.
* testing/lisp/test-ox-icalendar.el
(test-ox-icalendar/todo-repeater-shared): Test for exporting shared
SCHEDULED/DEADLINE repeater.
(test-ox-icalendar/todo-repeating-deadline-warndays): Test using
warning days as DTSTART of repeating deadline.
(test-ox-icalendar/todo-repeater-until): Test using DEADLINE as RRULE
UNTIL.
(test-ox-icalendar/todo-repeater-until-utc): Test RRULE UNTIL is in
UTC format when DTSTART is not in local time format.
(test-ox-icalendar/warn-unsupported-repeater): Unit test to warn for
unsupported repeater types.
* lisp/org-lint.el (org-lint-mismatched-planning-repeaters): Add lint
for mismatched SCHEDULED and DEADLINE repeaters.
* testing/lisp/test-org-lint.el
(test-org-lint/mismatched-planning-repeaters): Add test for linting of
mismatched SCHEDULED and DEADLINE repeaters.
* doc/org-manual.org (iCalendar Export): Add link to new variable
`org-icalendar-todo-unscheduled-start'.
2023-06-18 06:51:47 -07:00
Ihor Radchenko 34082ff184
org-indent-line: Fix with line is within blank lines after heading
* lisp/org.el (org-indent-line): Fix when we are within blank lines
after heading.  ELEMENT is then `heading' and looking at :begin - 1
does not make sense.
* testing/lisp/test-org.el (test-org/indent-region): Add test.

Reported-by: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Link: https://orgmode.org/list/d7129804-1f42-ea2b-85e8-18ea1ee32d73@vodafonemail.de
2023-06-11 13:16:31 +03:00
Ihor Radchenko 9082fa8892
Merge branch 'bugfix' 2023-06-08 16:14:13 +03:00
Ihor Radchenko 84e5a4da54
org-element-cache-map: Fix edge case when FUNC removes DATA
* lisp/org-element.el (org-element-cache-map): Fix when DATA is
obsolete after buffer modification.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Reported-by: Victor A. Stoichita <victor@svictor.net>
Link: https://orgmode.org/list/87v8fzxbfo.fsf@svictor.net
2023-06-08 16:11:38 +03:00
Ihor Radchenko ba8c468634
org-insert-todo-heading-respect-content: Fix regression in b4e41b
* lisp/org.el (org-insert-todo-heading-respect-content): Do not force
first TODO keyword in the inserted heading.  Instead, accept prefix
arguments and pass them directly to `org-insert-todo-heading'.
* etc/ORG-NEWS (~org-insert-todo-heading-respect-content~ now accepts
prefix arguments): Document the change.
*
testing/lisp/test-org.el (test-org/insert-todo-heading-respect-content):
Add tests.

Reported-by: Xuan Wang <xuan.public@gmail.com>
Link: https://orgmode.org/list/CALjN2yehOVYZuU+tURes+mJ5XyTrRY1O0UG1ijH-6TjJ=W0ibw@mail.gmail.com
2023-06-07 15:18:16 +03:00
Leo Butler d55a112149
lisp/ob-C.el: replace %f with %s to prevent unneeded rounding
* lisp/ob-C.el (org-babel-C-val-to-C-type): Floats should be printed
as string literals to prevent rounding introduced by %f format.

* testing/lisp/test-ob-C.el (ob-C/float-var): Test that floats are not
rounded when passed as an org :var.
2023-06-02 10:23:58 +03:00
Leo Butler c50b03d99e
lisp/ob-C.el: replace %f with %s to prevent unneeded rounding
* lisp/ob-C.el (org-babel-C-val-to-C-type): Floats should be printed
as string literals to prevent rounding introduced by %f format.

* testing/lisp/test-ob-C.el (ob-C/float-var): Test that floats are not
rounded when passed as an org :var.
2023-06-02 10:21:28 +03:00
Ihor Radchenko aa3980dd7f
test-org/return: Add test clauses for `org-return' at citations
* testing/lisp/test-org.el (test-org/return): Add new tests checking
new functionality of `org-return' at citations and citation
references.
2023-05-25 14:21:25 +02:00
Sławomir Grochowski 03afd25582
testing/lisp/test-org-colview.el: Add tests
* test-org-colview.el (test-org-colview/uncompile-format,
test-org-colview/compile-format): Add tests for functions:
`org-columns-uncompile-format' & `org-columns-compile-format'.
2023-05-14 16:06:41 +02:00
Ihor Radchenko 30b790f42b
org-refile: Fix heading being removed when refiling into itself
* lisp/org-refile.el (org-refile): Throw an error when attempting to
refile heading into itself and the point is not at bol.
* testing/lisp/test-org.el (test-org/refile): Add tests.

Reported-by: Oliver Epper <oliver.epper@gmail.com>
Link: https://list.orgmode.org/orgmode/CAP8tsuSEScO+Q7=g7kL=9Dk-95reJvUmLoyqmJjd2-ZM6iycfA@mail.gmail.com/
2023-05-11 12:07:27 +02:00
Max Nikulin ed0cfbd7b5
org-clock.el: Fix week start != 1
* lisp/org-clock.el (org-clock-special-range): Prevent returning
previous week for `thisweek' KEY when WSTART is 0.  Treat both 0 and 7
as Sunday.
* testing/lisp/test-org-clock.el (test-org-clock/special-range): New
test for `thisweek' and various WSTART arguments.

It seems only the case of weeks starting on Monday was tested.
Other variants caused shifted intervals.

Bug report: Marcin Borkowski. What is a week?
Mon, 10 Apr 2023 05:35:44 +0200.
<https://list.orgmode.org/87h6to1ka7.fsf@mbork.pl>
2023-05-07 10:03:52 +02:00
Ihor Radchenko 5ec364a1ae
org-cite-list-bibliography-files: Preserve relative bibliography paths
* lisp/oc.el (org-cite-list-bibliography-files): When the bibliography
path is relative to the exported file location, keep the path
relative.  Resolve relative paths for bibliographies from SETUPFILE as
well.

* testing/lisp/test-oc.el (test-org-cite/list-bibliography-files):
* testing/examples/sub-bib/include-relative-bib.org:
* testing/examples/sub-bib/include-global-bib.org: New test.

Link: https://orgmode.org/list/CAO48Bk_upR4h-xd0YL+FxeKtWvDoqH+Eju6F_Vzds_m6oxBKcg@mail.gmail.com
2023-05-02 14:47:56 +02:00
Ihor Radchenko 7ddc86a2ca
Merge branch 'bugfix' 2023-05-01 12:16:48 +02:00
Ihor Radchenko 08077812ef
org-clock-update-time-maybe: Fix return value
* lisp/org-clock.el: Ensure that we return expected value.
* testing/lisp/test-org-clock.el
(test-org-clok/org-clock-update-time-maybe): Add new test.
2023-05-01 12:15:09 +02:00
Ihor Radchenko 989cc51499
Prefer "timestamp" over "time-stamp"
* lisp/org.el (org-time-stamp-formats):
(org-timestamp-formats):
(org-time-stamp-rounding-minutes):
(org-timestamp-rounding-minutes):
(org-time-stamp-custom-formats):
(org-timestamp-custom-formats):
(org-time-stamp):
(org-timestamp):
(org-time-stamp-inactive):
(org-timestamp-inactive):
(org-insert-time-stamp):
(org-insert-timestamp):
(org-toggle-time-stamp-overlays):
(org-toggle-timestamp-overlays):
(org-time-stamp-to-now):
(org-timestamp-to-now):
* lisp/ox.el (org-export-time-stamp-file):
(org-export-timestamp-file): Rename using "timestamp" term, keeping
the old name as alias.
* doc/org-manual.org: Update all the uses, adding #+findex and
 #+vindex entries.  Keep the alias names for searchability.

Adjust all the callers.

The following "time-stamp" uses are unchanged:
1. `org-time-stamp-format' where obsolete and _different_ function
   `org-timestamp-format' still exists.
2. :time-stamp-file property in export INFO plist.  Changing this
   would be breaking.
3. ORG-NEWS remains unchanged.
2023-04-30 13:48:52 +02:00
Ihor Radchenko eaf274909f
Consistently allow null character in block and drawer bodies
Also, do not use [^\000] as a poor-man's replacement for
(rx (or any newline)).

* lisp/ob-core.el (org-babel-src-block-regexp):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs):
* lisp/org-compat.el (org-hide-block-toggle-all):
* lisp/org-element.el:
* lisp/org-feed.el (org-feed-read-previous-status):
(org-feed-parse-rss-feed):
(org-feed-parse-rss-entry):
* lisp/ox-org.el (org-org-publish-to-org):
* testing/lisp/test-ob-tangle.el:
* lisp/org.el (org-block-regexp):
(org-clock-drawer-re): Use \(.\|\n\) regexp instead of [^\000].
(org-latex-regexps): Do not try to match \000 inside latex fragments -
we now use parser for this purpose.

Reported-by: Tommy Kelly <tommy.kelly@verilab.com>
Link: https://orgmode.org/list/875yfk9vlv.fsf@localhost
2023-04-25 21:06:50 +02:00
Ihor Radchenko f81ba451a7
Prefer "backend" over "back-end"
* doc/org-manual.org (Exporting): Add cindex entry for both "backend"
and "back-end" for better searchability.

All other changes are trivial.

Note that `org-element-export-snippet-parser' will still use :back-end
property.  So will ox.el in INFO channel.
2023-04-20 14:11:19 +02:00
Ihor Radchenko 3c449cc438
* testing/lisp/test-ob-R.el (ob-session-R-result-value): New test 2023-04-18 15:04:57 +02:00
Ihor Radchenko 83e446ea86
* testing/lisp/test-ob-R.el: Fix test failures with the newest ESS
(ob-session-async-R-simple-session-async-output):
(ob-session-async-R-named-output):
(ob-session-async-R-output-drawer): Force no truncation of output
lines in ESS.  Otherwise, the expected output may be split into
multiple lines.

Note that we do not want to override the output splitting outside
tests - this is what users may prefer for :results output.  And
:results value is not affected.

Link: https://orgmode.org/list/87ilduqrem.fsf@localhost
2023-04-18 15:04:47 +02:00
Ihor Radchenko 2ad8a45f00
test-ob-fortran: Enable and fix commented tests
* testing/lisp/test-ob-fortran.el (ob-fortran/wrong-list):
(ob-fortran/compiler-flags): Uncomment the tests, making sure that
error buffer is displayed.
2023-04-08 14:56:08 +02:00
Jack Kamm e10b4054e6 ox-icalendar: Use consistent CRLF line endings
Fixes issue where the ox-icalendar export uses an inconsistent mix of
dos and unix style line endings.

* lisp/ox-icalendar.el (org-icalendar-fold-string): No longer converts
to CRLF, instead delegating that to `org-icalendar--post-process-file'.
(org-icalendar--post-process-file): New function to handle exported
file post-processing.  Converts EOL to CRLF, and then runs
`org-icalendar-after-save-hook'.
(org-icalendar-export-to-ics, org-icalendar-export-current-agenda,
org-icalendar--combine-files): Call `org-icalendar--post-process-file'
instead of running `org-icalendar-after-save-hook' directly.
* testing/lisp/test-ox-icalendar.el: New file for unit tests of
ox-icalendar.  Add an initial test for CRLF line endings.

See also:

https://list.orgmode.org/87o7oetneo.fsf@localhost/T/#m3e3eb80f9fc51ba75854b33ebfe9ecdefa2ded24

https://list.orgmode.org/orgmode/87ilgljv6i.fsf@localhost/
2023-04-02 13:20:56 -07:00
Matthew Trzcinski f7aa8c19f5 ob-shell.el: Add async evaluation
* ob-shell.el (org-babel-sh-evaluate): Add condition for async within
session.  Allow :async header argument to be either t or blank.

* test-ob-shell.el:
(test-ob-shell/session-async-valid-header-arg-values): Check that
:async header works for both t and blank values.
(test-ob-shell/session-async-inserts-uuid-before-results-are-returned):
Check that UUID is used as placeholder until results return.
(test-ob-shell/session-async-evaluation): Check that asynchronously
evaluated results are eventually placed in the buffer.

Link: https://list.orgmode.org/186283d230a.129f5feb61660123.3289004102603503414@excalamus.com/
2023-03-22 14:55:11 -04:00
Ihor Radchenko 20b33106cd
org-element-headline-parser: Fix empty headings with tags
* lisp/org-element.el (org-element-headline-parser): Allow empty title
with tags.  Do not consider space after COMMENT to be a part of title.
*
testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
Add tests.

Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/87zg8t4zgo.fsf@localhost
2023-03-22 16:08:32 +01:00
Ihor Radchenko 93bf820384
org-element-headline-parser: Treat "* TODO" as empty title + TODO keyword
* lisp/org-element.el (org-element-headline-parser): Allow end of line
instead of space after todo keyword.
*
testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
Add new test.
2023-03-22 15:52:24 +01:00
Ihor Radchenko 8589de94d8
Merge branch 'bugfix' 2023-03-07 14:09:48 +01:00
Rudolf Adamkovič eb6379a417
Fix LaTeX spelled as Latex
etc/ORG-NEWS (Non-floating minted listings in LaTeX export):
* lisp/ob-latex.el: (org-babel-execute:latex):
* lisp/org-element.el:
* lisp/ox-ascii.el:
* lisp/ox-html.el:
* lisp/ox-latex.el:
* lisp/ox-md.el:
* lisp/ox-odt.el:
* testing/examples/ob-maxima-test.org (LaTeX output):
* testing/lisp/test-org-element.el (test-org-element/cache): Spell LaTeX
correctly.
2023-03-07 14:08:40 +01:00
Ihor Radchenko c0a9c9edea
test-org-clock/mode-line: Update the docstring
* testing/lisp/test-org-clock.el (test-org-clock/mode-line): Link to
the info node explicitly.

Link: https://orgmode.org/list/m28rgbq8wo.fsf@me.com
2023-03-07 14:03:37 +01:00
Ihor Radchenko e52c531e17
Merge branch 'bugfix' 2023-03-05 13:22:02 +01:00
Rudolf Adamkovič 3d817c52c9
org-clock: Add a trailing space to the mode line string
* lisp/org-clock.el (org-clock-get-clock-string): End the mode line
element in a space, instead of beginning with space, to make it play
well with other mode line strings, which typically end a space.  For
reference, see the mode line string of the Display Time mode.
2023-03-05 13:20:30 +01:00
Ihor Radchenko f93cc661c6
org-element-set-contents: Do alter the anonymous parents
* lisp/org-element.el (org-element-set-contents): Do alter anonymous
elements (el1 el2 ...).  Such elements are used, for example, when
parsing keyword values during export, like :title.
* testing/lisp/test-org-element.el (test-org-element/set-contents):
Add test.

The patch fixed bug during export when exporting a subtree with
option stat:nil.  The :title during subtree export is taken from the
heading title and parsed.  However, the parsed value is stored outside
the parse tree, in :title property of the INFO channel.  The parsed
value does get filtered through `org-export--prune-tree', but before
this commit, `org-element-set-contents' did not actually alter the
out-of-AST-tree parent lists of elements.

Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/87mt4w8epo.fsf@t14.reltub.ca
2023-03-03 16:31:37 +01:00
Ihor Radchenko 2e883b21a7
org-sbe: Allow quoting string values
* lisp/ob-table.el (org-sbe): Allow quoting string values of variables
with "$".  Update the docstring.
* testing/lisp/test-ob-table.el (test-ob-table/sbe): Add test.  Do not
use `org-test-at-id' in favor of more illustrative
`org-test-with-temp-text'.  The latter does not force users to search
the ID in reference Org file.
* testing/examples/babel.org (calling code blocks from inside table):
Remove unused example.

Reported-by: 赵一宇 <zhyznd@163.com>
Link: https://orgmode.org/list/40651be0.3e3b.1867971e644.Coremail.zhyznd@163.com
2023-02-23 12:29:18 +03:00
Ihor Radchenko 236bd45849
Merge branch 'bugfix' 2023-02-22 13:20:47 +03:00
Ihor Radchenko 7a90f596d9
org-clock-timestamps-change: Fix when on opening timestamp
* lisp/org-clock.el (org-clock-timestamps-change): Do not rely on
global `org-last-changed-timestamp'.
*
testing/lisp/test-org-clock.el (test-org-clok/org-clock-timestamps-change):
Add new test.

Reported-by: sting.startup-0y@icloud.com
Link: https://orgmode.org/list/2380D54F-DE06-4CBE-88AC-5906A6E9253A@gmail.com
2023-02-22 13:19:06 +03:00
Matthew Trzcinski aa158da69b test-ob-shell: Fix test buffers not being removed on success
* test-ob-shell.el (test-ob-shell/remote-with-stdin-or-cmdline): Kill
test related buffers when test is successful.  See ce4f7db3c.
2023-02-19 18:19:45 -05:00
Ihor Radchenko fff9239dc1
Merge branch 'bugfix' 2023-02-17 13:41:18 +03:00
Rudolf Adamkovič 99c8ed09f8
ox-texinfo: Fix invalid syntax in Texinfo version detection code
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): Fix the incorrect
syntax @displaymath{1 + 1 = 2} used to detect whether Texinfo supports
TeX "math mode".  Instead, use the correct syntax @math{1 + 1 = 2}.
2023-02-17 13:30:16 +03:00
Ihor Radchenko b665f8de31
org-metaup, org-metadown: Move subtrees in active region
* lisp/org.el (org-metaup):
(org-metadown): When active region contains headings, move the
containing subtrees according to the selection.  Do not deactive
region.
* testing/lisp/test-org.el (test-org/move-subtree): Add test.
* etc/ORG-NEWS (~org-metaup~ and ~org-metadown~ now act on headings in
region): Announce the new features.
2023-02-04 16:49:30 +03:00
Ihor Radchenko b363ec04a2
Merge branch 'bugfix' 2023-02-01 00:21:06 +03:00
Ihor Radchenko 32b64607ad
org-element-cache-map: Fix when inside indirect buffer
* lisp/org-element.el: Query cache variables from the base buffer.
They are only kept up-to-date there.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Reported-by: Hanno Perrey <hanno@hoowl.se>
Link: https://orgmode.org/list/87pmau4fi3.fsf@hoowl.se
2023-02-01 00:18:56 +03:00
Ihor Radchenko 0509a84786
Merge branch 'bugfix' 2023-01-30 12:06:49 +03:00
Ihor Radchenko c340e799f8
org-element-cache-map: Always continue after point set by FUNC
* lisp/org-element.el (org-element-cache-map): Never map over element
starting before the point manually moved (or set via
`org-element-cache-map-continue-from') by FUNC.
* testing/lisp/test-org.el (test-org/map-entries): Add tests.

Reported-by: Matthieu Caneill <matt@brokenwa.re>
Link: https://orgmode.org/list/Y9MKUzWWbErLFhmq@brokenwa.re
2023-01-30 12:05:29 +03:00
Ihor Radchenko 59fa35a0b7
Merge branch 'bugfix' 2023-01-23 15:48:58 +03:00
Ihor Radchenko a1c7cedd28
test-ob-octave: Fix tests failing on Debian CI (followup)
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file-space): Do
not assert absence of warnings.  See 59228e513.
2023-01-23 15:47:08 +03:00
Ihor Radchenko 4166f55da1
Merge branch 'bugfix' 2023-01-23 13:28:46 +03:00
Ihor Radchenko 59228e5134
test-ob-octave: Fix tests failing on Debian CI
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session): Do not assert that octave must not
emit warnings.  Just test the file created by side effect.

We currently have no reliable way to disambiguate warnings from
non-zero exit code when using `org-babel-eval'.  Warnings are ok, as
long as they do not result in the file not being created in the test.

Link: https://orgmode.org/list/87mt6m5n6u.fsf@localhost
2023-01-23 13:28:00 +03:00
Ihor Radchenko ce4f7db3c1
test-ob-shell: Fix test failures on Emacs 26
* testing/lisp/test-ob-shell.el (test-ob-shell/remote-with-stdin-or-cmdline):
Work around non-local exit when running tests on Emacs 26.  Do no call
`kill-matching-buffers' unless Emacs in newer.
2023-01-22 19:21:25 +03:00
Ihor Radchenko b34bdc8719
org-capture-finalize: Do not save new file with :no-save aborted capture
* lisp/org-capture.el (org-capture-finalize): Do not save the newly
created file buffer when the capture is aborted and org-capture is not
asked to save upon capture.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.
2023-01-22 13:49:07 +03:00
Ilya Chernyshov 005c9ae747
lisp/org-datetree.el: Allow datetrees with TODO, priority, tags
* org-datetree.el (org-datetree--find-create): Add optional argument
MATCH-TITLE that controls whether to match REGEX-TEMPLATE against
heading title inside complex heading or to match REGEX-TEMPLATE
against the whole heading line.

* org-datetree.el (org-datetree--find-create-group,
org-datetree-find-iso-week-create): Allow finding a datetree with TODO
state, priority, tags, statistics cookies, or COMMENT keyword.

* testing/lisp/test-org-datetree.el
(test-org-datetree/find-date-create,
test-org-datetree/find-iso-week-create): Add tests for a datetree with
tags, TODO or priority keywords.

* etc/ORG-NEWS (Datetree structure headlines can now be complex):
Document the change.

* doc/org-manual.org: Update datetree definition.
2023-01-21 12:29:32 +03:00
Ihor Radchenko c92769a505
org-paste-subtree: Do not leave empty line in place of level indicator
* lisp/org.el (org-paste-subtree): Remove the whole line when level
indicator is provided.  Improve check for level indicator.
* testing/lisp/test-org.el (test-org/paste-subtree): Add test.

Reported-by: Philipp Kiefer <phil.kiefer@gmail.com>
Link: https://orgmode.org/list/a2cc49d3-7f65-5f6a-8f05-21e5056335b3@gmail.com
2023-01-20 13:05:08 +03:00
Ihor Radchenko 0d5951a9b0
org-refile: Fix edge case when we refile on top of the same subtree
* lisp/org-refile.el (org-refile): Use dedicated marker (move after
insertion) to store position of the heading being refiled.  Otherwise,
if refiled heading is inserted at the same point, `save-excursion'
would restore point before the inserted heading instead of keeping it
at the original heading.
* testing/lisp/test-org.el (test-org/refile): At test.

Reported-by: /u/madclassix
2023-01-12 13:19:02 +03:00
Ihor Radchenko d0758eabfe
Merge branch 'bugfix' 2023-01-12 12:23:41 +03:00
Ihor Radchenko a52d0f0918
org-export-as: Fix subtree export when metadata ends right before heading
* lisp/ox.el (org-export-as): Only include first newline after heading
line when the metadata is non-empty.
* testing/lisp/test-ox.el (test-org-export/export-scope): Add test.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY1d=UEJ-6ZPG1X+st=fCfBAnTfgbVNhxyxH_xKcLGG4cQ@mail.gmail.com
2023-01-12 12:23:19 +03:00
Ihor Radchenko 89d13998bd
org-element-fixed-width-parser: Fix when :value is empty
* lisp/org-element.el (org-element-fixed-width-interpreter): Interpret
fixed-width element with :value "" as ":\n", not as empty string.
* testing/lisp/test-org-element.el (test-org-element/fixed-width-interpreter):
Fixed the test.

The previous test, albeit intentionally asserting "" result, breaks
reversibility of parse-interpret sequence.
2023-01-12 12:23:19 +03:00
Matt Trzcinski bcca8819c3 test-ob-shell.el: Organize tests
* testing/lisp/test-ob-shell.el:
  - Give instructions on how to run tests
  - Require `org-test' explicitly
  - Group tests into sections
  - Insert `page-delimiter's between sections
2023-01-11 14:31:16 -05:00
Matt Trzcinski ccd5977f62 ob-shell-test.org: Remove ob-shell-test.org
* testing/examples/ob-shell-test.org: Delete file

File was used by test-ob-shell.el to test ob-shell.el.  Tests have
been updated to use temporary buffers, rendering ob-shell-test.org
unnecessary.
2023-01-11 14:31:10 -05:00
Matt Trzcinski d7ff5b2462 test-ob-shell.el: Refactor test names and kill test buffers
* testing/lisp/test-ob-shell.el:
(ob-shell/generic-uses-no-arrays): Rename test from
`ob-shell/generic-uses-no-arrays' to
`test-ob-shell/generic-uses-no-arrays'.
(ob-shell/generic-uses-no-arrays): Move comments from
testing/examples/ob-shell-test.org to docstring.
(ob-shell/generic-uses-no-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
(ob-shell/bash-uses-arrays): Rename `ob-shell/bash-uses-arrays' to
`test-ob-shell/bash-uses-arrays'.
(ob-shell/bash-uses-arrays): Move comments from
testing/examples/ob-shell-test.org to docstring.
(ob-shell/bash-uses-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
(ob-shell/simple-list): Change test name from `ob-shell/simple-list'
to `test-ob-shell/simple-list'.
(ob-shell/remote-with-stdin-or-cmdline): Change test name from
`ob-shell/remote-with-stdin-or-cmdline' to
`test-ob-shell/remote-with-stdin-or-cmdline'.
(ob-shell/remote-with-stdin-or-cmdline): On pass, kill buffer created
by test.
(ob-shell/results-table): Rename `ob-shell/results-table' to
`test-ob-shell/results-table'.
(ob-shell/results-list): Rename `ob-shell/results-list' to
`test-ob-shell/results-list'.
 (ob-shell/standard-output-after-success): Rename
`ob-shell/standard-output-after-success' to
`test-ob-shell/standard-output-after-success'.
(ob-shell/standard-output-after-failure): Rename
`ob-shell/standard-output-after-failure' to
`test-ob-shell/standard-output-after-failure'.
(ob-shell/standard-output-after-failure): On pass, kill buffer created
during test.
(ob-shell/error-output-after-success): Rename
`ob-shell/error-output-after-success' to
`test-ob-shell/error-output-after-success'.
(ob-shell/error-output-after-success): On pass, kill buffer created by
test.
(ob-shell/error-output-after-failure): Rename
`ob-shell/error-output-after-failure' to
`test-ob-shell/error-output-after-failure'.
(ob-shell/error-output-after-failure): On pass, kill buffer created by
test.
(ob-shell/error-output-after-failure-multiple): Rename
`ob-shell/error-output-after-failure-multiple' to
`test-ob-shell/error-output-after-failure-multiple'.
(ob-shell/error-output-after-failure-multiple): On pass, kill buffer
created by test.
(ob-shell/exit-code): Rename `ob-shell/exit-code' to
`test-ob-shell/exit-code'.
(ob-shell/exit-code): On pass, kill buffer created by test.
(ob-shell/exit-code-multiple): Rename `ob-shell/exit-code-multiple' to
`test-ob-shell/exit-code-multiple'.
(ob-shell/exit-code-multiple): On pass, kill buffer created by test.
2023-01-11 14:31:01 -05:00
Matt Trzcinski 16ea9f84f6 Refactor ob-shell/bash-uses-assoc-arrays
* testing/lisp/test-ob-shell.el (ob-shell/bash-uses-assoc-arrays):
Split test cases into separate tests,
`test-ob-shell/bash-uses-assoc-arrays' and
`test-ob-shell/bash-uses-assoc-arrays-with-lists'.  Rename prefix from
"ob-shell" to "test-ob-shell".
(ob-shell/bash-uses-assoc-arrays): Move comments from
testing/examples/ob-shell-test.org to docstrings.
(ob-shell/bash-uses-assoc-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
2023-01-11 14:30:53 -05:00
Matt Trzcinski c61112c850 test-ob-shell.el: Refactor ob-shell/generic-uses-no-assoc-arrays
* test-ob-shell.el (ob-shell/generic-uses-no-assoc-arrays): Split test
based on simple versus complex mapping cases,
`test-ob-shell/generic-uses-no-assoc-arrays-simple-map' and
`test-ob-shell/generic-uses-no-assoc-arrays-3-columns'.  Rename prefix
from "ob-shell" to "test-ob-shell".
(ob-shell/generic-uses-no-assoc-arrays): Move
headlines and commentary from `testing/examples/ob-shell-test.org' to
docstring.
(ob-shell/generic-uses-no-assoc-arrays): Remove dependency on
testing/examples/ob-shell-test.org.
2023-01-11 14:30:45 -05:00
Matt Trzcinski 2ddbee5e63 test-ob-shell.el: Refactor test-ob-shell/session
* testing/lisp/test-ob-shell.el (ob-shell/session): Split
`ob-shell/session' into
`test-ob-shell/session-single-return-returns-string' and
`test-ob-shell/session-multiple-returns-returns-list'.
(ob-shell/session): Rename comint from to test name. On
pass, kill process and remove process buffer.
2023-01-11 14:30:35 -05:00
Matt Trzcinski 875845de1b test-ob-shell.el: Split test-ob-shell/dont-error-on-empty-results
* testing/lisp/test-ob-shell.el
(test-ob-shell/dont-error-on-empty-results): Explicitly test handling
of empty results.
(test-ob-shell/dont-error-on-babel-error): Explicitly test handling of
Babel errors.  On pass, remove buffers created during test.

Original test conflated empty results (a valid Babel return) and Babel
errors.
2023-01-11 14:30:23 -05:00
Matthew Trzcinski 597ecaa5c1 Revert "Merge branch 'ob-shell-cleanup-tests'"
This reverts commit 4f319088ba, reversing
changes made to 07c63df9c7.
2023-01-11 14:27:45 -05:00
Matthew Trzcinski 4f319088ba Merge branch 'ob-shell-cleanup-tests' 2023-01-11 11:16:53 -05:00
Ihor Radchenko b58fbaf834
Merge branch 'bugfix' 2023-01-06 18:06:26 +03:00
Leo Butler 41ebc2e40c
test-ob-octave.el: wrap get-buffer in buffer-live-p
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file):
(ob-octave/graphics-file-session):
(ob-octave/graphics-file-space): Wrap GET-BUFFER in BUFFER-LIVE-P.
This ensures that a killed buffer does not cause an incorrect failure
of a test.

Link: https://orgmode.org/list/87bknh5nva.fsf@localhost
2023-01-06 18:01:37 +03:00
Kyle Meyer 96a402780c Merge branch 'bugfix' 2023-01-01 13:15:12 -05:00
Kyle Meyer a43866e1cf Update remaining copyright years
Most copyright years were updated with the port of Emacs's cae528457
in e0815d754.  Update the remaining copyright years for files that
have Free Software Foundation as the copyright holder but aren't
included in the Emacs repo.
2023-01-01 13:13:15 -05:00
Ihor Radchenko d5b8180e72
Merge branch 'bugfix' 2023-01-01 15:58:56 +03:00