From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alexander Pohoyda Newsgroups: gmane.emacs.bugs Subject: Simple fontification patch for TODO mode Date: Thu, 13 May 2004 22:58:33 +0200 (CEST) Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200405132058.i4DKwX2P000936@oak.pohoyda.family> NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1084482358 8962 80.91.224.253 (13 May 2004 21:05:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 May 2004 21:05:58 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu May 13 23:05:47 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BONOk-0008Mu-00 for ; Thu, 13 May 2004 23:05:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BONNI-0004fE-PR for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 May 2004 17:04:16 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.34) id 1BONJd-0003Pg-7v for bug-gnu-emacs@gnu.org; Thu, 13 May 2004 17:00:29 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1BONIz-0003G3-D2 for bug-gnu-emacs@gnu.org; Thu, 13 May 2004 17:00:24 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1BONHp-0002hw-A1 for bug-gnu-emacs@gnu.org; Thu, 13 May 2004 16:58:37 -0400 Original-Received: (qmail 15967 invoked by uid 65534); 13 May 2004 20:58:33 -0000 Original-Received: from p50843456.dip0.t-ipconnect.de (EHLO www2.gmx.net) (80.132.52.86) by mail.gmx.net (mp006) with SMTP; 13 May 2004 22:58:33 +0200 X-Authenticated: #14602519 Original-Received: from oak.pohoyda.family (localhost [127.0.0.1]) by www2.gmx.net (8.12.10/8.12.10) with ESMTP id i4DKwXYU000939 for ; Thu, 13 May 2004 22:58:33 +0200 (CEST) (envelope-from apog@oak.pohoyda.family) Original-Received: (from apog@localhost) by oak.pohoyda.family (8.12.10/8.12.10/Submit) id i4DKwX2P000936; Thu, 13 May 2004 22:58:33 +0200 (CEST) (envelope-from apog) Original-To: bug-gnu-emacs@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:7924 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:7924 Hi there, Please consider the following patch. Thank you. Index: todo-mode.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/calendar/todo-mode.el,v retrieving revision 1.52 diff -u -r1.52 todo-mode.el --- todo-mode.el 10 Apr 2004 05:55:47 -0000 1.52 +++ todo-mode.el 13 May 2004 20:43:26 -0000 @@ -373,6 +373,13 @@ (let ((time-stamp-format todo-time-string-format)) (concat (time-stamp-string) " " todo-initials ": "))) +(defface todo-date-face + '((t (:inherit font-lock-string-face))) + "Face used to highlight dates in item lines." + :group 'todo) +(defvar todo-date-face 'todo-date-face + "Face used to highlight dates in item lines.") + ;; --------------------------------------------------------------------------- ;; Set up some helpful context ... @@ -431,6 +438,15 @@ (defvar todo-header "-*- mode: todo; " "Header of todo files.") +(defvar todo-font-lock-keywords + (list (list (concat "^\\(" (regexp-quote todo-prefix) "\\) " + "\\(.*\\) " todo-initials ": " + "\\(---.*\\)?") + '(1 font-lock-constant-face t) + '(2 todo-date-face t) + '(3 font-lock-warning-face t t))) + "Additional expressions to highlight items in ToDo mode.") + ;; --------------------------------------------------------------------------- (defun todo-category-select () @@ -908,6 +924,11 @@ (setq mode-name "TODO") (use-local-map todo-mode-map) (easy-menu-add todo-menu) + + (make-local-variable 'font-lock-defaults) + (setq font-lock-defaults '(todo-font-lock-keywords t)) + (font-lock-mode t) + (run-hooks 'todo-mode-hook)) (eval-when-compile -- Alexander Pohoyda PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72 15 54 5F 62 20 23 C6 44