From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#75122: Treesit support for show-paren-mode Date: Fri, 27 Dec 2024 09:37:50 +0200 Organization: LINKOV.NET Message-ID: <87frm9vc1l.fsf@mail.linkov.net> References: <878qs2z477.fsf@mail.linkov.net> <6b729636-accf-4872-9b5e-627ec18bb255@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5854"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Yuan Fu , 75122@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 27 08:47:13 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tR53w-0001J5-KZ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Dec 2024 08:47:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tR53q-00043r-Mu; Fri, 27 Dec 2024 02:47:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tR53n-00043P-Ni for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 02:47:04 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tR53n-0000N5-BV for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 02:47:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=8Wg5yUoEZZ1p5RFacfHfOmO3LIPH+zpPmoYYf/3cqTg=; b=sKdonIEpd3hx2K6VQgFeH+4+eCjYwVDQXgBwAV/h/qYH8vCcA2tEa+DVjvySAb2t07EKSv2WxAB6HQ8eu/y/z3nWt3HtyMw5IqWXG7wdTLj2PMbl/fMMIm0mWkQrjr2e3SE291dP0+kqsrPU+oXm7pPrbcjzOxhWBRC6gA3FxzrWhZXYqZx5clZKMlWy5tMqp3geYw4V2/ORMdovAUJnJ63k8DyLuchddO+Ehr8yasizv+UlGo6BL4Le2y7V2XcYfVTNx6HzBBPKgODw068w2IINSFlGKKiAHoKJIiGwX68hLrvjU6aLrMA5wTvmyHK7n5UDxyXDunRZKKN/QoCR5g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tR53n-0001Aj-68 for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 02:47:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2024 07:47:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75122 X-GNU-PR-Package: emacs Original-Received: via spool by 75122-submit@debbugs.gnu.org id=B75122.17352855624376 (code B ref 75122); Fri, 27 Dec 2024 07:47:03 +0000 Original-Received: (at 75122) by debbugs.gnu.org; 27 Dec 2024 07:46:02 +0000 Original-Received: from localhost ([127.0.0.1]:44548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR52o-00018I-4T for submit@debbugs.gnu.org; Fri, 27 Dec 2024 02:46:02 -0500 Original-Received: from relay9-d.mail.gandi.net ([217.70.183.199]:39075) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tR52l-00017v-Pe for 75122@debbugs.gnu.org; Fri, 27 Dec 2024 02:46:00 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id DAC30FF802; Fri, 27 Dec 2024 07:45:50 +0000 (UTC) In-Reply-To: <6b729636-accf-4872-9b5e-627ec18bb255@gutov.dev> (Dmitry Gutov's message of "Thu, 26 Dec 2024 22:07:12 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297808 Archived-At: >> +(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.