changeset: 4407:f6c39b2d8b6227405501091559be63ca54161c31
user: Jerry James <james(a)xemacs.org>
date: Mon Jan 14 16:50:32 2008 -0700
files: lisp/ChangeLog lisp/font-lock.el
description:
Make font-lock-{add,remove}-keywords actually work.
2008-01-14 Jerry James <james(a)xemacs.org>
* font-lock.el (font-lock-add-keywords): Adapt to differences in
Emacs and XEmacs compiled font-lock lists.
* font-lock.el (font-lock-remove-keywords): Ditto.
* font-lock.el (font-lock-set-defaults-1): Make changes specified
by font-lock-keywords-alist and font-lock-removed-keywords-alist.
diff -r e8f448f997ac016c496451fbb54fff6e4b6e4f9d -r
f6c39b2d8b6227405501091559be63ca54161c31 lisp/ChangeLog
--- a/lisp/ChangeLog Mon Jan 14 15:25:22 2008 +0100
+++ b/lisp/ChangeLog Mon Jan 14 16:50:32 2008 -0700
@@ -1,3 +1,11 @@ 2008-01-14 Aidan Kehoe <kehoea@parhasa
+2008-01-14 Jerry James <james(a)xemacs.org>
+
+ * font-lock.el (font-lock-add-keywords): Adapt to differences in
+ Emacs and XEmacs compiled font-lock lists.
+ * font-lock.el (font-lock-remove-keywords): Ditto.
+ * font-lock.el (font-lock-set-defaults-1): Make changes specified
+ by font-lock-keywords-alist and font-lock-removed-keywords-alist.
+
2008-01-14 Aidan Kehoe <kehoea(a)parhasard.net>
* bytecomp.el (byte-compile-output-file-form):
diff -r e8f448f997ac016c496451fbb54fff6e4b6e4f9d -r
f6c39b2d8b6227405501091559be63ca54161c31 lisp/font-lock.el
--- a/lisp/font-lock.el Mon Jan 14 15:25:22 2008 +0100
+++ b/lisp/font-lock.el Mon Jan 14 16:50:32 2008 -0700
@@ -959,7 +959,7 @@ see the variables `c-font-lock-extra-typ
(let ((was-compiled (eq (car font-lock-keywords) t)))
;; Bring back the user-level (uncompiled) keywords.
(if was-compiled
- (setq font-lock-keywords (cadr font-lock-keywords)))
+ (setq font-lock-keywords (cdr font-lock-keywords)))
;; Now modify or replace them.
(if (eq how 'set)
(setq font-lock-keywords keywords)
@@ -1069,7 +1069,7 @@ happens, so the major mode can be correc
(let ((was-compiled (eq (car font-lock-keywords) t)))
;; Bring back the user-level (uncompiled) keywords.
(if was-compiled
- (setq font-lock-keywords (cadr font-lock-keywords)))
+ (setq font-lock-keywords (cdr font-lock-keywords)))
;; Edit them.
(setq font-lock-keywords (copy-sequence font-lock-keywords))
@@ -2031,7 +2031,10 @@ Each keyword has the form (MATCHER HIGHL
font-lock-defaults
(font-lock-find-font-lock-defaults major-mode)))
(keywords (font-lock-choose-keywords
- (nth 0 defaults) font-lock-maximum-decoration)))
+ (nth 0 defaults) font-lock-maximum-decoration))
+ (local (cdr (assq major-mode font-lock-keywords-alist)))
+ (removed-keywords
+ (cdr-safe (assq major-mode font-lock-removed-keywords-alist))))
;; Keywords?
(setq font-lock-keywords (if (fboundp keywords)
@@ -2096,7 +2099,14 @@ Each keyword has the form (MATCHER HIGHL
;; older way:
;; defaults not specified at all, so use `beginning-of-defun'.
(setq font-lock-beginning-of-syntax-function
- 'beginning-of-defun)))))
+ 'beginning-of-defun)))
+
+ ;; Local fontification?
+ (while local
+ (font-lock-add-keywords nil (car (car local)) (cdr (car local)))
+ (setq local (cdr local)))
+ (when removed-keywords
+ (font-lock-remove-keywords nil removed-keywords))))
(setq font-lock-cache-position (make-marker))
(setq font-lock-defaults-computed t)))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches