Function: magit-todos--section-end

magit-todos--section-end is a natively compiled function defined in magit-todos.el.

Signature

(magit-todos--section-end CONDITION)

Documentation

Return end position of section matching CONDITION, or nil.

CONDITION may be one accepted by magit-section-match, or top or bottom, which are handled specially.

Source Code

;; Defined in /nix/store/xy37aj9089qvbs5clw0qszpi3hrh3mxx-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-todos-20250928.1611/magit-todos.el
;;;; Functions

(defun magit-todos--section-end (condition)
  "Return end position of section matching CONDITION, or nil.
CONDITION may be one accepted by `magit-section-match', or `top'
or `bottom', which are handled specially."
  (cl-labels ((find-section (condition)
                (save-excursion
                  (goto-char (point-min))
                  (ignore-errors
                    (cl-loop until (magit-section-match condition)
                             do (magit-section-forward)
                             finally return (magit-current-section))))))
    (save-excursion
      (goto-char (point-min))
      (pcase condition
        ('top (when-let ((section (or (find-section 'tags)
                                      (find-section 'tag)
                                      (find-section 'branch))))
                ;; Add 1 to leave blank line after top sections.
                (1+ (oref section end))))
        ('bottom (oref (-last-item (oref magit-root-section children)) end))
        (_ (when-let ((section (find-section condition)))
             (oref section end)))))))