Function: org--get-outline-path-1

org--get-outline-path-1 is a byte-compiled function defined in org.el.gz.

Signature

(org--get-outline-path-1 &optional USE-CACHE)

Documentation

Return outline path to current headline.

Outline path is a list of strings, in reverse order. When optional argument USE-CACHE is non-nil, make use of a cache. See org-get-outline-path for details.

Assume buffer is widened and point is on a headline.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org--get-outline-path-1 (&optional use-cache)
  "Return outline path to current headline.

Outline path is a list of strings, in reverse order.  When
optional argument USE-CACHE is non-nil, make use of a cache.  See
`org-get-outline-path' for details.

Assume buffer is widened and point is on a headline."
  (or (and use-cache (cdr (assq (point) org-outline-path-cache)))
      (let ((p (point))
	    (heading (let ((case-fold-search nil))
		       (looking-at org-complex-heading-regexp)
		       (if (not (match-end 4)) ""
			 ;; Remove statistics cookies.
			 (org-trim
			  (org-link-display-format
			   (replace-regexp-in-string
			    "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
			    (match-string-no-properties 4))))))))
        (when (org-element-property :commentedp (org-element-at-point))
          (setq heading (replace-regexp-in-string (format "^%s[ \t]*" org-comment-string) "" heading)))
	(if (org-up-heading-safe)
	    (let ((path (cons heading (org--get-outline-path-1 use-cache))))
	      (when use-cache
		(push (cons p path) org-outline-path-cache))
	      path)
	  ;; This is a new root node.  Since we assume we are moving
	  ;; forward, we can drop previous cache so as to limit number
	  ;; of associations there.
	  (let ((path (list heading)))
	    (when use-cache (setq org-outline-path-cache (list (cons p path))))
	    path)))))