GNU bug report logs - #17297
shell script gets weirdly indented inside case statement

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Fri, 18 Apr 2014 21:37:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 17297 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 17297 <at> debbugs.gnu.org
Subject: Re: bug#17297: shell script gets weirdly indented inside case
 statement
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|\\)\\|$\\)")





This bug report was last modified 11 years and 32 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.