From 3279786cd221eafc876ca1987c04efe108ed0660 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sat, 19 Dec 2020 20:25:04 +0100 Subject: [PATCH] feat(emacs-tree-sitter-move): add a simple down movement as well Always goes to the first child for now. Change-Id: I1d00b2f2013ba7e5f88622d1de3c99500e5f1a7a Reviewed-on: https://cl.tvl.fyi/c/depot/+/2261 Reviewed-by: Profpatsch Tested-by: BuildkiteCI --- .../Profpatsch/emacs-tree-sitter-move/tree-sitter-move.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/users/Profpatsch/emacs-tree-sitter-move/tree-sitter-move.el b/users/Profpatsch/emacs-tree-sitter-move/tree-sitter-move.el index 0fd16e675..c23e401f0 100644 --- a/users/Profpatsch/emacs-tree-sitter-move/tree-sitter-move.el +++ b/users/Profpatsch/emacs-tree-sitter-move/tree-sitter-move.el @@ -94,10 +94,10 @@ (interactive) (tree-sitter-move--move-skip-non-sibling-nodes 'tsc-get-parent)) -;; TODO doesn’t work yet because sibling nodes are only skipped upwards -;; (defun tree-sitter-move-down () -;; (interactive) -;; (tree-sitter-move--move-skip-non-sibling-nodes (lambda (n) (tsc-get-nth-named-child n 0)))) +;; TODO: does not skip siblings yet, because the skip function only goes up (not down) +(defun tree-sitter-move-down () + (interactive) + (tree-sitter-move--move-if-possible (lambda (n) (tsc-get-nth-named-child n 0)))) (defun tree-sitter-move--move-skip-non-sibling-nodes (move-fn) "Moves to the sidewards next sibling. If the current node does not have siblings, go