bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#17297: shell script gets weirdly indented inside case statement
Date: Sat, 19 Apr 2014 13:14:46 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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|\\)\\|$\\)")






reply via email to

[Prev in Thread] Current Thread [Next in Thread]