浏览代码

Fix `org-entry-properties' with default priority

* lisp/org.el (org-entry-properties): When no priority is explicitly
  set, report `org-default-priority' instead.

* testing/lisp/test-org.el (test-org/entry-properties): Update test.
Nicolas Goaziou 9 年之前
父节点
当前提交
1abc4887a2
共有 2 个文件被更改,包括 9 次插入6 次删除
  1. 5 3
      lisp/org.el
  2. 4 3
      testing/lisp/test-org.el

+ 5 - 3
lisp/org.el

@@ -15728,9 +15728,11 @@ strings."
 		  (push (cons "TODO" (org-match-string-no-properties 2)) props)))
 	      (when specific (throw 'exit props)))
 	    (when (or (not specific) (string= specific "PRIORITY"))
-	      (when (looking-at org-priority-regexp)
-		(push (cons "PRIORITY" (org-match-string-no-properties 2))
-		      props))
+	      (push (cons "PRIORITY"
+			  (if (looking-at org-priority-regexp)
+			      (org-match-string-no-properties 2)
+			    (char-to-string org-default-priority)))
+		    props)
 	      (when specific (throw 'exit props)))
 	    (when (or (not specific) (string= specific "FILE"))
 	      (push (cons "FILE" (buffer-file-name (buffer-base-buffer)))

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

@@ -3356,9 +3356,10 @@ Paragraph<point>"
    (equal "A"
 	  (org-test-with-temp-text "* [#A] H"
 	    (cdr (assoc "PRIORITY" (org-entry-properties))))))
-  (should-not
-   (org-test-with-temp-text "* H"
-     (assoc "PRIORITY" (org-entry-properties nil "PRIORITY"))))
+  (should
+   (equal (char-to-string org-default-priority)
+	  (org-test-with-temp-text "* H"
+	    (cdr (assoc "PRIORITY" (org-entry-properties nil "PRIORITY"))))))
   ;; Get "FILE" property.
   (should
    (org-test-with-temp-text-in-file "* H\nParagraph"