I would like to fontify headlines with the same color/weight as their TODO keywords. So for example, the default is like this:
And I want it to look like this:
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
You can find out what face is applied to the text under point (the cursor) with the command
By doing this, I learned that the face applied to
TODO keywords is called
org-todo. The Face for top-level headings is
You can customize faces using via
M-x customize-face. You can set attributes individually, or you can apply the attributes from one face directly to another using the Inherit attribute. In your case, set the Inherit attribute for
When you're done,
C-c C-c in the customize buffer will set your changes temporarily, and
C-c C-s will save them permanently.
For DONE-keywords, there is a variable
org-fontify-done-headline that activates fontification of the whole headline. To do this also for "not-done" keywords, we have to add a similar extra font-lock rule for org. The easiest way to do this is by modifying
org-font-lock-set-keywords-hook (this then runs when initializing each buffer, as TODO-keywords etc. can vary).
The following works for the case of fontifying "not-done" headlines:
(defface aj/org-headline-todo '((t :inherit org-todo :weight normal)) "Face for TODO headlines" :group 'org-faces) (defun aj/org-fontify-todo-headline () "Fontify whole TODO headlines in org-mode" ;; fontify whole line for some of them (push (list (format org-heading-keyword-regexp-format (concat "\\(?:" (mapconcat 'regexp-quote org-not-done-keywords "\\|") "\\)")) '(2 'aj/org-headline-todo t)) org-font-lock-extra-keywords)) (add-hook 'org-font-lock-set-keywords-hook #'aj/org-fontify-todo-headline)
The custom face that inherits from
org-todo can of course be customized to suit your needs.