unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Using syntax info for font-locking?
@ 2006-10-27 20:44 spamfilteraccount
  0 siblings, 0 replies; 5+ messages in thread
From: spamfilteraccount @ 2006-10-27 20:44 UTC (permalink / raw)


Some people here

      http://erlide.sourceforge.net/

badmouths Emacs (the heretics! :), because it cannot provide as good
syntax highlighting for Erlang as their Eclipse-based Erlang IDE.

As far as I know they use the actual syntax information provided by an
Erlang node to do syntax highlighting.

I'm not very familiar with the implementation of font locking in Emacs.
If real-time syntax info for the current source file is available then
could Emacs use it for font locking?

Or font locking in Emacs is always static, done with predefined regexps
and stuff?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Using syntax info for font-locking?
@ 2006-10-27 21:42 spamfilteraccount
  2006-10-28  8:26 ` Dieter Wilhelm
       [not found] ` <mailman.329.1162024023.27805.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: spamfilteraccount @ 2006-10-27 21:42 UTC (permalink / raw)


Some people here

      http://erlide.sourceforge.net/

badmouths Emacs (the heretics! :), because it cannot provide as good
syntax highlighting for Erlang as their Eclipse-based Erlang IDE.

As far as I know they use the actual syntax information provided by an
Erlang node to do syntax highlighting.

I'm not very familiar with the implementation of font locking in Emacs.
If real-time syntax info for the current source file is available then
could Emacs use it for font locking?

Or font locking in Emacs is always static, done with predefined regexps
and stuff?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using syntax info for font-locking?
  2006-10-27 21:42 Using syntax info for font-locking? spamfilteraccount
@ 2006-10-28  8:26 ` Dieter Wilhelm
       [not found] ` <mailman.329.1162024023.27805.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Dieter Wilhelm @ 2006-10-28  8:26 UTC (permalink / raw)
  Cc: help-gnu-emacs

spamfilteraccount@gmail.com writes:

> Some people here
>
>       http://erlide.sourceforge.net/
>
> badmouths Emacs (the heretics! :), because it cannot provide as good
> syntax highlighting for Erlang as their Eclipse-based Erlang IDE.
>
> As far as I know they use the actual syntax information provided by an
> Erlang node to do syntax highlighting.
>
> I'm not very familiar with the implementation of font locking in Emacs.
> If real-time syntax info for the current source file is available then
> could Emacs use it for font locking?

It can be done, some guy on this list pointed me to the possibility of
specifying functions instead of regexps in the font-lock mechanism.

I'm using this for font-locking of user defined variables in a certain
programming mode.  My impressions, so far, are that that this is
rapidly becoming computationally very expensive for larger files.  I'm
not so deep into font-locking, there might be some tricks out there
which take advantage of syntactical checks Emacs is doing anyway.  But
at my state of knowledge the consequence of this "dynamic"
font-locking means to check after *any* self inserting key the whole
file and re-fontify it.

>
> Or font locking in Emacs is always static, done with predefined regexps
> and stuff?

So far I found only static examples.  I too hope in this thread
there'll pipe up examples to the contrary.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using syntax info for font-locking?
       [not found] ` <mailman.329.1162024023.27805.help-gnu-emacs@gnu.org>
@ 2006-10-28 14:14   ` spamfilteraccount
  2006-10-28 15:55     ` Dieter Wilhelm
  0 siblings, 1 reply; 5+ messages in thread
From: spamfilteraccount @ 2006-10-28 14:14 UTC (permalink / raw)



Dieter Wilhelm wrote:
> But
> at my state of knowledge the consequence of this "dynamic"
> font-locking means to check after *any* self inserting key the whole
> file and re-fontify it.

The process could probably be optimized by determining the smallest
possible region of the file which can be affected by the last change
and then comparing the syntactic information in this region with the
previous information and performing only those highlighting changes
which are necessary.

I imagine also the current font lock implementation performs only local
checks and doesn't refontify the whole file at every change.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Using syntax info for font-locking?
  2006-10-28 14:14   ` spamfilteraccount
@ 2006-10-28 15:55     ` Dieter Wilhelm
  0 siblings, 0 replies; 5+ messages in thread
From: Dieter Wilhelm @ 2006-10-28 15:55 UTC (permalink / raw)
  Cc: help-gnu-emacs

spamfilteraccount@gmail.com writes:

> Dieter Wilhelm wrote:
>> But
>> at my state of knowledge the consequence of this "dynamic"
>> font-locking means to check after *any* self inserting key the whole
>> file and re-fontify it.
>
> The process could probably be optimized by determining the smallest
> possible region of the file which can be affected by the last change
> and then comparing the syntactic information in this region with the
> previous information and performing only those highlighting changes
> which are necessary.

Yes, but what one saves in computational time is to be invested in
programming effort.

>
> I imagine also the current font lock implementation performs only local
> checks and doesn't refontify the whole file at every change.

I guess it affects only the current line when no multi-line stuff is
involved.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-10-28 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-27 21:42 Using syntax info for font-locking? spamfilteraccount
2006-10-28  8:26 ` Dieter Wilhelm
     [not found] ` <mailman.329.1162024023.27805.help-gnu-emacs@gnu.org>
2006-10-28 14:14   ` spamfilteraccount
2006-10-28 15:55     ` Dieter Wilhelm
  -- strict thread matches above, loose matches on Subject: below --
2006-10-27 20:44 spamfilteraccount

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).