0

Let us start with an unaligned piece of code

case $word in
pattern1)
command1
;;
*)
command_defaultcase
;;
esac

I can align this code by selecting the lines and pressing TAB. The result is:

case $word in
    pattern1)
        command1
        ;;
    *)
        command_defaultcase
        ;;
esac

However, the result is different if the pattern involves $:

case $word in
    $pattern1)
    command1
    ;;
    *)
        command_defaultcase
        ;;
esac

The emacs version I use is GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23) of 2015-02-20 on lxdist01.

What is wrong?

  • I can't replicate that in Emacs 25.3. Which version are you using? – phils Dec 23 '17 at 11:12
  • @phils I updated my question. – Viesturs Dec 23 '17 at 11:22
  • Also not reproduceable on emacs 24.5.1. – Tobias Dec 23 '17 at 19:01
  • @Tobias, I also cannot reproduce the problem in Emacs 24.5.1. – Viesturs Dec 23 '17 at 19:12
  • So, why not using emacs 24.5.1? – Tobias Dec 23 '17 at 20:05
2

Based on the comments, it seems clear that there was a bug in sh-mode in Emacs 23.1 which was fixed in some subsequent version (certainly by 24.5). So that explains "what is wrong".

If you cannot upgrade Emacs, you could try just using the sh-script.el from a newer version -- it's possible that it will work.

n.b. Any newer version which depends on lexical binding will not work correctly in Emacs 23 (although the presence of -*- lexical-binding:t -*- does not necessarily mean that the library depends on it -- it may just mean that it was confirmed to work with it as-is).

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.