unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: michael@cadilhac.name (Michaël Cadilhac)
To: Eli Zaretskii <eliz@gnu.org>
Cc: bug-emacs@gnu.org, Karl Berry <karl@freefriends.org>
Subject: Re: can't turn off font-lock
Date: Mon, 13 Aug 2007 02:10:57 +0200	[thread overview]
Message-ID: <87vebkfg4u.fsf@lrde.org> (raw)
In-Reply-To: <ups1te8t5.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 12 Aug 2007 06:22:14 +0300")


[-- Attachment #1.1.1: Type: text/plain, Size: 865 bytes --]

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: font-lock-bug.patch --]
[-- Type: text/x-patch, Size: 1529 bytes --]

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

[-- Attachment #1.1.3: Type: text/plain, Size: 711 bytes --]


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 #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
bug-gnu-emacs mailing list
bug-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnu-emacs

  parent reply	other threads:[~2007-08-13  0:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-11 21:24 can't turn off font-lock Karl Berry
2007-08-12  3:22 ` Eli Zaretskii
2007-08-12 17:56   ` Richard Stallman
2007-08-12 22:54   ` Karl Berry
2007-08-12 23:41   ` Michaël Cadilhac
2007-08-13  2:39     ` Eli Zaretskii
2007-08-13  0:10   ` Michaël Cadilhac [this message]
2007-08-13  0:23     ` Karl Berry
2007-08-13  5:01     ` Richard Stallman
2007-08-13 23:31     ` Karl Berry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vebkfg4u.fsf@lrde.org \
    --to=michael@cadilhac.name \
    --cc=bug-emacs@gnu.org \
    --cc=eliz@gnu.org \
    --cc=karl@freefriends.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).