From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: web-mode.el Date: Wed, 20 Jun 2012 06:01:00 +0400 Message-ID: <4FE12EDC.3080001@yandex.ru> References: <4FD9F40C.90406@yandex.ru> <4FDA927D.50306@yandex.ru> <4FDC89B7.3050907@yandex.ru> <4FDFCF27.8000309@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340157675 16912 80.91.229.3 (20 Jun 2012 02:01:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Jun 2012 02:01:15 +0000 (UTC) Cc: cyd@gnu.org, lennart.borgman@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 20 04:01:13 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ShAEI-0007nA-Eu for ged-emacs-devel@m.gmane.org; Wed, 20 Jun 2012 04:01:10 +0200 Original-Received: from localhost ([::1]:47501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShAEI-0003xc-Cp for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2012 22:01:10 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShAEF-0003xH-Ts for emacs-devel@gnu.org; Tue, 19 Jun 2012 22:01:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShAEE-0002BT-55 for emacs-devel@gnu.org; Tue, 19 Jun 2012 22:01:07 -0400 Original-Received: from forward7.mail.yandex.net ([77.88.61.37]:46793) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShAEB-0002Ac-1c; Tue, 19 Jun 2012 22:01:03 -0400 Original-Received: from smtp6.mail.yandex.net (smtp6.mail.yandex.net [77.88.61.56]) by forward7.mail.yandex.net (Yandex) with ESMTP id C2D301C1415; Wed, 20 Jun 2012 06:00:59 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340157659; bh=7Fl2od36/VXsuXG3fDuVZV590FI39q7UGcVO+vJfLec=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=IAHIy3ai58NuKwucDx+jsDGE+KtItiabC5gIA7ZdB8/+r8o38dK7wbYKm15d/6pTg NKpJAotOH6lp+GES2qBqnjAjxHBAEuMVDHESkcd/cp/MqEQPRrJcb/Si6tJMYr+M/f v4RllTtZ5BtCtu5/qQl39l7gO/xcF5FddLWJjl34= Original-Received: from smtp6.mail.yandex.net (localhost [127.0.0.1]) by smtp6.mail.yandex.net (Yandex) with ESMTP id 80C7116403CF; Wed, 20 Jun 2012 06:00:59 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp6.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0w6O18hj-0x6CfWaV; Wed, 20 Jun 2012 06:00:59 +0400 X-Yandex-Rcpt-Suid: monnier@iro.umontreal.ca X-Yandex-Rcpt-Suid: cyd@gnu.org X-Yandex-Rcpt-Suid: lennart.borgman@gmail.com X-Yandex-Rcpt-Suid: emacs-devel@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340157659; bh=7Fl2od36/VXsuXG3fDuVZV590FI39q7UGcVO+vJfLec=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=rsjLy91B0UF+ID4qn5g1KjdlOAA9FE8hHOPh1T8tK1fBxyKPTLG08kPhQL8Rr/i1d 0Ysl8pvd8BouLkMRFlkQDrNTSuNVxtHkQHbTOe6RMMLUPysX/c1DJ1KQX576JTQeai DOQOWhJzPFE3NpFlYk3J1bxtJp75p8BN8k46l3jo= User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 77.88.61.37 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151039 Archived-At: On 19.06.2012 7:09, Stefan Monnier wrote: >> It occurs to me that, once the supported interface is established, >> introducing new syntax-table value becomes not strictly necessary because, >> for example, a version of Lennart's `with-chunks' macro can be implemented >> in Lisp by applying whitespace or comment-starter/ender syntax to foreign >> chunks around the body calls (idea from mmm-noweb). >> Is that right? > > That's right as long as you're willing to dynamically modify the buffer > (with syntax-table text-properties) every time you move from one chunk > to another. Or just every time I want to indent a line, instead. And if I always use `narrow-to-region' before performing indentation within a submode, the syntax-table text property (unless it's 'whitespace') isn't going to affect the result, so I might as well assign text properties only once when the buffer is parsed for chunks, "commenting out" the submodes. > If you have many chunks, that can be a problem. This can happen if you > push the idea of multi-major-mode a bit further and consider for example > that comments and strings are really "text-mode chunks" embedded in > "some other mode chunks". Yes, but what follows is defining the supported interface and patching existing packages becomes first priority, and implementing low-level support in C code - only second, which means more time to get the latter right. For example, I'd like to see a use case for handling submode regions of the same mode as though they're contiguous (as oppsed to isolated), in the context of `syntax-ppss'. If there isn't, it might simplify the implementation. On 19.06.2012 14:39, Lennart Borgman wrote: > My idea with (with-chunks chunk-table ...) that chunk-table contains > this information instead. Then it can be cashed by the multi major > mode framework. You might want to consider how syntax-ppss cache works. Since text-property change in considered buffer modification, `syntax-ppss-flush-cache' will be called from `before-change-functions', invalidating the cache entries with positions after the edit position, and keeping the ones before it. With your proposal, it would need to somehow keep track of the chunk-table, too.