From: Dmitry Gutov <dgutov@yandex.ru>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: web-mode.el
Date: Tue, 19 Jun 2012 20:04:21 +0400 [thread overview]
Message-ID: <4FE0A305.3040608@yandex.ru> (raw)
In-Reply-To: <CANbX367QmWWTgpdhZKseni_vPsav3+ZXO0=q2m3e7n97D1rRTQ@mail.gmail.com>
On 19.06.2012 5:56, Lennart Borgman wrote:
> On Tue, Jun 19, 2012 at 3:18 AM, Dmitry Gutov <dgutov@yandex.ru> 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
<div>
<% if foo %>
<span>Hello!</span>
<% end %>
</div>
should be indented as
<div><!-- prev-prev chunk %>
<% if foo %>
<span>Hello!</span><!-- current chunk -->
<% end %>
</div>
?
>>> 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.
next prev parent reply other threads:[~2012-06-19 16:04 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-14 14:24 web-mode.el Dmitry Gutov
2012-06-14 16:54 ` web-mode.el Lennart Borgman
2012-06-15 3:24 ` web-mode.el Dmitry Gutov
2012-06-16 1:43 ` web-mode.el Lennart Borgman
2012-06-16 13:19 ` web-mode.el Dmitry Gutov
2012-06-16 13:30 ` web-mode.el Lennart Borgman
2012-06-19 1:18 ` web-mode.el Dmitry Gutov
2012-06-19 1:56 ` web-mode.el Lennart Borgman
2012-06-19 16:04 ` Dmitry Gutov [this message]
2012-06-14 17:28 ` web-mode.el Stefan Monnier
2012-06-15 1:40 ` web-mode.el Dmitry Gutov
2012-06-16 6:17 ` web-mode.el Stefan Monnier
2012-06-16 10:55 ` web-mode.el Lennart Borgman
2012-06-16 13:27 ` web-mode.el Dmitry Gutov
2012-06-16 13:32 ` web-mode.el Lennart Borgman
2012-06-18 1:49 ` web-mode.el Stefan Monnier
2012-06-19 1:00 ` web-mode.el Dmitry Gutov
2012-06-19 3:09 ` web-mode.el Stefan Monnier
2012-06-19 10:39 ` web-mode.el Lennart Borgman
2012-06-20 2:01 ` web-mode.el Dmitry Gutov
2012-07-31 8:46 ` web-mode.el Lennart Borgman
-- strict thread matches above, loose matches on Subject: below --
2012-06-14 0:33 web-mode.el Dmitry Gutov
2012-06-14 1:49 ` web-mode.el Lennart Borgman
2012-06-14 2:13 ` web-mode.el Dmitry Gutov
2012-06-14 3:23 ` web-mode.el Stefan Monnier
2012-06-15 8:34 ` web-mode.el Vitalie Spinu
2012-06-15 9:23 ` web-mode.el Lennart Borgman
2012-06-15 9:41 ` web-mode.El Vitalie Spinu
2012-06-16 1:37 ` web-mode.El Lennart Borgman
2012-06-11 22:24 web-mode.el Bois Francois-Xavier
2012-06-12 11:37 ` web-mode.el Lennart Borgman
2012-06-12 13:23 ` web-mode.el Bois Francois-Xavier
[not found] ` <CAK1xyPN=7To8ZsznHdjhDO=pd_8MocAqWXzSSrFJNe=uHRwp9g@mail.gmail.com>
2012-06-12 13:24 ` web-mode.el Lennart Borgman
2012-06-12 13:45 ` web-mode.el Bois Francois-Xavier
2012-06-13 7:45 ` web-mode.el Chong Yidong
2012-06-13 8:39 ` web-mode.el Bois Francois-Xavier
2012-07-31 8:41 ` web-mode.el Steinar Bang
2012-06-13 10:36 ` web-mode.el Lennart Borgman
2012-06-13 10:49 ` web-mode.el Bois Francois-Xavier
2012-06-13 10:55 ` web-mode.el Lennart Borgman
2012-06-13 11:43 ` web-mode.el Bois Francois-Xavier
2012-06-13 11:52 ` web-mode.el Lennart Borgman
2012-06-13 12:30 ` web-mode.el Stefan Monnier
2012-06-13 12:37 ` web-mode.el Lennart Borgman
2012-06-13 10:37 ` web-mode.el Dmitry Gutov
2012-06-13 10:46 ` web-mode.el Lennart Borgman
2012-06-13 10:26 ` web-mode.el Dmitry Gutov
2012-06-13 14:18 ` web-mode.el Richard Riley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FE0A305.3040608@yandex.ru \
--to=dgutov@yandex.ru \
--cc=emacs-devel@gnu.org \
--cc=lennart.borgman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.