emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] changing face (color) on tags-todo agenda headlines


From: Carsten Dominik
Subject: Re: [Orgmode] changing face (color) on tags-todo agenda headlines
Date: Wed, 9 Dec 2009 11:08:48 +0100

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 via email to

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