From: Dmitry Gutov <dgutov@yandex.ru>
To: Lennart Borgman <lennart.borgman@gmail.com>
Cc: cyd@gnu.org, emacs-devel@gnu.org
Subject: Re: web-mode.el
Date: Thu, 14 Jun 2012 06:13:58 +0400 [thread overview]
Message-ID: <4FD948E6.4010701@yandex.ru> (raw)
In-Reply-To: <CANbX367xAY=WGaO2rduHM0oOuf+wvSPiJanH1-HWOqN8vaMfLw@mail.gmail.com>
On 14.06.2012 5:49, Lennart Borgman wrote:
> On Thu, Jun 14, 2012 at 2:33 AM, Dmitry Gutov<dgutov@yandex.ru> wrote:
>>
>> Lennart Borgman<lennart.borgman@gmail.com> writes:
>>
>>
>>> However it might not be worth the trouble. The real problem lies in
>>> the Emacs C core. Parsing functions can currently not be stopped from
>>> parsing things outside of the major mode chunk they belong too.
>>> (mumamo.el goes a long way to try to address this problems as far as
>>> possible. That makes the code quite complicated. A rewrite of the C
>>> core makes things very simple. In addition to this rewrite of the
>>> scheduling functions to add suitable tools for handling chunk finding
>>> might be necessary, but that is much simpler.)=C2=A7
>>
>> From what I know, mmm-mode counteracts this problem effectively enough,
>> narrowing buffer to chunks during fontification, binding
>> font-lock-dont-widen to t, etc.
>
> I am afraid that is a total misunderstanding. Narrowing etc does not
> help because it does not affect all the functions involved.
I must've mixed it up with multi-mode. mmm-mode does not indeed call
narrow-to-region there, and instead calls respective
font-lock-fontify-region-function's with chunk start and end positions.
https://github.com/purcell/mmm-mode/blob/master/mmm-region.el#L793
>> Anyway, you've seen the list of my immediate gripes about how MuMaMo
>> works for ERB, and I'm inclined to fault chunk detection
>
> Chunk detection must logically be done from the start of the file. In
> the first version of MuMaMo I tried to do chunk detection from
> anywhere in the file. That worked for simple cases but not for more
> complicated cases so I rewrote this several years ago.
>
> I have no idea about what trouble you have had. Perhaps you could
> describe them? (Maybe there are still pieces of code I have forgotten
> to rewrite?)
https://bugs.launchpad.net/nxhtml/+bug/946464
>> and indentation logic in your code
>
> Indentation is surpricingly hard actually. One problem is that you
> have to do some language specific parsing (which the major mode
> normally does). Another problem is getting this to work with chunks
> and across chunks. There are several alternatives for this in
> mumamo.el - and unfortunately I think there might some trouble there.
One important thing that I'm almost certain your code doesn't do is set
indent-line-function in all chunks to the same value.
This function, when called, should save (- (current-column)
(current-indentation)) value, to restore it after indentation if it's
positive.
Then it should go (back-to-indentation), look in what chunk the point is
now, and act accordingly.
> I suspect you have been looking at some of the easier cases. Please
> take a look at the test cases. There should be more, but I think I
> have written test cases for some of the troublesome cases.
I posit that I've managed to make the examples from the bug above work
better then they do with eruby-html-mumamo-mode, using lesser (I think?)
amount of code.
Nothing is perfect, of course, but all templates in my current projects
I've tried yet have shown no problems.
next prev parent reply other threads:[~2012-06-14 2:13 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Dmitry Gutov [this message]
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
-- strict thread matches above, loose matches on Subject: below --
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 ` web-mode.el Dmitry Gutov
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
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=4FD948E6.4010701@yandex.ru \
--to=dgutov@yandex.ru \
--cc=cyd@gnu.org \
--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.