branch: externals/org
commit 1064bb308e41904b8db752d71bc03d2200a8c977
Author: Derek Chen-Becker <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    lisp/org.el: Fix handling of numeric priority in org-entry-put
    
    * lisp/org.el (org-entry-put): Change processing of PRIORITY to use
    `org-priority-to-value' instead of `string-to-char' to properly parse
    numeric priorities.
    
    * testing/lisp/test-org.el (test-org/entry-put): Add a unit test to
    exercise use of numeric priorities with `org-entry-put'
---
 lisp/org.el              | 2 +-
 testing/lisp/test-org.el | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 99d28b5c6e..c803eef450 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -13531,7 +13531,7 @@ decreases scheduled or deadline date by one day."
         (org-todo value)
         (when org-auto-align-tags (org-align-tags)))
         ((equal property "PRIORITY")
-        (org-priority (if (org-string-nw-p value) (string-to-char value) 
'remove))
+        (org-priority (if (org-string-nw-p value) (org-priority-to-value 
value) 'remove))
         (when org-auto-align-tags (org-align-tags)))
         ((equal property "SCHEDULED")
         (forward-line)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 108f19b20c..6b1ccb5f16 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -7437,6 +7437,13 @@ Paragraph<point>"
          (org-test-with-temp-text "* [#B] H"
            (org-entry-put (point) "PRIORITY" nil)
            (buffer-string))))
+  (should
+   (equal "* [#42] H"
+          (let ((org-priority-highest 40)
+                (org-priority-lowest 50))
+            (org-test-with-temp-text "* H"
+           (org-entry-put (point) "PRIORITY" "42")
+           (buffer-string)))))
   ;; Set "SCHEDULED" property.
   (should
    (string-match "* H\n *SCHEDULED: <2014-03-04 .*?>"

Reply via email to