emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: "Sullivan, Gregory (US SSA)" <gregory.sullivan@baesystems.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: changing face (color) on tags-todo agenda headlines
Date: Wed, 9 Dec 2009 11:08:48 +0100	[thread overview]
Message-ID: <4CEF4B35-4732-42D5-B6C9-9254590CAC00@gmail.com> (raw)
In-Reply-To: <814i1h$4jdn8r@dmzms99801.na.baesystems.com>

Hi Sullivan,

On Dec 8, 2009, at 5:46 PM, Sullivan, Gregory (US SSA) wrote:

> I'd like to process agenda headlines and apply face (color) to ones  
> with given tags.
>
> It seems like I should add a function to org-finalize-agenda-hook.   
> When that hook is invoked, how do I iterate over agenda headlines?
>
> I thought I could use org-map-entries, on the current buffer, as  
> follows:
>
> (add-hook 'org-finalize-agenda-hook
> 	  (lambda ()
> 	     (message "starting agenda-hook")
> 	     (org-map-entries
> 	      '(message "hi")
> 	      "+highlight" nil)))
>
> But I never get "hi" despite there being agenda items with the  
> "highlight" tag.

mapping entries only works in org-mode buffers, not in the agenda.

You need to do a regexp search, like this (untested):


(add-hook 'org-finalize-agenda-hook
	  (lambda ()
	     (goto-char (point-min))
	     (while (re-search-forward ":MYSPECIALTAG:" nil t)
                 (add-text-properties (point-at-bol) (point-at-eol)
                       '(face my-special-face)))))

or you can use forward-line to iterate over lines and then look at the  
text properties
to find the tags you are looking for.

Also, I'd recommend to put a named function into the hook - makes it
easier to change it during testing without putting a large
number of bad lambdas into that hook.

Hope this helps

- Carsten

      reply	other threads:[~2009-12-09 10:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-08 16:46 changing face (color) on tags-todo agenda headlines Sullivan, Gregory (US SSA)
2009-12-09 10:08 ` Carsten Dominik [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=4CEF4B35-4732-42D5-B6C9-9254590CAC00@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=gregory.sullivan@baesystems.com \
    /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).