unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: "Daniel Martín" <mardani29@yahoo.es>,
	"Stefan Monnier" <monnier@iro.umontreal.ca>
Cc: Eason Huang <aqua0210@foxmail.com>,
	casouri@gmail.com, 60087@debbugs.gnu.org
Subject: bug#60087: 29.0.60; c++-ts-mode conflict with electric-pair-mode
Date: Thu, 15 Dec 2022 21:43:19 +0000	[thread overview]
Message-ID: <CALDnm51H6M2mpitMxP=FwF-KabEVqRLk+pn7sFZmacEyJD9L6Q@mail.gmail.com> (raw)
In-Reply-To: <m1wn6ss65r.fsf@yahoo.es>

[-- Attachment #1: Type: text/plain, Size: 1855 bytes --]

On Thu, Dec 15, 2022 at 9:34 PM Daniel Martín <mardani29@yahoo.es> wrote:
>
> João Távora <joaotavora@gmail.com> writes:
>
> > I don't know how this can work if '<' is going to be used to input
> > the less-than operator.  I think more complex syntax-propertization
> > functionality is going to be needed here.  I don't have a tree-sitter
> > build to test, but I'd say that the tree-sitter backend should be asked
> > about what kind of '<' and '>' we're talking about.  AFAICT, just
> > saying that '<' has the delimiter syntax in C++ is wrong. It's not
> > like '(' or '{.'
>
> Yes, you are right.  I think for now it's better to consider them as
> punctuation.
>
> A better idea may be to add a syntax-table text property to "<" and ">"
> when they define a C++ template (or a Java generic).  Tree-sitter can
> match something like a "template_argument_list" node easily, but I
> wonder how to keep this information in sync with the buffer text in the
> most efficient way?

Supposedly this is what I understand tree-sitter to be very very good
at.  My completely naive and absolutely ignorant understanding of the
new tree sitter modes is that once you insert something into the buffer,
tree sitter is immediately notified, recomputes the syntax tree very
efficiently and incrementally, then Emacs can immediately take advantage
of that in the `syntax-propertize-function`, applying the correct syntax
to each separate manifestation of the '<' and '>' characters.  Hopefully
all of this runs in time for post-self-insert-hook to see the correct syntax
class and thus electric-pair-mode, which relies on p-s-i-h can do the
right thing each time.

Again, this is completely my vapourware idea of how all this was
implemented.  I'll also CC: Stefan who is my syntax-propertize
and electric-*-mode sensei.

João

[-- Attachment #2: Type: text/html, Size: 2419 bytes --]

  reply	other threads:[~2022-12-15 21:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 11:17 bug#60087: 29.0.60; c++-ts-mode conflict with electric-pair-mode Eason Huang
2022-12-15 12:24 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 13:10   ` João Távora
2022-12-15 21:34     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-15 21:43       ` João Távora [this message]
2022-12-27  9:03         ` Eason Huang
2022-12-29  6:10           ` Eason Huang
2022-12-29  6:33             ` Eli Zaretskii
2022-12-29  8:43             ` Yuan Fu
2022-12-29  9:07               ` João Távora
2022-12-15 13:05 ` João Távora
2022-12-15 13:21   ` Eason Huang

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='CALDnm51H6M2mpitMxP=FwF-KabEVqRLk+pn7sFZmacEyJD9L6Q@mail.gmail.com' \
    --to=joaotavora@gmail.com \
    --cc=60087@debbugs.gnu.org \
    --cc=aqua0210@foxmail.com \
    --cc=casouri@gmail.com \
    --cc=mardani29@yahoo.es \
    --cc=monnier@iro.umontreal.ca \
    /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).