emacs-devel
[Top][All Lists]
Advanced

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

Re: web-mode.el


From: Lennart Borgman
Subject: Re: web-mode.el
Date: Sat, 16 Jun 2012 03:43:55 +0200

On Fri, Jun 15, 2012 at 5:24 AM, Dmitry Gutov <address@hidden> wrote:
>
> Fully isolating the chunks might not be the best course of action, even if
> it were not too hard to do.
> For example, if we want to adjust indentation inside <% if %> <% end%>
> blocks, we need to be able to actually look inside them while we're in the
> primary mode chunk (between those two).

Can you give an example of what you mean here?

> I don't think I understand the code enough to answer that, but I'm inclined
> to fault implementation (not necessarily of the stage you described above).
> For example, one of the problems shows that indentation function behaves
> differently, depending on where inside the (same) line the point is.

Eh, yes, that is of course just a bug (but maybe not a very simple one).

> 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?

> js2-mode's indentation function is very similar to js-mode, since they're
> both derived from an javascript-mode. It doesn't work in multi-mode context,
> though, and while fixing that shouldn't be too hard, I'm not sure it's worth
> spending time on, because js2-mode's advantages over js-mode are most
> evident with larger files, not small snippets.

Is not this is a general problem, not something specific to js2-mode?

> 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.

>>>> Of course, tweaking some parts of the C mode might help.  E.g. we could
>>>> maybe extend syntax-tables slightly so that chunk boundaries are marked
>>>> with a special syntax-table value which then makes forward-comment skip
>>>> over "other language" chunks, so that any indentation code which
>>>> consistently ignores comments would then work in multi-major-mode.
>>
>>
>> I have tried to implement something like that in mumamo.el, but I
>> think it is not working correctly anymore. Something might have
>> changed since I did that.
>
>
> Could you show where this is implemented?

It just stores the value of syntax-ppss cache at the end of a chunk.
When handling the next chunk of the same time this value is picked up
again.



reply via email to

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