From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Klaus Zeitler Newsgroups: gmane.emacs.devel Subject: (add-hook 'font-lock-mode-hook ...) keeps adding to font-lock-keywords Date: Fri, 02 Sep 2005 11:04:02 +0200 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1125654202 15399 80.91.229.2 (2 Sep 2005 09:43:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 2 Sep 2005 09:43:22 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 02 11:43:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EB84L-00082u-Sb for ged-emacs-devel@m.gmane.org; Fri, 02 Sep 2005 11:42:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB88d-00076d-4q for ged-emacs-devel@m.gmane.org; Fri, 02 Sep 2005 05:47:11 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EB7Z0-0005QJ-Be for emacs-devel@gnu.org; Fri, 02 Sep 2005 05:10:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EB7Yy-0005OV-7A for emacs-devel@gnu.org; Fri, 02 Sep 2005 05:10:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EB7Yx-0005LF-LA for emacs-devel@gnu.org; Fri, 02 Sep 2005 05:10:19 -0400 Original-Received: from [192.11.222.161] (helo=ihemail1.lucent.com) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EB7Vz-0004rx-Ic for emacs-devel@gnu.org; Fri, 02 Sep 2005 05:07:15 -0400 Original-Received: from nbgif1.de.lucent.com (h135-246-31-82.lucent.com [135.246.31.82]) by ihemail1.lucent.com (8.12.11/8.12.11) with ESMTP id j82943H4007986 for ; Fri, 2 Sep 2005 04:04:04 -0500 (CDT) Original-Received: from sfsws1.de.lucent.com (sfsws1.de.lucent.com [135.246.31.38]) by nbgif1.de.lucent.com (8.11.7p1+Sun/8.11.7) with ESMTP id j82943B23459 for ; Fri, 2 Sep 2005 11:04:03 +0200 (MEST) Original-Received: from sfsw51.de.lucent.com (sfsw51.de.lucent.com [135.246.72.99]) by sfsws1.de.lucent.com (8.11.7p1+Sun/8.8.5) with ESMTP id j82942g15149 for ; Fri, 2 Sep 2005 11:04:03 +0200 (MEST) Original-Received: (from kzeitler@localhost) by sfsw51.de.lucent.com (8.11.7p1+Sun/8.8.8) id j82942t25396; Fri, 2 Sep 2005 11:04:02 +0200 (MEST) X-Authentication-Warning: sfsw51.de.lucent.com: kzeitler set sender to kzeitler@lucent.com using -f Original-To: emacs-devel@gnu.org Tomato: Green User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (usg-unix-v) 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:42577 Archived-At: For a long time I've been using the simple show-tabs function below. With CVS emacs I've noticed now that the same element gets appended to global font-lock-keywords over and over again. 1. emacs -Q& 2. M-x global-font-lock-mode 3. in scratch buffer evaluate the following 2 expressions: (defun show-tabs () "Show tabs with a slightly changed background" (setq font-lock-keywords (append font-lock-keywords '(("[\t]+" (0 'tab-face t)))))) (add-hook 'font-lock-mode-hook 'show-tabs) 4. in scratch buffer: C-h v font-lock-keywords Local in buffer *scratch*; global value is (("[ ]+" (0 'tab-face t))) 5. every C-h v font-lock-keywords adds one more entry to global font-lock-keywords Value: (t (("[ ]+" (0 'tab-face t))) ("[ ]+" (0 'tab-face t))) Moreover if I load e.g. a text file, then C-h v in that buffer will give me something like: Value: (t (("[ ]+" (0 'tab-face t))) ("[ ]+" (0 'tab-face t))) Local in buffer x.txt; global value is (("[ ]+" (0 'tab-face t)) ("[ ]+" (0 'tab-face t)) ("[ ]+" (0 'tab-face t)) ("[ ]+" (0 'tab-face t)) ("[ ]+" (0 'tab-face t))) -- ------------------------------------------ | Klaus Zeitler Lucent Technologies | | Email: kzeitler@lucent.com | ------------------------------------------ --- Why bother building any more nuclear warheads until we use the ones we have?