From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: regexp font-lock highlighting Date: Sat, 04 Jun 2005 10:11:51 +0200 Message-ID: <42A16247.7010204@gmx.at> References: <429AD1B5.1020408@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1117881831 21908 80.91.229.2 (4 Jun 2005 10:43:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 4 Jun 2005 10:43:51 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 04 12:43:49 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DeW74-00005a-Mk for ged-emacs-devel@m.gmane.org; Sat, 04 Jun 2005 12:42:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DeWCx-0006wc-FQ for ged-emacs-devel@m.gmane.org; Sat, 04 Jun 2005 06:48:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DeWBS-0006Oy-JA for emacs-devel@gnu.org; Sat, 04 Jun 2005 06:47:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DeW8L-0005uS-Rg for emacs-devel@gnu.org; Sat, 04 Jun 2005 06:44:06 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DeW8J-0005jt-Lj for emacs-devel@gnu.org; Sat, 04 Jun 2005 06:44:03 -0400 Original-Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1DeVtk-0006FJ-45 for emacs-devel@gnu.org; Sat, 04 Jun 2005 06:29:00 -0400 Original-Received: (qmail invoked by alias); 04 Jun 2005 10:19:35 -0000 Original-Received: from N847P010.adsl.highway.telekom.at (EHLO [62.47.49.202]) [62.47.49.202] by mail.gmx.net (mp003) with SMTP; 04 Jun 2005 12:19:35 +0200 X-Authenticated: #14592706 User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en Original-To: rms@gnu.org In-Reply-To: X-Y-GMX-Trusted: 0 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:38108 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38108 > 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.) > Note that I only fixed the endless looping behavior here. My code is not suitable when you use a support mode like jit-lock and change the delimiters of regexp groups. You would have to refontify text manually which is not very desirable. I'll try to handle this in a more user-friendly way.