all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* font-lock-global-modes = nil doesn't work
@ 2007-10-05 15:27 Juanma Barranquero
  2007-10-08 18:03 ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2007-10-05 15:27 UTC (permalink / raw)
  To: Emacs development discussions

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  <walters@debian.org>

        * 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))))

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-10 13:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05 15:27 font-lock-global-modes = nil doesn't work Juanma Barranquero
2007-10-08 18:03 ` Richard Stallman
2007-10-09  8:27   ` Juanma Barranquero
2007-10-10 13:01     ` Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.