all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to highlight a large number of keywords?
@ 2010-07-23  7:54 joakim
  2010-07-23  9:36 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: joakim @ 2010-07-23  7:54 UTC (permalink / raw
  To: Emacs development discussions

I'm trying to highlight a large number of keywords, 12000, with
font-lock. I've made a regexp using regexp-opt. This doesnt work, I dont
get any errors, but it seems the regexp is too large. What would be the
best way to highlight this large number of keywords in Emacs?
-- 
Joakim Verona



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

* Re: How to highlight a large number of keywords?
  2010-07-23  7:54 How to highlight a large number of keywords? joakim
@ 2010-07-23  9:36 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2010-07-23  9:36 UTC (permalink / raw
  To: joakim; +Cc: Emacs development discussions

> I'm trying to highlight a large number of keywords, 12000, with
> font-lock. I've made a regexp using regexp-opt. This doesnt work, I dont
> get any errors, but it seems the regexp is too large.

If you don't get an error, it should work (else, it's just a bug).
Most likely, it's a bug (12000 keywords is very likely to overflow the
maximum size of a compiled regexp).

> What would be the best way to highlight this large number of keywords
> in Emacs?

Use a regexp that matches a superset of all those keywords, and then
extract the matched string and compare it to your set of 12000 keywords
to see if it's indeed one of them.


        Stefan



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

end of thread, other threads:[~2010-07-23  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-23  7:54 How to highlight a large number of keywords? joakim
2010-07-23  9:36 ` 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.