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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 17297 in the body.
You can then email your comments to 17297 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#17297; Package emacs. (Fri, 18 Apr 2014 21:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 18 Apr 2014 21:37:03 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: shell script gets weirdly indented inside case statement
Date: Sat, 19 Apr 2014 05:35:46 +0800
[Message part 1 (text/plain, inline)]
Why the weird indenting for this shell script?

To reproduce, edit the file and do C-x h TAB

[b (application/x-sh, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#17297; Package emacs. (Wed, 23 Apr 2014 03:01:04 GMT) Full text and rfc822 format available.

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





bug closed, send any further explanations to 17297 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Stefan Monnier <monnier <at> IRO.UMontreal.CA> to control <at> debbugs.gnu.org. (Wed, 23 Apr 2014 03:01:08 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 21 May 2014 11:24:05 GMT) Full text and rfc822 format available.

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.