Browse Source

Merge branch 'maint'

Marco Wahl 2 years ago
parent
commit
13a09b3ba5
2 changed files with 13 additions and 2 deletions
  1. 2 2
      lisp/org-element.el
  2. 11 0
      testing/lisp/test-org-element.el

+ 2 - 2
lisp/org-element.el

@@ -947,10 +947,10 @@ Assume point is at beginning of the headline."
 	   (level (prog1 (org-reduced-level (skip-chars-forward "*"))
 		    (skip-chars-forward " \t")))
 	   (todo (and org-todo-regexp
-		      (let (case-fold-search) (looking-at org-todo-regexp))
+		      (let (case-fold-search) (looking-at (concat org-todo-regexp " ")))
 		      (progn (goto-char (match-end 0))
 			     (skip-chars-forward " \t")
-			     (match-string 0))))
+			     (match-string 1))))
 	   (todo-type
 	    (and todo (if (member todo org-done-keywords) 'done 'todo)))
 	   (priority (and (looking-at "\\[#.\\][ \t]*")

+ 11 - 0
testing/lisp/test-org-element.el

@@ -1029,6 +1029,17 @@ Some other text
 
 ;;;; Headline
 
+(ert-deftest test-org-element/headline-todo-keyword ()
+  "Test todo keyword recognition."
+  ;; Reference test.
+  (org-test-with-temp-text "* TODO Headline"
+    (let ((org-todo-keywords '((sequence "TODO" "DONE"))))
+      (should (org-element-property :todo-keyword (org-element-at-point)))))
+  ;; Todo keyword is prefix of headlines first word.
+  (org-test-with-temp-text "* TODOHeadline"
+    (let ((org-todo-keywords '((sequence "TODO" "DONE"))))
+      (should-not (org-element-property :todo-keyword (org-element-at-point))))))
+
 (ert-deftest test-org-element/headline-comment-keyword ()
   "Test COMMENT keyword recognition."
   ;; Reference test.