emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* On demand face for headers
@ 2009-12-18 19:21 PT
  0 siblings, 0 replies; only message in thread
From: PT @ 2009-12-18 19:21 UTC (permalink / raw)
  To: emacs-orgmode

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)))))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-18 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-18 19:21 On demand face for headers PT

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).