aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1996-07-27 20:23:55 +0000
committerRichard M. Stallman1996-07-27 20:23:55 +0000
commit00ddb61e2ef31d1509216fd49200c0fe06bf15d6 (patch)
tree3506588aa5a3e02492599a41a0c01221985fb785
parent2fe6d204c95fe2eede996b211ee1f2cb5c9e5129 (diff)
downloademacs-00ddb61e2ef31d1509216fd49200c0fe06bf15d6.tar.gz
emacs-00ddb61e2ef31d1509216fd49200c0fe06bf15d6.zip
(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.
-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."
501 (set (make-local-variable 'font-lock-mode) on-p) 501 (set (make-local-variable 'font-lock-mode) on-p)
502 ;; Turn on Font Lock mode. 502 ;; Turn on Font Lock mode.
503 (when on-p 503 (when on-p
504 (make-local-hook 'after-change-functions)
505 (add-hook 'after-change-functions 'font-lock-after-change-function nil t)
506 (font-lock-set-defaults) 504 (font-lock-set-defaults)
505 (unless (eq font-lock-fontify-region-function 'ignore)
506 (make-local-hook 'after-change-functions)
507 (add-hook 'after-change-functions 'font-lock-after-change-function nil t))
507 (font-lock-turn-on-thing-lock) 508 (font-lock-turn-on-thing-lock)
508 (run-hooks 'font-lock-mode-hook) 509 (run-hooks 'font-lock-mode-hook)
509 ;; Fontify the buffer if we have to. 510 ;; Fontify the buffer if we have to.
@@ -598,6 +599,9 @@ begins with `not'. For example:
598 (c-mode c++-mode) 599 (c-mode c++-mode)
599means that Font Lock mode is turned on for buffers in C and C++ modes only.") 600means that Font Lock mode is turned on for buffers in C and C++ modes only.")
600 601
602(defvar font-lock-inhibit-modes '(lisp-interaction-mode)
603 "Major modes for which Global Font Lock mode should not apply.")
604
601;;;###autoload 605;;;###autoload
602(defun global-font-lock-mode (&optional arg message) 606(defun global-font-lock-mode (&optional arg message)
603 "Toggle Global Font Lock mode. 607 "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'."
643 (set-buffer (car font-lock-buffers)) 647 (set-buffer (car font-lock-buffers))
644 (if (and (or font-lock-defaults 648 (if (and (or font-lock-defaults
645 (assq major-mode font-lock-defaults-alist)) 649 (assq major-mode font-lock-defaults-alist))
650 (not (memq major-mode font-lock-inhibit-modes))
646 (or (eq font-lock-global-modes t) 651 (or (eq font-lock-global-modes t)
647 (if (eq (car-safe font-lock-global-modes) 'not) 652 (if (eq (car-safe font-lock-global-modes) 'not)
648 (not (memq major-mode (cdr font-lock-global-modes))) 653 (not (memq major-mode (cdr font-lock-global-modes)))