From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Scott Jaderholm" Subject: Re: adding more color to agenda events Date: Thu, 1 Mar 2007 10:43:01 -0700 Message-ID: References: <286a22d00313775b9b71f6b0e93d4f0b@science.uva.nl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0326248269==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HMpJ5-0007pH-7b for emacs-orgmode@gnu.org; Thu, 01 Mar 2007 12:43:07 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HMpJ2-0007oq-Ot for emacs-orgmode@gnu.org; Thu, 01 Mar 2007 12:43:05 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HMpJ2-0007on-Lq for emacs-orgmode@gnu.org; Thu, 01 Mar 2007 12:43:04 -0500 Received: from nf-out-0910.google.com ([64.233.182.191]) by monty-python.gnu.org with esmtp (Exim 4.52) id 1HMpJ2-00045o-2l for emacs-orgmode@gnu.org; Thu, 01 Mar 2007 12:43:04 -0500 Received: by nf-out-0910.google.com with SMTP id n15so944272nfc for ; Thu, 01 Mar 2007 09:43:03 -0800 (PST) In-Reply-To: <286a22d00313775b9b71f6b0e93d4f0b@science.uva.nl> 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: Carsten Dominik Cc: emacs-orgmode@gnu.org --===============0326248269== Content-Type: multipart/alternative; boundary="----=_Part_31799_15731845.1172770981804" ------=_Part_31799_15731845.1172770981804 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/28/07, Carsten Dominik wrote: > > > On Feb 27, 2007, at 22:30, Scott Jaderholm wrote: > > > Hi, > > > > Is there an easy way to add new faces to org-agenda? > > > > I would like to add a face for events including the text "meeting" or > > "birthday" and other phrases. I'd also like to create a special face > > for event subjects, such as Diary, life, or work (the first column in > > agenda). It'd also be nice to be able to do faces based on tags. > > > > Is this possible without a lot of hacking? > > There is special way of doing this. In particular, the agenda does > *not* use font-lock, it sets its own faces. > > However, there is a hook you can use, and the code to write for it > is relatuvely simple. For example: > > (add-hook 'org-finalize-agenda-hook > (lambda () > (save-excursion > (goto-char (point-min)) > (while (re-search-forward "\\ " nil t) > (add-text-properties (match-beginning 0) (match-end 0) > '(face secondary-selection))) > (goto-char (point-min)) > (while (re-search-forward "\\ " nil t) > (add-text-properties (match-beginning 0) (match-end 0) > '(face bold)))))) > Thanks Carsten! Do you know how to select the whole line instead of just the word? Also, do you know where I can find more information about the syntax to use in setting colors in the '(face ) area? Is there an easy way to not interfere with the other highlighting that's going to happen? I'd like to highlight stuff in work.org with a different color, say orange, but I think I'd like TODO to stay red and Scheduled to stay green but change rest of headline color and the work: column. If there's a way to do this easily I'd also like to use it when defining special highlights for tags. Thanks again, Scott ------=_Part_31799_15731845.1172770981804 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
On 2/28/07, Carsten Dominik <dominik@science.uva.nl > wrote:

On Feb 27, 2007, at 22:30, Scott Jaderholm wrote:

> Hi,
>
> Is there an easy way to add new faces to org-agenda?
>
> I would like to add a face for events including the text "meeting" or
> "birthday" and other phrases. I'd also like to create a special face
> for event subjects, such as Diary, life, or work (the first column in
> agenda). It'd also be nice to be able to do faces based on tags.
>
> Is this possible without a lot of hacking?

There is special way of doing this.  In particular, the agenda does
*not* use font-lock, it sets its own faces.

However, there is a hook you can use, and the code to write for it
is relatuvely simple.  For example:

(add-hook 'org-finalize-agenda-hook
    (lambda ()
      (save-excursion
        (goto-char (point-min))
        (while (re-search-forward "\\<birthday\\>  " nil t)
          (add-text-properties (match-beginning 0) (match-end 0)
             '(face secondary-selection)))
        (goto-char (point-min))
        (while (re-search-forward "\\<meeting\\>  " nil t)
          (add-text-properties (match-beginning 0) (match-end 0)
             '(face bold))))))

Thanks Carsten!

Do you know how to select the whole line instead of just the word?

Also, do you know where I can find more information about the syntax to use in setting colors in the '(face ) area?

Is there an easy way to not interfere with the other highlighting that's going to happen? I'd like to highlight stuff in work.org with a different color, say orange, but I think I'd like TODO to stay red and Scheduled to stay green but change rest of headline color and the work: column. If there's a way to do this easily I'd also like to use it when defining special highlights for tags.

Thanks again,
Scott
 
------=_Part_31799_15731845.1172770981804-- --===============0326248269== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============0326248269==--