From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: regexp font-lock highlighting Date: Wed, 01 Jun 2005 05:39:46 -0400 Message-ID: References: <429AD1B5.1020408@gmx.at> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1117619653 30187 80.91.229.2 (1 Jun 2005 09:54:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 1 Jun 2005 09:54:13 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 01 11:54:11 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DdPuK-0007dS-Or for ged-emacs-devel@m.gmane.org; Wed, 01 Jun 2005 11:53:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DdPzb-0007Qz-AT for ged-emacs-devel@m.gmane.org; Wed, 01 Jun 2005 05:58:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DdPkv-0001UH-VX for emacs-devel@gnu.org; Wed, 01 Jun 2005 05:43:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DdPkr-0001T1-10 for emacs-devel@gnu.org; Wed, 01 Jun 2005 05:43:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DdPkp-0001MZ-R7 for emacs-devel@gnu.org; Wed, 01 Jun 2005 05:43:15 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DdPkK-0000lw-91 for emacs-devel@gnu.org; Wed, 01 Jun 2005 05:42:44 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1DdPhS-0003mp-MA; Wed, 01 Jun 2005 05:39:46 -0400 Original-To: martin rudalics In-reply-to: <429AD1B5.1020408@gmx.at> (message from martin rudalics on Mon, 30 May 2005 10:41:25 +0200) 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:37991 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37991 Moreover I don't think that anything is "broken" in the following: ;; Underline innermost grouping, so that you can more easily see what ;; belongs together. 2005-05-12: Font-lock can go into an ;; unbreakable endless loop on this -- something's broken. ;;("[\\][\\][(]\\(?:\\?:\\)?\\(\\(?:[^\\\"]+\\|[\\]\\(?:[^\\]\\|[\\][^(]\\)\\)+?\\)[\\][\\][)]" ;;1 'underline prepend) I believe that `font-lock-fontify-keywords-region' starts backtracking and this can take hours in more complicated cases. That sounds like "broken" to me. Whether it takes hours, or forever, either way Font Lock mode will be very unpleasant to use. Anyway, regexps are not suited to handle this. If you are willing to pay for two additional buffer-local variables such as I believe you, and it is ok to add local variables for this purpose. (Their names should start with `font-lock-' so that people understand what they are for. Or perhaps with `lisp-fl-' since they are specifically for Lisp mode.) Your code is large enough that we need papers to install it. I will send you some instructions in another message. Meanwhile, I will revert the change that introduced this code. The idea was good, but the current code is not good. Finally, I would use three distinct font-lock faces for regexps: Those suggestions look good to me.