From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#60525: 29.0.60; tree-sitter support in semantic-symref Date: Wed, 04 Jan 2023 13:20:26 -0500 Message-ID: References: <864jt7xzku.fsf@mail.linkov.net> <83pmbuz88u.fsf@gnu.org> <83a62yz18b.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40067"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: larsi@gnus.org, juri@linkov.net, 60525@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 04 19:21:27 2023 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 1pD8OE-000AAE-Hf for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 04 Jan 2023 19:21:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pD8Ns-0003IO-D9; Wed, 04 Jan 2023 13:21:04 -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 1pD8Nq-0003I2-A8 for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 13:21:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pD8Nq-0005vo-1k for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 13:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pD8Np-0003lM-Ns for bug-gnu-emacs@gnu.org; Wed, 04 Jan 2023 13:21:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 Jan 2023 18:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60525 X-GNU-PR-Package: emacs Original-Received: via spool by 60525-submit@debbugs.gnu.org id=B60525.167285643714423 (code B ref 60525); Wed, 04 Jan 2023 18:21:01 +0000 Original-Received: (at 60525) by debbugs.gnu.org; 4 Jan 2023 18:20:37 +0000 Original-Received: from localhost ([127.0.0.1]:49549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pD8NR-0003kY-6I for submit@debbugs.gnu.org; Wed, 04 Jan 2023 13:20:37 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28155) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pD8NP-0003kK-7q for 60525@debbugs.gnu.org; Wed, 04 Jan 2023 13:20:36 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id DCFB3441B02; Wed, 4 Jan 2023 13:20:29 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 06EC64409B9; Wed, 4 Jan 2023 13:20:28 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1672856428; bh=sRUnH2fXejDrxO5GZujCL85zhGlC2r2yiW5qd6cY7t8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=CI9a6etbKK7aGt43ZtLlpUZA20VqvRc2tPHbw2IA1LJG6JCwYbYfmAU75ShDlT3IF /0yDyBnBrAXuD5ZsEDDozY7CxZ4YIrh1yJ0+yuLPLHKidbGGTQ3m8Zv4Qz+LC1/axT roDtsULR4PiF/jmkxHCZRhWK3HkDjIQidzQ1S9A5aJmnD6yMfFXx9PcAu++1QuRJjc omvPLt+TfWxCBUt4uuLIj/ho8FbxahWvF7bdFjNOALnJ1EzSN5YTyU9+7Zdap78n/v GV/FRTvUdYLRmfBWU0eaqbf6nRsBq2UUgawXzDbarLJPHfiUEeC4wBBy7vaiiRpk3+ XB1skYY6LktTg== Original-Received: from pastel (unknown [45.72.200.228]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C4714120840; Wed, 4 Jan 2023 13:20:27 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Wed, 04 Jan 2023 13:07:47 -0500") 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:252518 Archived-At: >>> >> On 03/01/2023 20:06, Juri Linkov wrote: >>> >> > + (c-ts-mode "*.[ch]") >>> >> > (c++-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh") >>> >> > + (c++-ts-mode "*.[chCH]" "*.[ch]pp" "*.cc" "*.hh") >>> >> > (html-mode "*.html" "*.shtml" "*.php") >>> >> > (mhtml-mode "*.html" "*.shtml" "*.php") ; FIXME: remove >>> >> > ; duplication of >>> >> > @@ -53,7 +55,10 @@ semantic-symref-filepattern-alist >>> >> > ; major mode definition? >>> >> > (ruby-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml" >>> >> > "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile") >>> >> > + (ruby-ts-mode "*.r[bu]" "*.rake" "*.gemspec" "*.erb" "*.haml" >>> >> > + "Rakefile" "Thorfile" "Capfile" "Guardfile" "Vagrantfile") >>> >> > (python-mode "*.py" "*.pyi" "*.pyw") >>> >> >>> >> Instead of duplicating entries, we could try to look up the remappings >>> >> in major-mode-remap-alist. >>> > >>> > That doesn't sound to me like the use of major-mode-remap-alist that >>> > was intended. >>> > >>> > I'm okay with duplication at this point. It is much easier, and we >>> > can always augment or fix later as needed. I see no reason to do >>> > anything fancier at this point. >>> > >>> > Stefan, Lars, WDYT? >>> >>> I'll just note that the above alists already duplicate info present in >>> `auto-mode-alist`. Admittedly, this redundant info is present in >>> a different form, so maybe not directly usable as is, but if we care >>> about redundancy, we should maybe add some layer on top which we can >>> then use both for `semantic-symref-filepattern-alist` and for >>> `auto-mode-alist`. >> >> I' aware of the redundancy. But since we decided to go with those >> separate modes in Emacs 29, I think the redundancy is in general >> unavoidable. If we can use the fact that auto-mode-alist already >> mentions both modes, and we can do that cleanly, it's fine by me. >> Otherwise we will have to live with this for now. > > BTW, other ways to reduce the redundancy (not between > `semantic-symref-filepattern-alist` and `auto-mode-alist`, but the one > introduced by the patch above): > > - make the various variants of a major mode all inherit from a shared > parent mode (and then use that shared parent mode in > `semantic-symref-filepattern-alist`). > > - Use `set-auto-mode--last` which remembers the mode specified before it > was remapped by things like `major-mode-remap-alist` (or by dispatch > functions like `tex-mode`). Oh, and of course: - move the info from `semantic-symref-filepattern-alist` to a buffer-local `semantic-symref-filepattern` which is set by the major modes, so the same setting can be shared by the various modes like all the other buffer-local settings (`comment-start`, ...). BTW, I see that the info provided by `semantic-symref-filepattern-alist` could be (re)used also in `C-u M-x grep`. Stefan