From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriel Santos via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#75141: [PATCH] Add button navigation to treesit-explorer Date: Fri, 27 Dec 2024 10:54:04 -0300 Message-ID: <87msgh5j0j.fsf@disroot.org> Reply-To: Gabriel Santos Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15995"; mail-complaints-to="usenet@ciao.gmane.io" To: 75141@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 27 14:55:24 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 1tRAoG-0003zq-04 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 27 Dec 2024 14:55:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRAny-0000N3-5B; Fri, 27 Dec 2024 08:55: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 1tRAnv-0000L0-In for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 08:55:03 -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 1tRAnv-0006Ts-82 for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 08:55: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:From:To:Subject; bh=VBKEqSlb6ErM5Ae7HEAzQhN9Zz+TBRH4EZMszvD9p+M=; b=rBO9s5oVDXxV7A1ieSHaqBAMaquYINHUtyWjU6ZKWfKR7qVeWyrOj0s4czeUrkZHQtsYNXSdSEBPtD+sEx8Yi2Svp8RBnKj0peouulZysToCkd4mv2XuaNOCJeJ9yOlAwkfJHRwKWHS9N/X1k1mmaCtVaYwnkdXIUy+sGHd672VpxIJPPMR1iOl87VKFhNIejj2Xw5W1LadMpb76GDyFi1wQoCt0eSEWyehvvG4Ewra8QREJEbHdi5JWKmJEFUuiIaPPxA3b7seTyxWesTdHgx0l0jk/IYbJCk+r1DNeQLfYmvpDy3PUFM+ctV8i7Z23SnNtshNc/QO7zUDpk7goqQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRAnu-00022V-Kl for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 08:55:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gabriel Santos Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 27 Dec 2024 13:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75141 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17353076577756 (code B ref -1); Fri, 27 Dec 2024 13:55:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Dec 2024 13:54:17 +0000 Original-Received: from localhost ([127.0.0.1]:45193 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRAnB-000212-Ek for submit@debbugs.gnu.org; Fri, 27 Dec 2024 08:54:17 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRAnA-00020u-6S for submit@debbugs.gnu.org; Fri, 27 Dec 2024 08:54:16 -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 1tRAn9-0000IN-U0 for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 08:54:15 -0500 Original-Received: from layka.disroot.org ([178.21.23.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRAn7-0006EM-On for bug-gnu-emacs@gnu.org; Fri, 27 Dec 2024 08:54:15 -0500 Original-Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id BC2DA25C1B for ; Fri, 27 Dec 2024 14:54:10 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id B1SUuuzudaSW for ; Fri, 27 Dec 2024 14:54:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1735307649; bh=LJv0UTFN5Tvaq7XDw+IElpL4wScI2JdWNeePqUxpjWw=; h=From:To:Subject:Date; b=VDaS4jX4JWVZKbqbFT4nNmlXISIPcLega3l3M6bPzbE/wTL0Sdp1/XqiHWpjfDBgE ofoqIYPEZbARYbxAZPh5HiQ6OBjxpTLKYmUJ1VHmqFh2H/6/FivIjTx5wW6mRL9JeN T9C+aMpXVEde+XixSdlPobgj1pA+jdHAjRLNNaWklRBgWN1xe7oRZWsFHlW3/O0aoH IPRwwaoGKzTXaiF2G+qLYDEoWEsWsG4r4tRXoqkadPezFWJvL51rJZK1im5pCUzwdZ NlXMTMOQElPLDYGz0LmrRE0MHZJeP8XITDdxRIHlW9WPlMNV7eyGMC/qrrB+2Kvhso jeMuLMxVFN8+A== Received-SPF: pass client-ip=178.21.23.139; envelope-from=gabrielsantosdesouza@disroot.org; helo=layka.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:297828 Archived-At: --=-=-= Content-Type: text/plain Greetings, Currently, the only way to navigate through treesit-explorer is by the use of C-n and C-p. Since this buffer is full of buttons, I decided to add button navigation to it. This patch adds button navigation to treesit-explorer, for the following keys: * forward-button - f - n - TAB * backward-button - b - p - * Points of discussion Maybe that's too many keys? The only ones I think that don't really fit that much are "f" and "b", because they can also go down, but there's no harm in having extra keys. Regards, -- Gabriel Santos --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-button-navigation-to-treesit-explorer.patch Content-Description: [PATCH] Add button navigation to treesit-explorer >From d78745581bdf7daf77602eb0bd06b6bdccc3c3c6 Mon Sep 17 00:00:00 2001 From: Gabriel Santos Date: Fri, 27 Dec 2024 10:43:20 -0300 Subject: [PATCH] Add button navigation to treesit-explorer * lisp/treesit.el (treesit--explorer-tree-mode-map): Define it as a child of special-mode-map, adding multiple keys for button navigation. --- lisp/treesit.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lisp/treesit.el b/lisp/treesit.el index eb3e26fff7e..9925f8ee014 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3907,6 +3907,17 @@ covers point. PARSER-NAME are unique." "Mode for displaying syntax trees for `treesit-explore-mode'." nil) +(defvar-keymap treesit--explorer-tree-mode-map + :doc "Keymap for the treesit tree explorer. +Navigates from button to button." + :parent special-mode-map + "n" #'forward-button + "p" #'backward-button + "f" #'forward-button + "b" #'backward-button + "TAB" #'forward-button + "" #'backward-button) + (defun treesit-explorer-switch-parser (parser) "Switch explorer to use PARSER." (interactive -- 2.47.0 --=-=-=--