emacs-devel
[Top][All Lists]
Advanced

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

Re: /srv/bzr/emacs/trunk r101338: * lisp/emacs-lisp/syntax.el (syntax-pp


From: Stefan Monnier
Subject: Re: /srv/bzr/emacs/trunk r101338: * lisp/emacs-lisp/syntax.el (syntax-ppss): More sanity check to catch
Date: Fri, 14 Feb 2014 15:53:39 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Maybe I'm missing something, but how do you define fontification
> functions that are only in effect in a portion of a buffer?

Here's one way:
>From the C code's point of view, fontification-functions will always
point to the one and only jit-lock-function, and then jit-lock will call
font-lock which will go through font-lock-fontify-region-function will
be hooked by mmm-mode to dispatch to use the proper font-lock-keywords
depending on the major mode in that region.

We could also provide more direct support either directly in font-lock
or directly in jit-lock, but the existing hooks might be sufficient.

>> >> What we need instead is some conventions that major modes need to
>> >> follow to play well in things like mmm-mode or mumamo.
>> > Like what?
>> Like "font-lock-keywords can only look before/after the provided region
>> boundaries by calling special functions".
> And why would this not play well?

Not sure I understand the question.  If the major modes don't obey this
rule, they may end up looking at code which is written in another
language and hence go them all confused.

> We are not talking about narrowing to an arbitrary portion of text.
> We are talking about narrowing to a portion that presents a
> syntactically complete snippet of code.

Not necessarily.  As mentioned earlier, it may have to start indentation
at a non-0 column, for example.

Or, if you think of a comment as a "chunk" in another major mode, then
you'll want to be able to jump from a brace to the matching other end,
even if there's a comment between the two, so you'll have to jump over
that "chunk" somehow, but "narrowing" won't do it, since it would have
to "hide" something inside rather than something outside.

Anyway, if you can hash out a design and implement it, go for it.


        Stefan



reply via email to

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