Function: speedbar-restricted-move
speedbar-restricted-move is a byte-compiled function defined in
speedbar.el.gz.
Signature
(speedbar-restricted-move ARG)
Documentation
Move to the next ARGth line in a speedbar buffer at the same depth.
This means that movement is restricted to a subnode, and that siblings of intermediate nodes are skipped.
Source Code
;; Defined in /usr/src/emacs/lisp/speedbar.el.gz
(defun speedbar-restricted-move (arg)
"Move to the next ARGth line in a speedbar buffer at the same depth.
This means that movement is restricted to a subnode, and that siblings
of intermediate nodes are skipped."
(if (not (numberp arg)) (signal 'wrong-type-argument (list 'numberp arg)))
;; First find the extent for which we are allowed to move.
(let ((depth (save-excursion (beginning-of-line)
(if (looking-at "[0-9]+:")
(string-to-number (match-string 0))
0)))
(crement (if (< arg 0) 1 -1)) ; decrement or increment
(lastmatch (point)))
(while (/= arg 0)
(forward-line (- crement))
(let ((subdepth (save-excursion (beginning-of-line)
(if (looking-at "[0-9]+:")
(string-to-number (match-string 0))
0))))
(cond ((or (< subdepth depth)
(progn (end-of-line) (eobp))
(progn (beginning-of-line) (bobp)))
;; We have reached the end of this block.
(goto-char lastmatch)
(setq arg 0)
(error "End of sub-list"))
((= subdepth depth)
(setq lastmatch (point)
arg (+ arg crement))))))
(speedbar-position-cursor-on-line)))