summaryrefslogtreecommitdiff
path: root/lisp/progmodes/sh-script.el
diff options
context:
space:
mode:
authorJonathan Shin Hayase <pythonnut@gmail.com>2019-06-25 23:00:20 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-06-25 23:00:20 +0200
commit955e3703736d3de5a3d0784f3b70a95132a4f7bd (patch)
tree2f17a3a35fa2c2494e9e02ba99260393bd310246 /lisp/progmodes/sh-script.el
parent59550f7cce9b51f817b89a78f6c4ab3723e70beb (diff)
downloademacs-955e3703736d3de5a3d0784f3b70a95132a4f7bd.tar.gz
emacs-955e3703736d3de5a3d0784f3b70a95132a4f7bd.tar.bz2
emacs-955e3703736d3de5a3d0784f3b70a95132a4f7bd.zip
Highlight zsh glob flags and qualifiers in sh-mode
* lisp/progmode/sh-script.el (sh-syntax-propertize-function): Add regexps to highlight zsh glob flags and alternate qualifiers without mistaking them for comments. (bug#19455).
Diffstat (limited to 'lisp/progmodes/sh-script.el')
-rw-r--r--lisp/progmodes/sh-script.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 853a3500ee1..aa6ada96cd4 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1141,7 +1141,13 @@ subshells can nest."
;; 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 addition, `#' at the beginning of closed parentheses
+ ;; does not start a comment if the parentheses are not isolated
+ ;; by metacharacters, excluding [()].
+ ;; (e.g. `foo(#q/)' and `(#b)foo' in zsh)
+ ("[^|&;<>(`\\\"' \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.