Browse Source

Restrict priorities fontification to headlines and inlinetasks

* lisp/org.el (org-font-lock-add-priority-faces): Restrict priorities
  fontification to headlines and inlinetasks.
Nicolas Goaziou 5 years ago
parent
commit
8b46521211
1 changed files with 9 additions and 8 deletions
  1. 9 8
      lisp/org.el

+ 9 - 8
lisp/org.el

@@ -5990,14 +5990,15 @@ When FACE-OR-COLOR is not a string, just return it."
 (defun org-font-lock-add-priority-faces (limit)
   "Add the special priority faces."
   (while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t)
-    (add-text-properties
-     (match-beginning 0) (match-end 0)
-     (list 'face (or (org-face-from-face-or-color
-		      'priority 'org-special-keyword
-		      (cdr (assoc (char-after (match-beginning 1))
-				  org-priority-faces)))
-		     'org-special-keyword)
-	   'font-lock-fontified t))))
+    (when (save-match-data (org-at-heading-p))
+      (add-text-properties
+       (match-beginning 0) (match-end 0)
+       (list 'face (or (org-face-from-face-or-color
+			'priority 'org-special-keyword
+			(cdr (assoc (char-after (match-beginning 1))
+				    org-priority-faces)))
+		       'org-special-keyword)
+	     'font-lock-fontified t)))))
 
 (defun org-get-tag-face (kwd)
   "Get the right face for a TODO keyword KWD.