]> git.eshelyaron.com Git - emacs.git/commit
Fix indentation for c-ts-mode (bug#61026)
authorYuan Fu <casouri@gmail.com>
Thu, 26 Jan 2023 07:47:27 +0000 (23:47 -0800)
committerYuan Fu <casouri@gmail.com>
Thu, 26 Jan 2023 07:47:27 +0000 (23:47 -0800)
commitcdf74254ffa2c53612f6d985e3774b51233fbd49
treed1bc32bc8f622bce15efa9335187b10411d4cfed
parent4bd06ce2a9fa1601aff5a5fcab7411e5fce20d28
Fix indentation for c-ts-mode (bug#61026)

Fix indentation for things like

  while (true)
    if (true)
      {
        puts ("Hello");
      }

Note that the outer while loop omits brackets.

* lisp/progmodes/c-ts-mode.el:
(c-ts-mode--statement-offset-post-processr): New variable.
(c-ts-mode--statement-offset): Use the new function.
(c-ts-mode--fix-bracketless-indent): New function.
(c-ts-base-mode): Use the new function.
* test/lisp/progmodes/c-ts-mode-resources/indent.erts: New tests.
lisp/progmodes/c-ts-mode.el
test/lisp/progmodes/c-ts-mode-resources/indent.erts