From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#56637: 28.1.90; [FR] Allow a way around font-lock-mode being unconditionally disabled in " *hidden*" buffers Date: Tue, 19 Jul 2022 15:55:59 +0300 Message-ID: <837d49ntwg.fsf@gnu.org> References: <874jzdhh5m.fsf@localhost> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23911"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 56637@debbugs.gnu.org To: Ihor Radchenko , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jul 19 14:58:02 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDmnY-00066K-1a for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Jul 2022 14:58:00 +0200 Original-Received: from localhost ([::1]:41466 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDmnX-0000xY-4Q for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 19 Jul 2022 08:57:59 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDmmc-0000hL-Dn for bug-gnu-emacs@gnu.org; Tue, 19 Jul 2022 08:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDmmc-0001Ez-5O for bug-gnu-emacs@gnu.org; Tue, 19 Jul 2022 08:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oDmmb-0005ZF-R7 for bug-gnu-emacs@gnu.org; Tue, 19 Jul 2022 08:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Jul 2022 12:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56637 X-GNU-PR-Package: emacs Original-Received: via spool by 56637-submit@debbugs.gnu.org id=B56637.165823538221342 (code B ref 56637); Tue, 19 Jul 2022 12:57:01 +0000 Original-Received: (at 56637) by debbugs.gnu.org; 19 Jul 2022 12:56:22 +0000 Original-Received: from localhost ([127.0.0.1]:53099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDmly-0005YA-3N for submit@debbugs.gnu.org; Tue, 19 Jul 2022 08:56:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:49086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDmlt-0005Xu-9p for 56637@debbugs.gnu.org; Tue, 19 Jul 2022 08:56:20 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:34698) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDmln-00011b-P0; Tue, 19 Jul 2022 08:56:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=NvL0gtgGYuHSJUyjzw5I84VfLUI3l34ARetyicC9WnQ=; b=E/kmAjc4bmdJ Yxb+cjlBo6H024RiDW/rQPXSM4GCtQsvgTpBhj651cAcNwfklAPyLQuZkykIZGS4KFiSpcvMImw3p ANfbDCrbYR93kBqwlb13lbfwZh85cANPf+NHR4miaMPLbNBdnsRPr1OWBYR2g1X6PR79OcTlcdmCM L0KuQlN8F1xTmdw3JlTQMKOTrI8auup5Ym4HWzgN7QFr5WCeIHbbbMikgSzZlUrvRNeAhSAG1lJXk kYnGgczsqdt611GfuFm1MQneLLk8sDGi28x7jRC03uoL1SE14Y+63Iai1AZj631XTpLYDb/PdfQk2 F7tuKOrtJCVOa6TtNT/5Iw==; Original-Received: from [87.69.77.57] (port=1302 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDmln-0004OV-93; Tue, 19 Jul 2022 08:56:11 -0400 In-Reply-To: <874jzdhh5m.fsf@localhost> (message from Ihor Radchenko on Tue, 19 Jul 2022 12:15:33 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:237433 Archived-At: > From: Ihor Radchenko > Date: Tue, 19 Jul 2022 12:15:33 +0800 > > font-lock-mode contains the follow clause: > > ;; Don't turn on Font Lock mode if we don't have a display (we're running a > ;; batch job) or if the buffer is invisible (the name starts with a space). > (when (or noninteractive (eq (aref (buffer-name) 0) ?\s)) > (setq font-lock-mode nil)) > > which interferes with Org mode's fontification code in some edge cases. > > Org mode fontifies code blocks using "hidden" temporary buffers with > their name starting from " ": " *org-src-fontification:major-mode*". > > The buffers are kept around to avoid extra major-mode loading overheads > and the fontification is not using (font-lock-ensure). > > (font-lock-ensure) usually fontifies the buffer correctly even though > font-lock-mode is disabled. However, not always. > > We just got some edge case > https://teddit.net/r/orgmode/comments/w2b0tw/syntax_highlighting_in_orgsource_blocks/igqdx18/ > with web-mode, which directly sets 'font-lock-face text properties. > > Without font-lock-mode being enabled, 'font-lock-face is not > automatically remapped to 'face text property and hence some part of the > fontification may not be reflected by simply looking into 'face > property. > > While Org can work around this particular case by looking into > 'font-lock-face, I am not sure if disabled font-lock may not trigger > similar issues in other cases. > > It would be nice if we could somehow enable font-lock inside " *hidden*" > buffers. Would it be possible? Depends on the "somehow" part. I generally prefer that obscure corner cases be solved in the software which creates those obscure cases. In this case, it seems like web-mode is that place? I'm not sure why you say Org should solve this, but perhaps I didn't understand the description well enough. But if this indeed needs to be solved in Org, how about not using buffers whose names begin with a space?