all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: miha@kamnitnik.top
Cc: 59693@debbugs.gnu.org
Subject: bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly
Date: Wed, 30 Nov 2022 02:17:14 -0800	[thread overview]
Message-ID: <5F7AE71F-0327-409E-BCE9-310E1980C17A@gmail.com> (raw)
In-Reply-To: <87r0xlbjg6.fsf@miha-pc>


miha@kamnitnik.top writes:

>     *** Welcome to IELM ***  Type (describe-mode) or press C-h m for help.
>     ELISP> (set-buffer (get-buffer-create "a"))
>     ELISP> (insert "int main();")
>     ELISP> (require 'treesit)
>     ELISP> (treesit-node-children (treesit-node-child (treesit-buffer-root-node 'c) 0))
>     (#<treesit-node
>       (primitive_type)
>       in 1-4> #<treesit-node
>       (function_declarator)
>       in 5-11> #<treesit-node ";" in 11-12>)
>
> This is expected
>
>     ELISP> (set-buffer (make-indirect-buffer "a" "b"))
>     ELISP> (goto-char (point-min))
>     ELISP> (insert " ")
>     ELISP> (set-buffer "a")
>     ELISP> (buffer-string)
>     " int main();"
>
>     ELISP> (treesit-node-children (treesit-node-child (treesit-buffer-root-node 'c) 0))
>     (#<treesit-node
>       (primitive_type)
>       in 1-4> #<treesit-node
>       (function_declarator)
>       in 5-11> #<treesit-node
>       (ERROR)
>       in 11-12> #<treesit-node ";" in 12-13>)
>
> This is unexpected. If we had called '(insert " ")' in the base buffer
> "a", we would have got
>
>     (#<treesit-node
>       (primitive_type)
>       in 2-5> #<treesit-node
>       (function_declarator)
>       in 6-12> #<treesit-node ";" in 12-13>)
>
> Thanks for your hard work.

Thanks! I forgot about indirect buffers... We’ll need to make sure to
use the parsers in the original buffer when user edits the indirect
buffer, or something like that. I need to look into how does indirect
buffer works.

Yuan





  reply	other threads:[~2022-11-30 10:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 20:21 bug#59693: 29.0.50; treesitter in base buffer doesn't respond to modifications in indirect buffer correctly miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-30 10:17 ` Yuan Fu [this message]
2022-11-30 14:05   ` Eli Zaretskii
2022-12-02  5:05     ` Yuan Fu
2022-12-02  8:33       ` Eli Zaretskii
2022-12-03  1:01         ` Yuan Fu
2022-12-04  7:20           ` Yuan Fu
2022-12-04  7:46             ` Eli Zaretskii
2022-12-04 23:21               ` Yuan Fu
2022-12-05  3:49       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05  8:19         ` Eli Zaretskii
2022-12-05 15:29           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-05 15:44             ` Eli Zaretskii
2022-12-05 20:14               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-06  2:15               ` Yuan Fu
2022-12-06  3:57                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-06 12:17                 ` Eli Zaretskii
2022-12-07 23:13                   ` Yuan Fu
2022-12-08  6:47                     ` Eli Zaretskii
2022-12-10  1:41 ` Yuan Fu

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=5F7AE71F-0327-409E-BCE9-310E1980C17A@gmail.com \
    --to=casouri@gmail.com \
    --cc=59693@debbugs.gnu.org \
    --cc=miha@kamnitnik.top \
    /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.