Function: consult--outline-candidates
consult--outline-candidates is a byte-compiled function defined in
consult.el.
Signature
(consult--outline-candidates)
Documentation
Return list of outline heading strings with position attached.
Source Code
;; Defined in ~/.emacs.d/elpa/consult-20260805.1130/consult.el
;;;;; Command: consult-outline
(defun consult--outline-candidates ()
"Return list of outline heading strings with position attached."
(consult--forbid-minibuffer)
(let* ((line (line-number-at-pos (point-min) consult-line-numbers-widen))
(heading-regexp (concat "^\\(?:"
;; default definition from outline.el
(or (bound-and-true-p outline-regexp) "[*\^L]+")
"\\)"))
(heading-alist (bound-and-true-p outline-heading-alist))
(level-fun (or (bound-and-true-p outline-level)
(lambda () ;; as in the default from outline.el
(or (cdr (assoc (match-string 0) heading-alist))
(- (match-end 0) (match-beginning 0))))))
(buffer (current-buffer))
candidates)
(save-excursion
(goto-char (point-min))
(while (save-excursion
(if-let* ((fun (bound-and-true-p outline-search-function)))
(funcall fun)
(re-search-forward heading-regexp nil t)))
(incf line (consult--count-lines (match-beginning 0)))
(push (consult--location-candidate
(buffer-substring-no-properties (pos-bol) (pos-eol))
(cons buffer (point)) (1- line) (1- line)
'consult--outline-level (funcall level-fun))
candidates)
(goto-char (1+ (pos-eol)))))
(unless candidates
(user-error "No headings"))
(nreverse candidates)))