Subject: Re: bug#11946: syntax highlighting error in sh-mode

From: Stefan Monnier <[email-masked]>
Date: Tue, 17 Jul 2012 04:38:54 -0400

> Hi, the following after the "#" is taken as a comment, which is wrong:
> VERSION[${#VERSION[*]}]=$i

Thanks, installed the patch below in trunk to fix this problem.

        Stefan

--- lisp/progmodes/sh-script.el	2012-07-10 11:51:54 +0000
+++ lisp/progmodes/sh-script.el	2012-07-17 08:19:01 +0000
@@ -1087,7 +1087,7 @@
     ;; metacharacters.  The list of special chars is taken from
     ;; the single-unix spec of the shell command language (under
     ;; `quoting') but with `$' removed.
-    ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
+    ("\\(?:[^|&;<>()`\\\"' \t\n]\\|\\${\\)\\(#+\\)" (1 "_"))
     ;; In a '...' the backslash is not escaping.
     ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote)))
     ;; Make sure $@ and $? are correctly recognized as sexps.