From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.devel Subject: sh-script fontification errors (error during display messages) Date: Fri, 14 Oct 2005 01:47:29 +0000 (UTC) Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1129254926 16335 80.91.229.2 (14 Oct 2005 01:55:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 14 Oct 2005 01:55:26 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 14 03:55:16 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EQElA-0000wn-18 for ged-emacs-devel@m.gmane.org; Fri, 14 Oct 2005 03:53:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQEl9-0002jT-Fl for ged-emacs-devel@m.gmane.org; Thu, 13 Oct 2005 21:53:23 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EQEkx-0002iZ-LL for emacs-devel@gnu.org; Thu, 13 Oct 2005 21:53:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EQEkw-0002iN-4S for emacs-devel@gnu.org; Thu, 13 Oct 2005 21:53:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQEkw-0002iK-1V for emacs-devel@gnu.org; Thu, 13 Oct 2005 21:53:10 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EQEkw-0003zJ-51 for emacs-devel@gnu.org; Thu, 13 Oct 2005 21:53:10 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1EQEip-0000H7-HH for emacs-devel@gnu.org; Fri, 14 Oct 2005 03:51:00 +0200 Original-Received: from na6mk2fw02.fidelity.com ([192.223.243.6]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 14 Oct 2005 03:50:59 +0200 Original-Received: from mmaug by na6mk2fw02.fidelity.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 14 Oct 2005 03:50:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 64 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 192.223.243.6 (Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; JFV; IE 6.0 SP1 (FID r3.0); .NET CLR 1.0.3705; .NET CLR 1.1.4322)) 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:44009 Archived-At: I'm encountering the following error message while editing bash shell scripts (sh-script-mode) and have font-lock-mode enabled: Error during redisplay: (error No match 6 in highlight (6 font-lock-builtin- face)) In addition, not all of the shell keywords get fontified. For example, try the following script: #!/usr/bin/bash while true; do if false; then echo "Hello" else break fi done You may see the "while", "do", ... keywords get fontified briefly before they revert to their un-fontified appearance. I've tracked down the problem to line 1440 of lisp/progmodes/sh-script.el: 1426: (defun sh-font-lock-keywords-1 (&optional builtins) 1427: "Function to get better fontification including keywords." 1428: (let ((keywords (concat "\\([;(){}`|&]\\|^\\)[ \t]*\\(\\(" 1429: (regexp-opt (sh-feature sh-leading-keywords) t) 1430: "[ \t]+\\)?" 1431: (regexp-opt (append (sh-feature sh-leading-keywords) 1432: (sh-feature sh-other-keywords)) 1433: t)))) 1434: (sh-font-lock-keywords 1435: `(,@(if builtins 1436: `((,(concat keywords "[ \t]+\\)?" 1437: (regexp-opt (sh-feature sh-builtins) t) 1438: "\\>") 1439: (2 font-lock-keyword-face nil t) 1440: (6 font-lock-builtin-face)) 1441: ,@(sh-feature sh-font-lock-keywords-var-2))) 1442: (,(concat keywords "\\)\\>") 1443: 2 font-lock-keyword-face) 1444: ,@(sh-feature sh-font-lock-keywords-var-1))))) If I comment that line out (and insert the necessary closing paren), my scripts are fontified properly and there are no error messages generated. I'm not able to decypher what the line intended to do so I'm not sure how to fix it. One thing I did notice was that in 2001 the regexp-opt was added to build the regexp for the builtins where previously (an inefficient) mapconcat expression had been used. That could result in a change in the number of subpattern expressions (thus the 6th expression was no longer what it used to be). However, undoing that change leads to no good in Mudville. So I'm running with the line commented out, but ask that someone more familiar with the intent of that code take a look. (Assuming others can duplicate my experience). Since the code runs under jit-lock, I'm wondering if the recent tweaking of that code may have exacerbated this underlying issue... I'm running a week old CVS snapshot on w32 (GNU Emacs 22.0.50.1 (i386-mingw- nt5.1.2600) of 2005-10-09 on MMAUGXP). Thanks