changeset 19846:f5f2feb0bd0f

Try to comment where font-lock-keyword order is important.
author Simon Marshall <simon@gnu.org>
date Tue, 09 Sep 1997 13:01:02 +0000
parents f03431d49548
children f4f4b72d1239
files lisp/font-lock.el
diffstat 1 files changed, 46 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/font-lock.el	Tue Sep 09 09:16:54 1997 +0000
+++ b/lisp/font-lock.el	Tue Sep 09 13:01:02 1997 +0000
@@ -597,39 +597,6 @@
 (defvar font-lock-mode-hook nil
   "Function or functions to run on entry to Font Lock mode.")
 
-;; Originally these variable values were face names such as `bold' etc.
-;; Now we create our own faces, but we keep these variables for compatibility
-;; and they give users another mechanism for changing face appearance.
-;; We now allow a FACENAME in `font-lock-keywords' to be any expression that
-;; returns a face.  So the easiest thing is to continue using these variables,
-;; rather than sometimes evaling FACENAME and sometimes not.  sm.
-(defvar font-lock-comment-face		'font-lock-comment-face
-  "Face name to use for comments.")
-
-(defvar font-lock-string-face		'font-lock-string-face
-  "Face name to use for strings.")
-
-(defvar font-lock-keyword-face		'font-lock-keyword-face
-  "Face name to use for keywords.")
-
-(defvar font-lock-builtin-face		'font-lock-builtin-face
-  "Face name to use for builtins.")
-
-(defvar font-lock-function-name-face	'font-lock-function-name-face
-  "Face name to use for function names.")
-
-(defvar font-lock-variable-name-face	'font-lock-variable-name-face
-  "Face name to use for variable names.")
-
-(defvar font-lock-type-face		'font-lock-type-face
-  "Face name to use for type names.")
-
-(defvar font-lock-reference-face	'font-lock-reference-face
-  "Face name to use for reference names.")
-
-(defvar font-lock-warning-face		'font-lock-warning-face
-  "Face name to use for things that should stand out.")
-
 ;; Font Lock mode.
 
 (eval-when-compile
@@ -649,7 +616,13 @@
 	 (,@ body)
 	 (when (and (not modified) (buffer-modified-p))
 	   (set-buffer-modified-p nil)))))
-  (put 'save-buffer-state 'lisp-indent-function 1))
+  (put 'save-buffer-state 'lisp-indent-function 1)
+  ;;
+  ;; Shut up the byte compiler.
+  (defvar global-font-lock-mode)	; Now a defcustom.
+  (defvar font-lock-face-attributes)	; Obsolete but respected if set.
+  (defvar font-lock-string-face)	; Used in syntactic fontification.
+  (defvar font-lock-comment-face))
 
 ;;;###autoload
 (defun font-lock-mode (&optional arg)
@@ -836,8 +809,6 @@
 
 (defvar font-lock-buffers nil)		; For remembering buffers.
 
-(defvar global-font-lock-mode)		;Prevent warnings in defun below.
-
 ;;;###autoload
 (defun global-font-lock-mode (&optional arg message)
   "Toggle Global Font Lock mode.
@@ -863,7 +834,7 @@
 				   (font-lock-mode)))))
 		   (buffer-list))))
     (when message
-      (message "Global Font Lock mode %s" (if on-p "enabled" "disabled")))
+      (message "Global Font Lock mode %s." (if on-p "enabled" "disabled")))
     (setq global-font-lock-mode on-p)))
 
 ;; Naughty hack.  This variable was originally a `defvar' to keep track of
@@ -1616,7 +1587,38 @@
 
 ;;; Colour etc. support.
 
-(defvar font-lock-face-attributes)	;Avoid compiler warnings below.
+;; Originally these variable values were face names such as `bold' etc.
+;; Now we create our own faces, but we keep these variables for compatibility
+;; and they give users another mechanism for changing face appearance.
+;; We now allow a FACENAME in `font-lock-keywords' to be any expression that
+;; returns a face.  So the easiest thing is to continue using these variables,
+;; rather than sometimes evaling FACENAME and sometimes not.  sm.
+(defvar font-lock-comment-face		'font-lock-comment-face
+  "Face name to use for comments.")
+
+(defvar font-lock-string-face		'font-lock-string-face
+  "Face name to use for strings.")
+
+(defvar font-lock-keyword-face		'font-lock-keyword-face
+  "Face name to use for keywords.")
+
+(defvar font-lock-builtin-face		'font-lock-builtin-face
+  "Face name to use for builtins.")
+
+(defvar font-lock-function-name-face	'font-lock-function-name-face
+  "Face name to use for function names.")
+
+(defvar font-lock-variable-name-face	'font-lock-variable-name-face
+  "Face name to use for variable names.")
+
+(defvar font-lock-type-face		'font-lock-type-face
+  "Face name to use for type names.")
+
+(defvar font-lock-reference-face	'font-lock-reference-face
+  "Face name to use for reference names.")
+
+(defvar font-lock-warning-face		'font-lock-warning-face
+  "Face name to use for things that should stand out.")
 
 ;; Originally face attributes were specified via `font-lock-face-attributes'.
 ;; Users then changed the default face attributes by setting that variable.
@@ -1919,7 +1921,6 @@
 	     "(" (regexp-opt
 		  '("cond" "if" "while" "catch" "throw" "let" "let*"
 		    "prog" "progn" "progv" "prog1" "prog2" "prog*"
-		    "closure" "preparse-closure" "make-closure"
 		    "inline" "save-restriction" "save-excursion"
 		    "save-window-excursion" "save-selected-window"
 		    "save-match-data" "save-current-buffer" "unwind-protect"
@@ -2332,6 +2333,7 @@
       (1 font-lock-keyword-face) (2 font-lock-reference-face nil t))
     ;; Anders Lindgren <andersl@csd.uu.se> points out that it is quicker to use
     ;; MATCH-ANCHORED to effectively anchor the regexp on the left.
+    ;; This must come after the one for keywords and targets.
     '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:"
 	   (beginning-of-line) (end-of-line)
 	   (1 font-lock-reference-face)))
@@ -2432,8 +2434,7 @@
 	(eval-when-compile
 	  (regexp-opt
 	   '("break" "continue" "do" "else" "for" "if" "return" "switch"
-	     "while" "asm" "catch" "delete" "new" "operator" "sizeof" "this"
-	     "throw" "try"
+	     "while" "asm" "catch" "delete" "new" "sizeof" "this" "throw" "try"
 	     ;; Eric Hopper <hopper@omnifarious.mn.org> says these are new.
 	     "static_cast" "dynamic_cast" "const_cast" "reinterpret_cast") t)))
        (c++-operators
@@ -2513,6 +2514,7 @@
     ;; Fontify case/goto keywords and targets, and case default/goto tags.
     '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
       (1 font-lock-keyword-face) (2 font-lock-reference-face nil t))
+    ;; This must come after the one for keywords and targets.
     '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:\\($\\|[^:]\\)"
 	   (beginning-of-line) (end-of-line)
 	   (1 font-lock-reference-face)))
@@ -2662,12 +2664,13 @@
     '("\\<\\(case\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
       (1 font-lock-keyword-face) (2 font-lock-reference-face nil t))
     ;; Fontify tags iff sole statement on line, otherwise we detect selectors.
+    ;; This must come after the one for keywords and targets.
     '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:[ \t]*$"
 	   (beginning-of-line) (end-of-line)
 	   (1 font-lock-reference-face)))
     ;;
     ;; Fontify null object pointers.
-    '("\\<\\(Nil\\|nil\\)\\>" 1 font-lock-reference-face)
+    '("\\<[Nn]il\\>" . font-lock-reference-face)
     )))
 
  (setq objc-font-lock-keywords-3
@@ -2788,6 +2791,7 @@
     ;; Fontify keywords and targets, and case default/goto tags.
     (list "\\<\\(break\\|case\\|continue\\|goto\\)\\>[ \t]*\\(-?\\sw+\\)?"
 	  '(1 font-lock-keyword-face) '(2 font-lock-reference-face nil t))
+    ;; This must come after the one for keywords and targets.
     '(":" ("^[ \t]*\\(\\sw+\\)[ \t]*:"
 	   (beginning-of-line) (end-of-line)
 	   (1 font-lock-reference-face)))