Subject: bug#16500: 24.3.50; Wrong font-lock backquote highlighting in plan9 rc

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 03 Sep 2022 12:02:15 +0200

Vasilij Schneidermann <[email-masked]> writes:

> I've run into this bug while switching all my sh/bash scripts to rc and
> used the following workaround:
>
>     (defun my-sh-set-shell-hook ()
>       (when (member sh-shell '(rc es))
>         (modify-syntax-entry ?` ".")))
>
>     (add-hook 'sh-set-shell-hook 'my-sh-set-shell-hook)
>
> I doubt this warrants inclusion into sh-script.el as is, but should
> demonstrate a possible approach how to fix it.

But we want the {...} to be fontified as a quoted-exec, so I think the
correct fix here is to make { } be a pair after ` in the rc version?

That is, tweak this:

(defun sh-font-lock-syntactic-face-function (state)
  (let ((q (nth 3 state)))
    (if q
        (if (characterp q)
            (if (eq q ?\`) 'sh-quoted-exec font-lock-string-face)
          'sh-heredoc)
      font-lock-comment-face)))

Possibly...