forked from mirrors/org-mode
Allow a user-define function for getting the base priority of a node
* lisp/org.el (org-get-priority-function): New option. (org-get-priority): Call `org-get-priority-function' if that has been set.
This commit is contained in:
parent
cae52eb288
commit
815374e952
22
lisp/org.el
22
lisp/org.el
|
@ -2473,6 +2473,16 @@ command used) one higher or lower that the default priority."
|
||||||
:group 'org-priorities
|
:group 'org-priorities
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom org-get-priority-function nil
|
||||||
|
"Function to extract the priority from a string.
|
||||||
|
The string is normally the headline. If this is nil Org computes the
|
||||||
|
priority from the priority cookie like [#A] in the headline. It returns
|
||||||
|
an integer, increasing by 1000 for each priority level.
|
||||||
|
The user can set a different function here, which should take a string
|
||||||
|
as an argument and return the numeric priority."
|
||||||
|
:group 'org-priorities
|
||||||
|
:type 'function)
|
||||||
|
|
||||||
(defgroup org-time nil
|
(defgroup org-time nil
|
||||||
"Options concerning time stamps and deadlines in Org-mode."
|
"Options concerning time stamps and deadlines in Org-mode."
|
||||||
:tag "Org Time"
|
:tag "Org Time"
|
||||||
|
@ -12214,11 +12224,13 @@ ACTION can be `set', `up', `down', or a character."
|
||||||
|
|
||||||
(defun org-get-priority (s)
|
(defun org-get-priority (s)
|
||||||
"Find priority cookie and return priority."
|
"Find priority cookie and return priority."
|
||||||
(save-match-data
|
(if (functionp org-get-priority-function)
|
||||||
(if (not (string-match org-priority-regexp s))
|
(funcall org-get-priority-function)
|
||||||
(* 1000 (- org-lowest-priority org-default-priority))
|
(save-match-data
|
||||||
(* 1000 (- org-lowest-priority
|
(if (not (string-match org-priority-regexp s))
|
||||||
(string-to-char (match-string 2 s)))))))
|
(* 1000 (- org-lowest-priority org-default-priority))
|
||||||
|
(* 1000 (- org-lowest-priority
|
||||||
|
(string-to-char (match-string 2 s))))))))
|
||||||
|
|
||||||
;;;; Tags
|
;;;; Tags
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue