Function: outline-next-visible-heading

outline-next-visible-heading is an interactive and byte-compiled function defined in outline.el.gz.

Signature

(outline-next-visible-heading ARG)

Documentation

Move to the next visible heading line.

With ARG, repeats or can move backward if negative. A heading line is one that starts with a * (or that outline-regexp matches).

This function has :around advice: outline-next-visible-heading@fix-for-org-fold.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/outline.el.gz
(defun outline-next-visible-heading (arg)
  "Move to the next visible heading line.
With ARG, repeats or can move backward if negative.
A heading line is one that starts with a `*' (or that
`outline-regexp' matches)."
  (interactive "p")
  (goto-char (if (< arg 0) (pos-bol) (pos-eol)))
  (let ((regexp (unless outline-search-function
                  (concat "^\\(?:" outline-regexp "\\)")))
        found-heading-p)
    (while (and (not (bobp)) (< arg 0))
      (while (and (not (bobp))
		  (setq found-heading-p
			(if outline-search-function
                            (funcall outline-search-function nil t t)
                          (re-search-backward regexp nil 'move)))
		  (outline-invisible-p)))
      (setq arg (1+ arg)))
    (while (and (not (eobp)) (> arg 0))
      (while (and (not (eobp))
		  (setq found-heading-p
			(if outline-search-function
                            (funcall outline-search-function nil t)
                          (re-search-forward regexp nil 'move)))
		  (outline-invisible-p (match-beginning 0))))
      (setq arg (1- arg)))
    (if found-heading-p (forward-line 0))))