emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] On demand face for headers


From: PT
Subject: [Orgmode] On demand face for headers
Date: Fri, 18 Dec 2009 19:21:27 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

In this thread there was a solution for highlighting the whole
header line, so it stands out more from the buffer text:

http://thread.gmane.org/gmane.emacs.orgmode/15721/


This solution was a bit too heavy, because it affected all header
lines, and I didn't want all headers to be so conspicuous
everywhere, so I set a background color only for top-level
headers in my setup.

Here's an other solution which can be used to highlight headers
selectively if you want only particular headers to stand
out (bigger font, background color, etc.) without affecting other
headers on the same level.

To highlight a header with a custom color, simply put a space to
the end of the header line. (Headers with tags are not handled,
because I did not need it.)



(defface my-org-level-2
  '((t :background "darkseagreen1"))
  "")

(defface my-org-level-3
  '((t :background "moccasin"))
  "")


(setq my-org-level-emphasis-faces
      '((org-level-2 . my-org-level-2)
        (org-level-3 . my-org-level-3)
        ))


(defadvice org-get-level-face (after my-org-get-level-face activate)
  (if (and (eq (ad-get-arg 0) 3)
           (equal (aref (match-string 0)
                        (- (length (match-string 0)) 
                           (if org-fontify-whole-heading-line 2 1)))
                  ? ))
      (let ((new-face (assoc-default ad-return-value
                                     my-org-level-emphasis-faces)))
        (if new-face
            (setq ad-return-value new-face)))))







reply via email to

[Prev in Thread] Current Thread [Next in Thread]