From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Oliver Scholz Newsgroups: gmane.emacs.help Subject: font-lock and text mode Date: Mon, 24 Feb 2003 13:40:01 +0100 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1046090807 25838 80.91.224.249 (24 Feb 2003 12:46:47 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 24 Feb 2003 12:46:47 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18nI0L-0006ia-00 for ; Mon, 24 Feb 2003 13:46:45 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18nHzH-0003S6-00 for gnu-help-gnu-emacs@m.gmane.org; Mon, 24 Feb 2003 07:45:39 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!dialin-145-254-195-124.arcor-ip.NET!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 45 Original-NNTP-Posting-Host: dialin-145-254-195-124.arcor-ip.net (145.254.195.124) Original-X-Trace: fu-berlin.de 1046090415 54481697 145.254.195.124 (16 [87814]) X-Operating-System: GNU/Linux, built from scratch: http://www.linuxfromscratch.org/ X-Attribution: os X-Face: "HgH2sgK|bfH$; PiOJI6|qUCf.ve<51_Od(%ynHr?=>znn#~#oS>",F%B8&\vus),2AsPYb -n>PgddtGEn}s7kH?7kH{P_~vu?]OvVN^qD(L)>G^gDCl(U9n{:d>'DkilN!_K"eNzjrtI4Ya6;Td% IZGMbJ{lawG+'J>QXPZD&TwWU@^~A}f^zAb[Ru;CT(UA]c& User-Agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50 Cancel-Lock: sha1:YEmolXd9cAxtQbf/ZkiUXrOXwAM= Original-Xref: shelby.stanford.edu gnu.emacs.help:110556 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:7058 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:7058 I noticed that `hi-lock-mode' doesn't work properly in text mode (CVS Emacs): after I have added a regexp with `C-x w h', matches already in the buffer are highlighted, but matching text that I insert after that is not. Also it seems to be impossible to add highlighting via font-lock-keywords to text mode. (font-lock-add-keywords nil '(("\\" . font-lock-warning-face))) I tried a lot to find the reason for this. Finally I tested whether font-locking works with a derived mode of text-mode. (defvar test-mode-font-lock-keywords '(("lirum-larum" . font-lock-warning-face))) (define-derived-mode test-mode text-mode "FIXME" (set (make-local-variable 'font-lock-defaults) '(test-mode-font-lock-keywords t))) This is fine. My guess was that this has something to do with the implementation of `global-font-lock-mode', so I tried to call `global-font-lock-mode-cmmh' manually, but to no avail. Looking at the expansion of `define-derived-mode' above and experimenting with it, I found that `kill-all-local-variables' is critical here. This is enough to enable font-locking: (progn (kill-all-local-variables) (set (make-local-variable 'font-lock-defaults) '((("\\" . font-lock-warning-face)) t))) So I looked at the code of `kill-all-local-variables'. But I can't find anything there relating to `font-lock' (except the hook `change-major-modes', but calling `global-font-lock-mode-cmmh' should amount to the same). I am puzzled. What am I missing? Oliver -- 6 Ventôse an 211 de la Révolution Liberté, Egalité, Fraternité!