Function: outline-back-to-heading@fix-for-org-fold
outline-back-to-heading@fix-for-org-fold is a byte-compiled function
defined in org-compat.el.gz.
Signature
(outline-back-to-heading@fix-for-org-fold OLDFUN &optional INVISIBLE-OK &rest EXTRA)
Documentation
Run org-back-to-heading when in org-mode.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-compat.el.gz
(define-advice outline-back-to-heading (:around (oldfun &optional invisible-ok &rest extra) fix-for-org-fold)
"Run `org-back-to-heading' when in org-mode."
(if (derived-mode-p 'org-mode)
(progn
(forward-line 0)
(or (org-at-heading-p (not 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 (org-fold-folded-p)))
(point)))))
(goto-char found)
found)))
;; Apply EXTRA to avoid breakages if advised function definition
;; changes.
(apply oldfun invisible-ok extra)))