From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Fontifying unterminated strings [was: CC Mode and electric-pair "problem".] Date: Thu, 28 Jun 2018 20:43:40 -0400 Message-ID: References: <20180531123747.GA24752@ACM> <20180617201351.GA4580@ACM> <20180618103654.GA9771@ACM> <20180618154227.GB3973@ACM> <20180618180846.GC3973@ACM> <20180626160850.GA4464@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1530232963 22721 195.159.176.226 (29 Jun 2018 00:42:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 29 Jun 2018 00:42:43 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: =?windows-1252?Q?Cl=E9ment?= Pit-Claudel , =?windows-1252?B?Sm/jbyBU4XZvcmE=?= , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 29 02:42:39 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fYhUh-0005lB-HF for ged-emacs-devel@m.gmane.org; Fri, 29 Jun 2018 02:42:35 +0200 Original-Received: from localhost ([::1]:39296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYhWo-0004eI-Vb for ged-emacs-devel@m.gmane.org; Thu, 28 Jun 2018 20:44:46 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYhVx-0004cy-Ku for emacs-devel@gnu.org; Thu, 28 Jun 2018 20:43:54 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYhVt-00055E-P0 for emacs-devel@gnu.org; Thu, 28 Jun 2018 20:43:53 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:45287) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYhVt-000533-CX for emacs-devel@gnu.org; Thu, 28 Jun 2018 20:43:49 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id w5T0hfP6025693; Thu, 28 Jun 2018 20:43:43 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id C78CD660EB; Thu, 28 Jun 2018 20:43:40 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Thu, 28 Jun 2018 19:56:36 -0400") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6318=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6318> : inlines <6728> : streams <1791042> : uri <2665642> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226827 Archived-At: > My suggestion has no "string-fence syntax-table" or any such thing, so > I'm not sure what you're saying here. > Before suggesting something else, could you clarify the downside you see > with my proposal? Hmm... sorry: I'm catching up with some mail backlog and didn't read carefully. I noticed too late that I misread: your message was not in reply to my last suggestion but to some earlier discussion. So, please disregard the above text. I'll finish reading my mail before replying further. I think the following part of my answer is still correct, tho maybe out-of-date with subsequent discussion I'm about to discover. Stefan >> (ii) we amend font-{lock,core}.el to apply the desired fontification, to >> be like the new fontification in CC Mode? > > This problem is not specific to C but it's not common to all programming > languages either, so I think that modifying font-(lock|core).el > for that would be a gross hack. > > We could do it somewhat cleanly by having font-lock.el provide some > "standard" function that major modes could opt to use in their > font-lock-* settings, of course, but I'm having a hard time imagining > a solution with a nice semantics on that side: if we do it only by > tweaking faces, then we get inconsistent behavior between highlighting > and C-M-f, and if we do it by tweaking syntax-tables, then we get weird > differences between the case where font-lock is used and where it's not > used (e.g. between not-yet-displayed code and already displayed code, or > between the case where font-lock-mode is enabled or not). > > `syntax-table` properties should be applied via > syntax-propertize-function in order to be reliably available. > > > Stefan