From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jorgen Schaefer Newsgroups: gmane.emacs.bugs Subject: Font-lock should ignore missing submatches Date: Sun, 3 Feb 2008 20:30:56 +0000 (UTC) Message-ID: <20080203203056.0DDA72BFE5@sarg.kollektiv-hamburg.de> NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1202095800 5403 80.91.229.12 (4 Feb 2008 03:30:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Feb 2008 03:30:00 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Feb 04 04:30:21 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JLs2D-0003pJ-BI for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Feb 2008 04:30:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLs1l-0000J1-Aj for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Feb 2008 22:29:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JLlUh-0000TI-A6 for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2008 15:31:15 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JLlUf-0000QR-40 for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2008 15:31:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JLlUe-0000QD-Tk for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2008 15:31:12 -0500 Original-Received: from mx02.hansenet.de ([213.191.73.26] helo=webmail.hansenet.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JLlUe-0003AJ-Fp for bug-gnu-emacs@gnu.org; Sun, 03 Feb 2008 15:31:12 -0500 Original-Received: from sarg.kollektiv-hamburg.de (85.179.198.98) by webmail.hansenet.de (7.3.118.12) (authenticated as jorgen.schaefer@hanse.net) id 479FE9B300DE2FC2 for bug-gnu-emacs@gnu.org; Sun, 3 Feb 2008 21:31:11 +0100 Original-Received: by sarg.kollektiv-hamburg.de (Postfix, from userid 1000) id 0DDA72BFE5; Sun, 3 Feb 2008 20:30:56 +0000 (UTC) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. X-Mailman-Approved-At: Sun, 03 Feb 2008 22:29:44 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17463 Archived-At: Hello! When using font-lock-mode to highlight complex expressions, the font locking engine crashes when one of the subexpressions specified was not matched. Consider: (set (make-local-variable 'font-lock-keywords) '(("\\(?:\\(foo\\) *\\)?\\(bar\\)" (1 font-lock-comment-face) (2 font-lock-string-face)))) I.e. "possibly match the foo that is followed by whitespace, then definitively match a bar." This will (correctly) highlight these expressions: foobar foo bar etc. But font-lock will error out if the first subexpression does not match anything, even though the regular expression matches: oobar oo bar bar etc. The code will give an appropriate error: Error during redisplay: (error No match 1 in highlight (1 font-lock-comment-face)) Is there any chance to make font-lock just ignore unmatched subexpressions? Tested in: - GNU Emacs 22.1.1 - GNU Emacs from CVS, approx. two weeks old Sorry, no current CVS version here :-( Regards, -- Jorgen