From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Could the current font-lock mechanism support font locking code in comments? Date: Tue, 30 Mar 2021 10:06:05 -0400 Message-ID: References: <-vuXfnLB83FOYoLI0Kery7gGaun-l6OFzywSWZ6LMyJTpDGk9ooLIKfJ4xSCkYwNTK9IHgDhtkdxPw7kXZkyaippVgp7CRR3aMz7dbos3og=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37816"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "emacs-devel@gnu.org" To: scame Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 30 16:06:58 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lRF1F-0009if-Sn for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 16:06:57 +0200 Original-Received: from localhost ([::1]:39878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lRF1E-0007iT-Ni for ged-emacs-devel@m.gmane-mx.org; Tue, 30 Mar 2021 10:06:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52656) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRF0i-0007Ii-34 for emacs-devel@gnu.org; Tue, 30 Mar 2021 10:06:24 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lRF0d-0003Co-M1 for emacs-devel@gnu.org; Tue, 30 Mar 2021 10:06:23 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id ABD2A10021D; Tue, 30 Mar 2021 10:06:16 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6BF15100018; Tue, 30 Mar 2021 10:06:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1617113174; bh=0kcQmKRlPI/mxnE7ydJ1LKRGxUT3k5+b9g3ugXydqao=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=kDfFqNtCat0HTzkQ+Ng87b4XaRGDWjEOs/kj2plVa3AdfRR4YBEN78pdgGb0E2sga MIAS4O0+3bvjshxyVwe7uWnOtLsM23hKwnJtDMh81bEexn6hoYc/6kdL+NEWFf6GEz 9PCLlmwcX3RexOJluOyTb5sJy8okmuHbvL1m1Hy5dpz/aZo0s1O7qNAO70GKhcZH8a quX44CHk9hI0HU6JV8UC5XlkeKr6DQYzBQHqfnl0kqQQSlrUs1B4MoNEDIYZff52XH c4EyJ1k7mUy4827ntQm4XPdrHenno/EijKNxG2NxKvAYil1Es3mowA/pgtX36n0Eg9 CB5ZH/uRN7bYA== Original-Received: from alfajor (unknown [157.52.5.19]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 4171B120246; Tue, 30 Mar 2021 10:06:14 -0400 (EDT) In-Reply-To: <-vuXfnLB83FOYoLI0Kery7gGaun-l6OFzywSWZ6LMyJTpDGk9ooLIKfJ4xSCkYwNTK9IHgDhtkdxPw7kXZkyaippVgp7CRR3aMz7dbos3og=@protonmail.com> (scame's message of "Tue, 30 Mar 2021 07:40:25 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:267173 Archived-At: > Could current font lock support this somehow or there > is no way that the same buffer part can be fontified > two times by such competing rules? `sm-c-mode` does exactly what you describe, except it does it inside things the user doesn't think are comments: it sets up the buffer's syntax-table such that preprocessor directives are treated a special kinds of comments, and then it tells font-lock to apply the usual rules inside those "comments". IOW, the problem is just one of recognizing those comments that contain code rather than text, which requires some kind of markup. Stefan