Subject: Re: bug#9190: 24.0.50; wrong indentation in shell mode with main function
From: Stefan Monnier <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Tue, 02 Aug 2011 22:00:53 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> 2) paste the following

> main () {
> }

> 3) press tab on the last line

> The curly bracket is indented wrong:

> main () {
>     }

> The curly bracket is incorrectly indented. It happens to any function
> ending in main. Reproducible on emacs 23.3 and bzr.

Indeed, it's the case for any function ending in "in".  I've installed
the patch below which should fix the problem,

        Stefan

--- lisp/progmodes/sh-script.el	2011-04-22 18:44:26 +0000
+++ lisp/progmodes/sh-script.el	2011-08-03 01:54:12 +0000
@@ -1066,7 +1066,7 @@
                  ;; a normal command rather than the real `in' keyword.
                  ;; I.e. we should look back to try and find the
                  ;; corresponding `case'.
-                   (and (looking-at ";[;&]\\|in")
+                   (and (looking-at ";[;&]\\|\\_<in")
                         ;; ";; esac )" is a case that looks like a case-pattern
                         ;; but it's really just a close paren after a case
                         ;; statement.  I.e. if we skipped over `esac' just now,