* bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work
[not found] ` <CACdyrTmDB5hB3DzBm_Xu2mzUU4iaV-3jd=rHb6p3b3NhfxBpvw@mail.gmail.com>
@ 2021-12-07 1:48 ` Kyle Meyer
2021-12-07 10:41 ` Robert Pluim
2021-12-10 3:48 ` Kyle Meyer
0 siblings, 2 replies; 4+ messages in thread
From: Kyle Meyer @ 2021-12-07 1:48 UTC (permalink / raw)
To: bruce robertson; +Cc: Bastien, 52341
bruce robertson writes:
> 1. in init.el:
> (custom-set-variables
> '(org-priority-default 32)
> '(org-priority-highest 0)
> '(org-priority-lowest 31)
> )
> 2. position to line in .org file:
> ** TODO [#0] test line
>
> 3. from M-x view-lossage:
> C-c , ;; org-priority
>
> 4. mini-buffer displays:
> "Priority 0-31, SPC to remove: "
>
> 5. further in view-lossage:
> SPC ;; self-insert-command
> <return> ;; exit-minibuffer
>
> 4. from *Messages* (and mini-buffer):
> Priority of current item set to 0
>
> 5. PROBLEM:
> I wanted to remove priority.
>
> 6. WORK-AROUND:
> set priority to 32. Then priority disappears. Perhaps this is because 32
> is space code or because I've set org-priority-default to 32.
> ( I spent a medium amount of time to find this behavior. )
>
> 7. SUGGESTION:
> rewrite org-priority to have a clear distinction between numbers and
> characters and whatever will be used to remove the priority.
> ( I gave a look at this but my emacs-fu is too weak. Or my time-fu is
> too small. )
Right, this stems from org-priority feeding " " to string-to-number and
ending up with 0 instead of the ?\s (32) that's used downstream to
signal "remove". The problem goes back to when support for numeric
priorities was added in Org v9.4's 4f98694bf (Allow numeric values for
priorities, 2020-01-30).
I suppose one solution would be to check for " " and translate that to
the ?\s so that the remove is triggered. I'll plan to apply the change
below to Org's bugfix branch in a day or two unless the author of the
above commit (+cc) or someone else has another suggestion.
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 @@ (defun org-priority (&optional action show)
(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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work
2021-12-07 1:48 ` bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work Kyle Meyer
@ 2021-12-07 10:41 ` Robert Pluim
2021-12-08 1:58 ` Kyle Meyer
2021-12-10 3:48 ` Kyle Meyer
1 sibling, 1 reply; 4+ messages in thread
From: Robert Pluim @ 2021-12-07 10:41 UTC (permalink / raw)
To: Kyle Meyer; +Cc: Bastien, bruce robertson, 52341
>>>>> On Mon, 06 Dec 2021 20:48:46 -0500, Kyle Meyer <kyle@kyleam.com> said:
Kyle> Right, this stems from org-priority feeding " " to string-to-number and
Kyle> ending up with 0 instead of the ?\s (32) that's used downstream to
Kyle> signal "remove". The problem goes back to when support for numeric
Kyle> priorities was added in Org v9.4's 4f98694bf (Allow numeric values for
Kyle> priorities, 2020-01-30).
Kyle> I suppose one solution would be to check for " " and translate that to
Kyle> the ?\s so that the remove is triggered. I'll plan to apply the change
Kyle> below to Org's bugfix branch in a day or two unless the author of the
Kyle> above commit (+cc) or someone else has another suggestion.
That fixes part of the issue, but still when using numeric priorities,
removal will be 'SPC RET' rather than 'SPC'.
Robert
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work
2021-12-07 10:41 ` Robert Pluim
@ 2021-12-08 1:58 ` Kyle Meyer
0 siblings, 0 replies; 4+ messages in thread
From: Kyle Meyer @ 2021-12-08 1:58 UTC (permalink / raw)
To: Robert Pluim; +Cc: Bastien, bruce robertson, 52341
Robert Pluim writes:
>>>>>> On Mon, 06 Dec 2021 20:48:46 -0500, Kyle Meyer <kyle@kyleam.com> said:
> Kyle> Right, this stems from org-priority feeding " " to string-to-number and
> Kyle> ending up with 0 instead of the ?\s (32) that's used downstream to
> Kyle> signal "remove". The problem goes back to when support for numeric
> Kyle> priorities was added in Org v9.4's 4f98694bf (Allow numeric values for
> Kyle> priorities, 2020-01-30).
>
> Kyle> I suppose one solution would be to check for " " and translate that to
> Kyle> the ?\s so that the remove is triggered. I'll plan to apply the change
> Kyle> below to Org's bugfix branch in a day or two unless the author of the
> Kyle> above commit (+cc) or someone else has another suggestion.
>
> That fixes part of the issue, but still when using numeric priorities,
> removal will be 'SPC RET' rather than 'SPC'.
If someone 1) uses numeric priorities and 2) has org-priority-lowest
above 9, read-string is used to prompt with "Priority M-N, SPC to
remove: ". They need to use 'SPC RET' just as they need to use, say, '3
RET'. That is, it's consistent with the prompt behavior for entering
the actual priorities.
Perhaps that should change in some way (though I'm not planning on
working on it myself), but in my view that behavior shouldn't be
conflated with SPC not being translated to "remove the priority".
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work
2021-12-07 1:48 ` bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work Kyle Meyer
2021-12-07 10:41 ` Robert Pluim
@ 2021-12-10 3:48 ` Kyle Meyer
1 sibling, 0 replies; 4+ messages in thread
From: Kyle Meyer @ 2021-12-10 3:48 UTC (permalink / raw)
To: bruce robertson; +Cc: Bastien, 52341
close 52341
quit
Kyle Meyer writes:
> I suppose one solution would be to check for " " and translate that to
> the ?\s so that the remove is triggered. I'll plan to apply the change
> below to Org's bugfix branch in a day or two unless the author of the
> above commit (+cc) or someone else has another suggestion.
Applied to the Org repo (4aca51fcb).
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-10 3:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CACdyrTmdEOp1zb6bMVQBuyrLsGiRhpzdWXdzBVbxiddaKqcFrA@mail.gmail.com>
[not found] ` <CACdyrTmDB5hB3DzBm_Xu2mzUU4iaV-3jd=rHb6p3b3NhfxBpvw@mail.gmail.com>
2021-12-07 1:48 ` bug#52341: Fwd: 29.0.50; org-priority 'SPC to remove' doesn't work Kyle Meyer
2021-12-07 10:41 ` Robert Pluim
2021-12-08 1:58 ` Kyle Meyer
2021-12-10 3:48 ` Kyle Meyer
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).