From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#635: Adding font-lock keywords results in no font-lock at all Date: Tue, 05 Aug 2008 15:12:46 +0200 Message-ID: <489851CE.1030105@gmx.at> References: <200808010621.m716LUC22179@sfsw51.de.lucent.com> Reply-To: martin rudalics , 635@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1217942865 13825 80.91.229.12 (5 Aug 2008 13:27:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Aug 2008 13:27:45 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Klaus Zeitler , 635@emacsbugs.donarmstrong.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 05 15:28:30 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KQMaT-0004gV-Eg for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2008 15:28:29 +0200 Original-Received: from localhost ([127.0.0.1]:54557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQMZY-0005s0-6L for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Aug 2008 09:27:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQMZT-0005rk-EA for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:27:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQMZR-0005rF-MK for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:27:26 -0400 Original-Received: from [199.232.76.173] (port=40224 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQMZR-0005rB-IP for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:27:25 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:35286) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KQMZQ-0006bz-SO for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:27:25 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m75DRM5u012411; Tue, 5 Aug 2008 06:27:22 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m75DK6Zc009786; Tue, 5 Aug 2008 06:20:06 -0700 X-Loop: don@donarmstrong.com Resent-From: martin rudalics Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 05 Aug 2008 13:20:06 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 635 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 635-submit@emacsbugs.donarmstrong.com id=B635.12179419597975 (code B ref 635); Tue, 05 Aug 2008 13:20:06 +0000 Original-Received: (at 635) by emacsbugs.donarmstrong.com; 5 Aug 2008 13:12:39 +0000 Original-Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with SMTP id m75DCYou007966 for <635@emacsbugs.donarmstrong.com>; Tue, 5 Aug 2008 06:12:36 -0700 Original-Received: (qmail invoked by alias); 05 Aug 2008 13:12:29 -0000 Original-Received: from 62-47-40-29.adsl.highway.telekom.at (EHLO [62.47.40.29]) [62.47.40.29] by mail.gmx.net (mp017) with SMTP; 05 Aug 2008 15:12:29 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18FbAxvgL4FQDiqix3SBETQirYhWdRmbUFuZ9+2mt SnzR1b2aeaDRGb User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <200808010621.m716LUC22179@sfsw51.de.lucent.com> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.63 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Resent-Date: Tue, 05 Aug 2008 09:27:26 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:19029 Archived-At: > For many years I had the following statement in my .emacs file: > > (defun show-tabs () "Show tabs with a slightly changed background" > (font-lock-add-keywords nil '(("\t" (0 'tab-face t))) t)) > (add-hook 'font-lock-mode-hook 'show-tabs) > > This has worked without any problems up to 22.1. > In version 22.2 and 23 I do have problems with syntax highlighting due > to these few lines above in some modes, e.g. when I try M-x list-faces-display > all colors are gone. The behavior you observe seems due to the change 2007-06-11 Stefan Monnier * font-lock.el (font-lock-add-keywords): In case font-lock was only half-activated, forcefully activate it completely. which added the following lines to `font-lock-add-keywords' (when (and font-lock-mode (not (or font-lock-keywords font-lock-defaults))) ;; The major mode has not set any keywords, so when we enabled ;; font-lock-mode it only enabled the font-core.el part, not the ;; font-lock-mode-internal. Try again. (font-lock-mode -1) (set (make-local-variable 'font-lock-defaults) '(nil t)) (font-lock-mode 1)) What happens appears to be that in any mode that does not specify `font-lock-keywords' (like `help-mode' or `view-mode' in your case), (font-lock-mode -1) unfontifies the entire buffer thus removing any faces assigned earlier by, for example, `list-faces-display'. Since these faces are not reassigned by font-lock you won't get them back either :-( AFAICT, this change also broke `hi-lock-mode' in such buffers. Get your original behavior back by writing something like (defun show-tabs () "Show tabs with a slightly changed background" (unless (or font-lock-keywords font-lock-defaults) (set (make-local-variable 'font-lock-defaults) '(nil t))) (font-lock-add-keywords nil '(("\t" (0 'tab-face t))) t)) (add-hook 'font-lock-mode-hook 'show-tabs) or by removing the offending lines from font-lock.el ;-( martin