* bug#75141: [PATCH] Add button navigation to treesit-explorer
@ 2024-12-27 13:54 Gabriel Santos via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; only message in thread
From: Gabriel Santos via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-12-27 13:54 UTC (permalink / raw)
To: 75141
[-- Attachment #1: Type: text/plain, Size: 562 bytes --]
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
- <backtab>
* 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: [PATCH] Add button navigation to treesit-explorer --]
[-- Type: text/x-patch, Size: 1135 bytes --]
From d78745581bdf7daf77602eb0bd06b6bdccc3c3c6 Mon Sep 17 00:00:00 2001
From: Gabriel Santos <gabrielsantosdesouza@disroot.org>
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
+ "<backtab>" #'backward-button)
+
(defun treesit-explorer-switch-parser (parser)
"Switch explorer to use PARSER."
(interactive
--
2.47.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-27 13:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-27 13:54 bug#75141: [PATCH] Add button navigation to treesit-explorer Gabriel Santos via Bug reports for GNU Emacs, the Swiss army knife of text editors
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).