Function: helpful--outline-function

helpful--outline-function is a byte-compiled function defined in helpful.el.

Signature

(helpful--outline-function &optional BOUND MOVE BACKWARD LOOKING-AT)

Documentation

outline-search-function for `helpful-mode`.

See documentation of outline-search-function for BOUND, MOVE, BACKWARD and LOOKING-AT.

Source Code

;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--outline-function (&optional bound move backward looking-at)
  "`outline-search-function' for `helpful-mode`.
See documentation of `outline-search-function' for BOUND, MOVE,
BACKWARD and LOOKING-AT."
  (if looking-at
      (eq 'helpful-heading (get-text-property (point) 'face))
    (let ((heading-found nil)
          (bound (if bound bound (if backward (point-min) (point-max)))))
      (save-excursion
        (when (eq 'helpful-heading (get-text-property (point) 'face))
          (forward-line (if backward -1 1)))
        (if backward
            (while (not (or (eq (point) bound)
                            (eq 'helpful-heading (get-text-property (point) 'face))))
              (goto-char (or (previous-single-property-change (point) 'face nil bound)
                             bound)))
          (goto-char (or (text-property-any (point) bound 'face 'helpful-heading)
                         bound)))
        (when (eq 'helpful-heading (get-text-property (point) 'face))
          (setq heading-found (point))))
      (if heading-found
          (progn
            (goto-char heading-found)
            (set-match-data (list heading-found heading-found)))
        (when move
          (goto-char bound) nil)))))