diff options
author | Bastien <bzg@gnu.org> | 2020-01-30 12:05:07 +0100 |
---|---|---|
committer | Bastien <bzg@gnu.org> | 2020-01-30 12:05:07 +0100 |
commit | 7b1077def786910729d4baa1c42de983c8a90ed6 (patch) | |
tree | 671634d1446c9972569429fa4a7f668797be4665 | |
parent | 759c1567b16bd97d7a0183c96376f45c676bb2a6 (diff) | |
download | org-mode-7b1077def786910729d4baa1c42de983c8a90ed6.tar.gz |
Tiny enhancements to priority handling
* lisp/org.el (org-font-lock-add-priority-faces): Use
`org-priority-regexp'.
(org-priority-regexp): Match multiple characters.
* lisp/org-agenda.el (org-agenda-fontify-priorities): Use
`org-priority-regexp'.
This commit paves the way for more flexibility in priority handling.
For example, `org-priority-[up/down]' could deal with priorities as
numbers (e.g. [#1]) instead of letters.
-rw-r--r-- | lisp/org-agenda.el | 8 | ||||
-rw-r--r-- | lisp/org.el | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index a27cfba..079a77a 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3958,15 +3958,15 @@ FILTER-ALIST is an alist of filters we need to apply when (save-excursion (let (b e p ov h l) (goto-char (point-min)) - (while (re-search-forward "\\[#\\(.\\)\\]" nil t) + (while (re-search-forward org-priority-regexp nil t) (setq h (or (get-char-property (point) 'org-highest-priority) org-highest-priority) l (or (get-char-property (point) 'org-lowest-priority) org-lowest-priority) - p (string-to-char (match-string 1)) - b (match-beginning 0) + p (string-to-char (match-string 2)) + b (match-beginning 1) e (if (eq org-agenda-fontify-priorities 'cookies) - (match-end 0) + (match-end 1) (point-at-eol)) ov (make-overlay b e)) (overlay-put diff --git a/lisp/org.el b/lisp/org.el index 61a96f3..87c7a29 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5886,9 +5886,11 @@ If TAG is a number, get the corresponding match group." 'tag 'org-tag (cdr (assoc tag org-tag-faces))) 'org-tag))) +(defvar org-priority-regexp) ; defined later in the file + (defun org-font-lock-add-priority-faces (limit) "Add the special priority faces." - (while (re-search-forward "^\\*+ .*?\\(\\[#\\(.\\)\\]\\)" limit t) + (while (re-search-forward org-priority-regexp limit t) (add-text-properties (match-beginning 1) (match-end 1) (list 'face (org-get-priority-face (string-to-char (match-string 2))) @@ -7966,8 +7968,6 @@ Optional argument WITH-CASE means sort case-sensitively." (org-link-display-format s) t t) t t)) -(defvar org-priority-regexp) ; defined later in the file - (defvar org-after-sorting-entries-or-items-hook nil "Hook that is run after a bunch of entries or items have been sorted. When children are sorted, the cursor is in the parent line when this @@ -11625,7 +11625,7 @@ from the `before-change-functions' in the current buffer." ;;;; Priorities -(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]\\)\\] ?\\)" +(defvar org-priority-regexp ".*?\\(\\[#\\([A-Z0-9]+\\)\\] ?\\)" "Regular expression matching the priority indicator.") (defvar org-remove-priority-next-time nil) |