perfect, here's the updated patch
>From 33f2ec7db51a54cef8982ecd8be76ba756b6f613 Mon Sep 17 00:00:00 2001
From: drlkf <[email protected]>
Date: Sun, 9 Aug 2026 18:37:04 +0200
Subject: [PATCH] lisp/org.el: consolidate priority markers
* lisp/org.el (org-priority-regexp, org-priority): consolidate
priority markers into a single set of consts
---
lisp/org.el | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 59163e252..ee56647bd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -123,14 +123,29 @@ sure that we are at the beginning of the line.")
"Matches a headline, putting stars and text into groups.
Stars are put in group 1 and the trimmed body in group 2.")
+(defconst org-priority-prefix "[#"
+ "Marker preceding value in the priority indicator e.g [# in [#A].")
+
+(defconst org-priority-suffix "]"
+ "Marker following value in the priority indicator e.g ] in [#A].")
+
(defvar org-priority-value-regexp "[A-Z]\\|[0-9]\\|[1-5][0-9]\\|6[0-4]"
"Regular expression matching valid priority values.
The priority value must be a capital Latin
alphabetic character, A through Z, or can be an integer value in the range 0
through 64.")
+(defun org-make-priority-regexp ()
+ "Generate a correct `org-priority-regexp' using `org-priority'
+variables. Useful after setting custom priority markers or value
+regexp."
+ (format ".*?\\(%s\\(%s\\)%s ?\\)"
+ (regexp-quote org-priority-prefix)
+ org-priority-value-regexp
+ (regexp-quote org-priority-suffix)))
+
(defvar org-priority-regexp
- (format ".*?\\(\\[#\\(%s\\)\\] ?\\)" org-priority-value-regexp)
+ (org-make-priority-regexp)
"Regular expression matching the priority indicator.
A priority indicator can be e.g. [#A] or [#1].
The value of the priority cookie must be a capital Latin
@@ -11613,9 +11628,9 @@ interactive prompt, it will automatically be converted to uppercase."
(if (match-end 2)
(progn
(goto-char (match-end 2))
- (insert " [#" new-value-string "]"))
+ (insert " " org-priority-prefix new-value-string org-priority-suffix))
(goto-char (match-beginning 3))
- (insert "[#" new-value-string "] "))))
+ (insert org-priority-prefix new-value-string org-priority-suffix " "))))
(when org-auto-align-tags (org-align-tags)))
(if remove
(message "Priority removed")
--
2.47.3
best
On Sun, 09 August 2026 15:34, Ihor Radchenko <[email protected]> wrote:
> drlkf <[email protected]> writes:
>
>> I submitted a patch a few years ago about the same change which I could
>> not follow-up on because I've been quite busy, however most of the
>> refactoring I had done has already been included in some form or another
>> so this time the feature I'm trying to include is much more
>> straightforward, although it could still lead to the parsing clashes the
>> maintainer mentioned in the original thread:
>>
>> https://lists.gnu.org/archive/html/emacs-orgmode/2022-10/msg00635.html
>>
>> I'm submitting the new patch here, if it's not acceptable to modify this
>> behavior then I'll provide another one to extract the piece of code I
>> want to modify so I can override it with advice.
>
> As I mentioned in the response to your earlier patch, we do not intend to
> officially support syntax customization. We are aiming for an opposite -
> syntax will be more standardized to simplify Org syntax support outside Emacs.
>
> That said, I do not oppose this patch if we limit it to refactoring.
>
>> +#+vindex: org-priority-prefix
>> +#+vindex: org-priority-suffix
>> +#+vindex: org-priority-regexp
>> +#+vindex: org-make-priority-regexp
>> +You can set your own style of priority marker using
>> +~org-priority-prefix~, ~org-priority-suffix~ and generate the
>> +appropriate ~org-make-priority-regexp~ for ~org-priority-regexp~:
>> +
>> +#+begin_src elisp
>> +(setq org-priority-prefix "<:"
>> + org-priority-suffers ">"
>> + org-priority-regexp (org-make-priority-regexp))
>> +#+end_src
>> +
>> +: *** TODO <:1> Customize priority marker
>
> This should be dropped.
>
>> +(defvar org-priority-prefix "[#"
>> + "Marker preceding value in the priority indicator e.g [# in [#A].")
>> +
>> +(defvar org-priority-suffix "]"
>> + "Marker following value in the priority indicator e.g ] in [#A].")
>
> These should be two defconsts.
>
>> + ;; Test all valid numbers with customized markers
>> + (should
>> + (let* ((org-priority-prefix "_")
>> + (org-priority-suffix "|")
>> + (org-priority-regexp (org-make-priority-regexp)))
>> + (seq-every-p (lambda (p)
>> + (let ((cookie (format "_%d|" p)))
>> + (org-priority-valid-cookie-string-p cookie)))
>> + (number-sequence 0 64))))
>
> This should be dropped.
>
> And please add a commit message, following
> https://orgmode.org/worg/org-contribute.html#commit-messages
--
drlkf