all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dmitry@gutov.dev>
To: Eli Zaretskii <eliz@gnu.org>
Cc: casouri@gmail.com, theo@thornhill.no, 62717@debbugs.gnu.org,
	mardani29@yahoo.es, joaotavora@gmail.com, acm@muc.de
Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET
Date: Sun, 9 Apr 2023 19:33:20 +0300	[thread overview]
Message-ID: <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> (raw)
In-Reply-To: <83a5zhmy3r.fsf@gnu.org>

On 09/04/2023 08:19, Eli Zaretskii wrote:
>> Cc: Theodor Thornhill<theo@thornhill.no>, Yuan Fu<casouri@gmail.com>,
>>   62717@debbugs.gnu.org,
>>   João Távora<joaotavora@gmail.com>,
>>   Alan Mackenzie<acm@muc.de>
>> Date: Sun, 9 Apr 2023 03:20:23 +0300
>> From: Dmitry Gutov<dmitry@gutov.dev>
>>
>> What does this mean for us? Short of reimplementing nvim-treesitter's
>> algorithm (and I haven't read Atom's or Zed's indentation code;
>> anybody's welcome to chime in with a summary of either), we could just
>> install the patch at the end of this message: it fixes this particular
>> case, in a bit hackish way, but at least it doesn't affect other languages.
>>
>> Note that it still doesn't fix very similar cases, e.g.
>>
>>     int main () {
>>       for (;;) {<RET>
>>
>> (we need additional rules looking for ERROR nodes, like in nvim's
>> indent.scm), but in does fix
>>
>>     int main () {
>>       for (;;) {}<RET>
>>
>> and
>>
>>     int main () {
>>       int foo;<RET>
>>
>> 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.
> If the patch solves some of the problems, passes the test suite, and
> doesn't introduce any regressions you see, I think you should install
> it (unless someone here objects).

With this kind of change, it's hard to judge regression potential in 
advance. I don't really write C/C++ myself with any regularity. And our 
test suite doesn't really work incomplete parse trees, I think.

So if we want this in emacs-29, I think someone interested should try 
running with this patch applied, at least for a little bit. Maybe just 
wait for a couple of days, if Daniel is testing it already.





  reply	other threads:[~2023-04-09 16:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m1355ba2xr.fsf.ref@yahoo.es>
2023-04-07 19:48 ` bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-08  1:57   ` Dmitry Gutov
2023-04-08 18:37     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-09  0:20       ` Dmitry Gutov
2023-04-09  5:19         ` Eli Zaretskii
2023-04-09 16:33           ` Dmitry Gutov [this message]
2023-04-09 17:37             ` Eli Zaretskii
2023-04-10  0:36               ` Dmitry Gutov
2023-04-10 21:04                 ` Yuan Fu
2023-04-09 11:05         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-09 16:30           ` Dmitry Gutov

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=9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev \
    --to=dmitry@gutov.dev \
    --cc=62717@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=casouri@gmail.com \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=mardani29@yahoo.es \
    --cc=theo@thornhill.no \
    /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.