all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Werner LEMBERG <wl@gnu.org>
To: emacs-devel@gnu.org
Subject: lua-mode: indentation of multi-line conditionals
Date: Tue, 25 Jul 2023 04:50:21 +0000 (UTC)	[thread overview]
Message-ID: <20230725.065021.1043605172004320866.wl@gnu.org> (raw)


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	other threads:[~2023-07-25  4:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  4:50 Werner LEMBERG [this message]
2023-07-25 12:02 ` lua-mode: indentation of multi-line conditionals Eli Zaretskii
2023-07-25 14:41   ` Werner LEMBERG

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230725.065021.1043605172004320866.wl@gnu.org \
    --to=wl@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.