aboutsummaryrefslogtreecommitdiff
path: root/pearl.el
diff options
context:
space:
mode:
Diffstat (limited to 'pearl.el')
-rw-r--r--pearl.el16
1 files changed, 13 insertions, 3 deletions
diff --git a/pearl.el b/pearl.el
index 58e5bd3..ae02f1f 100644
--- a/pearl.el
+++ b/pearl.el
@@ -5042,12 +5042,22 @@ decided later."
(defun pearl--priority-number-at-point ()
"Return the Linear priority (0-4) implied by the heading cookie at point.
-A/B/C/D map to Urgent/High/Medium/Low (1-4); no cookie is None (0)."
+A/B/C/D map to Urgent/High/Medium/Low (1-4); no cookie is None (0). A cookie
+present but outside A-D (e.g. \\='[#E]\\=') is not a Linear priority: it signals
+a `user-error' rather than silently mapping to None, which would clear the
+issue's priority on save. Linear has exactly five priorities, so A-D plus
+no-cookie is the whole range."
(save-excursion
(org-back-to-heading t)
(let ((case-fold-search nil))
- (if (re-search-forward "\\[#\\([A-D]\\)\\]" (line-end-position) t)
- (cdr (assoc (match-string 1) '(("A" . 1) ("B" . 2) ("C" . 3) ("D" . 4))))
+ (if (re-search-forward "\\[#\\([A-Z]\\)\\]" (line-end-position) t)
+ (let ((letter (match-string 1)))
+ (or (cdr (assoc letter '(("A" . 1) ("B" . 2) ("C" . 3) ("D" . 4))))
+ (user-error
+ (concat "Priority cookie [#%s] is not a Linear priority; "
+ "use A-D (A=Urgent, B=High, C=Medium, D=Low) "
+ "or no cookie for None")
+ letter)))
0))))
(defun pearl--priority-dirty-p ()