Subject: bug#70785: [PATCH] Improve indentation in 'lua-ts-mode'

From: john muhl <[email-masked]>
Date: Sun, 05 May 2024 07:54:04 -0500

Tags: patch

I was contacted off-list about a few tweaks to the indentation.
They seemed fine so here they are.

1. Change it so that comments are ignored when indenting table
fields and function arguments/parameters:

  -- before
  local mt = { -- the comment
               first = 1,
               second = 2,
             }

  -- after
  local mt = { -- the comment
    first = 1,
    second = 2,
  }

2. It also changes how tables are handled in function arguments:

  -- before
  fn(true, {
             x = 1,
             y = 0,
           })

  -- after
  fn(true, {
    x = 1,
    y = 0,
  })

3. And it changes how simple use of an anonymous function is indented:

  -- before
  fn(function()
       print'ok'
     end)

  -- after
  fn(function()
    print'ok'
  end)

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-05-02 built on localhost
Repository revision: 962bb71b4a813eb9c3832494746695d32d6f9109
Repository branch: master
System Description: Fedora Linux 39 (Thirty Nine)

Configured using:
 'configure --with-pgtk --prefix=/home/jm/.local'