From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Easier customization of TODO keyword colors Date: Thu, 25 Feb 2010 17:48:53 +0100 Message-ID: <699315B7-F6F2-42D6-9A73-859303D7CA03@gmail.com> References: <4AA0A386.6030901@thompsonclan.org> 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 1Nkgtb-0005kn-2o for emacs-orgmode@gnu.org; Thu, 25 Feb 2010 11:49:03 -0500 Received: from [140.186.70.92] (port=49245 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nkgta-0005j5-32 for emacs-orgmode@gnu.org; Thu, 25 Feb 2010 11:49:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NkgtZ-00076w-6w for emacs-orgmode@gnu.org; Thu, 25 Feb 2010 11:49:02 -0500 Received: from mail-ew0-f222.google.com ([209.85.219.222]:43344) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NkgtY-00076o-Rc for emacs-orgmode@gnu.org; Thu, 25 Feb 2010 11:49:01 -0500 Received: by ewy22 with SMTP id 22so1676353ewy.26 for ; Thu, 25 Feb 2010 08:48:58 -0800 (PST) In-Reply-To: <4AA0A386.6030901@thompsonclan.org> 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: "Ryan C. Thompson" Cc: org-mode Mailinglist Hi Ryan, hu everyone, this code (an extended version of it) has now been integrated into Org. It allows you to set fonts for TODO keywords, tags, and priorities in this way. And you can use the variable `org-faces-easy-properties' to make these colors specify the background rather tan the foreground color - something I like for my TODO keywords. Thanks Ryan! Next stop will be using your level indentation cycling function. Just make sure the FSF papers get through.... :-) - Carsten On Sep 4, 2009, at 7:20 AM, Ryan C. Thompson wrote: > Here is some code I came up with some code to make it easier to > customize the colors of various TODO keywords. As long as you just > want a different color and nothing else, you can customize the > variable org-todo-keyword-faces and use just a string color (i.e. a > string of the color name) as the face, and then org-get-todo-face > will convert the color to a face, inheriting everything else from > the standard org-todo face. > > To demonstrate, I currently have org-todo-keyword-faces set to > (("IN PROGRESS" . "dark orange") > ("WAITING" . "red4") > ("CANCELED" . "saddle brown")) > > Here's the code, in a form you can put in your .emacs. > > (eval-after-load 'org-faces > '(progn > (defcustom org-todo-keyword-faces nil > "Faces for specific TODO keywords. > This is a list of cons cells, with TODO keywords in the car and > faces in the cdr. The face can be a symbol, a color, or a > property list of attributes, like (:foreground \"blue\" :weight > bold :underline t)." > :group 'org-faces > :group 'org-todo > :type '(repeat > (cons > (string :tag "Keyword") > (choice color (sexp :tag "Face"))))))) > > (eval-after-load 'org > '(progn > (defun org-get-todo-face-from-color (color) > "Returns a specification for a face that inherits from org-todo > face and has the given color as foreground. Returns nil if > color is nil." > (when color > `(:inherit org-warning :foreground ,color))) > > (defun org-get-todo-face (kwd) > "Get the right face for a TODO keyword KWD. > If KWD is a number, get the corresponding match group." > (if (numberp kwd) (setq kwd (match-string kwd))) > (or (let ((face (cdr (assoc kwd org-todo-keyword-faces)))) > (if (stringp face) > (org-get-todo-face-from-color face) > face)) > (and (member kwd org-done-keywords) 'org-done) > 'org-todo)))) > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten