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

    org-element-headline-interpreter: Fix incorrect placement of COMMENT
    
    * lisp/org-element.el (org-element-headline-interpreter): Put COMMENT
    after priority cookie as per parser spec.
    * testing/lisp/test-org-element.el (test-org-element/headline-interpreter):
    New test cases.
    
    Reported-by: Samuel Wales <[email protected]>
    Link: 
https://orgmode.org/list/cajcao8ue4zvvhmkf2nnlnm66tt2obp3otwhmatfynjmhjng...@mail.gmail.com
---
 lisp/org-element.el              | 2 +-
 testing/lisp/test-org-element.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 651790c19a..6abccd0015 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -1519,8 +1519,8 @@ CONTENTS is the contents of the element."
          (concat (make-string (if org-odd-levels-only (1- (* level 2)) level)
                               ?*)
                  (and todo (concat " " todo))
-                 (and commentedp (concat " " org-element-comment-string))
                  (and priority (format " [#%s]" (org-priority-to-string 
priority)))
+                 (and commentedp (concat " " org-element-comment-string))
                  " "
                  (if (and org-footnote-section
                           (org-element-property :footnote-section-p headline))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 3b9c2ea6d4..f1e3eb3752 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -3591,6 +3591,14 @@ Test.\n")
    (equal (let ((org-comment-string "COMMENT"))
            (org-test-parse-and-interpret "* COMMENT Headline"))
          "* COMMENT Headline\n"))
+  (should
+   (equal (let ((org-comment-string "COMMENT"))
+           (org-test-parse-and-interpret "* [#A] COMMENT Headline"))
+         "* [#A] COMMENT Headline\n"))
+  (should
+   (equal (let ((org-comment-string "COMMENT"))
+           (org-test-parse-and-interpret "* TODO [#A] COMMENT Headline"))
+         "* TODO [#A] COMMENT Headline\n"))
   ;; 6. Keep same number of blank lines before body.
   (should
    (equal (org-test-parse-and-interpret

Reply via email to