emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lua-mode: indentation of multi-line conditionals


From: Werner LEMBERG
Subject: lua-mode: indentation of multi-line conditionals
Date: Tue, 25 Jul 2023 04:50:21 +0000 (UTC)

Looking at

  https://dev.minetest.net/Lua_code_style_guidelines

I read the following about Lua source code:

> Conditional expressions have continuation lines indented by two
> tabs.[*]

For Emacs, replacing 'tabs' with 'indentation level', this would be

```
if long_function_call(with, many, arguments) and
      another_function_call() then
   do_something()
end
```

However, this is not what Emacs does by default in Lua mode; you
rather get

```
if long_function_call(with, many, arguments) and
   another_function_call() then
   do_something()
end
```

which makes the code hard to read.

Assuming that this functionality is available, how can I activate this
in Lua mode?  Otherwise I wonder whether I should file a bug report.


    Werner


[*] Another recommended way to format multi-line conditionals is
described at

  https://roblox.github.io/lua-style-guide/#newlines-in-long-expressions

```
if
   long_function_call(with, many, arguments)
   and another_function_call()
then
   do_something()
end
```

However, this becomes ugly if you are going to use `else` and
`elseif`.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]