Browse Source

Fix CATEGORY property retrieval

* lisp/org.el (org-entry-properties): Fix returned CATEGORY property
  when no specific keyword is provided.

* testing/lisp/test-org.el (test-org/entry-properties): Add test.
Nicolas Goaziou 10 years ago
parent
commit
3e13ffdfb6
2 changed files with 5 additions and 0 deletions
  1. 1 0
      lisp/org.el
  2. 4 0
      testing/lisp/test-org.el

+ 1 - 0
lisp/org.el

@@ -15730,6 +15730,7 @@ strings."
 			      (if p (setcdr p (concat value " " (cdr p)))
 				(push (cons key value) props))))))))))))
 	  (unless (assoc "CATEGORY" props)
+	    (goto-char beg)
 	    (push (cons "CATEGORY" (org-get-category)) props)
 	    (when (string= specific "CATEGORY") (throw 'exit props)))
 	  ;; Return value.

+ 4 - 0
testing/lisp/test-org.el

@@ -2767,6 +2767,10 @@ Text.
    (org-test-with-temp-text "* H"
      (cdr (assoc "SCHEDULED" (org-entry-properties nil "SCHEDULED")))))
   ;; Get "CATEGORY"
+  (should
+   (equal "cat"
+	  (org-test-with-temp-text "#+CATEGORY: cat\n<point>* H"
+	    (cdr (assoc "CATEGORY" (org-entry-properties))))))
   (should
    (equal "cat"
 	  (org-test-with-temp-text "#+CATEGORY: cat\n<point>* H"