3

I get the following indentation for my bash script

for i in *; {
    echo $i
}
         echo done

The last indent is wrong and should be zero spaces.

How can this be fixed?

  • I removed the part about Emacs 25 because I see the same thing in Emacs 24.5. – Dan Feb 15 '17 at 17:15
  • Alright. Although I just realized seeing it recently after switching to emacs 25 from 24 and I also don't see it on emacs 23. Maybe it just started on a recent emacs 24 or I just happened to not notice. Anyway thanks for pointing this out! – Frank Breitling Feb 15 '17 at 17:20
  • Use for i in *; do ... end? – Stefan Feb 16 '17 at 15:33
  • The workaround is do ... done. But I think someone needs to file an emacs bug report. – Frank Breitling Feb 16 '17 at 17:05
  • It's not a workaround; do ... done is the only documented syntax: gnu.org/software/bash/manual/html_node/Looping-Constructs.html – Philipp Feb 18 '17 at 16:47
3

I have reported this as emacs bug 25768 at

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25768.

However, this is not the only indentation problem. More can be found in the emacs bug tracker and others should be reported via M-x report-emacs-bug.

  • FYI indentation is not provided by any single library in Emacs, so there's no one problem area, or thing to "overhaul". The indentation code for a given mode may (or may not) be 100% unique to that mode. – phils Feb 17 '17 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.