org-element-clock-parser: Do not be case-sensitive

* lisp/org-element.el (org-element-clock-parser): Fix demanding
upcased "CLOCK:" string.  As per general Org mode syntax principle,
keywords in Org mode are case-insensitive.
* testing/lisp/test-org-element.el (test-org-element/clock-parser):
Add test.

Reported-by: Gregor Zattler <telegraph@gmx.net>
Link: https://orgmode.org/list/875xx8mvvn.fsf@no.lan
This commit is contained in:
Ihor Radchenko 2024-03-27 14:57:17 +03:00
parent 990b89d324
commit 3f20e32f8e
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
2 changed files with 11 additions and 3 deletions

View File

@ -2291,9 +2291,8 @@ Return a new syntax node of `clock' type containing `:status',
`:value', `:time', `:begin', `:end', `:post-blank' and
`:post-affiliated' as properties."
(save-excursion
(let* ((case-fold-search nil)
(begin (point))
(value (progn (search-forward "CLOCK:" (line-end-position) t)
(let* ((begin (point))
(value (progn (search-forward "CLOCK:" (line-end-position))
(skip-chars-forward " \t")
(org-element-timestamp-parser)))
(duration (and (search-forward " => " (line-end-position) t)

View File

@ -1157,6 +1157,15 @@ CLOCK: [2023-10-13 Fri 14:40]--[2023-10-13 Fri 14:51] => 0:11"
(org-element-property :value clock))
"[2012-01-01 sun. 00:01]"))
(should-not (org-element-property :duration clock)))
;; clock string should not be case-sensitive.
(let ((clock (org-test-with-temp-text "Clock: [2012-01-01 sun. 00:01]"
(org-element-at-point))))
(should (eq (org-element-property :status clock) 'running))
(should
(equal (org-element-property :raw-value
(org-element-property :value clock))
"[2012-01-01 sun. 00:01]"))
(should-not (org-element-property :duration clock)))
;; Closed clock.
(let ((clock
(org-test-with-temp-text