Subject: bug#7947: Does sh-script.el recognize new case grammar ; & and ; ; & ?

From: Stefan Monnier <[email-masked]>
Date: Tue, 01 Feb 2011 12:56:23 -0500

SM> a reference describing what it means

> $ man bash|grep ';&'
>               matches are attempted after the first pattern match.  Using ;&
> in place of ;; causes execution to continue
>               with the list associated with the next set of patterns.
> Using ;;& in place of ;; causes the shell to test
> Also on Debian in /usr/share/doc/abs-guide/examples/case4.sh

> All I know is indenting seems funny around them when using emacs'
> sh-script.el .

Does the patch below fix things for you?

        Stefan

=== modified file 'lisp/progmodes/sh-script.el'
--- lisp/progmodes/sh-script.el	2011-01-26 08:36:39 +0000
+++ lisp/progmodes/sh-script.el	2011-02-01 17:55:26 +0000
@@ -1104,7 +1104,7 @@
                  ;; a normal command rather than the real `in' keyword.
                  ;; I.e. we should look back to try and find the
                  ;; corresponding `case'.
-                 (looking-at ";;\\|in"))
+                 (looking-at ";[;&]\\|in"))
       sh-st-punc)))
 
 (defun sh-font-lock-backslash-quote ()
@@ -1659,6 +1659,8 @@
      ("esac" sh-handle-this-esac sh-handle-prev-esac)
      (case-label nil sh-handle-after-case-label) ;; ???
      (";;" nil sh-handle-prev-case-alt-end) ;; ???
+     (";;&" nil sh-handle-prev-case-alt-end) ;; ???
+     (";&" nil sh-handle-prev-case-alt-end) ;; ???
      ("done" sh-handle-this-done sh-handle-prev-done)
      ("do" sh-handle-this-do sh-handle-prev-do))
 
@@ -2496,7 +2498,7 @@
                          (sh-prev-line nil)
                        (line-beginning-position))))
       (skip-chars-backward " \t;" min-point)
-      (if (looking-at "\\s-*;;")
+      (if (looking-at "\\s-*;[;&]")
           ;; (message "Found ;; !")
           ";;"
         (skip-chars-backward "^)}];\"'`({[" min-point)