Function: org-next-visible-heading
org-next-visible-heading is an interactive and byte-compiled function
defined in org.el.gz.
Signature
(org-next-visible-heading ARG)
Documentation
Move to the next visible heading line.
With ARG, repeats or can move backward if negative.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-next-visible-heading (arg)
"Move to the next visible heading line.
With ARG, repeats or can move backward if negative."
(interactive "p")
(let ((regexp (concat "^" (org-get-limited-outline-regexp))))
(if (< arg 0)
(beginning-of-line)
(end-of-line))
(while (and (< arg 0) (re-search-backward regexp nil :move))
(unless (bobp)
(when (org-fold-folded-p)
(goto-char (org-fold-previous-visibility-change))
(unless (looking-at-p regexp)
(re-search-backward regexp nil :mode))))
(cl-incf arg))
(while (and (> arg 0) (re-search-forward regexp nil :move))
(when (org-fold-folded-p)
(goto-char (org-fold-next-visibility-change))
(skip-chars-forward " \t\n")
(end-of-line))
(cl-decf arg))
(if (> arg 0) (goto-char (point-max)) (beginning-of-line))))