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.
This commit is contained in:
Nicolas Goaziou 2014-11-18 10:27:45 +01:00
parent 4375a941cc
commit 3e13ffdfb6
2 changed files with 5 additions and 0 deletions

View file

@ -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.

View file

@ -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"