Function: allout-next-visible-heading
allout-next-visible-heading is an interactive and byte-compiled
function defined in allout.el.gz.
Signature
(allout-next-visible-heading ARG)
Documentation
Move to the next ARGth visible heading line, backward if ARG is negative.
Move to buffer limit in indicated direction if headings are exhausted.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_ > allout-next-visible-heading (arg)
(defun allout-next-visible-heading (arg)
"Move to the next ARGth visible heading line, backward if ARG is negative.
Move to buffer limit in indicated direction if headings are exhausted."
(interactive "p")
(let* ((inhibit-field-text-motion t)
(backward (if (< arg 0) (setq arg (* -1 arg))))
(step (if backward -1 1))
(progress (allout-current-bullet-pos))
;; Move to the next physical line.
(line-move-visual nil)
prev got)
(while (> arg 0)
(while (and
;; Boundary condition:
(not (if backward (bobp)(eobp)))
;; Move, skipping over all concealed lines in one fell swoop:
(prog1 (condition-case nil (or (line-move step) t)
(error nil))
(allout-beginning-of-current-line)
;; line-move can wind up on the same line if long.
;; when moving forward, that would yield no-progress
(when (and (not backward)
(<= (point) progress))
;; ensure progress by doing line-move from end-of-line:
(end-of-line)
(condition-case nil (or (line-move step) t)
(error nil))
(allout-beginning-of-current-line)
(setq progress (point))))
;; Deal with apparent header line:
(save-match-data
(if (not (looking-at allout-regexp))
;; not a header line, keep looking:
t
(allout-prefix-data)
(if (and (allout-do-doublecheck)
(allout-aberrant-container-p))
;; skip this aberrant prospective header line:
t
;; this prospective headerline qualifies -- register:
(setq got allout-recent-prefix-beginning)
;; and break the loop:
nil)))))
;; Register this got, it may be the last:
(if got (setq prev got))
(setq arg (1- arg)))
(cond (got ; Last move was to a prefix:
(allout-end-of-prefix))
(prev ; Last move wasn't, but prev was:
(goto-char prev)
(allout-end-of-prefix))
((not backward) (end-of-line) nil))))