diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-09-07 01:29:14 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-09-07 01:29:14 +0000 |
commit | 256a88f2a2ffeeadea84377e548b0e923dcf1821 (patch) | |
tree | 83d5a25ba60a26147fd8ce9fb994cc656ba8d359 /lisp/font-lock.el | |
parent | 20ebbd717377af3eab253fb60c1ed82e67e99513 (diff) | |
download | emacs-256a88f2a2ffeeadea84377e548b0e923dcf1821.tar.gz |
(global-font-lock-mode): When turning off
Global Font Lock mode, turn off Font Lock mode everywhere.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r-- | lisp/font-lock.el | 26 |
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). When Global Font Lock mode is enabled, Font Lock mode is automagically turned on in a buffer if its major mode is one of `font-lock-global-modes'." (interactive "P\np") - (let ((off-p (if arg - (<= (prefix-numeric-value arg) 0) - global-font-lock-mode))) - (if off-p - (remove-hook 'find-file-hooks 'turn-on-font-lock-if-enabled) - (add-hook 'find-file-hooks 'turn-on-font-lock-if-enabled) - (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) - (setq font-lock-buffers (buffer-list))) + (let ((on-p (if arg + (> (prefix-numeric-value arg) 0) + (not global-font-lock-mode)))) + (cond (on-p + (add-hook 'find-file-hooks 'turn-on-font-lock-if-enabled) + (add-hook 'post-command-hook 'turn-on-font-lock-if-enabled) + (setq font-lock-buffers (buffer-list))) + (t + (remove-hook 'find-file-hooks 'turn-on-font-lock-if-enabled) + (mapcar (function (lambda (buffer) + (with-current-buffer buffer + (when font-lock-mode + (font-lock-mode))))) + (buffer-list)))) (when message - (message "Global Font Lock mode is now %s." (if off-p "OFF" "ON"))) - (setq global-font-lock-mode (not off-p)))) + (message "Global Font Lock mode %s" (if on-p "enabled" "disabled"))) + (setq global-font-lock-mode on-p))) ;; Naughty hack. This variable was originally a `defvar' to keep track of ;; whether Global Font Lock mode was turned on or not. As a `defcustom' with |