unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#17297: shell script gets weirdly indented inside case statement
@ 2014-04-18 21:35 積丹尼 Dan Jacobson
  2014-04-19 17:14 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: 積丹尼 Dan Jacobson @ 2014-04-18 21:35 UTC (permalink / raw)
  To: 17297

[-- Attachment #1: Type: text/plain, Size: 94 bytes --]

Why the weird indenting for this shell script?

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


[-- Attachment #2: shell script --]
[-- Type: application/x-sh, Size: 994 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#17297: shell script gets weirdly indented inside case statement
  2014-04-18 21:35 bug#17297: shell script gets weirdly indented inside case statement 積丹尼 Dan Jacobson
@ 2014-04-19 17:14 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2014-04-19 17:14 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 17297

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






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-19 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-18 21:35 bug#17297: shell script gets weirdly indented inside case statement 積丹尼 Dan Jacobson
2014-04-19 17:14 ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).