From 4aca51fcbec7c4753792998a8a6afb36af2ea7c4 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 6 Dec 2021 20:48:46 -0500 Subject: [PATCH] org-priority: Fix SPC handling for numeric priorities (bug#52341) * lisp/org.el (org-priority): When reading numeric priorities, provide special handling of SPC so that it clears the priority, as advertised. If the user has configured numeric priorities and tries to clear a priority by inputting SPC at the prompt, org-priority feeds " " to string-to-number and ends up with 0 instead of the ?\s (32) that's used downstream to signal "remove". Explicitly check for " " and translate it to ?\s. Reported-by: "Bruce E. Robertson" Link: https://list.orgmode.org/877dch89s1.fsf@kyleam.com/ --- lisp/org.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1a1375461..998da0656 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11323,13 +11323,14 @@ or a character." (setq new (if nump - (let ((msg (format "Priority %s-%s, SPC to remove: " - (number-to-string org-priority-highest) - (number-to-string org-priority-lowest)))) - (if (< 9 org-priority-lowest) - (string-to-number (read-string msg)) - (message msg) - (string-to-number (char-to-string (read-char-exclusive))))) + (let* ((msg (format "Priority %s-%s, SPC to remove: " + (number-to-string org-priority-highest) + (number-to-string org-priority-lowest))) + (s (if (< 9 org-priority-lowest) + (read-string msg) + (message msg) + (char-to-string (read-char-exclusive))))) + (if (equal s " ") ?\s (string-to-number s))) (progn (message "Priority %c-%c, SPC to remove: " org-priority-highest org-priority-lowest) (save-match-data