branch: externals/org commit 927278b497cb57c3a1d0036156c1029248ada18e Author: Ihor Radchenko <yanta...@posteo.net> Commit: Ihor Radchenko <yanta...@posteo.net>
lisp/org.el (org-sort-entries): Fix sorting by numeric priority * lisp/org.el (org-sort-entries): Use `org-priority-to-value'. * testing/lisp/test-org.el (test-org/sort-entries): New test. Reported-by: jl...@homemail.com Link: https://orgmode.org/list/trinity-c9960a97-485f-47e6-ab72-90b65e8ccd25-1746919281305@3c-app-mailcom-lxa09 --- lisp/org.el | 2 +- testing/lisp/test-org.el | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 174c4c8e54..0a406d7cca 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8074,7 +8074,7 @@ function is being called interactively." (float-time now)))) ((= dcst ?p) (if (re-search-forward org-priority-regexp (line-end-position) t) - (string-to-char (match-string 2)) + (org-priority-to-value (match-string 2)) org-priority-default)) ((= dcst ?r) (or (org-entry-get nil property) "")) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 79102d3825..36dea35b70 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -3857,6 +3857,21 @@ Foo Bar (org-sort-entries nil ?O) (buffer-string)))) ;; Sort by priority. + (should + (equal "#+PRIORITIES: 0 9 9 +* TODO [#0] Bob +* TODO [#1] Perci +* TODO Tim +" + (org-test-with-temp-text + "#+PRIORITIES: 0 9 9 +* TODO [#0] Bob +* TODO Tim +* TODO [#1] Perci +" + (org-set-regexps-and-options) + (org-sort-entries nil ?p) + (buffer-string)))) (should (equal "\n* [#A] h2\n* [#B] h3\n* [#C] h1\n" (org-test-with-temp-text