1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-28 10:56:57 +00:00

New face `org-priority'. Enhance fontification of priority cookies in agenda.

* org-faces.el (org-priority): New face.

* org.el (org-font-lock-add-priority-faces): Use the new face.

* org-agenda.el (org-agenda-fontify-priorities): Use the
org-priority face and add specific agenda face on top of it.
This commit is contained in:
Bastien Guerry 2013-01-24 14:16:11 +01:00
parent af49713a95
commit b2abdfb95a
3 changed files with 21 additions and 13 deletions

View File

@ -3673,8 +3673,7 @@ generating a new one."
(delete-overlay o)))
(overlays-in (point-min) (point-max)))
(save-excursion
(let ((inhibit-read-only t)
b e p ov h l)
(let (b e p ov h l)
(goto-char (point-min))
(while (re-search-forward "\\[#\\(.\\)\\]" nil t)
(setq h (or (get-char-property (point) 'org-highest-priority)
@ -3689,15 +3688,16 @@ generating a new one."
ov (make-overlay b e))
(overlay-put
ov 'face
(cond ((org-face-from-face-or-color
'priority nil
(cdr (assoc p org-priority-faces))))
((and (listp org-agenda-fontify-priorities)
(org-face-from-face-or-color
'priority nil
(cdr (assoc p org-agenda-fontify-priorities)))))
((equal p l) 'italic)
((equal p h) 'bold)))
(cons (cond ((org-face-from-face-or-color
'priority nil
(cdr (assoc p org-priority-faces))))
((and (listp org-agenda-fontify-priorities)
(org-face-from-face-or-color
'priority nil
(cdr (assoc p org-agenda-fontify-priorities)))))
((equal p l) 'italic)
((equal p h) 'bold))
'org-priority))
(overlay-put ov 'org-type 'org-priority)))))
(defun org-agenda-dim-blocked-tasks (&optional invisible)

View File

@ -394,6 +394,14 @@ determines if it is a foreground or a background color."
(string :tag "Color")
(sexp :tag "Face")))))
(defface org-priority ;; originally copied from font-lock-string-face
(org-compatible-face 'font-lock-keyword-face
'((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
(((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
(t (:italic t))))
"Face used for priority cookies."
:group 'org-faces)
(defcustom org-priority-faces nil
"Faces for specific Priorities.
This is a list of cons cells, with priority character in the car

View File

@ -6128,10 +6128,10 @@ When FACE-OR-COLOR is not a string, just return it."
(add-text-properties
(match-beginning 0) (match-end 0)
(list 'face (or (org-face-from-face-or-color
'priority 'org-special-keyword
'priority 'org-priority
(cdr (assoc (char-after (match-beginning 1))
org-priority-faces)))
'org-special-keyword)
'org-priority)
'font-lock-fontified t)))))
(defun org-get-tag-face (kwd)