emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

font-lock-global-modes = nil doesn't work


From: Juanma Barranquero
Subject: font-lock-global-modes = nil doesn't work
Date: Fri, 5 Oct 2007 17:27:59 +0200

According to `font-lock-global-modes' docstring:

"*Modes for which Font Lock mode is automagically turned on.
Global Font Lock mode is controlled by the command `global-font-lock-mode'.
If nil, means no modes have Font Lock mode automatically turned on.
[...]"

But that's not true:

 (setq font-lock-global-modes nil)
 (global-font-lock-modes 1)

still activates font-locking for all buffers.

The reason is this change (the relevant part of the patch is after the
signature):

2002-06-12  Colin Walters  <address@hidden>

        * font-core.el [...]
        (turn-on-font-lock-if-enabled): Always turn on font-lock unless it
        is specifically excluded by the user.

It is intended for font-lock-global-modes = nil to be ignored (and
then I'll fix the docstring) or it is a bug? (A bug, I think.)

It does not cause trouble, I suppose, because users who do *not* want
global font-locking just set (global-font-lock-mode -1) in their
.emacs, instead of setting font-lock-global-modes to nil. However, the
bug precludes setting it buffer-locally to nil.

             Juanma


@@ -354,10 +343,6 @@

 (defun turn-on-font-lock-if-enabled ()
-  (when (and (or font-lock-defaults
-                (assq major-mode font-lock-defaults-alist))
-            (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)))
-                  (memq major-mode font-lock-global-modes))))
+  (unless (and (eq (car-safe font-lock-global-modes) 'not)
+              (memq major-mode (cdr font-lock-global-modes)))
     (let (inhibit-quit)
       (turn-on-font-lock))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]