;;; font-lock.el --- Electric font lock mode
-;; Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000, 2001, 02, 2003, 2004
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+;; 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
;; Author: jwz, then rms, then sm
;; Maintainer: FSF
(eval . FORM)
where MATCHER can be either the regexp to search for, or the function name to
-call to make the search (called with one argument, the limit of the search) and
-return non-nil if it succeeds (and set `match-data' appropriately).
+call to make the search (called with one argument, the limit of the search;
+it should return non-nil, move point, and set `match-data' appropriately iff
+it succeeds; like `re-search-forward' would).
MATCHER regexps can be generated via the function `regexp-opt'.
FORM is an expression, whose value should be a keyword element, evaluated when
;; If the keywords were compiled before, compile them again.
(if was-compiled
(set (make-local-variable 'font-lock-keywords)
- (font-lock-compile-keywords keywords t)))))))
+ (font-lock-compile-keywords font-lock-keywords t)))))))
(defun font-lock-update-removed-keyword-alist (mode keywords append)
;; Update `font-lock-removed-keywords-alist' when adding new
;; If the keywords were compiled before, compile them again.
(if was-compiled
(set (make-local-variable 'font-lock-keywords)
- (font-lock-compile-keywords keywords t)))))))
+ (font-lock-compile-keywords font-lock-keywords t)))))))
\f
;;; Font Lock Support mode.
font-lock-syntactic-keywords)))
;; Get down to business.
(let ((case-fold-search font-lock-keywords-case-fold-search)
- (keywords (cdr font-lock-syntactic-keywords))
+ (keywords (cddr font-lock-syntactic-keywords))
keyword matcher highlights)
(while keywords
;; Find an occurrence of `matcher' from `start' to `end'.
(if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
(goto-char start)
;;
- ;; Find the state at the `beginning-of-line' before `start'.
+ ;; Find the `start' state.
(setq state (or ppss (syntax-ppss start)))
;;
;; Find each interesting place between here and `end'.
(setq state (parse-partial-sexp (point) end nil nil state
'syntax-table))
(when face (put-text-property beg (point) 'face face)))
- (setq state (parse-partial-sexp (point) end nil nil state
- 'syntax-table))
- (< (point) end)))))
+ (< (point) end))
+ (setq state (parse-partial-sexp (point) end nil nil state
+ 'syntax-table)))))
;;; End of Syntactic fontification functions.
\f
(add-text-properties start end (cddr val))
(setq val (cadr val)))
(cond
+ ((not (or val (eq override t)))
+ ;; If `val' is nil, don't do anything. It is important to do it
+ ;; explicitly, because when adding nil via things like
+ ;; font-lock-append-text-property, the property is actually
+ ;; changed from <face> to (<face>) which is undesirable. --Stef
+ nil)
((not override)
;; Cannot override existing fontification.
(or (text-property-not-all start end 'face nil)
(make-local-variable 'font-lock-fontified)
(make-local-variable 'font-lock-multiline)
(let* ((defaults (or font-lock-defaults
- (cdr (assq major-mode font-lock-defaults-alist))))
+ (cdr (assq major-mode
+ (with-no-warnings
+ font-lock-defaults-alist)))))
(keywords
(font-lock-choose-keywords (nth 0 defaults)
(font-lock-value-in-major-mode font-lock-maximum-decoration)))
;; Now compile the keywords.
(unless (eq (car font-lock-keywords) t)
(set (make-local-variable 'font-lock-keywords)
- (font-lock-compile-keywords keywords t))))))
+ (font-lock-compile-keywords font-lock-keywords t))))))
\f
;;; Colour etc. support.
'("when" "unless" "case" "ecase" "typecase" "etypecase"
"ccase" "ctypecase" "handler-case" "handler-bind"
"restart-bind" "restart-case" "in-package"
- "cerror" "break" "ignore-errors"
+ "break" "ignore-errors"
"loop" "do" "do*" "dotimes" "dolist" "the" "locally"
"proclaim" "declaim" "declare" "symbol-macrolet"
"lexical-let" "lexical-let*" "flet" "labels" "compiler-let"
- "destructuring-bind" "macrolet" "tagbody" "block"
- "multiple-value-bind"
+ "destructuring-bind" "macrolet" "tagbody" "block" "go"
+ "multiple-value-bind" "multiple-value-prog1"
"return" "return-from"
"with-accessors" "with-compilation-unit"
"with-condition-restarts" "with-hash-table-iterator"
'(2 font-lock-constant-face nil t))
;;
;; Erroneous structures.
- '("(\\(abort\\|assert\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
+ '("(\\(abort\\|assert\\|warn\\|check-type\\|cerror\\|error\\|signal\\)\\>" 1 font-lock-warning-face)
;;
;; Words inside \\[] tend to be for `substitute-command-keys'.
'("\\\\\\\\\\[\\(\\sw+\\)]" 1 font-lock-constant-face prepend)
\f
(provide 'font-lock)
-;;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c
+;; arch-tag: 682327e4-64d8-4057-b20b-1fbb9f1fc54c
;;; font-lock.el ends here