branch: externals/org
commit 4fc79630d09fb8649f94e5de455155e1e337b4cf
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    org-element-babel-call-parser: Fix calls without ()
    
    * lisp/org-element.el (org-element-babel-call-parser): Avoid including
    newline into the #+call: name without ().  Such format is technically
    not a babel call, but we may as well make it such (keeping closer the
    existing behavior).  This is also intuitive enough to drop empty ().
    * testing/lisp/test-org-element.el (test-org-element/babel-call-parser):
    New test.
    
    Reported-by: Rodrigo Morales <[email protected]>
    Link: https://orgmode.org/list/87wlxhlovc.fsf@localhost
---
 lisp/org-element.el              | 2 +-
 testing/lisp/test-org-element.el | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index e26fa989b0..41d7a46f23 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -2352,7 +2352,7 @@ Return a new syntax node of `babel-call' type containing 
`:call',
           (call
            (or (org-string-nw-p
                 (buffer-substring-no-properties
-                 (point) (progn (skip-chars-forward "^[]()" before-blank)
+                 (point) (progn (skip-chars-forward "^[]()\n" before-blank)
                                 (point))))))
           (inside-header (org-element--parse-paired-brackets ?\[))
           (arguments (org-string-nw-p
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index e5ab89ac03..4d70927de4 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -935,6 +935,11 @@ CLOCK: [2023-10-13 Fri 14:40]--[2023-10-13 Fri 14:51] =>  
0:11"
    (eq 'babel-call
        (org-test-with-temp-text "#+CALL: test()"
         (org-element-type (org-element-at-point)))))
+  (should
+   (org-test-with-temp-text "#+CALL: test\n\n"
+     (eq 'babel-call
+         (org-element-type (org-element-at-point)))
+     (equal "test" (org-element-property :call (org-element-at-point)))))
   ;; Ignore case.
   (should
    (eq 'babel-call

Reply via email to