all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* font-lock-mode limitations
@ 2019-03-19 17:11 Aurel Buche
  2019-03-19 18:48 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Aurel Buche @ 2019-03-19 17:11 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]

Hi,

I am working for a company that uses a proprietary Scheme based language
The language has a rich API and its own conventions, so I created a new
major mode but I am struggling with fontification:

I have elisp functions to fetch all documented functions and user-defined
functions from my code and add them properly to font-lock-defaults (using
regexp-opt)

Everything was working fine while I was fetching keywords from a very
limited number of modules. But now I am using more of them and I have
hundreds (maybe thousands) of keywords to highlights. Now that I added more
functions to font-lock-defaults nothing is highlighted anymore.

I really need to add those modules and I definitely require fontification
as I am too used to it.
I don't want to replace keywords with more global regular expressions as it
is really helpful to have keywords highlighted only when they are written
properly

I took a quick glimpse at font-core.el and font-lock.el but I could not
find where the regexp match limitations are set

Do you have a solution or an idea to increase the limits of keywords that
can be matched by font-lock-mode ?

I would be extremely grateful if you can help me

Regards,

Aurélien Buchet

[-- Attachment #2: Type: text/html, Size: 1836 bytes --]

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

* Re: font-lock-mode limitations
  2019-03-19 17:11 font-lock-mode limitations Aurel Buche
@ 2019-03-19 18:48 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2019-03-19 18:48 UTC (permalink / raw)
  To: emacs-devel

> hundreds (maybe thousands) of keywords to highlights.  Now that I added more
> functions to font-lock-defaults nothing is highlighted anymore.

You need to look for the actual error that causes this.
Is there are relevant message in *Messages*?
Maybe M-x jit-lock-debug-mode RET (along with enabling the debugger)
could help as well.

> I took a quick glimpse at font-core.el and font-lock.el but I could not
> find where the regexp match limitations are set

The limits would be in src/regexp.c

BTW, instead of creating a monster regexp, maybe another approach is to
use a simple regexp that matches any identifier in function position
and then look up a table to see what kind of highlighting to apply to it
(IIRC that's what we do in elisp-mode to highlight macro calls
differently from function calls).


        Stefan




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

end of thread, other threads:[~2019-03-19 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-19 17:11 font-lock-mode limitations Aurel Buche
2019-03-19 18:48 ` Stefan Monnier

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.