summaryrefslogtreecommitdiff
path: root/lisp/font-lock.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-07-27 20:23:55 +0000
committerRichard M. Stallman <rms@gnu.org>1996-07-27 20:23:55 +0000
commita9a3155621ee8f4db2fd3b5e6c228bc21d231abc (patch)
tree45e50f308641921ccbd2d6b760e2a0ca3c3dbbaa /lisp/font-lock.el
parent897c033877e70d38b92a5988bd83dc9f0648328f (diff)
downloademacs-a9a3155621ee8f4db2fd3b5e6c228bc21d231abc.tar.gz
(font-lock-mode): Don't add to after-change-functions
if font-lock-fontify-region-function is `ignore'. (font-lock-inhibit-modes): New variable. (turn-on-font-lock-if-enabled): Test it.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r--lisp/font-lock.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index ac9978c1718..885a654aae4 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -501,9 +501,10 @@ its mode hook."
(set (make-local-variable 'font-lock-mode) on-p)
;; Turn on Font Lock mode.
(when on-p
- (make-local-hook 'after-change-functions)
- (add-hook 'after-change-functions 'font-lock-after-change-function nil t)
(font-lock-set-defaults)
+ (unless (eq font-lock-fontify-region-function 'ignore)
+ (make-local-hook 'after-change-functions)
+ (add-hook 'after-change-functions 'font-lock-after-change-function nil t))
(font-lock-turn-on-thing-lock)
(run-hooks 'font-lock-mode-hook)
;; Fontify the buffer if we have to.
@@ -598,6 +599,9 @@ begins with `not'. For example:
(c-mode c++-mode)
means that Font Lock mode is turned on for buffers in C and C++ modes only.")
+(defvar font-lock-inhibit-modes '(lisp-interaction-mode)
+ "Major modes for which Global Font Lock mode should not apply.")
+
;;;###autoload
(defun global-font-lock-mode (&optional arg message)
"Toggle Global Font Lock mode.
@@ -643,6 +647,7 @@ turned on in a buffer if its major mode is one of `font-lock-global-modes'."
(set-buffer (car font-lock-buffers))
(if (and (or font-lock-defaults
(assq major-mode font-lock-defaults-alist))
+ (not (memq major-mode font-lock-inhibit-modes))
(or (eq font-lock-global-modes t)
(if (eq (car-safe font-lock-global-modes) 'not)
(not (memq major-mode (cdr font-lock-global-modes)))