zsh has a ton of syntax. In particular, the
# character serves a bunch of different roles. Here are two that are problematic:
This finds all files that end in
.c and captures their basenames using backreferences
This lists the uppercase names of all files that end in
sh[zsh]-mode, the the
#s are incorrectly detected as starting comments:
Normally, this wouldn't be a big deal, but unfortunately, this throws the braces out of balance (as indicated by
rainbow-parentheses), which messes with the indentation of the rest of the file, making certain files essentially uneditable.
I took a stab at the
sh-mode source, but it's pretty dizzying. How can I teach Emacs about this syntax, and how can I answer this sort of question myself should anything similar arise in the future?
p.s. see the Emacs bug I filed a while back.