1

I would like to fontify headlines with the same color/weight as their TODO keywords. So for example, the default is like this:

TODO Headline

And I want it to look like this:

TODO Headline

Any ideas?

1

You can find out what face is applied to the text under point (the cursor) with the command M-x describe-face.

By doing this, I learned that the face applied to TODO keywords is called org-todo. The Face for top-level headings is org-level-1.

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 org-level-1 to org-todo.

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.

| improve this answer | |
0

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-extra-keywords using 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.