emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* changing face (color) on tags-todo agenda headlines
@ 2009-12-08 16:46 Sullivan, Gregory (US SSA)
  2009-12-09 10:08 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Sullivan, Gregory (US SSA) @ 2009-12-08 16:46 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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.

Any help would be much appreciated.
Thanks!

--Greg

--
Gregory T. Sullivan, Ph.D.
BAE Systems Advanced Information Technologies
6 New England Executive Park, Burlington, MA 01803
781-262-4553 (office),  978-430-3461 (cell)
gregory.sullivan@baesystems.com 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: changing face (color) on tags-todo agenda headlines
  2009-12-08 16:46 changing face (color) on tags-todo agenda headlines Sullivan, Gregory (US SSA)
@ 2009-12-09 10:08 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2009-12-09 10:08 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-09 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 16:46 changing face (color) on tags-todo agenda headlines Sullivan, Gregory (US SSA)
2009-12-09 10:08 ` Carsten Dominik

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).