Function: magit-todos--line-item

magit-todos--line-item is a natively compiled function defined in magit-todos.el.

Signature

(magit-todos--line-item REGEXP &optional FILENAME)

Documentation

Return item on current line, parsing current buffer with REGEXP.

FILENAME is added to the item as its filename. Sets match data. This should be called in a process's output buffer from one of the async callback functions. The calling function should advance to the next line.

Source Code

;; Defined in /nix/store/xy37aj9089qvbs5clw0qszpi3hrh3mxx-emacs-packages-deps/share/emacs/site-lisp/elpa/magit-todos-20250928.1611/magit-todos.el
(cl-defun magit-todos--line-item (regexp &optional filename)
  "Return item on current line, parsing current buffer with REGEXP.
FILENAME is added to the item as its filename.  Sets match data.
This should be called in a process's output buffer from one of
the async callback functions.  The calling function should
advance to the next line."
  (let ((case-fold-search magit-todos-ignore-case))
    (when (condition-case err
              (re-search-forward regexp (line-end-position) t)
            (error (if (string-match-p "Stack overflow in regexp matcher" (error-message-string err))
                       ;; FIXME: This may raise multiple warnings per file.
                       (let ((filename (buffer-substring (point) (1- (re-search-forward ":")))))
                         (message "magit-todos: File has lines too long for Emacs to search.  Consider excluding it from scans: %s" filename)
                         nil)
                     (signal (car err) (cdr err)))))
      (make-magit-todos-item :filename (or filename
                                           (match-string 8))
                             :line (--when-let (match-string 2)
                                     (string-to-number it))
                             :column (--when-let (match-string 3)
                                       (string-to-number it))
                             :position (--when-let (match-string 9)
                                         (string-to-number it))
                             :org-level (match-string 1)
                             :keyword (match-string 4)
                             :suffix (match-string 6)
                             :description (match-string 5)))))