From: Lynn Winebarger <owinebar@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, Dmitry Gutov <dgutov@yandex.ru>,
dancol@dancol.org, Yuan Fu <casouri@gmail.com>,
emacs-devel <emacs-devel@gnu.org>,
Theodor Thornhill <theo@thornhill.no>
Subject: Re: treesit indentation "blinking"
Date: Wed, 29 Mar 2023 18:56:01 -0400 [thread overview]
Message-ID: <CAM=F=bBygVHk4xH4GNcoV=XiZX3T=pFcG6RApUggkdOxhZcxRg@mail.gmail.com> (raw)
In-Reply-To: <CALDnm51Gf+ttkf4sFEGzsDd23fS1a1J4kAwG1fym20wSaS+yMQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2875 bytes --]
On Wed, Mar 29, 2023, 6:29 PM João Távora <joaotavora@gmail.com> wrote:
> On Wed, Mar 29, 2023 at 3:26 AM Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > From: João Távora <joaotavora@gmail.com>
> > > Cc: Dmitry Gutov <dgutov@yandex.ru>, dancol@dancol.org,
> casouri@gmail.com,
> > > emacs-devel@gnu.org, theo@thornhill.no
> > > Date: Tue, 28 Mar 2023 23:11:05 +0100
> > >
> > > Though a number of indenting problems would remain after that, at least
> > > this one clear annoyance would be solved. So if there are no
> > > objections, I propose to apply this patch.
> > >
> > > diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
> > > index 59eb9fc23e6..88360716381 100644
> > > --- a/lisp/progmodes/c-ts-mode.el
> > > +++ b/lisp/progmodes/c-ts-mode.el
> > > @@ -956,10 +956,6 @@ c-ts-base-mode
> > > ;; Comment
> > > (c-ts-common-comment-setup)
> > >
> > > - ;; Electric
> > > - (setq-local electric-indent-chars
> > > - (append "{}():;,#" electric-indent-chars))
> > > -
> > > ;; Imenu.
> > > (setq-local treesit-simple-imenu-settings
> > > (let ((pred #'c-ts-mode--defun-valid-p))
> > >
> > > In master? In emacs-29?
> >
> > I suggest to do this in emacs-29, but conditionally, with a
> > defcustom. This will allow users to try both ways and maybe we will
> > have some feedback regarding what is the best way.
>
> I'm not fond of creating a defcustom to work around what I consider
> as a simple bug and to configure something which the user can already
> configure with a two-line mode hook addition. So I won't do that
> change myself.
>
> > I'm also interested to know what other editors do, as Daniel points
> > out.
>
> I don't use many other editors but I can tell you that online editors
> like the ones found at hackerrank.com, which I strongly suspect are
> based on LSP + treesitter behave as if electric-pair-mode was on
> and electric-indent-chars is just '(?\n). I.e. they auto-indent
> on newline and don't bounce around when symbols such as ':',')' or
> ';' are typed. As far as I can tell, auto-indenting on characters
> other than newline is an Emacs invention that only works well if a
> mode has near-perfect predictive powers of indentation, which
> c++-ts-mode clearly doesn't have (yet).
>
> And then my personal opinion is that it is an annoying
> feature to have on by default as it whole lines about.
> Having electric-indent-chars set to '(?\n), like c++-mode
> has, is fine.
>
I would think the advantage of using tree-sitter is triggering formatting
based on lexemes and grammar symbols rather than raw characters. So
instead of ';' a formatting action might be triggered by the parser
deducing a lexeme/symbol STATEMENT-SEPARATOR, as opposed to a ';'
separating clauses in a for statement.
Lynn
[-- Attachment #2: Type: text/html, Size: 4430 bytes --]
next prev parent reply other threads:[~2023-03-29 22:56 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 20:49 treesit indentation "blinking" Daniel Colascione
2023-03-23 0:00 ` Yuan Fu
2023-03-23 0:07 ` Daniel Colascione
2023-03-23 1:02 ` Yuan Fu
2023-03-23 4:51 ` Daniel Colascione
2023-03-23 20:04 ` Yuan Fu
2023-03-23 21:10 ` Daniel Colascione
2023-03-23 21:24 ` Dmitry Gutov
2023-03-25 9:05 ` João Távora
2023-03-25 12:42 ` Dmitry Gutov
2023-03-25 14:42 ` Eli Zaretskii
2023-03-25 16:18 ` João Távora
2023-03-28 22:11 ` João Távora
2023-03-28 23:57 ` Daniel Colascione
2023-03-29 2:26 ` Eli Zaretskii
2023-03-29 22:30 ` João Távora
2023-03-29 22:37 ` Herman, Géza
2023-03-29 23:25 ` João Távora
2023-03-30 7:47 ` Herman, Géza
2023-03-29 22:56 ` Lynn Winebarger [this message]
2023-03-30 7:43 ` Eli Zaretskii
2023-03-30 8:58 ` Dmitry Gutov
2023-03-30 9:15 ` João Távora
2023-03-30 9:06 ` João Távora
2023-03-30 9:20 ` Dmitry Gutov
2023-03-30 9:28 ` João Távora
2023-03-30 9:36 ` Dmitry Gutov
2023-03-30 10:00 ` João Távora
2023-03-30 16:29 ` Dmitry Gutov
2023-03-30 17:14 ` João Távora
2023-03-30 10:07 ` Eli Zaretskii
2023-03-30 10:26 ` Herman, Géza
2023-03-30 13:39 ` Eli Zaretskii
2023-03-30 15:03 ` Herman, Géza
2023-03-30 14:58 ` Eli Zaretskii
2023-04-01 19:39 ` Yuan Fu
2023-04-02 1:49 ` Yuan Fu
2023-04-02 5:31 ` Eli Zaretskii
2023-04-02 14:26 ` Alan Mackenzie
2023-04-02 15:48 ` João Távora
2023-04-02 17:04 ` Alan Mackenzie
2023-04-02 17:23 ` João Távora
2023-04-02 17:51 ` Eli Zaretskii
2023-04-02 18:04 ` João Távora
2023-04-02 18:14 ` Eli Zaretskii
2023-04-02 21:38 ` João Távora
2023-04-02 21:21 ` Dmitry Gutov
2023-04-02 21:40 ` João Távora
2023-04-03 9:59 ` Alan Mackenzie
2023-04-03 10:28 ` João Távora
2023-04-03 12:07 ` Dmitry Gutov
2023-04-03 12:56 ` Alan Mackenzie
2023-04-03 20:58 ` Dmitry Gutov
2023-04-03 21:59 ` Daniel Colascione
2023-04-03 22:10 ` Dmitry Gutov
2023-04-04 8:31 ` João Távora
2023-04-07 14:20 ` Daniel Martín
2023-04-08 1:32 ` Dmitry Gutov
2023-04-08 2:42 ` Yuan Fu
2023-04-08 18:59 ` Daniel Martín
2023-04-03 21:47 ` parser error recovery algorithm vs " Stephen Leake
2023-04-04 12:01 ` John Yates
2023-04-04 13:40 ` Dmitry Gutov
2023-04-04 16:00 ` Stephen Leake
2023-04-04 13:50 ` Stephen Leake
2023-04-04 14:05 ` Dmitry Gutov
2023-03-30 11:05 ` João Távora
2023-03-30 14:00 ` Eli Zaretskii
2023-03-30 14:43 ` João Távora
2023-03-30 14:52 ` Eli Zaretskii
2023-03-30 15:42 ` João Távora
2023-03-25 16:14 ` João Távora
2023-03-24 11:39 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM=F=bBygVHk4xH4GNcoV=XiZX3T=pFcG6RApUggkdOxhZcxRg@mail.gmail.com' \
--to=owinebar@gmail.com \
--cc=casouri@gmail.com \
--cc=dancol@dancol.org \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=joaotavora@gmail.com \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).