[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/font-lock.el
From: |
Luc Teirlinck |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/font-lock.el |
Date: |
Sat, 04 Jun 2005 18:23:44 -0400 |
Index: emacs/lisp/font-lock.el
diff -c emacs/lisp/font-lock.el:1.259 emacs/lisp/font-lock.el:1.260
*** emacs/lisp/font-lock.el:1.259 Sun May 29 08:39:40 2005
--- emacs/lisp/font-lock.el Sat Jun 4 22:23:44 2005
***************
*** 683,691 ****
adds two fontification patterns for C mode, to fontify `FIXME:' words, even in
comments, and to fontify `and', `or' and `not' words as keywords.
! When used from a Lisp program (such as a minor mode), it is recommended to
! use nil for MODE (and place the call on a hook) to avoid subtle problems
! due to details of the implementation.
Note that some modes have specialized support for additional patterns, e.g.,
see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
--- 683,704 ----
adds two fontification patterns for C mode, to fontify `FIXME:' words, even in
comments, and to fontify `and', `or' and `not' words as keywords.
! The above procedure will only add the keywords for C mode, not
! for modes derived from C mode. To add them for derived modes too,
! pass nil for MODE and add the call to c-mode-hook.
!
! For example:
!
! (add-hook 'c-mode-hook
! (lambda ()
! (font-lock-add-keywords 'c-mode
! '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 font-lock-warning-face prepend)
! (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" .
! font-lock-keyword-face)))))
!
! The above procedure may fail to add keywords to derived modes if
! some involved major mode does not follow the standard conventions.
! File a bug report if this happens, so the major mode can be corrected.
Note that some modes have specialized support for additional patterns, e.g.,
see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
***************
*** 704,710 ****
(font-lock-update-removed-keyword-alist mode keywords append))
(t
;; Otherwise set or add the keywords now.
! ;; This is a no-op if it has been done already in this buffer.
(font-lock-set-defaults)
(let ((was-compiled (eq (car font-lock-keywords) t)))
;; Bring back the user-level (uncompiled) keywords.
--- 717,724 ----
(font-lock-update-removed-keyword-alist mode keywords append))
(t
;; Otherwise set or add the keywords now.
! ;; This is a no-op if it has been done already in this buffer
! ;; for the correct major mode.
(font-lock-set-defaults)
(let ((was-compiled (eq (car font-lock-keywords) t)))
;; Bring back the user-level (uncompiled) keywords.
***************
*** 774,782 ****
MODE should be a symbol, the major mode command name, such as `c-mode'
or nil. If nil, highlighting keywords are removed for the current buffer.
! When used from a Lisp program (such as a minor mode), it is recommended to
! use nil for MODE (and place the call on a hook) to avoid subtle problems
! due to details of the implementation."
(cond (mode
;; Remove one keyword at the time.
(dolist (keyword keywords)
--- 788,798 ----
MODE should be a symbol, the major mode command name, such as `c-mode'
or nil. If nil, highlighting keywords are removed for the current buffer.
! To make the removal apply to modes derived from MODE as well,
! pass nil for MODE and add the call to MODE-hook. This may fail
! for some derived modes if some involved major mode does not
! follow the standard conventions. File a bug report if this
! happens, so the major mode can be corrected."
(cond (mode
;; Remove one keyword at the time.
(dolist (keyword keywords)
***************
*** 1571,1582 ****
(defvar font-lock-set-defaults nil) ; Whether we have set up defaults.
(defun font-lock-set-defaults ()
"Set fontification defaults appropriately for this mode.
Sets various variables using `font-lock-defaults' (or, if nil, using
`font-lock-defaults-alist') and `font-lock-maximum-decoration'."
! ;; Set fontification defaults iff not previously set.
! (unless font-lock-set-defaults
(set (make-local-variable 'font-lock-set-defaults) t)
(make-local-variable 'font-lock-fontified)
(make-local-variable 'font-lock-multiline)
--- 1587,1600 ----
(defvar font-lock-set-defaults nil) ; Whether we have set up defaults.
+ (defvar font-lock-mode-major-mode)
(defun font-lock-set-defaults ()
"Set fontification defaults appropriately for this mode.
Sets various variables using `font-lock-defaults' (or, if nil, using
`font-lock-defaults-alist') and `font-lock-maximum-decoration'."
! ;; Set fontification defaults iff not previously set for correct major mode.
! (unless (and font-lock-set-defaults
! (eq font-lock-mode-major-mode major-mode))
(set (make-local-variable 'font-lock-set-defaults) t)
(make-local-variable 'font-lock-fontified)
(make-local-variable 'font-lock-multiline)
- [Emacs-diffs] Changes to emacs/lisp/font-lock.el,
Luc Teirlinck <=
- [Emacs-diffs] Changes to emacs/lisp/font-lock.el, Luc Teirlinck, 2005/06/04
- [Emacs-diffs] Changes to emacs/lisp/font-lock.el, Juri Linkov, 2005/06/06
- [Emacs-diffs] Changes to emacs/lisp/font-lock.el, Luc Teirlinck, 2005/06/06
- [Emacs-diffs] Changes to emacs/lisp/font-lock.el, Juanma Barranquero, 2005/06/16
- [Emacs-diffs] Changes to emacs/lisp/font-lock.el, Stefan Monnier, 2005/06/29