unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alexander Pohoyda <alexander.pohoyda@gmx.net>
Subject: Simple fontification patch for TODO mode
Date: Thu, 13 May 2004 22:58:33 +0200 (CEST)	[thread overview]
Message-ID: <200405132058.i4DKwX2P000936@oak.pohoyda.family> (raw)

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 <alexander.pohoyda@gmx.net>
PGP Key fingerprint: 7F C9 CC 5A 75 CD 89 72  15 54 5F 62 20 23 C6 44

                 reply	other threads:[~2004-05-13 20:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200405132058.i4DKwX2P000936@oak.pohoyda.family \
    --to=alexander.pohoyda@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).