Hi

One more observation is that it's the subshell, code in parens, that's not handled correctly. In the following example, the indentation in haveid3 is incorrect so the issue is not due to the std handle redirects.

#!/bin/bash

haveid1 () {
    (id) 2> /dev/null 1>&2
         if [ $? -eq 0 ]; then
             echo "haveid1: yes"
         else
             echo "haveid1: no"
         fi
         x = 1
         
}

haveid2 () {
    id 2> /dev/null 1>&2
    if [ $? -eq 0 ]; then
        echo "haveid2: yes"
    else
        echo "haveid2: no"
    fi
}

haveid3 () {
    (id)
        if [ $? -eq 0 ]; then
            echo "haveid2: yes"
        else
            echo "haveid2: no"
        fi
}




On Wed, Apr 30, 2025 at 8:49 AM John C <john.ciolfi.32@gmail.com> wrote:
Hi 

I debugged this a little and see the regression occurred when sh-script.el  sh-font-lock-paren was changed in Emacs 30 to have:

                    ;; Also recognize OpenBSD's case X { ... } (bug#55764).
                    (and (looking-at ";\\(?:;&?\\|[&|]\\)\\|\\_<in\\|.{")

where the Emacs 29 had:


                    (and (looking-at ";[;&]\\|\\_<in")

when I modify Emacs 30 sh-script.el to revert this one line back to the Emacs 29 content, we get the correct answer. I suspect reverting this line is not the right thing to do. Rather, I hope it helps someone find the solution.

Thanks
John