all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-priority: allow customization of priority indicator
@ 2022-10-17 20:46 drlkf
  2022-10-18  6:57 ` Bastien
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: drlkf @ 2022-10-17 20:46 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Hello,

I would like to submit a patch to allow users to change the priority
tag's form entirely. While it has been working for my use-case i.e
basic operations inside org buffers and org-agenda, it is not perfect
and there are some bugs that remain when using more advanced features
with different tag forms (mine is `_p' where `p' is `[1-9]'), that I am
not competent enough to solve. However I believe there are no breaking
changes if the user does not modify said tag form. If there's any
precision I can add, please let me know.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-priority.patch --]
[-- Type: text/x-diff, Size: 6579 bytes --]

From 94117daef8fec4e214d9973a17c2ae4baba1d761 Mon Sep 17 00:00:00 2001
From: drlkf <drlkf@drlkf.net>
Date: Thu, 9 Jun 2022 03:19:00 +0200
Subject: [PATCH] org-priority: allow customization of priority indicator

* org.el (org-priority): Allow the user to set the prefix and suffix
of the priority indicator so that it have a completely different form
for them (e.g _A instead of [#A]).
---
 org-agenda.el  |  4 ++--
 org-element.el |  8 ++++++--
 org.el         | 40 ++++++++++++++++++++++++++++++++--------
 3 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/org-agenda.el b/org-agenda.el
index 71aac271f..cbbe5e4c6 100644
--- a/org-agenda.el
+++ b/org-agenda.el
@@ -3431,8 +3431,8 @@ This ensures the export commands can easily use it."
       (setq props (plist-put props 'day tmp))
       (setq props (plist-put props 'agenda-day tmp)))
     (when (setq tmp (plist-get props 'txt))
-      (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp)
-	(plist-put props 'priority-letter (match-string 1 tmp))
+      (when (string-match org-priority-regexp tmp)
+	(plist-put props 'priority-letter (match-string 3 tmp))
 	(setq tmp (replace-match "" t t tmp)))
       (when (and (setq re (plist-get props 'org-todo-regexp))
 		 (setq re (concat "\\`\\.*" re " ?"))
diff --git a/org-element.el b/org-element.el
index 9db1406b3..2047e202b 100644
--- a/org-element.el
+++ b/org-element.el
@@ -1009,7 +1009,9 @@ Assume point is at beginning of the headline."
 			     (match-string 1))))
 	   (todo-type
 	    (and todo (if (member todo org-done-keywords) 'done 'todo)))
-	   (priority (and (looking-at "\\[#.\\][ \t]*")
+	   (priority (and (looking-at (format "%s.%s[ \t]*"
+                                              (regexp-quote org-priority-prefix)
+                                              (regexp-quote org-priority-prefix)))
 			  (progn (goto-char (match-end 0))
 				 (aref (match-string 0) 2))))
 	   (commentedp
@@ -1158,7 +1160,9 @@ Assume point is at beginning of the inline task."
 			     (match-string 0))))
 	   (todo-type (and todo
 			   (if (member todo org-done-keywords) 'done 'todo)))
-	   (priority (and (looking-at "\\[#.\\][ \t]*")
+	   (priority (and (looking-at (format "%s.%s[ \t]*"
+                                              (regexp-quote org-priority-prefix)
+                                              (regexp-quote org-priority-prefix)))
 			  (progn (goto-char (match-end 0))
 				 (aref (match-string 0) 2))))
 	   (title-start (point))
diff --git a/org.el b/org.el
index 06af12339..648eb840a 100644
--- a/org.el
+++ b/org.el
@@ -4468,14 +4468,18 @@ related expressions."
 	      org-complex-heading-regexp
 	      (concat "^\\(\\*+\\)"
 		      "\\(?: +" org-todo-regexp "\\)?"
-		      "\\(?: +\\(\\[#.\\]\\)\\)?"
+		      (format "\\(?: +\\(%s.%s\\)\\)?"
+                              (regexp-quote org-priority-prefix)
+                              (regexp-quote org-priority-suffix))
 		      "\\(?: +\\(.*?\\)\\)??"
 		      "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?"
 		      "[ \t]*$")
 	      org-complex-heading-regexp-format
 	      (concat "^\\(\\*+\\)"
 		      "\\(?: +" org-todo-regexp "\\)?"
-		      "\\(?: +\\(\\[#.\\]\\)\\)?"
+		      (format "\\(?: +\\(%s.%s\\)\\)?"
+                              (regexp-quote org-priority-prefix)
+                              (regexp-quote org-priority-suffix))
 		      "\\(?: +"
 		      ;; Stats cookies can be stuck to body.
 		      "\\(?:\\[[0-9%%/]+\\] *\\)*"
@@ -5764,8 +5768,10 @@ needs to be inserted at a specific position in the font-lock sequence.")
 	  '(org-activate-code (1 'org-code t))
 	  ;; COMMENT
 	  (list (format
-		 "^\\*+\\(?: +%s\\)?\\(?: +\\[#[A-Z0-9]\\]\\)? +\\(?9:%s\\)\\(?: \\|$\\)"
+		 "^\\*+\\(?: +%s\\)?\\(?: +%s[A-Z0-9]%s\\)? +\\(?9:%s\\)\\(?: \\|$\\)"
 		 org-todo-regexp
+		 (regexp-quote org-priority-prefix)
+		 (regexp-quote org-priority-suffix)
 		 org-comment-string)
 		'(9 'org-special-keyword t))
 	  ;; Blocks and meta lines
@@ -7144,7 +7150,7 @@ This is a list with the following elements:
       (list (length (match-string 1))
 	    (org-reduced-level (length (match-string 1)))
 	    (match-string-no-properties 2)
-	    (and (match-end 3) (aref (match-string 3) 2))
+	    (and (match-end 3) (aref (match-string 3) (length org-priority-prefix)))
 	    (match-string-no-properties 4)
 	    (match-string-no-properties 5)))))
 
@@ -11269,13 +11275,29 @@ from the `before-change-functions' in the current buffer."
 
 ;;;; Priorities
 
+(defvar org-priority-prefix "[#"
+  "Prefix to insert before a priority value to form the priority indicator.
+It should be matched in accordance by `org-priority-regexp' in order
+for priorities to work both-ways (inserting and extracting).")
+
+(defvar org-priority-suffix "]"
+  "Suffix to insert after a priority value to end the priority indicator.
+It should be matched in accordance by `org-priority-regexp' in order
+for priorities to work both-ways (inserting and extracting).")
+
 (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]+\\)\\] ?\\)"
   "Regular expression matching the priority indicator.
 A priority indicator can be e.g. [#A] or [#1].
 This regular expression matches these groups:
 0 : the whole match, e.g. \"TODO [#A] Hack\"
 1 : the priority cookie, e.g. \"[#A]\"
-2 : the value of the priority cookie, e.g. \"A\".")
+2 : the value of the priority cookie, e.g. \"A\".
+
+This regexp should match `org-priority-prefix' and
+`org-priority-suffix' values in order for priorities to work both-ways
+(inserting and extracting).
+
+See also `org-mouse-priority-regexp'.")
 
 (defun org-priority-up ()
   "Increase the priority of the current item."
@@ -11389,9 +11411,9 @@ or a character."
 	    (if (match-end 2)
 		(progn
 		  (goto-char (match-end 2))
-		  (insert " [#" news "]"))
+		  (insert " " org-priority-prefix news org-priority-suffix))
 	      (goto-char (match-beginning 3))
-	      (insert "[#" news "] "))))
+	      (insert org-priority-prefix news org-priority-suffix " "))))
 	(org-align-tags))
       (if remove
 	  (message "Priority removed")
@@ -18800,7 +18822,9 @@ and :keyword."
 	(push (org-point-in-group p 4 :tags) clist))
       (goto-char p)
       (skip-chars-backward "^[\n\r \t") (or (bobp) (backward-char 1))
-      (when (looking-at "\\[#[A-Z0-9]\\]")
+      (when (looking-at (format "%s[A-Z0-9]%s"
+                                (regexp-quote org-priority-prefix)
+                                (regexp-quote org-priority-suffix)))
 	(push (org-point-in-group p 0 :priority) clist)))
 
      ((org-at-item-p)
-- 
2.30.2


[-- Attachment #3.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: org-priority: allow customization of priority indicator
  2022-10-17 20:46 org-priority: allow customization of priority indicator drlkf
@ 2022-10-18  6:57 ` Bastien
  2022-10-18  6:59 ` Stefan Kangas
  2022-10-18  8:28 ` Fwd: " drlkf
  2 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2022-10-18  6:57 UTC (permalink / raw)
  To: drlkf; +Cc: emacs-devel

Hi,

drlkf <drlkf@drlkf.net> writes:

> I would like to submit a patch to allow users to change the priority
> tag's form entirely. 

Can you resubmit this patch to emacs-orgmode@gnu.org, where such
changes are being discussed and reviewed?

Thanks a lot!

-- 
 Bastien



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-priority: allow customization of priority indicator
  2022-10-17 20:46 org-priority: allow customization of priority indicator drlkf
  2022-10-18  6:57 ` Bastien
@ 2022-10-18  6:59 ` Stefan Kangas
  2022-10-18  8:28 ` Fwd: " drlkf
  2 siblings, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2022-10-18  6:59 UTC (permalink / raw)
  To: drlkf, emacs-devel; +Cc: Ihor Radchenko

drlkf <drlkf@drlkf.net> writes:

> I would like to submit a patch to allow users to change the priority
> tag's form entirely.

I recommend submitting this patch to the Org mode developers directly,
as they are in a better position to review it:

    https://orgmode.org/worg/org-mailing-list.html



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Fwd: org-priority: allow customization of priority indicator
  2022-10-17 20:46 org-priority: allow customization of priority indicator drlkf
  2022-10-18  6:57 ` Bastien
  2022-10-18  6:59 ` Stefan Kangas
@ 2022-10-18  8:28 ` drlkf
  2022-10-18 12:35   ` Ihor Radchenko
  2 siblings, 1 reply; 9+ messages in thread
From: drlkf @ 2022-10-18  8:28 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 535 bytes --]

Hello,

I would like to submit a patch to allow users to change the priority
tag's form entirely. While it has been working for my use-case i.e
basic operations inside org buffers and org-agenda, it is not perfect
and there are some bugs that remain when using more advanced features
with different tag forms (mine is `_p' where `p' is `[1-9]'), that I am
not competent enough to solve. However I believe there are no breaking
changes if the user does not modify said tag form. If there's any
precision I can add, please let me know.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-priority.patch --]
[-- Type: text/x-diff, Size: 6579 bytes --]

From 94117daef8fec4e214d9973a17c2ae4baba1d761 Mon Sep 17 00:00:00 2001
From: drlkf <drlkf@drlkf.net>
Date: Thu, 9 Jun 2022 03:19:00 +0200
Subject: [PATCH] org-priority: allow customization of priority indicator

* org.el (org-priority): Allow the user to set the prefix and suffix
of the priority indicator so that it have a completely different form
for them (e.g _A instead of [#A]).
---
 org-agenda.el  |  4 ++--
 org-element.el |  8 ++++++--
 org.el         | 40 ++++++++++++++++++++++++++++++++--------
 3 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/org-agenda.el b/org-agenda.el
index 71aac271f..cbbe5e4c6 100644
--- a/org-agenda.el
+++ b/org-agenda.el
@@ -3431,8 +3431,8 @@ This ensures the export commands can easily use it."
       (setq props (plist-put props 'day tmp))
       (setq props (plist-put props 'agenda-day tmp)))
     (when (setq tmp (plist-get props 'txt))
-      (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp)
-	(plist-put props 'priority-letter (match-string 1 tmp))
+      (when (string-match org-priority-regexp tmp)
+	(plist-put props 'priority-letter (match-string 3 tmp))
 	(setq tmp (replace-match "" t t tmp)))
       (when (and (setq re (plist-get props 'org-todo-regexp))
 		 (setq re (concat "\\`\\.*" re " ?"))
diff --git a/org-element.el b/org-element.el
index 9db1406b3..2047e202b 100644
--- a/org-element.el
+++ b/org-element.el
@@ -1009,7 +1009,9 @@ Assume point is at beginning of the headline."
 			     (match-string 1))))
 	   (todo-type
 	    (and todo (if (member todo org-done-keywords) 'done 'todo)))
-	   (priority (and (looking-at "\\[#.\\][ \t]*")
+	   (priority (and (looking-at (format "%s.%s[ \t]*"
+                                              (regexp-quote org-priority-prefix)
+                                              (regexp-quote org-priority-prefix)))
 			  (progn (goto-char (match-end 0))
 				 (aref (match-string 0) 2))))
 	   (commentedp
@@ -1158,7 +1160,9 @@ Assume point is at beginning of the inline task."
 			     (match-string 0))))
 	   (todo-type (and todo
 			   (if (member todo org-done-keywords) 'done 'todo)))
-	   (priority (and (looking-at "\\[#.\\][ \t]*")
+	   (priority (and (looking-at (format "%s.%s[ \t]*"
+                                              (regexp-quote org-priority-prefix)
+                                              (regexp-quote org-priority-prefix)))
 			  (progn (goto-char (match-end 0))
 				 (aref (match-string 0) 2))))
 	   (title-start (point))
diff --git a/org.el b/org.el
index 06af12339..648eb840a 100644
--- a/org.el
+++ b/org.el
@@ -4468,14 +4468,18 @@ related expressions."
 	      org-complex-heading-regexp
 	      (concat "^\\(\\*+\\)"
 		      "\\(?: +" org-todo-regexp "\\)?"
-		      "\\(?: +\\(\\[#.\\]\\)\\)?"
+		      (format "\\(?: +\\(%s.%s\\)\\)?"
+                              (regexp-quote org-priority-prefix)
+                              (regexp-quote org-priority-suffix))
 		      "\\(?: +\\(.*?\\)\\)??"
 		      "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?"
 		      "[ \t]*$")
 	      org-complex-heading-regexp-format
 	      (concat "^\\(\\*+\\)"
 		      "\\(?: +" org-todo-regexp "\\)?"
-		      "\\(?: +\\(\\[#.\\]\\)\\)?"
+		      (format "\\(?: +\\(%s.%s\\)\\)?"
+                              (regexp-quote org-priority-prefix)
+                              (regexp-quote org-priority-suffix))
 		      "\\(?: +"
 		      ;; Stats cookies can be stuck to body.
 		      "\\(?:\\[[0-9%%/]+\\] *\\)*"
@@ -5764,8 +5768,10 @@ needs to be inserted at a specific position in the font-lock sequence.")
 	  '(org-activate-code (1 'org-code t))
 	  ;; COMMENT
 	  (list (format
-		 "^\\*+\\(?: +%s\\)?\\(?: +\\[#[A-Z0-9]\\]\\)? +\\(?9:%s\\)\\(?: \\|$\\)"
+		 "^\\*+\\(?: +%s\\)?\\(?: +%s[A-Z0-9]%s\\)? +\\(?9:%s\\)\\(?: \\|$\\)"
 		 org-todo-regexp
+		 (regexp-quote org-priority-prefix)
+		 (regexp-quote org-priority-suffix)
 		 org-comment-string)
 		'(9 'org-special-keyword t))
 	  ;; Blocks and meta lines
@@ -7144,7 +7150,7 @@ This is a list with the following elements:
       (list (length (match-string 1))
 	    (org-reduced-level (length (match-string 1)))
 	    (match-string-no-properties 2)
-	    (and (match-end 3) (aref (match-string 3) 2))
+	    (and (match-end 3) (aref (match-string 3) (length org-priority-prefix)))
 	    (match-string-no-properties 4)
 	    (match-string-no-properties 5)))))
 
@@ -11269,13 +11275,29 @@ from the `before-change-functions' in the current buffer."
 
 ;;;; Priorities
 
+(defvar org-priority-prefix "[#"
+  "Prefix to insert before a priority value to form the priority indicator.
+It should be matched in accordance by `org-priority-regexp' in order
+for priorities to work both-ways (inserting and extracting).")
+
+(defvar org-priority-suffix "]"
+  "Suffix to insert after a priority value to end the priority indicator.
+It should be matched in accordance by `org-priority-regexp' in order
+for priorities to work both-ways (inserting and extracting).")
+
 (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]+\\)\\] ?\\)"
   "Regular expression matching the priority indicator.
 A priority indicator can be e.g. [#A] or [#1].
 This regular expression matches these groups:
 0 : the whole match, e.g. \"TODO [#A] Hack\"
 1 : the priority cookie, e.g. \"[#A]\"
-2 : the value of the priority cookie, e.g. \"A\".")
+2 : the value of the priority cookie, e.g. \"A\".
+
+This regexp should match `org-priority-prefix' and
+`org-priority-suffix' values in order for priorities to work both-ways
+(inserting and extracting).
+
+See also `org-mouse-priority-regexp'.")
 
 (defun org-priority-up ()
   "Increase the priority of the current item."
@@ -11389,9 +11411,9 @@ or a character."
 	    (if (match-end 2)
 		(progn
 		  (goto-char (match-end 2))
-		  (insert " [#" news "]"))
+		  (insert " " org-priority-prefix news org-priority-suffix))
 	      (goto-char (match-beginning 3))
-	      (insert "[#" news "] "))))
+	      (insert org-priority-prefix news org-priority-suffix " "))))
 	(org-align-tags))
       (if remove
 	  (message "Priority removed")
@@ -18800,7 +18822,9 @@ and :keyword."
 	(push (org-point-in-group p 4 :tags) clist))
       (goto-char p)
       (skip-chars-backward "^[\n\r \t") (or (bobp) (backward-char 1))
-      (when (looking-at "\\[#[A-Z0-9]\\]")
+      (when (looking-at (format "%s[A-Z0-9]%s"
+                                (regexp-quote org-priority-prefix)
+                                (regexp-quote org-priority-suffix)))
 	(push (org-point-in-group p 0 :priority) clist)))
 
      ((org-at-item-p)
-- 
2.30.2


[-- Attachment #3.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #3.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: Fwd: org-priority: allow customization of priority indicator
  2022-10-18  8:28 ` Fwd: " drlkf
@ 2022-10-18 12:35   ` Ihor Radchenko
  2022-11-21  3:24     ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2022-10-18 12:35 UTC (permalink / raw)
  To: drlkf; +Cc: emacs-orgmode

drlkf <drlkf@drlkf.net> writes:

> I would like to submit a patch to allow users to change the priority
> tag's form entirely. While it has been working for my use-case i.e
> basic operations inside org buffers and org-agenda, it is not perfect
> and there are some bugs that remain when using more advanced features
> with different tag forms (mine is `_p' where `p' is `[1-9]'), that I am
> not competent enough to solve. However I believe there are no breaking
> changes if the user does not modify said tag form. If there's any
> precision I can add, please let me know.

Thanks for the patch!

In general, we do not intend to support changing basic elements of Org
syntax. So, things like your _p may remain buggy because they clash with
underscore emphasis.

However, your patch is anyway useful because it makes the Org code
cleaner and more modular. A side effect that users will be able to
change the syntax at their own risk can also be considered as somewhat
odd feature (apparently useful for you at least).

As a general feedback to the patch, I suggest moving the old and new
priority variables into org-element.el and change them to defconst
(Elisp still allows altering defconsts). When moving, rename them to use
org-element-* prefix, but keep old existing variables under defvaralias.

More comments below.

> Subject: [PATCH] org-priority: allow customization of priority indicator
>
> * org.el (org-priority): Allow the user to set the prefix and suffix
> of the priority indicator so that it have a completely different form
> for them (e.g _A instead of [#A]).

Please word the patch more along the lines of "Refactor priority
syntax". Org maintainers are not going to take an extra burden of
resolving bugs coming from arbitrary changes in property syntax.

> -      (when (string-match "\\[#\\([A-Z0-9]\\)\\] ?" tmp)
> -	(plist-put props 'priority-letter (match-string 1 tmp))
> +      (when (string-match org-priority-regexp tmp)
> +	(plist-put props 'priority-letter (match-string 3 tmp))

Do note that org-priority-regexp is not the same with the old regexp.
Maybe we can introduce something like org-element-priority-regexp that
does not do match groups. Just "[\\[#[A-Z0-9]+\\][ \t]*". Then, you can use it
here instead of employing costly lazy matching in analytic
org-priority-regexp.

> -	   (priority (and (looking-at "\\[#.\\][ \t]*")
> +	   (priority (and (looking-at (format "%s.%s[ \t]*"
> +                                              (regexp-quote org-priority-prefix)
> +                                              (regexp-quote org-priority-prefix)))

Better use org-element-priority-regexp as above.

> -	   (priority (and (looking-at "\\[#.\\][ \t]*")
> +	   (priority (and (looking-at (format "%s.%s[ \t]*"
> +                                              (regexp-quote org-priority-prefix)
> +                                              (regexp-quote org-priority-prefix)))
>  			  (progn (goto-char (match-end 0))
>  				 (aref (match-string 0) 2))))

same

> -		      "\\(?: +\\(\\[#.\\]\\)\\)?"
> +		      (format "\\(?: +\\(%s.%s\\)\\)?"
> +                              (regexp-quote org-priority-prefix)
> +                              (regexp-quote org-priority-suffix))
>  		      "\\(?: +\\(.*?\\)\\)??"
>  		      "\\(?:[ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)?"
>  		      "[ \t]*$")
>  	      org-complex-heading-regexp-format
>  	      (concat "^\\(\\*+\\)"
>  		      "\\(?: +" org-todo-regexp "\\)?"
> -		      "\\(?: +\\(\\[#.\\]\\)\\)?"
> +		      (format "\\(?: +\\(%s.%s\\)\\)?"
> +                              (regexp-quote org-priority-prefix)
> +                              (regexp-quote org-priority-suffix))

same

>  		      "\\(?: +"
>  		      ;; Stats cookies can be stuck to body.
>  		      "\\(?:\\[[0-9%%/]+\\] *\\)*"
> @@ -5764,8 +5768,10 @@ needs to be inserted at a specific position in the font-lock sequence.")
>  	  '(org-activate-code (1 'org-code t))
>  	  ;; COMMENT
>  	  (list (format
> -		 "^\\*+\\(?: +%s\\)?\\(?: +\\[#[A-Z0-9]\\]\\)? +\\(?9:%s\\)\\(?: \\|$\\)"
> +		 "^\\*+\\(?: +%s\\)?\\(?: +%s[A-Z0-9]%s\\)? +\\(?9:%s\\)\\(?: \\|$\\)"
>  		 org-todo-regexp
> +		 (regexp-quote org-priority-prefix)
> +		 (regexp-quote org-priority-suffix)

same

>  ;;;; Priorities
>  
> +(defvar org-priority-prefix "[#"
> +  "Prefix to insert before a priority value to form the priority indicator.
> +It should be matched in accordance by `org-priority-regexp' in order
> +for priorities to work both-ways (inserting and extracting).")
> +
> +(defvar org-priority-suffix "]"
> +  "Suffix to insert after a priority value to end the priority indicator.
> +It should be matched in accordance by `org-priority-regexp' in order
> +for priorities to work both-ways (inserting and extracting).")
> +
>  (defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]+\\)\\] ?\\)"

You can use org-priority-prefix and org-priority-suffix values here.

> -      (when (looking-at "\\[#[A-Z0-9]\\]")
> +      (when (looking-at (format "%s[A-Z0-9]%s"
> +                                (regexp-quote org-priority-prefix)
> +                                (regexp-quote org-priority-suffix)))

org-element-priority-regexp

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fwd: org-priority: allow customization of priority indicator
  2022-10-18 12:35   ` Ihor Radchenko
@ 2022-11-21  3:24     ` Ihor Radchenko
  2022-11-24 22:11       ` drlkf
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2022-11-21  3:24 UTC (permalink / raw)
  To: drlkf; +Cc: emacs-orgmode

Ihor Radchenko <yantar92@posteo.net> writes:

> Thanks for the patch!
>
> In general, we do not intend to support changing basic elements of Org
> syntax. So, things like your _p may remain buggy because they clash with
> underscore emphasis.
> ...
> More comments below.
> ...

[I am following this up as more than one month passed since the last
activity in the thread]

Have you had a chance to look into my comments?
If you have any objections or issues with addressing them, feel free to
reply.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fwd: org-priority: allow customization of priority indicator
  2022-11-21  3:24     ` Ihor Radchenko
@ 2022-11-24 22:11       ` drlkf
  2022-11-25  2:12         ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: drlkf @ 2022-11-24 22:11 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 789 bytes --]

Hi,

Apologies, I've been quite busy and I haven't had time to dive more into
this, but I have it written down somewhere and I'll make modifications
as soon as I am able. I'll reply here with a new patch when I'm done.

Ihor Radchenko <yantar92@posteo.net> wrote:

> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> Thanks for the patch!
>>
>> In general, we do not intend to support changing basic elements of Org
>> syntax. So, things like your _p may remain buggy because they clash with
>> underscore emphasis.
>> ...
>> More comments below.
>> ...
>
> [I am following this up as more than one month passed since the last
> activity in the thread]
>
> Have you had a chance to look into my comments?
> If you have any objections or issues with addressing them, feel free to
> reply.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fwd: org-priority: allow customization of priority indicator
  2022-11-24 22:11       ` drlkf
@ 2022-11-25  2:12         ` Ihor Radchenko
  2023-04-04 12:59           ` Ihor Radchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Ihor Radchenko @ 2022-11-25  2:12 UTC (permalink / raw)
  To: drlkf; +Cc: emacs-orgmode

drlkf <drlkf@drlkf.net> writes:

> Apologies, I've been quite busy and I haven't had time to dive more into
> this, but I have it written down somewhere and I'll make modifications
> as soon as I am able. I'll reply here with a new patch when I'm done.

No problem. This email was not to push you. Rather just a reminder to
make sure that you did not forget about this thread.

Take your time.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Fwd: org-priority: allow customization of priority indicator
  2022-11-25  2:12         ` Ihor Radchenko
@ 2023-04-04 12:59           ` Ihor Radchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Ihor Radchenko @ 2023-04-04 12:59 UTC (permalink / raw)
  To: drlkf; +Cc: emacs-orgmode

Canceled.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-04 12:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17 20:46 org-priority: allow customization of priority indicator drlkf
2022-10-18  6:57 ` Bastien
2022-10-18  6:59 ` Stefan Kangas
2022-10-18  8:28 ` Fwd: " drlkf
2022-10-18 12:35   ` Ihor Radchenko
2022-11-21  3:24     ` Ihor Radchenko
2022-11-24 22:11       ` drlkf
2022-11-25  2:12         ` Ihor Radchenko
2023-04-04 12:59           ` Ihor Radchenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.