0

My EMACS (26.3) thinks the line after

for i (`seq 1 10`) echo $i

should be indented. Is this a bug?

  • 1
    If the indentation is incorrect, then it's a bug. Whether the indentation is correct is not an Emacs-related question. So either ask the question to a zsh-related group, or M-x report-emacs-bug, or ask a different question. – Stefan Mar 16 at 12:43
  • @Drew, sh-mode. mode line shows zsh is recognized. typing the line in zsh works, so i don't think anything is missing. – Toothrot Mar 16 at 16:29
1

If sh-use-smie is set to t the Simple Minded Indentation Engine (SMIE) is used for indentation. As you experience, the sh-mode setup for SMIE does not cover all the alternate complex commands of zsh yet.

Note that those forms should not be used in new programs. I cite the zsh doc:

These are non-standard and are likely not to be obvious even to seasoned shell programmers; they should not be used anywhere that portability of shell code is a concern.

Nevertheless, it may be that you have to fight with such forms in legacy software.

If you set sh-use-smie to nil the line after the short form of the alternate form of for is not indented.

Disclaimer: I do not know the negative consequences of setting sh-use-smie to nil.

This bug already has a long-standing bug report on bug-gnu-emacs. It is also registered in the bug tracker. But it looks like nobody cares.

| improve this answer | |
  • I don't see that the cited passage actually says they shouldn't be used in new programmes, or implies it? In any case, this is just a line in my zshrc, so I think I'll just change it to the normal form. – Toothrot Mar 17 at 12:25

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.