bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#61502: 29.0.60; c-ts-mode auto-indent not working


From: Dmitry Gutov
Subject: bug#61502: 29.0.60; c-ts-mode auto-indent not working
Date: Tue, 14 Feb 2023 22:59:03 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 14/02/2023 21:41, Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote:
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 749781894b..300a703515 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1418,6 +1418,8 @@ treesit--indent-1
           ;; encompass the whitespace.
           (parent (cond ((and node parser)
                          (treesit-node-parent node))
+                       ((equal (treesit-node-type smallest-node) "}")
+                        (treesit-node-parent smallest-node))
                         (t (treesit-node-on bol bol)))))
        (funcall treesit-indent-function node parent bol))))

Is it a good idea to add C-specific constants to generic code?

Other modes might not have a node called "}" at all.





reply via email to

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