From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Easier customization of TODO keyword colors Date: Fri, 04 Sep 2009 16:23:27 +0800 Message-ID: <87skf36ruo.fsf@bzg.ath.cx> References: <4AA0A386.6030901@thompsonclan.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjZhY-0004T8-Pk for emacs-orgmode@gnu.org; Fri, 04 Sep 2009 10:23:44 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjZhT-0004SE-8j for emacs-orgmode@gnu.org; Fri, 04 Sep 2009 10:23:43 -0400 Received: from [199.232.76.173] (port=47146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjZhT-0004SB-1T for emacs-orgmode@gnu.org; Fri, 04 Sep 2009 10:23:39 -0400 Received: from mail-bw0-f220.google.com ([209.85.218.220]:57292) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjZhS-0001qD-7I for emacs-orgmode@gnu.org; Fri, 04 Sep 2009 10:23:38 -0400 Received: by bwz20 with SMTP id 20so760013bwz.42 for ; Fri, 04 Sep 2009 07:23:37 -0700 (PDT) In-Reply-To: <4AA0A386.6030901@thompsonclan.org> (Ryan C. Thompson's message of "Thu, 03 Sep 2009 22:20:06 -0700") 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 "Ryan C. Thompson" writes: > 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. Interesting - would you like to add this in org-hacks? http://orgmode.org/worg/org-hacks.php If so, please send me your username on repo.or.cz (if you are not already a Worger...) Thank! > 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 > -- Bastien