This adds a feature similar to the org-fontify-done-headline, but
instead for the TODO headlines.
This is enabled with the boolean customization org-fontify-todo-headline
and can be themed via the face org-headline-todo.
I was missing this when I wanted to distinguish more clearly between the
TODO headlines and the other headlines (more so than the highlighted
TODO keyword(s)).
Hope someone else finds this useful.
Best regards,
Terje Larsen
>From 57dd1fca737794f4c20d439d1fbf288511b1e44f Mon Sep 17 00:00:00 2001
From: Terje Larsen
Date: Sun, 1 Dec 2019 20:20:55 +0100
Subject: [PATCH] org: Add customization to fontify TODO headlines
* lisp/org (org-fontify-todo-headline): Add new boolean customization to
toggle this behavior.
* lisp/org (org-set-font-lock-defaults): Apply face org-headline-todo to
lines starting with keywords in org-not-done-keywords.
* lisp/org-faces (org-headline-todo): Add new face to customize look of
todo headlines.
---
etc/ORG-NEWS | 5 +
lisp/org-faces.el | 9 +
lisp/org.el | 18 ++
3 files changed, 32 insertions(+)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 689a07871..872cebf76 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -20,6 +20,11 @@ work also for this level. In other words; defining things in a
property drawer before the first headline will make them "inheritable"
for all headlines.
+*** Fontify whole TODO headlines
+This feature is the same as =org-fontify-done-headline=, but for TODO
+headlines instead. This allows you to distinguish TODO headlines from
+normal headlines. The face can be customized via =org-headline-todo=.
+
* Version 9.3
** Incompatible changes
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index a97d4dc4a..416f49b52 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -243,6 +243,15 @@ is of course immediately visible, but for example a passed deadline is
of the frame, for example."
:group 'org-faces)
+(defface org-headline-todo ;Copied from `font-lock-string-face'
+ 'class color) (min-colors 16) (background light)) (:foreground "Red4"))
+(((class color) (min-colors 16) (background dark)) (:foreground "Pink2"))
+(((class color) (min-colors 8) (background light)) (:bold t)))
+ "Face used to indicate that a headline is marked as TODO.
+This face is only used if `org-fontify-todo-headline' is set. If applies
+to the part of the headline after the TODO keyword."
+ :group 'org-faces)
+
(defface org-headline-done ;Copied from `font-lock-string-face'
'class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
(((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
diff --git a/lisp/org.el b/lisp/org.el
index 20c263f74..53bc47641 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3686,6 +3686,15 @@ hide them with `org-toggle-custom-properties-visibility'."
:version "24.3"
:type '(repeat (string :tag "Property Name")))
+(defcustom org-fontify-todo-headline nil
+ "Non-nil means change the face of a headline if it is marked as TODO.
+Normally, only the TODO/DONE keyword indicates the state of a headline.
+When this is non-nil, the headline after the keyword is set to the
+`org-headline-todo' as an additional indication."
+ :group 'org-appearance
+ :package-version '(Org . "9.4")
+ :type 'boolean)
+
(defcustom org-fontify-done-headline nil
"Non-nil means change the face of a headline if it is marked DONE.
Normally, only the TODO/DONE keyword indicates the state of a headline.
@@ -5652,6 +5661,15 @@ needs to be inserted at a specific position in the font-lock sequence.")
(list (format org-heading-keyword-regexp-format
org-todo-regexp)
'(2 (org-get-todo-face 2) t))
+ ;; TODO
+ (if org-fontify-todo-headline
+ (list (format org-heading-keyword-regexp-format
+ (concat
+ "\\(?:"
+ (mapconcat 'regexp-quote org-not-done-keywords "\\|")
+ "\\)"))
+ '(2 'org-headline-todo t))
+ nil)
;; DONE
(if org-fontify-done-headline
(list (format org-heading-keyword-regexp-format
--
2.24.0