GNU bug report logs -
#62717
29.0.60; c-ts-mode does not indent the first line in a function after RET
Previous Next
Full log
Message #20 received at 62717 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
>
> I'm not sure, though, what is the big deal with adding the top-level
> function's closing curly first thing before writing the body (after
> that the parser starts working much better), so as far as I'm
> concerned this patch is very optional. It does add some complexity,
> after all.
I think this problem also affects languages without curly braces like
Ruby or Python.
For example, if I insert this Ruby code in a buffer with ruby-ts-mode
enabled
def sample RET
The newline is not indented, but it is indented in ruby-mode.
>
> Adding Alan and Joao, who were interested in this scenario as well.
>
> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
> index 981c7766375..9aaa8b32c73 100644
> --- a/lisp/progmodes/c-ts-mode.el
> +++ b/lisp/progmodes/c-ts-mode.el
Thanks for the patch. It works correctly and the existing c-ts-mode
tests pass. I suggest adding a test to prevent regressions:
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 5cdefe2122c..221b3d809af 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -464,3 +464,17 @@ main (void)
|
}
=-=-=
+
+Name: Empty Line (Block Start)
+
+=-=
+int
+main (void)
+{
+|
+=-=
+int
+main (void)
+{
+ |
+=-=-=
This bug report was last modified 2 years and 67 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.