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: Tue, 19 Jun 2012 20:04:21 +0400 Message-ID: <4FE0A305.3040608@yandex.ru> References: <4FD9F40C.90406@yandex.ru> <4FDAAADA.1030609@yandex.ru> <4FDC87D9.3080704@yandex.ru> <4FDFD35C.5070701@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340121898 12960 80.91.229.3 (19 Jun 2012 16:04:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 19 Jun 2012 16:04:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 19 18:04:58 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 1Sh0vI-00034U-KE for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2012 18:04:56 +0200 Original-Received: from localhost ([::1]:52194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh0vI-0002wf-77 for ged-emacs-devel@m.gmane.org; Tue, 19 Jun 2012 12:04:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh0vF-0002wV-UT for emacs-devel@gnu.org; Tue, 19 Jun 2012 12:04:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh0v6-000420-Nb for emacs-devel@gnu.org; Tue, 19 Jun 2012 12:04:53 -0400 Original-Received: from forward11.mail.yandex.net ([95.108.130.93]:47860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh0v6-00041r-4P for emacs-devel@gnu.org; Tue, 19 Jun 2012 12:04:44 -0400 Original-Received: from smtp13.mail.yandex.net (smtp13.mail.yandex.net [95.108.130.68]) by forward11.mail.yandex.net (Yandex) with ESMTP id 2A690E820D0; Tue, 19 Jun 2012 20:04:42 +0400 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1340121882; bh=7qJ3tYkOQEHzJC5ScCSMFcizBK62RxI/2CALkDBOTd4=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=tortlGZX2PZovSelMTISQTFhGsLie1Wpg/J0lnwxnRh8GLydnQggpUMDQMZAtbrKE bCK7ewvvmdhILKsQw8V2t4vh73LRrPQvxaAPYCvdl/ooQbbaGgAwljHTulmihI31eP P+/Ae72Ve6vPr9Cxn9wPiYd6xkHNc1wYyuJu0pnQ= Original-Received: from smtp13.mail.yandex.net (localhost [127.0.0.1]) by smtp13.mail.yandex.net (Yandex) with ESMTP id 09354E40481; Tue, 19 Jun 2012 20:04:41 +0400 (MSK) Original-Received: from 98-87.nwlink.spb.ru (98-87.nwlink.spb.ru [178.252.98.87]) by smtp13.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 4f98LCka-4f9uJ3H0; Tue, 19 Jun 2012 20:04:41 +0400 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=1340121881; bh=7qJ3tYkOQEHzJC5ScCSMFcizBK62RxI/2CALkDBOTd4=; h=Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=glpkYr6eTceuHZDiM8ShZA4wTCVeSAgrFY4BIhKe9WJXVlex8ZlXhzf+Iqy82P1pT R3EXDg3wlav5c9qCwvhLFMmZ8afec2bTEl+JKCEJBVQ+oS07QCX/+rOdULkDXTDRee hPZJ/F7eUqKeISOnvFVEEFR0/Mx5KxkPjoYZRv+k= 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: 95.108.130.93 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:151023 Archived-At: On 19.06.2012 5:56, Lennart Borgman wrote: > On Tue, Jun 19, 2012 at 3:18 AM, Dmitry Gutov wrote: >> >> What if the difference between mumamo-depth of pre-pre chunk and this one is >> 1 or -1, can you indent correctly in this case? If so, why the difference of >> 0 is a special case? Is this just a speed optimization? > > Yes, 0 is a special case. All chunks that "belongs to" the main major > mode (this could be for example html-mode) in the file has > mumamo-depth 0. Sub-chunks (for example a js or css chunk) has > mumamo-depth 1, i.e. 0+1. > > The sub-chunks could themselves have sub-chunks which then have a +1 > greater mumamo-depth. > > If a pre-pre chunk has the same depth as this one then the code in > this one could be a continuation of the code in the pre-pre chunk. > (This could be the case in for example a file which html+php code.) So > the user probably expects those chunks to be indented together. Does that mean that
<% if foo %> Hello! <% end %>
should be indented as
<% end %>
? >>> Yes, I was trying to answer that. The reason it fails is because >>> nxml-mode (like js2-mode) contains a full parser. I have been thinking >>> that rewriting it is very difficult, but maybe Stefan's proposal (the >>> change to "syntax-ppss") is a rather easy road. >> >> >> I don't think this changes much for nxml-mode: it uses the parser from >> xmltok.el, which doesn't employ any of the -sexp commands. > > I thought that parser perhaps could use the -sexp commands for testing. I think this will be a performance hit. When you just check sexp status at important points, that's fine, but here you'd have to call `syntax-ppss' each time you're scanning a token. To look at it another way, an indent-line-function skipping comments is normal. A parser, on the other hand, parses comments, too.