Mercurial > emacs
changeset 19783:c833b837a3fd
(global-font-lock-mode): When turning off
Global Font Lock mode, turn off Font Lock mode everywhere.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 07 Sep 1997 01:29:14 +0000 |
parents | 013cea3890cb |
children | da913efb39cf |
files | lisp/font-lock.el |
diffstat | 1 files changed, 16 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/font-lock.el Sun Sep 07 01:24:23 1997 +0000 +++ b/lisp/font-lock.el Sun Sep 07 01:29:14 1997 +0000 @@ -813,17 +813,23 @@ 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