Commit 36901266 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

* lisp/font-lock.el (font-lock-major-mode): Rename from

font-lock-mode-major-mode to distinguish it from
global-font-lock-mode's own font-lock-mode-major-mode.
(font-lock-set-defaults):
* lisp/font-core.el (font-lock-default-function): Adjust users.
(font-lock-mode): Don't set it at all.

Fixes: debbugs:6135
parent 8b9f5fe8
2010-06-16 Stefan Monnier <monnier@iro.umontreal.ca>
* font-lock.el (font-lock-major-mode): Rename from
font-lock-mode-major-mode to distinguish it from
global-font-lock-mode's own font-lock-mode-major-mode (bug#6135).
(font-lock-set-defaults):
* font-core.el (font-lock-default-function): Adjust users.
(font-lock-mode): Don't set it at all.
2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca> 2010-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
* vc-annotate.el (vc-annotate): Use vc-read-revision. * vc-annotate.el (vc-annotate): Use vc-read-revision.
......
...@@ -97,7 +97,7 @@ It will be passed one argument, which is the current value of ...@@ -97,7 +97,7 @@ It will be passed one argument, which is the current value of
`font-lock-mode'.") `font-lock-mode'.")
;; The mode for which font-lock was initialized, or nil if none. ;; The mode for which font-lock was initialized, or nil if none.
(defvar font-lock-mode-major-mode) (defvar font-lock-major-mode)
(define-minor-mode font-lock-mode (define-minor-mode font-lock-mode
"Toggle Font Lock mode. "Toggle Font Lock mode.
With arg, turn Font Lock mode off if and only if arg is a non-positive With arg, turn Font Lock mode off if and only if arg is a non-positive
...@@ -159,9 +159,7 @@ your own function which is called when `font-lock-mode' is toggled via ...@@ -159,9 +159,7 @@ your own function which is called when `font-lock-mode' is toggled via
;; Arrange to unfontify this buffer if we change major mode later. ;; Arrange to unfontify this buffer if we change major mode later.
(if font-lock-mode (if font-lock-mode
(add-hook 'change-major-mode-hook 'font-lock-change-mode nil t) (add-hook 'change-major-mode-hook 'font-lock-change-mode nil t)
(remove-hook 'change-major-mode-hook 'font-lock-change-mode t)) (remove-hook 'change-major-mode-hook 'font-lock-change-mode t)))
(when font-lock-mode
(setq font-lock-mode-major-mode major-mode)))
;; Get rid of fontification for the old major mode. ;; Get rid of fontification for the old major mode.
;; We do this when changing major modes. ;; We do this when changing major modes.
...@@ -213,8 +211,8 @@ this function onto `change-major-mode-hook'." ...@@ -213,8 +211,8 @@ this function onto `change-major-mode-hook'."
(and mode (and mode
(boundp 'font-lock-set-defaults) (boundp 'font-lock-set-defaults)
font-lock-set-defaults font-lock-set-defaults
font-lock-mode-major-mode font-lock-major-mode
(not (eq font-lock-mode-major-mode major-mode)))) (not (eq font-lock-major-mode major-mode))))
(font-lock-mode-internal mode))) (font-lock-mode-internal mode)))
(defun turn-on-font-lock () (defun turn-on-font-lock ()
......
...@@ -1784,15 +1784,18 @@ preserve `hi-lock-mode' highlighting patterns." ...@@ -1784,15 +1784,18 @@ preserve `hi-lock-mode' highlighting patterns."
(kill-local-variable 'font-lock-set-defaults) (kill-local-variable 'font-lock-set-defaults)
(font-lock-mode 1)) (font-lock-mode 1))
(defvar font-lock-mode-major-mode) (defvar font-lock-major-mode nil
"Major mode for which the font-lock settings have been setup.")
(make-variable-buffer-local 'font-lock-major-mode)
(defun font-lock-set-defaults () (defun font-lock-set-defaults ()
"Set fontification defaults appropriately for this mode. "Set fontification defaults appropriately for this mode.
Sets various variables using `font-lock-defaults' (or, if nil, using Sets various variables using `font-lock-defaults' (or, if nil, using
`font-lock-defaults-alist') and `font-lock-maximum-decoration'." `font-lock-defaults-alist') and `font-lock-maximum-decoration'."
;; Set fontification defaults if not previously set for correct major mode. ;; Set fontification defaults if not previously set for correct major mode.
(unless (and font-lock-set-defaults (unless (and font-lock-set-defaults
(eq font-lock-mode-major-mode major-mode)) (eq font-lock-major-mode major-mode))
(setq font-lock-mode-major-mode major-mode) (setq font-lock-major-mode major-mode)
(set (make-local-variable 'font-lock-set-defaults) t) (set (make-local-variable 'font-lock-set-defaults) t)
(make-local-variable 'font-lock-fontified) (make-local-variable 'font-lock-fontified)
(make-local-variable 'font-lock-multiline) (make-local-variable 'font-lock-multiline)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment