summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-11-17 09:12:47 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-11-17 09:12:47 +0100
commit815374e95290e88a5bc1283c0743aa4be3ff96d5 (patch)
treef88b98f072764949ad5c275f191b62f43df2e8a3
parentcae52eb288b9ea43bdcedb9c4082a482c41ab6f2 (diff)
downloadorg-mode-815374e95290e88a5bc1283c0743aa4be3ff96d5.tar.gz
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.
-rw-r--r--lisp/org.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el
index e2de48e..e45dab0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2473,6 +2473,16 @@ command used) one higher or lower that the default priority."
:group 'org-priorities
: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
"Options concerning time stamps and deadlines in Org-mode."
:tag "Org Time"
@@ -12214,11 +12224,13 @@ ACTION can be `set', `up', `down', or a character."
(defun org-get-priority (s)
"Find priority cookie and return priority."
- (save-match-data
- (if (not (string-match org-priority-regexp s))
- (* 1000 (- org-lowest-priority org-default-priority))
- (* 1000 (- org-lowest-priority
- (string-to-char (match-string 2 s)))))))
+ (if (functionp org-get-priority-function)
+ (funcall org-get-priority-function)
+ (save-match-data
+ (if (not (string-match org-priority-regexp s))
+ (* 1000 (- org-lowest-priority org-default-priority))
+ (* 1000 (- org-lowest-priority
+ (string-to-char (match-string 2 s))))))))
;;;; Tags