I am trying to override the default syntax highlighting in org-mode
and org-agenda-mode
buffers.
To clarify my intention: my current reason for doing this is to highlight headings (or parts of headings) based on their tags. The built-in variable org-tag-faces
only allows customisation of the tag itself, not the heading containing the tag.
With reference to the following related questions:
Emacs font lock mode: provide a custom color instead of a face
https://emacs.stackexchange.com/questions/8211/color-code-a-new-generic-character-combination
In thread 2 the accepted answer is to use font-lock for this purpose.
In thread 3 I am trying to achieve the exact opposite of the poster. The last comment by Jordon Biondo says:
take out the t from your keywords, what that t specifies is that font-lock should override already colored things.
Since I want to override already coloured things I am adding in the t but as far as I can tell the org-mode
highlighting is still overriding my custom face.
In org-mode
buffers this manifests as the main body of the heading text being changed but any other items such as todo-states, dates, tags etc. retaining there existing faces.
In org-agenda-mode
buffers it completely fails to modify any aspect of the matched lines.
By way of a simple example here is some code I'm trying to use to set any lines containing :TT: to red in org-mode
buffers:
(add-hook 'org-mode-hook
(lambda ()
(font-lock-add-keywords
'org-mode
'(
("^.*:TT:.*$" 0 '(:foreground "#FF0000") t)
))))