From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#635: Adding font-lock keywords results in no font-lock at all Date: Tue, 18 Aug 2009 20:14:53 -0400 Message-ID: References: <87bpmjnux1.fsf@cyd.mit.edu> Reply-To: Stefan Monnier , 635@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1250802886 11131 80.91.229.12 (20 Aug 2009 21:14:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 20 Aug 2009 21:14:46 +0000 (UTC) Cc: 635@emacsbugs.donarmstrong.com To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 20 23:14:37 2009 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 1MeExu-0005ZV-Nb for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Aug 2009 23:14:35 +0200 Original-Received: from localhost ([127.0.0.1]:57696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeExu-0004a9-3C for geb-bug-gnu-emacs@m.gmane.org; Thu, 20 Aug 2009 17:14:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MeEvq-0003ho-6i for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2009 17:12:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MeEvj-0003hT-Qz for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2009 17:12:24 -0400 Original-Received: from [199.232.76.173] (port=55473 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MeEvj-0003hQ-IZ for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2009 17:12:19 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:52315) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MeEvi-0007El-Q6 for bug-gnu-emacs@gnu.org; Thu, 20 Aug 2009 17:12:19 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7KKkpoG019227; Thu, 20 Aug 2009 13:48:03 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n7KKbi0O017577; Thu, 20 Aug 2009 13:37:44 -0700 Resent-Date: Thu, 20 Aug 2009 13:37:44 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Stefan Monnier Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 20 Aug 2009 20:37:44 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 635 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 635-submit@emacsbugs.donarmstrong.com id=B635.125064090222816 (code B ref 635); Thu, 20 Aug 2009 20:37:44 +0000 Original-Received: (at 635) by emacsbugs.donarmstrong.com; 19 Aug 2009 00:15:02 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-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" Original-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 Original-Received: by pastel.home (Postfix, from userid 20848) id 858D782F0; Tue, 18 Aug 2009 20:14:53 -0400 (EDT) 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) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Thu, 20 Aug 2009 17:12:24 -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:30361 Archived-At: >>>>> "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