emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@gnu.org>
To: Sebastien Vauban
	<public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org>
Cc: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org
Subject: Re: color header based on priority/tags rather than level
Date: Tue, 14 Jan 2014 10:21:47 +0100	[thread overview]
Message-ID: <87a9eyhqac.fsf@bzg.ath.cx> (raw)
In-Reply-To: <86vbxn6k0f.fsf@somewhere.org> (Sebastien Vauban's message of "Tue, 14 Jan 2014 09:32:48 +0100")



"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
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	other threads:[~2014-01-14  9:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-14  2:53 color header based on priority/tags rather than level David Rees
2014-01-14  8:32 ` Sebastien Vauban
2014-01-14  9:21   ` Bastien [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9eyhqac.fsf@bzg.ath.cx \
    --to=bzg@gnu.org \
    --cc=public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org \
    --cc=public-sva-news-D0wtAvR13HarG/iDocfnWg@plane.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).