aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-09-07 01:29:14 +0000
committerRichard M. Stallman1997-09-07 01:29:14 +0000
commit56072c85920389af7f3f24f37dc90d5939e20280 (patch)
tree051f245bdadd2d691c135ea9430e8eaf2f634fae
parent582305b09bb47fb3c92bba5dc2d130163730aaa1 (diff)
downloademacs-56072c85920389af7f3f24f37dc90d5939e20280.tar.gz
emacs-56072c85920389af7f3f24f37dc90d5939e20280.zip
(global-font-lock-mode): When turning off
Global Font Lock mode, turn off Font Lock mode everywhere.
-rw-r--r--lisp/font-lock.el26
1 files changed, 16 insertions, 10 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index d424ab7c0eb..f06caa531c4 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -813,17 +813,23 @@ Returns the new status of Global Font Lock mode (non-nil means on).
813When Global Font Lock mode is enabled, Font Lock mode is automagically 813When Global Font Lock mode is enabled, Font Lock mode is automagically
814turned on in a buffer if its major mode is one of `font-lock-global-modes'." 814turned on in a buffer if its major mode is one of `font-lock-global-modes'."
815 (interactive "P\np") 815 (interactive "P\np")
816 (let ((off-p (if arg 816 (let ((on-p (if arg
817 (<= (prefix-numeric-value arg) 0) 817 (> (prefix-numeric-value arg) 0)
818 global-font-lock-mode))) 818 (not global-font-lock-mode))))
819 (if off-p 819 (cond (on-p
820 (remove-hook 'find-file-hooks 'turn-on-font-lock-if-enabled) 820 (add-hook 'find-file-hooks 'turn-on-font-lock-if-enabled)
821 (add-hook 'find-file-hooks 'turn-on-font-lock-if-enabled) 821 (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled)
822 (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) 822 (setq font-lock-buffers (buffer-list)))
823 (setq font-lock-buffers (buffer-list))) 823 (t
824 (remove-hook 'find-file-hooks 'turn-on-font-lock-if-enabled)
825 (mapcar (function (lambda (buffer)
826 (with-current-buffer buffer
827 (when font-lock-mode
828 (font-lock-mode)))))
829 (buffer-list))))
824 (when message 830 (when message
825 (message "Global Font Lock mode is now %s." (if off-p "OFF" "ON"))) 831 (message "Global Font Lock mode %s" (if on-p "enabled" "disabled")))
826 (setq global-font-lock-mode (not off-p)))) 832 (setq global-font-lock-mode on-p)))
827 833
828;; Naughty hack. This variable was originally a `defvar' to keep track of 834;; Naughty hack. This variable was originally a `defvar' to keep track of
829;; whether Global Font Lock mode was turned on or not. As a `defcustom' with 835;; whether Global Font Lock mode was turned on or not. As a `defcustom' with