all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: Yuan Fu <casouri@gmail.com>, 75122@debbugs.gnu.org
Subject: bug#75122: Treesit support for show-paren-mode
Date: Fri, 27 Dec 2024 09:37:50 +0200	[thread overview]
Message-ID: <87frm9vc1l.fsf@mail.linkov.net> (raw)
In-Reply-To: <6b729636-accf-4872-9b5e-627ec18bb255@gutov.dev> (Dmitry Gutov's message of "Thu, 26 Dec 2024 22:07:12 +0200")

>> +(defun treesit-show-paren-data ()
>> +  "A function suitable for `show-paren-data-function' (which see)."
>> +  (let* ((node (treesit-thing-at (point) 'sexp-list))
>> +         (beg (when node (treesit-node-start node)))
>> +         (end (when node (treesit-node-end node))))
>> +    ;; When after the closing node, try the previous position inside the node
>
> The comment doesn't seem to correspond to the code, or anyway to all the
> cases the code might be handling? I might misunderstand, though.

Sorry for the unclear comment.  I meant that when detecting
the opening node we should use (point).  But for detecting
the closing node we need to check (1- (point)) that is
inside the balanced node at the end of the node.

>> +    (unless (or (eq (point) beg) (eq (point) end) (bobp))
>> +      (setq node (treesit-thing-at (1- (point)) 'sexp-list)
>> +            beg (when node (treesit-node-start node))
>> +            end (when node (treesit-node-end node))))
>
> Without getting into more details, it seems the user options
> show-paren-when-point-inside-paren and show-paren-when-point-in-periphery
> are not handled (don't have any effect).

Thanks for referencing these options.  I didn't dig deeper since
I didn't see these options in the SMIE implementation.  But
these options definitely should be consulted to adjust the location
used in '(treesit-thing-at (1- (point)) ...'

> Not sure what's needed for that, but FWIW SMIE's show-paren integration
> seems to react to the value of the first of these options (even though it's
> never referenced directly in smie.el), while the second one is not
> supported there either.

This is strange since neither is referenced in smie.el.
Ok, need to investigate more.





      reply	other threads:[~2024-12-27  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26 18:31 bug#75122: Treesit support for show-paren-mode Juri Linkov
2024-12-26 20:07 ` Dmitry Gutov
2024-12-27  7:37   ` Juri Linkov [this message]

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=87frm9vc1l.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=75122@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=dmitry@gutov.dev \
    /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.