From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: changing face (color) on tags-todo agenda headlines Date: Wed, 9 Dec 2009 11:08:48 +0100 Message-ID: <4CEF4B35-4732-42D5-B6C9-9254590CAC00@gmail.com> References: <814i1h$4jdn8r@dmzms99801.na.baesystems.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIK1g-0001wv-PP for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:44:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIK1b-0001t6-SS for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:44:08 -0500 Received: from [199.232.76.173] (port=39611 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIK1b-0001sm-DT for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:44:03 -0500 Received: from mail-ew0-f209.google.com ([209.85.219.209]:46646) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIK1a-0000df-Ri for emacs-orgmode@gnu.org; Wed, 09 Dec 2009 05:44:03 -0500 Received: by mail-ew0-f209.google.com with SMTP id 1so3857079ewy.8 for ; Wed, 09 Dec 2009 02:44:00 -0800 (PST) In-Reply-To: <814i1h$4jdn8r@dmzms99801.na.baesystems.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Sullivan, Gregory (US SSA)" Cc: "emacs-orgmode@gnu.org" 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