]> git.eshelyaron.com Git - emacs.git/commitdiff
Further tweaks to sh-script \ #foo font locking
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 31 Oct 2019 12:07:37 +0000 (13:07 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 31 Oct 2019 12:07:37 +0000 (13:07 +0100)
* lisp/progmodes/sh-script.el (sh-syntax-propertize-function):
Tweak previous \ #foo change to work on all quoted characters, but
check that the backslash itself is not backslashed.  Regexp from
Stefan Monnier.

lisp/progmodes/sh-script.el

index b2f896ecab9a19c5610b7552f7542adb42ba757c..6ec131980be0b4afbb28aab40a307ff702378a8c 100644 (file)
@@ -1140,8 +1140,10 @@ subshells can nest."
     ;; beginning of a word.  In the shell, words are separated by
     ;; 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 "_"))
+    ;; `quoting') but with `$' removed.  Also -- if there's something like
+    ;; \ #foo, then that's not a comment, unless the backslash itself
+    ;; is backslashed.
+    ("\\(?:[^|&;<>(`\\\"' \t\n]\\|\\${\\|\\(?:[^\\]\\|^\\)\\\\\\(?:\\\\\\\\\\)*.\\)\\(#+\\)" (1 "_"))
     ;; In addition, `#' at the beginning of closed parentheses
     ;; does not start a comment if the parentheses are not isolated
     ;; by metacharacters, excluding [()].