From unknown Tue Jun 17 20:13:25 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#635 <635@debbugs.gnu.org> To: bug#635 <635@debbugs.gnu.org> Subject: Status: Adding font-lock keywords results in no font-lock at all Reply-To: bug#635 <635@debbugs.gnu.org> Date: Wed, 18 Jun 2025 03:13:25 +0000 retitle 635 Adding font-lock keywords results in no font-lock at all reassign 635 emacs submitter 635 Klaus Zeitler severity 635 normal thanks From kzeitler@alcatel-lucent.com Thu Jul 31 23:26:37 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.4 required=4.0 tests=AWL,BAYES_00,FOURLA, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 1 Aug 2008 06:26:38 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m716QX1Y020262 for ; Thu, 31 Jul 2008 23:26:35 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOo5x-00032e-8s for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2008 02:26:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOo5v-0002zr-9z for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2008 02:26:32 -0400 Received: from [199.232.76.173] (port=54268 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOo5v-0002zh-5E for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2008 02:26:31 -0400 Received: from mx20.gnu.org ([199.232.41.8]:65306) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KOo5u-0001bQ-So for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2008 02:26:31 -0400 Received: from ihemail4.lucent.com ([135.245.0.39]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KOo4Q-00018w-Bx for bug-gnu-emacs@gnu.org; Fri, 01 Aug 2008 02:24:58 -0400 Received: from ihrh1.emsr.lucent.com (h135-1-218-53.lucent.com [135.1.218.53]) by ihemail4.lucent.com (8.13.8/IER-o) with ESMTP id m716OnW1022208 for ; Fri, 1 Aug 2008 01:24:50 -0500 (CDT) Received: from nbgif1.de.lucent.com (nbgif1.de.lucent.com [135.246.31.82]) by ihrh1.emsr.lucent.com (8.13.8/emsr) with ESMTP id m716Om08024261 for ; Fri, 1 Aug 2008 01:24:49 -0500 (CDT) Received: from sfsws1.de.lucent.com (sfsws1.de.lucent.com [135.246.31.38]) by nbgif1.de.lucent.com (8.11.7p3+Sun/8.11.7) with ESMTP id m716Ol328476 for ; Fri, 1 Aug 2008 08:24:47 +0200 (MEST) Received: from sfsw51.de.lucent.com (sfsw51.de.lucent.com [135.246.72.99]) by sfsws1.de.lucent.com (8.13.8/8.12.10) with ESMTP id m716OlF8006832 for ; Fri, 1 Aug 2008 08:24:47 +0200 (MEST) Received: (from kzeitler@localhost) by sfsw51.de.lucent.com (8.11.7p1+Sun/8.8.8) id m716OlA22223 for bug-gnu-emacs@gnu.org; Fri, 1 Aug 2008 08:24:47 +0200 (MEST) X-Authentication-Warning: sfsw51.de.lucent.com: kzeitler set sender to kzeitler@alcatel-lucent.com using -f Sender: kzeitler@de.lucent.com Resent-Sender: kzeitler@de.lucent.com Resent-To: bug-gnu-emacs@gnu.org Resent-Reply-To: kzeitler@alcatel-lucent.com Resent-From: Klaus Zeitler Resent-Date: Fri, 01 Aug 2008 08:24:47 +0200 Resent-Message-ID: X-From-Line: kzeitler@de.lucent.com Fri Aug 1 08:21:46 2008 Received: from mail.gslb.alcatel-lucent.com [135.248.189.45] by sfsw51.de.lucent.com with IMAP (fetchmail-6.3.7) for (single-drop); Fri, 01 Aug 2008 08:21:46 +0200 (MEST) Received: from DEEXP01.de.lucent.com ([135.248.187.65]) by DEEXC1U01.de.lucent.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 1 Aug 2008 08:21:37 +0200 Received: from ilexp02.ndc.lucent.com ([135.3.39.2]) by DEEXP01.de.lucent.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 1 Aug 2008 08:21:37 +0200 Received: from ihrh1.emsr.lucent.com ([135.1.218.53]) by ilexp02.ndc.lucent.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 1 Aug 2008 01:21:33 -0500 Received: from nbgif1.de.lucent.com (nbgif1.de.lucent.com [135.246.31.82]) by ihrh1.emsr.lucent.com (8.13.8/emsr) with ESMTP id m716LWDV021908 for ; Fri, 1 Aug 2008 01:21:33 -0500 (CDT) Received: from sfsws1.de.lucent.com (sfsws1.de.lucent.com [135.246.31.38]) by nbgif1.de.lucent.com (8.11.7p3+Sun/8.11.7) with ESMTP id m716LV327614; Fri, 1 Aug 2008 08:21:31 +0200 (MEST) Received: from sfsw51.de.lucent.com (sfsw51.de.lucent.com [135.246.72.99]) by sfsws1.de.lucent.com (8.13.8/8.12.10) with ESMTP id m716LUCv006637; Fri, 1 Aug 2008 08:21:31 +0200 (MEST) Received: (from kzeitler@localhost) by sfsw51.de.lucent.com (8.11.7p1+Sun/8.8.8) id m716LUC22179; Fri, 1 Aug 2008 08:21:30 +0200 (MEST) Date: Fri, 1 Aug 2008 08:21:30 +0200 (MEST) Message-Id: <200808010621.m716LUC22179@sfsw51.de.lucent.com> From: Klaus Zeitler Cc: Klaus Zeitler To: bug-gnu-emacs@gnu.org Subject: Adding font-lock keywords results in no font-lock at all X-OriginalArrivalTime: 01 Aug 2008 06:21:34.0298 (UTC) FILETIME=[D88423A0:01C8F39E] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 68 X-Scanned-By: MIMEDefang 2.57 on 135.245.2.39 X-detected-kernel: by mx20.gnu.org: Solaris 9 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) Resent-Date: Fri, 01 Aug 2008 02:26:32 -0400 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. To reproduce: 1. start "emacs -Q" 2. in scratch buffer evaluate (defun show-tabs () "Show tabs with a slightly changed background" (font-lock-add-keywords nil '(("\t" (0 'font-lock-constant-face t))) t)) (add-hook 'font-lock-mode-hook 'show-tabs) 3. M-x list-faces-display => everything's displayed in default face In GNU Emacs 22.2.2 (sparc-sun-solaris2.8, Motif Version 2.1.0) of 2008-04-09 on sfsws4 Windowing system distributor `Sun Microsystems, Inc.', version 11.0.6410 configured using `configure '--with-gcc' '--prefix=/vol/freeware/SunOS-5.8/emacs/22.2' '--sharedstatedir=/vol/freeware/SunOS-5.8/emacs/22.2/share' '--with-x-toolkit=motif' '--x-includes=/usr/openwin/include:/usr/local/gnu/include:/opt/exp/gnu/include:/opt/exp/include:/opt/exp/lib/xpm/include' '--x-libraries=/usr/openwin/lib:/usr/local/gnu/lib:/opt/exp/gnu/lib:/opt/exp/lib:/opt/exp/lib/xpm/lib' '--with-pop' 'CC=gcc' 'XMKMF=/usr/openwin/bin/xmkmf'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: C locale-coding-system: nil default-enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t line-number-mode: t Recent input: Recent messages: ("emacs" "-Q") For information about GNU Emacs and the GNU system, type C-h C-a. Loading emacsbug... Loading regexp-opt...done Loading emacsbug...done From rudalics@gmx.at Tue Aug 5 06:12:40 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-7.0 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 5 Aug 2008 13:12:40 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m75DCafn007968 for ; Tue, 5 Aug 2008 06:12:37 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KQML6-00070O-3T for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:12:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KQML2-0006ym-Jy for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:12:35 -0400 Received: from [199.232.76.173] (port=42400 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KQML2-0006yT-AW for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:12:32 -0400 Received: from mail.gmx.net ([213.165.64.20]:57455) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1KQML1-0002XO-8F for bug-gnu-emacs@gnu.org; Tue, 05 Aug 2008 09:12:31 -0400 Received: (qmail invoked by alias); 05 Aug 2008 13:12:29 -0000 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 Message-ID: <489851CE.1030105@gmx.at> Date: Tue, 05 Aug 2008 15:12:46 +0200 From: martin rudalics User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: Klaus Zeitler , 635@debbugs.gnu.org CC: bug-gnu-emacs@gnu.org Subject: Re: bug#635: Adding font-lock keywords results in no font-lock at all References: <200808010621.m716LUC22179@sfsw51.de.lucent.com> In-Reply-To: <200808010621.m716LUC22179@sfsw51.de.lucent.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.63 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-CrossAssassin-Score: 2 > 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 From kzeitler@alcatel-lucent.com Mon Aug 11 23:43:56 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-7.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 12 Aug 2008 06:43:56 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7C6hrbR021603 for ; Mon, 11 Aug 2008 23:43:54 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSnbk-0005iO-QM for bug-gnu-emacs@gnu.org; Tue, 12 Aug 2008 02:43:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSnbj-0005gL-Q2 for bug-gnu-emacs@gnu.org; Tue, 12 Aug 2008 02:43:51 -0400 Received: from [199.232.76.173] (port=50546 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSnbj-0005fv-E9 for bug-gnu-emacs@gnu.org; Tue, 12 Aug 2008 02:43:51 -0400 Received: from ihemail1.lucent.com ([135.245.0.33]:38697) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KSnbj-0005EY-9m for bug-gnu-emacs@gnu.org; Tue, 12 Aug 2008 02:43:51 -0400 Received: from ihrh1.emsr.lucent.com (h135-1-218-53.lucent.com [135.1.218.53]) by ihemail1.lucent.com (8.13.8/IER-o) with ESMTP id m7C6hfSi027219; Tue, 12 Aug 2008 01:43:42 -0500 (CDT) Received: from nbgif1.de.lucent.com (nbgif1.de.lucent.com [135.246.31.82]) by ihrh1.emsr.lucent.com (8.13.8/emsr) with ESMTP id m7C6hcvF012733; Tue, 12 Aug 2008 01:43:39 -0500 (CDT) Received: from sfsws1.de.lucent.com (sfsws1.de.lucent.com [135.246.31.38]) by nbgif1.de.lucent.com (8.11.7p3+Sun/8.11.7) with ESMTP id m7C6hbs26538; Tue, 12 Aug 2008 08:43:37 +0200 (MEST) Received: from sfsw51.de.lucent.com (sfsw51.de.lucent.com [135.246.72.99]) by sfsws1.de.lucent.com (8.13.8/8.12.10) with ESMTP id m7C6haGh008110; Tue, 12 Aug 2008 08:43:37 +0200 (MEST) Received: (from kzeitler@localhost) by sfsw51.de.lucent.com (8.11.7p1+Sun/8.8.8) id m7C6hab24453; Tue, 12 Aug 2008 08:43:36 +0200 (MEST) X-Authentication-Warning: sfsw51.de.lucent.com: kzeitler set sender to kzeitler@alcatel-lucent.com using -f Sender: kzeitler@de.lucent.com To: martin rudalics Cc: 635@debbugs.gnu.org, bug-gnu-emacs@gnu.org Subject: Re: bug#635: Adding font-lock keywords results in no font-lock at all Reply-To: kzeitler@alcatel-lucent.com References: <200808010621.m716LUC22179@sfsw51.de.lucent.com> <489851CE.1030105@gmx.at> From: Klaus Zeitler X-Uboat-Death-Message: ATTACKED BY CORVETTE. SINKING. U-621. Date: Tue, 12 Aug 2008 08:43:36 +0200 In-Reply-To: <489851CE.1030105@gmx.at> (martin rudalics's message of "Tue\, 05 Aug 2008 15\:12\:46 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (usg-unix-v) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.57 on 135.245.2.33 X-detected-kernel: by monty-python.gnu.org: Solaris 9 X-CrossAssassin-Score: 2 >>>>> "martin" == martin rudalics writes: martin> martin> Get your original behavior back by writing something like martin> martin> (defun show-tabs () "Show tabs with a slightly changed background" martin> (unless (or font-lock-keywords font-lock-defaults) martin> (set (make-local-variable 'font-lock-defaults) '(nil t))) martin> (font-lock-add-keywords nil '(("\t" (0 'tab-face t))) t)) martin> (add-hook 'font-lock-mode-hook 'show-tabs) Yes, it works now again as expected. martin> or by removing the offending lines from font-lock.el ;-( I can live with your workaround till it's fixed :-). Thanks a lot for your help. Klaus -- -------------------------------------------------- | Klaus Zeitler Alcatel-Lucent | | Email: kzeitler@alcatel-lucent.com | -------------------------------------------------- --- Biology is the only science in which multiplication means the same thing as division. From cyd@stupidchicken.com Mon Sep 1 13:10:36 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-3.7 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at control) by emacsbugs.donarmstrong.com; 1 Sep 2008 20:10:36 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m81KAXYx028947 for ; Mon, 1 Sep 2008 13:10:34 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 2348A57E337; Mon, 1 Sep 2008 16:12:50 -0400 (EDT) To: control@debbugs.gnu.org Subject: close bug From: Chong Yidong Date: Mon, 01 Sep 2008 16:12:50 -0400 Message-ID: <874p4zfwvx.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii close 635 thanks From cyd@stupidchicken.com Mon Sep 1 13:11:28 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.7 required=4.0 tests=AWL,BAYES_00, VALID_BTS_CONTROL autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at control) by emacsbugs.donarmstrong.com; 1 Sep 2008 20:11:28 +0000 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m81KBPYc029052 for ; Mon, 1 Sep 2008 13:11:26 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 36D1857E337; Mon, 1 Sep 2008 16:13:42 -0400 (EDT) To: control@debbugs.gnu.org Subject: cancel last change From: Chong Yidong Date: Mon, 01 Sep 2008 16:13:42 -0400 Message-ID: <871w03fwuh.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii reopen 635 thanks From cyd@stupidchicken.com Thu Aug 13 16:40:51 2009 Received: (at 635) by emacsbugs.donarmstrong.com; 13 Aug 2009 23:40:51 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.1 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7DNeorK004926 for <635@emacsbugs.donarmstrong.com>; Thu, 13 Aug 2009 16:40:51 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id A814257E21A; Thu, 13 Aug 2009 19:41:46 -0400 (EDT) From: Chong Yidong To: Stefan Monnier Cc: martin rudalics , Klaus Zeitler , 635@debbugs.gnu.org Subject: Re: bug#635: Adding font-lock keywords results in no font-lock at all Date: Thu, 13 Aug 2009 19:41:46 -0400 Message-ID: <87bpmjnux1.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > 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. Maybw we should do away with the optimization where font-lock-mode avoids calling font-lock-internal when font-lock-defaults is empty. The performance benefit is probably negligible. Stefan, WDYT? From monnier@iro.umontreal.ca Tue Aug 18 17:15:02 2009 Received: (at 635) by emacsbugs.donarmstrong.com; 19 Aug 2009 00:15:02 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7J0F05t022768 for <635@emacsbugs.donarmstrong.com>; Tue, 18 Aug 2009 17:15:01 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnsFAB/hikpFpaKZ/2dsb2JhbACBUtZyhBkFh08 X-IronPort-AV: E=Sophos;i="4.43,405,1246852800"; d="scan'208";a="43762746" Received: from 69-165-162-153.dsl.teksavvy.com (HELO pastel.home) ([69.165.162.153]) by ironport2-out.teksavvy.com with ESMTP; 18 Aug 2009 20:14:19 -0400 Received: by pastel.home (Postfix, from userid 20848) id 858D782F0; Tue, 18 Aug 2009 20:14:53 -0400 (EDT) From: Stefan Monnier To: Chong Yidong Cc: martin rudalics , Klaus Zeitler , 635@debbugs.gnu.org Subject: Re: bug#635: Adding font-lock keywords results in no font-lock at all Message-ID: References: <87bpmjnux1.fsf@cyd.mit.edu> Date: Tue, 18 Aug 2009 20:14:53 -0400 In-Reply-To: <87bpmjnux1.fsf@cyd.mit.edu> (Chong Yidong's message of "Thu, 13 Aug 2009 19:41:46 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii >>>>> "Chong" == Chong Yidong writes: >> 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. > Maybe we should do away with the optimization where font-lock-mode > avoids calling font-lock-internal when font-lock-defaults is empty. > The performance benefit is probably negligible. Maybe that would work, although I'm a bit worried about turn it on in buffers where font-lock doesn't belong. E.g. list-faces-display shouldn't be combined with font-lock, IIUC (or we'd have to change it to use font-lock-face first). I don't know in which way hi-lock-mode was broken "in such buffers", so it's hard to say more. Clearly the current situation is not very satisfactory, with its many hacks, workarounds, and corner cases, but I'm not sure this would improve the situation, really. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 09 00:08:14 2010 Received: (at 635-done) by debbugs.gnu.org; 9 Oct 2010 04:08:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P4QjF-0000hQ-PT for submit@debbugs.gnu.org; Sat, 09 Oct 2010 00:08:13 -0400 Received: from pantheon-po42.its.yale.edu ([130.132.50.101]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P4QjD-0000hL-Ho for 635-done@debbugs.gnu.org; Sat, 09 Oct 2010 00:08:12 -0400 Received: from furry (adsl-99-111-197-225.dsl.wlfrct.sbcglobal.net [99.111.197.225]) (authenticated bits=0) by pantheon-po42.its.yale.edu (8.12.11.20060308/8.12.11) with ESMTP id o994BTZ7006140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for <635-done@debbugs.gnu.org>; Sat, 9 Oct 2010 00:11:29 -0400 Received: by furry (Postfix, from userid 1000) id 4E7A7C018; Sat, 9 Oct 2010 00:11:29 -0400 (EDT) From: Chong Yidong To: 635-done@debbugs.gnu.org Subject: Re: bug#635: Adding font-lock keywords results in no font-lock at all Date: Sat, 09 Oct 2010 00:11:29 -0400 Message-ID: <878w28j98u.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-YaleITSMailFilter: Version 1.2c (attachment(s) not renamed) X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 635-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.5 (--) I've just checked in a patch by David Koppelman which should fix this: http://lists.gnu.org/archive/html/emacs-devel/2010-10/msg00239.html From unknown Tue Jun 17 20:13:25 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 06 Nov 2010 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator