Function: ruby-ts--arrow-up-start

ruby-ts--arrow-up-start is an interactive and byte-compiled function defined in ruby-ts-mode.el.gz.

Signature

(ruby-ts--arrow-up-start ARG)

Documentation

Move to the start ARG levels up or out.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ruby-ts-mode.el.gz
(defun ruby-ts--arrow-up-start (arg)
  "Move to the start ARG levels up or out."
  (interactive "p")
  (setq arg (or arg 1))
  (let* ((pnt (point))
         (found (treesit-node-at pnt))
         (pos (treesit-node-start found))
         new-pos)
    (while (and found pos (> arg 0))
      (setq found (treesit-node-parent found)
            new-pos (treesit-node-start found))
      (when (and new-pos (not (= new-pos pos)))
        (setq arg (1- arg)
              pos new-pos)))
    (if pos
        (goto-char pos)
      (error "Something didn't work"))))