diff lisp/energize/energize-font-lock.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children 0293115a14e9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/energize/energize-font-lock.el	Mon Aug 13 08:45:50 2007 +0200
@@ -0,0 +1,76 @@
+;; interactive turn on and off of the font-lock-mode
+;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+;; This file is preloaded, but font-lock.el is not.
+;; Make the font-lock faces exist at startup time, so that people can
+;; mess with them in their .emacs file.
+;;
+;; They will be initialized either: from the resource db when the first
+;; frame is created; or by font-lock.el when it is first loaded.
+
+(make-face 'font-lock-comment-face)
+(make-face 'font-lock-doc-string-face)
+(make-face 'font-lock-string-face)
+(make-face 'font-lock-function-name-face)
+(make-face 'font-lock-keyword-face)
+(make-face 'font-lock-type-face)
+
+
+;; Fontify Energize Error Log
+(defconst energize-log-font-lock-keywords 
+  (purecopy
+   '(("^ *Note:.*$"			. font-lock-string-face)
+     ("^ *Warning:.*$"			. font-lock-keyword-face)
+     ("^ *Error:.*$"			. font-lock-function-name-face)
+     ("^/.* file system is full\r?$"	. font-lock-function-name-face)
+     ))
+  "Expressions to highlight in the Energize Error Log.")
+(add-hook 'energize-log-mode-hook 'turn-on-font-lock)
+
+;; font-lock is a kludge.  Why does it have to be such a pain to configure?
+(defun energize-configure-font-lock-mode (on-p font-p less-p)
+  (setq font-p (or font-p (not (x-color-display-p))))
+  (cond (on-p
+	 (add-hook 'c++-mode-hook 'turn-on-font-lock)
+	 (add-hook 'c-mode-hook 'turn-on-font-lock)
+	 (add-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
+	 (add-hook 'lisp-mode-hook 'turn-on-font-lock))
+	(t
+	 (remove-hook 'c++-mode-hook 'turn-on-font-lock)
+	 (remove-hook 'c-mode-hook 'turn-on-font-lock)
+	 (remove-hook 'emacs-lisp-mode-hook 'turn-on-font-lock)
+	 (remove-hook 'lisp-mode-hook 'turn-on-font-lock)))
+  (cond (font-p
+	 (remove-hook 'font-lock-mode-hook 'font-lock-use-default-colors)
+	 (add-hook 'font-lock-mode-hook 'font-lock-use-default-fonts))
+	(t
+	 (remove-hook 'font-lock-mode-hook 'font-lock-use-default-fonts)
+	 (add-hook 'font-lock-mode-hook 'font-lock-use-default-colors)))
+  (cond (less-p
+	 (remove-hook 'font-lock-mode-hook
+		      'font-lock-use-default-maximal-decoration)
+	 (add-hook 'font-lock-mode-hook
+		   'font-lock-use-default-minimal-decoration))
+	(t
+	 (remove-hook 'font-lock-mode-hook
+		      'font-lock-use-default-minimal-decoration)
+	 (add-hook 'font-lock-mode-hook
+		   'font-lock-use-default-maximal-decoration))))
+