]> git.eshelyaron.com Git - emacs.git/commitdiff
Add button navigation to treesit-explorer (bug#75141)
authorGabriel Santos <gabrielsantosdesouza@disroot.org>
Fri, 27 Dec 2024 13:43:20 +0000 (10:43 -0300)
committerEshel Yaron <me@eshelyaron.com>
Sat, 11 Jan 2025 11:17:35 +0000 (12:17 +0100)
* lisp/treesit.el (treesit--explorer-tree-mode-map): Define it
as a child of special-mode-map, adding keys for button
navigation.

(cherry picked from commit 493bb2eaf1610ec950e4a2f7229d6e1f939064b9)

lisp/treesit.el

index 49ccc53aa62b1402910f9e89459264c896f0f5e7..888efeea239a9eb2861d41c7676575f437b13285 100644 (file)
@@ -4040,6 +4040,16 @@ 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
+  "TAB" #'forward-button
+  "<backtab>" #'backward-button)
+
 (defun treesit-explorer-switch-parser (parser)
   "Switch explorer to use PARSER."
   (interactive