Commit Graph

2149 Commits

Author SHA1 Message Date
Nick Dokos 98a771cc3b
test-ob-octave: Add missing `provide' 2022-04-27 16:56:31 +08:00
Ihor Radchenko d2775da08d
test-ol/org-toggle-link-display: Fix compatibility with old Emacs
* testing/lisp/test-ol.el (test-ol/org-toggle-link-display): Use
back-compatible `org-xor' instead of `xor'.
2022-04-25 19:40:12 +08:00
Ihor Radchenko 444d1c50ac
test-org/string-width: Add tests for strings with prefix properties 2022-04-25 19:40:10 +08:00
Ihor Radchenko 6d4e65a124
Add org-fold-related tests 2022-04-25 19:40:01 +08:00
Ihor Radchenko f63ff07441
Fix subtle differences between overlays and invisible text properties
* lisp/org-clock.el (org-clock-in):
(org-clock-find-position):
(org-clock-out):
* lisp/org.el (org-add-planning-info):
(org-scan-tags):
(org-global-tags-completion-table):
(org-make-tags-matcher):
(org-tags-expand):
(org--property-local-values):
(org-read-date-analyze):
(org-revert-all-org-buffers):
(org-beginning-of-line): Make sure that we inherit invisible state
when inserting text.
(org-sort-entries): Preserve invisible state after replace-match.

(org-log-beginning): Do not try to move by visible lines.

* lisp/org-macs.el (org-preserve-local-variables): Do not try to
preserve overlays.
* lisp/ox.el (org-export--generate-copy-script): Preserve folding
properties in export buffer.
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Fix
test failure.
* testing/lisp/test-org.el (test-org/meta-return):
(test-org/custom-properties): Use new folding.
2022-04-25 19:39:56 +08:00
Ihor Radchenko fa7530c7b4
Rename old function call to use org-fold 2022-04-25 19:39:53 +08:00
Ihor Radchenko 6304afcaa4
Merge branch 'bugfix' 2022-03-26 15:20:22 +08:00
Ihor Radchenko b1a570b3b4
org-agenda: Fix regression when diary sexp timestamps are ignored
* lisp/org.el (org-at-timestamp-p): Return non-nil on sexp timestamps
when called with 'agenda argument.
* testing/examples/agenda-file.org (test sexp timestamp inside properties):
* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking sexp timestamp inside properties drawer.
2022-03-26 15:17:45 +08:00
Ihor Radchenko 735f666fad
test-org-agenda: Fix failing test and warn about using today's agenda
* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Fix test that failed because of different behavior of agenda view
depending whether the view is called today (according to system date)
or not.  Today's agenda (even called with custom date argument)
display the past scheduled items, while it is not the case for
non-today agendas.
* testing/lisp/test-org-agenda.el (test-org-agenda/one-line):
(test-org-agenda/scheduled-non-todo):
(test-org-agenda/non-scheduled-re-matces):
(test-org-agenda/property-timestamp):
(test-org-agenda/diary-inclusion):
(test-org-agenda/set-priority):
Add a note to warn future test developers about potential surprising
agenda behaviour.
2022-03-26 15:17:45 +08:00
Ihor Radchenko c9c0b9d004
Merge branch 'bugfix' 2022-03-22 17:40:49 +08:00
Ihor Radchenko d9bf64f064
org-agenda: Match timestamps inside node properties
* lisp/org-agenda.el (org-agenda-get-timestamps): Use
`org-at-timestamp-p' instead of org-element to check if at valid
timestamp.  Agenda should consider timestamps inside node properties
even though they are not parsed by org-element.

* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking active timestamp inside property drawer.

* testing/examples/agenda-file.org (test timestamp inside properties):
Add heading for `test-org-agenda/property-timestamp'.

Reported in https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com
2022-03-22 17:37:47 +08:00
Nicolas Goaziou ef66660cf4 Merge branch 'bugfix' 2022-02-28 15:46:06 +01:00
Nicolas Goaziou bafeaf161c element: Fix parsing of inline footnotes
* lisp/org-element.el (org-element--pair-round-table):
(org-element--pair-square-table):
(org-element--pair-curly-table): De-activate all but one pair of
parenthesis.
* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
Add test.

Reported-by: Greg Minshall <minshall@umich.edu>
<http://lists.gnu.org/r/emacs-orgmode/2022-02/msg00369.html>
2022-02-28 15:45:25 +01:00
Kyle Meyer e822291aca Merge branch 'bugfix' 2022-02-27 23:45:32 -05:00
Kyle Meyer 57362f7414 org-copy-visible: Respect buffer-invisibility-spec
* lisp/org.el (org-copy-visible): Decide whether text is invisible by
calling invisible-p rather than checking whether the invisible
property at point is non-nil.

Text may have a non-nil invisible property but _not_ be hidden from
the user (and thus should be copied by org-copy-visible).  For
example, the link itself is shown when org-link-descriptive is nil,
but it still has an invisible property of `org-link'.
2022-02-27 23:43:59 -05:00
Kyle Meyer f2833ff255 org-copy-visible: Fix handling of adjacent invisible text
* lisp/org.el (org-copy-visible): Don't copy invisible text that
follows invisible text with a different property value.

If org-copy-visible sees that the left bound position has a non-nil
invisible property, it uses next-single-char-property-change to find
the new bound.  However, next-single-char-property-change may just
find a bound that still has a _different_ non-nil invisible property.

Reported-by: "Максим Бабушкин" <maxbabushkin@gmail.com>
Link: https://debbugs.gnu.org/49967
2022-02-27 23:43:59 -05:00
Kyle Meyer e85a872f3b test-org.el: Actually test org-copy-visible
* testing/lisp/test-org.el (test-org/copy-visible): Switch defun to
ert-deftest so that the test is actually executed, and resolve
failures in test.

Make two adjustments so that the now executed test passes:

  - Correct the end value of the hidden part of the string for one
    test case.

  - Disable org-unfontify-region so that the invisible properties show
    up in the temporary buffer.

    I think org-unfontify-region should probably be changed to _not_
    remove the invisible property, but it's a longstanding behavior.
    Changing it would need more thought and isn't something that
    should be done on the bugfix branch.
2022-02-27 23:41:44 -05:00
Nicolas Goaziou 6ac5e0adc8 Merge branch 'bugfix' 2022-02-13 22:14:55 +01:00
Nicolas Goaziou 17e4fe9093 lint: Fix false positive with inline footnote definitions
* lisp/org-lint.el (org-lint-invalid-macro-argument-and-template):
Take into consideration inline definitions.
* testing/lisp/test-org-lint.el (test-org-lint/undefined-footnote-reference):
Add test.

Reported-by: Timothy <tecosaur@gmail.com>
2022-02-13 22:13:41 +01:00
Ihor Radchenko a694cf5224
Merge branch 'bugfix' 2022-02-07 21:08:54 +08:00
Sacha Chua c5ceb6a2c3
org-list-send-item: allow dest to be a buffer position
* lisp/org-list.el (org-list-send-item): Check if dest is a string
before matching it, to allow dest to be a buffer position.
* testing/lisp/test-org-list.el (test-org-list/send-item): Add tests.
2022-02-07 21:07:52 +08:00
Ihor Radchenko 26decec006
test-org-element-at-point: Add tests for point outside contents 2022-01-24 22:54:18 +08:00
Ihor Radchenko 846226a202
test-org-element/cache: Fix typo 2022-01-21 20:53:11 +08:00
Ihor Radchenko 9b58ead467
org-element-context: Use element cache
* lisp/org-element.el (org-element-context): Use
`org-element-at-point', which makes use of cache.
* testing/lisp/test-org-element.el (test-org-element/lineage): Expect
full lineage up to org-data from `org-element-context'.
2022-01-17 20:20:57 +08:00
Ihor Radchenko 8d9ca0eac1
test-org/entry-get: Add test checking reported bug
See https://list.orgmode.org/orgmode/87zgrqqlcs.fsf@toloe.se/
2022-01-15 19:48:24 +08:00
Ihor Radchenko a9b2e262cd
Merge branch 'bugfix' 2022-01-12 21:11:33 +08:00
Ihor Radchenko 65f9524136
test-org-agenda: Test for scheduled-looking lines
* testing/examples/agenda-file.org: Add test headings where SCHEDULED
line is not planning.
*
testing/lisp/test-org-agenda.el (test-org-agenda/non-scheduled-re-matces):
Make sure that SCHEDULED lines that do no belong to planning do not
trigger agenda matches.

See https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t
2022-01-12 21:08:55 +08:00
Ihor Radchenko dc4b2772e3
org-element-cache-map: Fix an edge case with org-element-cache-continue-from
* lisp/org-element.el (org-element-cache-map): Make sure that START is
never set to -1.  It may cause infinite loops in some scenarios.
* testing/lisp/test-org.el (test-org/map-entries): Add a test catching
the reported situation.

Reported in https://list.orgmode.org/CADywB5JHAyPX99Vr02SvAqiMTD+7ss4VWVipOhKfm=iGirDPhA@mail.gmail.com/T/#t
2022-01-07 22:10:22 +08:00
Ihor Radchenko 515ce56d4e
org-element-cache: Fix transforming keywords to affiliated
* lisp/org-element.el (org-element--cache-for-removal): Consider
preceding keywords to be updated unconditionally.
(org-element-cache-map): Fix infinite loop revealed by the new test.

* testing/lisp/test-org-element.el (test-org-element/cache-affiliated):
New test.
2022-01-07 21:24:43 +08:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Ihor Radchenko 06f58e4759
org-element-cache-map: Fix when FUNC deletes current element
* lisp/org-element.el (org-element-cache-map-continue-from): New
variable forcing `org-element-cache-map' to continue from a custom
point in buffer.
(org-element-cache-map): Add support for
`org-element-cache-map-continue-from'.  Update docstring accordingly.
Also, make sure that mapping terminates correctly when FUNC deletes
all elements in buffer.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Fixes https://orgmode.org/list/CADywB5KOJ1p0NpvA=iX-ybHsO=huGA8qL3xMpUTETmS2qp7_ng@mail.gmail.com
2022-01-01 14:13:26 +08:00
Ihor Radchenko e2a8e95576
org-element-cache: Fix when edit extends previous element
* lisp/org-element.el (org-element--cache-after-change): Always extend
changed region to bol.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking the new fix.  Amend some tests around making sure that cache
is active during testing.
2021-12-17 20:23:50 +08:00
Ihor Radchenko d267486002
org-element-cache: Fix some edits right after indent at :begin
* lisp/org-element.el (org-element--cache-after-change): Extend
changed region to bol when we are editing near beginning of an element
within or right after indentation.  Such edits potentially change
:post-blank value of the previous element.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking one of such cases.
2021-12-16 21:39:25 +08:00
Ihor Radchenko f0c474e659
test-org-element: Add new tests for org-element-cache
* testing/lisp/test-org-element.el (test-org-element/cache): Add tests
for edits near :end of an element.
2021-12-16 12:03:18 +08:00
Ihor Radchenko 4bad221a60
test-org-element: Add new tests
* testing/lisp/test-org-element.el (test-org-element/cache): Add new
tests checking against intersected elements and checking that Phase 2
removes obsolete elements.
2021-12-16 11:53:01 +08:00
Ihor Radchenko 003968f94e
test-org-element: Rename cache-bugs test to cache-table
* testing/lisp/test-org-element.el (test-org-element/cache): The bug
has been fixed.  Old test name does not make sense anymore.
2021-12-16 11:52:22 +08:00
Nicolas Goaziou 7e2d9091d0 oc: Allow declaring cite styles as a function
* lisp/oc.el (org-cite-register-processor): Allow a function
as :cite-styles value.
(org-cite-supported-styles): Propagate change above.
* testing/lisp/test-oc.el (test-org-cite/supported-styles): Add test.
2021-12-12 15:42:29 +01:00
Nicolas Goaziou b4acde37ba lint: Allow user-defined checkers during linting
* lisp/org-lint.el (org-lint-add-checker): New function.
(org-lint--generate-reports): Checker function now must be specified.
It is not deduced anymore from the name of the checker.
* testing/lisp/test-org-lint.el (test-org-lint/add-checker): New test.
2021-12-01 16:09:13 +01:00
Nicolas Goaziou 6766c45bfd org-lint: Add checkers for citations and related
* lisp/org-lint.el (org-lint--checkers): Register new checkers.
(org-lint-non-existent-bibliography):
(org-lint-missing-print-bibliography):
(org-lint-invalid-cite-export-declaration):
(org-lint-incomplete-citation): New functions.
* testing/lisp/test-org-lint.el (test-org-lint/non-existent-bibliography):
(test-org-lint/missing-print-bibliography):
(test-org-lint/invalid-cite-export-declaration):
(test-org-lint/incomplete-citation): New tests.
2021-11-30 22:21:46 +01:00
Nicolas Goaziou 5d2e2cd1bc oc: Factor out string to cite export processor triplet conversion
* lisp/oc.el (org-cite-read-processor-declaration): New function.
(org-cite-store-export-processor): Use new function.
* testing/lisp/test-oc.el (test-org-cite/read-processor-declaration):
New test.
2021-11-30 22:21:46 +01:00
Kyle Meyer 6e7c54ed94 Merge branch 'bugfix' 2021-11-27 16:17:16 -05:00
Kyle Meyer 96d91bea65 test-org-attach-git: Fix recent failure to load tests
* testing/lisp/test-org-attach-git.el: Provide feature.

As of 9044b300e (org-test: Fix ERC errors using latest Emacs master,
2021-11-24), tests must provide a feature.
2021-11-27 16:16:51 -05:00
Kyle Meyer b9cf130c91 test-org-attach-git: Fix file name in header and footer
* testing/lisp/test-org-attach-git.el: Update file name in the header
and footer to match the actual file name.
2021-11-27 16:16:48 -05:00
Nicolas Goaziou 25640ace0f Merge branch 'bugfix' 2021-11-26 11:44:30 +01:00
Nicolas Goaziou 413afbe210 test-org: Fix failing test in non-English languages
* testing/lisp/test-org.el (test-org/auto-repeat-maybe): Do not assume
abbreviated day name is in English.
2021-11-26 11:43:20 +01:00
Ihor Radchenko 23138b9b11
Merge branch 'bugfix' 2021-11-24 20:10:03 +08:00
Ihor Radchenko 9044b300ee
org-test: Fix ERC errors using latest Emacs master
* testing/lisp/test-ob-C.el:
* testing/lisp/test-ob-awk.el:
* testing/lisp/test-ob-sed.el: Add missing provide.
* testing/lisp/test-property-inheritance.el: Fix incorrect feature
name.
* testing/org-test.el (org-test-load): Use `require' instead of
`load-file' to load tests.  `load-file' can lead to duplicate test
definitions that now trigger ERC errors.

See https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01968.html
2021-11-24 20:06:15 +08:00
Ihor Radchenko 0d7cf4e402
test-ob.el: Remove duplicate test 2021-11-24 20:06:07 +08:00
Ihor Radchenko 7a14d6035c
Fix element property queries for inlinetasks
* lisp/org.el (org-get-tags): Do not ignore local tags in inlinetasks.
(org-in-commented-heading-p): Do not ignore commented inlinetasks.
* testing/lisp/test-org.el (test-org/get-tags): Add tests for
inlinetasks.

Fixes https://list.orgmode.org/CAKJdtO8-KkVvhcviTqhi+DMZmSK=o37jn1jJPM9qxcuXZPnGgw@mail.gmail.com/T/#u
2021-11-22 19:34:21 +08:00