emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: web-mode.el


From: Dmitry Gutov
Subject: Re: web-mode.el
Date: Tue, 19 Jun 2012 05:18:20 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1

On 16.06.2012 17:30, Lennart Borgman wrote:
As an aside, this bit from the docstring sounds not very useful, maybe
even harmful:

"- However first non-empty line indentation in a chunk when going
in is special if prev-prev chunk is on same mumamo-depth and
have the same major mode. Then indent relative last non-empty
line in prev-prev chunk."


Why do you think this is wrong?


If mumamo-depth doesn't take into account nesting level of plain html tags,
then this is going to be wrong when nesting levels are different.

If it does take into account those, this shouldn't be a problem, but I still
don't understand why you need this mechanic at all.

The reason you may need it is that for example chunks at a deeper
level may have html code in them. They may be writing html code.
MuMaMo tries to make it possible to fontify and indent this html code
separately then.

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?

js2-mode is doing things differently from most major modes: 1) it reads all
buffer contents, scanning through every buffer character one by one while
parsing, 2) its fontification is all manual, performed by setting
'font-lock-face and 'syntax-table text properties during parsing.
And parsing is scheduled directly from after-change-functions, not through
jit-lock.

That is because it is a full parser. I think we will see more such
examples now that CEDET is finally inside Emacs.

As long as we don't try to use js2-mode as primary mode, the "full parser" thing won't be a problem, since it respects narrowing.
The only thing to change is the way parsing is invoked.

I have yet to look into using nxml as primary mode. Do you have any
suggestions how that could be made easier?


There are such multi major modes in nXhtml. However they does not
always behave as I expected.


I was asking specifically about nxml, because my initial attempt to make it
work with erb-style tags in mmm-mode had failed.

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]