Subject: bug#17297: shell script gets weirdly indented inside case statement

From: Stefan Monnier <[email-masked]>
Date: Sat, 19 Apr 2014 13:14:46 -0400

> Why the weird indenting for this shell script?

It's just that the tokenizer was confused with "do=", taken "do" for the
keyword used in "while foo; do bar; done" rather than
a variable identifier.  I installed the patch below which should fix it.

        Stefan

=== modified file 'lisp/progmodes/sh-script.el'
--- lisp/progmodes/sh-script.el	2014-03-05 19:02:55 +0000
+++ lisp/progmodes/sh-script.el	2014-04-19 17:12:02 +0000
@@ -1832,9 +1832,10 @@
 
 (defun sh-smie--sh-keyword-p (tok)
   "Non-nil if TOK (at which we're looking) really is a keyword."
-  (if (equal tok "in")
-      (sh-smie--sh-keyword-in-p)
-    (sh-smie--keyword-p)))
+  (cond
+   ((looking-at "[[:alnum:]_]+=") nil)
+   ((equal tok "in") (sh-smie--sh-keyword-in-p))
+   (t (sh-smie--keyword-p))))
 
 (defun sh-smie-sh-forward-token ()
   (if (and (looking-at "[ \t]*\\(?:#\\|\\(\\s|\\)\\|$\\)")