bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: can't turn off font-lock


From: Michaël Cadilhac
Subject: Re: can't turn off font-lock
Date: Mon, 13 Aug 2007 02:10:57 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sat, 11 Aug 2007 16:24:42 -0500
>> From: karl@freefriends.org (Karl Berry)
>> Cc: 
>> 
>> emacs-22.1 -q --no-site
>> 
>> And invoke:
>> M-x eval-expression RET (global-font-lock-mode 0) RET
>> 
>> And now I try a few commands:
>> C-h a font-lock RET             (a *Help* buffer)
>> M-x grep RET e /etc/issue RET   (grep to get a couple matches)
>> M-x shell RET pwd RET
>> 
>> In all cases, I observe that fontification is happening.  Argh!
>
> That's not fontification, those are faces set by other features.  If
> you place the cursor on one of the characters you think are fontified,
> and type "C-u C-x =", Emacs will show you the face's name: you will
> see that those are not font-lock faces.

So the bug was in compile.el, mainly. Here's a fix (which I believe is
correct) for that:

Index: progmodes/compile.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/compile.el,v
retrieving revision 1.439
diff -u -B -w -r1.439 compile.el
--- progmodes/compile.el        7 Aug 2007 20:10:14 -0000       1.439
+++ progmodes/compile.el        13 Aug 2007 00:08:38 -0000
@@ -1405,7 +1405,8 @@
          (turn-on-font-lock)))
     (setq font-lock-defaults '(compilation-mode-font-lock-keywords t))
     ;; maybe defer font-lock till after derived mode is set up
-    (run-mode-hooks 'compilation-turn-on-font-lock)))
+    (when font-lock-mode
+      (run-mode-hooks 'compilation-turn-on-font-lock))))
 
 ;;;###autoload
 (define-minor-mode compilation-shell-minor-mode
Index: progmodes/grep.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.76
diff -u -B -w -r1.76 grep.el
--- progmodes/grep.el   26 Jul 2007 05:27:27 -0000      1.76
+++ progmodes/grep.el   13 Aug 2007 00:08:38 -0000
@@ -356,7 +356,7 @@
 Set up `compilation-exit-message-function' and run `grep-setup-hook'."
   (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
     (grep-compute-defaults))
-  (when (eq grep-highlight-matches t)
+  (when (and font-lock-mode (eq grep-highlight-matches t))
     ;; Modify `process-environment' locally bound in `compilation-start'
     (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always"))
     ;; for GNU grep 2.5.1
compile.el used turn-on-font-lock unconditionally, supposedly to update
the font-locking keywords.

grep.el used the colorful output of grep without parsing it if
font-locking was off (thus giving the user an output with ^[31m). Of
course, someone who's playing with font-locking on/off in a grep buffer
executed with font-locking on will see those ^[31m; but it's a detail.

-- 
 |   Michaël `Micha' Cadilhac       |  «Tu aimeras ton prochain.»            |
 |   http://michael.cadilhac.name   |    D'abord, Dieu ou pas,               |
 |   JID/MSN:                       |       j'ai horreur qu'on me tutoie.    |
 `----  michael.cadilhac@gmail.com  |           -- P. Desproges         -  --'

Attachment: pgpLFlxmPwvyB.pgp
Description: PGP signature


reply via email to

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