emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] color header based on priority/tags rather than level


From: Bastien
Subject: Re: [O] color header based on priority/tags rather than level
Date: Tue, 14 Jan 2014 10:21:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)


"Sebastien Vauban" <sva-news-D0wtAvR13HarG/address@hidden>
writes:

> Once again, not what you're looking for, but John Wiegley once shared
> his code to highlight agenda lines depending of a tag (home, work,
> etc.).

(font-lock-add-keywords 'org-mode
  '(("^.*:write:.*$" . font-lock-keyword-face)))

will use `font-lock-keyword-face' for headings tagged with ":write:"
in org-mode.

The following snippet can be used for boldifying ":write:"-tagged
lines in the agenda:

(setq org-agenda-face-for-tagged-lines
   '(("write" . bold)))

(defun org-agenda-fontify-tagged-line ()
  "Use `org-agenda-face-for-tagged-lines' to fontify lines with certain tags."
  (goto-char (point-min))
  (let (tags)
    (while (progn (forward-line 1) (not (eobp)))
      (if (setq tags (get-text-property (point) 'tags))
          (mapcar
           (lambda (pair)
             (if (member (car pair) tags)
                 (add-text-properties (point-at-bol) (point-at-eol) `(face 
,(cdr pair)))))
           org-agenda-face-for-tagged-lines)))))

(add-hook 'org-agenda-finalize-hook 'org-agenda-fontify-tagged-line)

HTH,

-- 
 Bastien




reply via email to

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