From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: html, css, and js modes working together Date: Mon, 6 Feb 2017 05:46:48 +0200 Message-ID: References: <87o9ynarz3.fsf@tromey.com> <87fujs80fk.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1486352826 11956 195.159.176.226 (6 Feb 2017 03:47:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 6 Feb 2017 03:47:06 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 Cc: Emacs discussions To: Tom Tromey Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 06 04:47:02 2017 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 1caaGb-0002jy-VY for ged-emacs-devel@m.gmane.org; Mon, 06 Feb 2017 04:47:02 +0100 Original-Received: from localhost ([::1]:45424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caaGc-0005GJ-Nh for ged-emacs-devel@m.gmane.org; Sun, 05 Feb 2017 22:47:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caaGV-0005GB-Tr for emacs-devel@gnu.org; Sun, 05 Feb 2017 22:46:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1caaGS-0001ci-Sd for emacs-devel@gnu.org; Sun, 05 Feb 2017 22:46:56 -0500 Original-Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:34049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1caaGS-0001cS-Lc for emacs-devel@gnu.org; Sun, 05 Feb 2017 22:46:52 -0500 Original-Received: by mail-wr0-x244.google.com with SMTP id 89so2321144wrr.1 for ; Sun, 05 Feb 2017 19:46:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HkvPM5QPy2LI5UvSC//Bk+LpVm0aOYK0cAUkU98zb2s=; b=Hlvixkoa5zfKywJ7wMFJJ/d4prt5NfAsQqOeY1lHwslglTYjxk82JmJ/7N9voeltOB m03aUWnBXEfX3Sfmdr2TH3fdVRfBSCW9yl61V8uE4gnL3fpFg6hiX7oKLufF/LnKuwLW 5W163VXbuv6bLLT+x1GFfxDTx2myHPOPrcfbOlsInFizd7Z8ThUHoqvgYAvghk/Qmwlc Y3IRfZUf4OjoAk2b95/Z6ZZsL2zGCGb+8IAPoV9BgDNtTlFjJz8uis+x61r6vm3rKsnv aqx8WTz1N97TjBeOKlMSZJTPBKlyKKcBfFDoI8t5zQ8rrWN0n093BbbtXQNHPVNHBhLJ zwDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HkvPM5QPy2LI5UvSC//Bk+LpVm0aOYK0cAUkU98zb2s=; b=ktTMLYgzHd9KBjQOyPoLbyXbD99LrTBJRUA1iGmE6h08/oBUPRQssR5vdwqmBUEVfF dTq7pZP/lb+BAFSJUxgdMzFVSKzMhHu3Ett4PtjA5NXXt1qlFIzFW/kcF9/TiE54uJc1 6Ho23sCaCPnOz0GLv5t+aZYPl0Az3bL/V13I179L0TryEE6rzyRFU/QqOa/4x/ypZd5P hkJxv8mumdoDQjvPOuON1ztm498j6xRkLdo3HBQPlnnNp3i9EcskM08jKzC3xeeQ1Z/j GakgrGupr5k5UVlmK7hhqBHLcg6JeCCLm6IEFTB4gx0BhL5Njce0F1qYv4GBaKkmj8Oz oDpg== X-Gm-Message-State: AIkVDXJwud/5JzHsKuFTKGUyUuqHloPcEPD4M+4ksNnMqHjcaaao/NUySQtHldKTWV3TfA== X-Received: by 10.223.150.118 with SMTP id c51mr6908560wra.190.1486352811496; Sun, 05 Feb 2017 19:46:51 -0800 (PST) Original-Received: from [10.8.0.14] (v-2-eu19-d3962-07.webazilla.com. [78.140.151.7]) by smtp.googlemail.com with ESMTPSA id b51sm58070179wrd.39.2017.02.05.19.46.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Feb 2017 19:46:50 -0800 (PST) In-Reply-To: <87fujs80fk.fsf@tromey.com> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::244 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:212016 Archived-At: On 06.02.2017 05:26, Tom Tromey wrote: > I'm not sure what you're referring to here. Do some of the existing > mixed mode things piggyback on the existing html mode? Both https://github.com/purcell/mmm-mode/ and https://github.com/vspinu/polymode/ do. > I guess my view is that it is always ok to make things in-tree work > better with each other, even at the expense of some code that is > out-of-tree and presumably relying on implementation details to do its > work. Still, defining a new major mode instead of directly reusing an existing one shouldn't take a lot of effort. Especially while the result is functional but not ideal. And breaking packages that worked fine for many years is not nice, especially when it can be avoided. > Dmitry> So far it's only used in python-mode, I think. > > grep shows no users in-tree, so maybe this never went in? Or is this > one of the various out-of-tree python modes? lisp/progmodes/python.el uses prog-first-column and prog-widen, both of which refer to prog-indentation-context. > Yeah, what I mean is that font-locking does not occur, but it would be > good to have. I couldn't find anything saying how this might be solved. > I haven't come up with any really good ideas myself. Maybe font-lock > could also look at text properties to decide what keywords to use? Here's one way to do it: https://github.com/purcell/mmm-mode/blob/master/mmm-region.el#L768-L787 > Dmitry> - Both css-mode and js-mode call syntax-ppss in their indentation > Dmitry> code. Luckily, their syntax tables are fairly compatible. But > Dmitry> sgml-syntax-propertize-rules calls syntax-ppss as well. > > I thought that a syntax-table property on the characters would make > syntax-ppss do the "right" thing; namely, notice where the syntax table > changes and change its parsing method accordingly. That seems orthogonal to the possibility of breaking the cache after calling syntax-ppss while a different syntax table is in effect. The characters with the syntax-table text property set should be the same in both "world views", but they are usually a minority. > I didn't try your example yet. Thanks for providing that, that's very > helpful. No problem. BTW, I've worked around it with a hack like this: https://github.com/purcell/mmm-mode/blob/master/mmm-erb.el#L93-L98