Function: outline-back-to-heading

outline-back-to-heading is a byte-compiled function defined in outline.el.gz.

Signature

(outline-back-to-heading &optional INVISIBLE-OK)

Documentation

Move to previous heading line, or beg of this line if it's a heading.

Only visible heading lines are considered, unless INVISIBLE-OK is non-nil.

This function has :around advice: outline-back-to-heading@fix-for-org-fold.

Source Code

;; Defined in /usr/src/emacs/lisp/outline.el.gz
(defun outline-back-to-heading (&optional invisible-ok)
  "Move to previous heading line, or beg of this line if it's a heading.
Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
  (beginning-of-line)
  (or (outline-on-heading-p invisible-ok)
      (let (found)
	(save-excursion
	  (while (not found)
	    (or (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
				    nil t)
                (signal 'outline-before-first-heading nil))
	    (setq found (and (or invisible-ok (not (outline-invisible-p)))
			     (point)))))
	(goto-char found)
	found)))