unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Simple fontification patch for TODO mode
@ 2004-05-13 20:58 Alexander Pohoyda
  0 siblings, 0 replies; only message in thread
From: Alexander Pohoyda @ 2004-05-13 20:58 UTC (permalink / 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-05-13 20:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-13 20:58 Simple fontification patch for TODO mode Alexander Pohoyda

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).