From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How to highlight a large number of keywords? Date: Fri, 23 Jul 2010 11:36:32 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1279877812 16786 80.91.229.12 (23 Jul 2010 09:36:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 23 Jul 2010 09:36:52 +0000 (UTC) Cc: Emacs development discussions To: joakim@verona.se Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 23 11:36:49 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OcEgR-0004ss-5N for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2010 11:36:47 +0200 Original-Received: from localhost ([127.0.0.1]:55574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcEgQ-0002HQ-Ga for ged-emacs-devel@m.gmane.org; Fri, 23 Jul 2010 05:36:46 -0400 Original-Received: from [140.186.70.92] (port=60743 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OcEgI-0002G5-GJ for emacs-devel@gnu.org; Fri, 23 Jul 2010 05:36:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OcEgH-0008N7-C4 for emacs-devel@gnu.org; Fri, 23 Jul 2010 05:36:38 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:45589) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OcEgH-0008Mx-5W for emacs-devel@gnu.org; Fri, 23 Jul 2010 05:36:37 -0400 Original-Received: from ceviche.home (vpn-132-204-232-40.acd.umontreal.ca [132.204.232.40]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o6N9aX7x011073; Fri, 23 Jul 2010 05:36:34 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 8487C660D2; Fri, 23 Jul 2010 11:36:32 +0200 (CEST) In-Reply-To: (joakim@verona.se's message of "Fri, 23 Jul 2010 09:54:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3584=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:127689 Archived-At: > 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