From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#19080: 24.4; wish: enable show-paren-mode to highlight matching same-level keywords Date: Fri, 13 May 2022 08:52:50 +0300 Message-ID: <83k0aqnfm5.fsf@gnu.org> References: <878ujat60c.fsf@berdine.net> <87lev734ok.fsf@gnus.org> <8335hfqpm5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9367"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 19080@debbugs.gnu.org, larsi@gnus.org, josh@berdine.net To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 13 07:53:14 2022 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 1npOEi-0002BM-Pq for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 07:53:12 +0200 Original-Received: from localhost ([::1]:43068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1npOEh-0005qU-65 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 May 2022 01:53:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npOEY-0005qM-Rb for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 01:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48866) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1npOEY-0003zy-JB for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 01:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1npOEY-0000wh-Ha for bug-gnu-emacs@gnu.org; Fri, 13 May 2022 01:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 May 2022 05:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19080 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 19080-submit@debbugs.gnu.org id=B19080.16524211733616 (code B ref 19080); Fri, 13 May 2022 05:53:02 +0000 Original-Received: (at 19080) by debbugs.gnu.org; 13 May 2022 05:52:53 +0000 Original-Received: from localhost ([127.0.0.1]:42763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npOEP-0000wG-Gi for submit@debbugs.gnu.org; Fri, 13 May 2022 01:52:53 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1npOEN-0000vz-R8 for 19080@debbugs.gnu.org; Fri, 13 May 2022 01:52:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:54984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npOEI-0003ty-7y; Fri, 13 May 2022 01:52:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=AztCEn5GX6XR647qe0hC4EPh54LwpIo9AtPSVRS0JzM=; b=X2+pxAGDWL1cqZjnxN22 AwOUoLoHqu+0IQ+clTK/eCf0R7FDOeEiMDZaNCADJ7GtabJk5jlyclUrFfmDU+Z2sE97BcjCg+vBd y87/00XCAOu5OhWhVHrAH2cnuQbDQWg+kCoau3JbXf5h7RGj/ZfJvUu1xobchHSmOL+f5muGpShKO 6aWTlLHJs9KWpT6iMtJoEUReO45Mr3gO+E38kaT3CzHVRnYPVnjwBDyc0JIPk/iTdu6ySX6Iq3QuT E/09RcI9lJUYQXz6fzCBvlGN9mU1I6xQl07wUzFe39XtSmEMQLGaUkaFACcCRrW40ApsedRD9L/PN lOutN7hfjhPAmg==; Original-Received: from [87.69.77.57] (port=2855 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1npOEH-0002wI-LE; Fri, 13 May 2022 01:52:45 -0400 In-Reply-To: (message from Yuan Fu on Thu, 12 May 2022 15:52:14 -0700) 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" Xref: news.gmane.io gmane.emacs.bugs:232107 Archived-At: > From: Yuan Fu > Date: Thu, 12 May 2022 15:52:14 -0700 > Cc: Lars Ingebrigtsen , > josh@berdine.net, > 19080@debbugs.gnu.org > > > We could perhaps add a new feature, based on tree-sitter, to highlight > > a block of code, where the block is defined by PL rules, not by > > parens, braces, and similar simple syntactic elements. > > > > Yuan, WDYT? Can this be added to the tree-sitter branch perhaps? > > That sounds interesting, and it should be easy. But what do we want the API be? First of all, should we make a separate mode or extend show-paren-mode? Extending show-paren-mode entails doing some non-trivial refactoring to paren.el. IMO, it should be a separate minor mode; show-paren-mode is not necessarily about program blocks, since parentheses appear not only (and mostly not) as block delimiters. The API should be probably: given a buffer POSITION, return the 2 positions of the innermost enclosing block, or nil if POSITION is not in any block. A possible extension could be to return a list of position pairs that provide also the blocks enclosed inside the POSITION's block. > I think, that adding tree-sitter “backend” needs refactoring existing code non-trivially. If show-paren-mode would want to use tree-sitter, it will need refactoring, yes. Which other packages you envision could benefit from using tree-sitter?