From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords Date: Mon, 05 Sep 2005 11:54:37 -0400 Message-ID: <87irxfqzu0.fsf-monnier+emacs@gnu.org> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1125936227 6207 80.91.229.2 (5 Sep 2005 16:03:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 5 Sep 2005 16:03:47 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Sep 05 18:03:46 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ECJQL-0002ey-Uv for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2005 18:02:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECJUn-000717-LA for ged-emacs-devel@m.gmane.org; Mon, 05 Sep 2005 12:06:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ECJPF-0002tx-Vp for emacs-devel@gnu.org; Mon, 05 Sep 2005 12:01:14 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ECJP6-0002rQ-3b for emacs-devel@gnu.org; Mon, 05 Sep 2005 12:01:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ECJP5-0002oO-DF for emacs-devel@gnu.org; Mon, 05 Sep 2005 12:01:03 -0400 Original-Received: from [209.226.175.184] (helo=tomts22-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ECJMe-0006XY-8o for emacs-devel@gnu.org; Mon, 05 Sep 2005 11:58:32 -0400 Original-Received: from alfajor ([67.71.35.49]) by tomts22-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050905155437.HKKR21470.tomts22-srv.bellnexxia.net@alfajor>; Mon, 5 Sep 2005 11:54:37 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 9245AD747C; Mon, 5 Sep 2005 11:54:37 -0400 (EDT) Original-To: Klaus Zeitler In-Reply-To: (Klaus Zeitler's message of "Mon, 05 Sep 2005 10:58:49 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:42625 Archived-At: Stefan> font-lock-mode-hook is called both when turning the mode ON and Stefan> when turning the mode OFF. > But I didn't turn it off. No, but it still means your hook code is wrong: you should check that font-lock-mode is non-nil before calling your `show-tabs'. Stefan> font-lock-keywords should not be modified as you do. Instead you > Is that documented somewhere. I've seen similar constructs used quite a few > times (e.g. emacs wiki page). Not really, but it's always been that way. Take a look at what font-lock-compile-keywords does. It has partly changed over time, but some form of it has existed for "ever". Also the docstring suggests using font-lock-add-keywords: [...] contained expressions. You can also alter it by calling `font-lock-add-keywords' or `font-lock-remove-keywords' with MODE = nil. [...] > and now it looks better, but it still looks a bit odd to me: Only to you. Not to Emacs. Stefan