all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* lua-mode: indentation of multi-line conditionals
@ 2023-07-25  4:50 Werner LEMBERG
  2023-07-25 12:02 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Werner LEMBERG @ 2023-07-25  4:50 UTC (permalink / raw)
  To: emacs-devel


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`.



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

* Re: lua-mode: indentation of multi-line conditionals
  2023-07-25  4:50 lua-mode: indentation of multi-line conditionals Werner LEMBERG
@ 2023-07-25 12:02 ` Eli Zaretskii
  2023-07-25 14:41   ` Werner LEMBERG
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2023-07-25 12:02 UTC (permalink / raw)
  To: Werner LEMBERG; +Cc: emacs-devel

> Date: Tue, 25 Jul 2023 04:50:21 +0000 (UTC)
> From: Werner LEMBERG <wl@gnu.org>
> 
> 
> 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

Is this about lua-mode from Non-GNU ELPA?  Or about some other
package?  Because Emacs doesn't include such a mode, AFAICT.




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

* Re: lua-mode: indentation of multi-line conditionals
  2023-07-25 12:02 ` Eli Zaretskii
@ 2023-07-25 14:41   ` Werner LEMBERG
  0 siblings, 0 replies; 3+ messages in thread
From: Werner LEMBERG @ 2023-07-25 14:41 UTC (permalink / raw)
  To: eliz; +Cc: emacs-devel


>> However, this is not what Emacs does by default in Lua mode; you
>> rather get [...]
> 
> Is this about lua-mode from Non-GNU ELPA?  Or about some other
> package?  Because Emacs doesn't include such a mode, AFAICT.

Oops!  Indeed, this is not part of Emacs.  Sorry for the noise, I will
report the problem elsewhere.


    Werner



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

end of thread, other threads:[~2023-07-25 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25  4:50 lua-mode: indentation of multi-line conditionals Werner LEMBERG
2023-07-25 12:02 ` Eli Zaretskii
2023-07-25 14:41   ` Werner LEMBERG

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.