Function: majutsu-op--parse-diff-marker-line

majutsu-op--parse-diff-marker-line is a natively compiled function defined in majutsu-op.el.

Signature

(majutsu-op--parse-diff-marker-line PLAIN-LINE COLORED-LINE GROUP-KIND REF-NAME)

Documentation

Parse a marker PLAIN-LINE/COLORED-LINE in GROUP-KIND under REF-NAME.

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-op.el
(defun majutsu-op--parse-diff-marker-line (plain-line colored-line group-kind ref-name)
  "Parse a marker PLAIN-LINE/COLORED-LINE in GROUP-KIND under REF-NAME."
  (when (and group-kind (string-match "\\([+-]\\) \\(.*\\)\\'" plain-line))
    (let* ((marker (match-string 1 plain-line))
           (payload (match-string 2 plain-line))
           (payload-start (match-beginning 2))
           (line-type (if (memq group-kind '(commits working-copy))
                          'commit-line
                        'ref-line)))
      (pcase-let* ((`(,prefix ,target ,target-offset)
                    (majutsu-op--diff-strip-prefix payload))
                   (summary-start (+ payload-start target-offset))
                   (display-summary (substring colored-line summary-start))
                   (base (list :marker marker
                               :prefix prefix
                               :group-kind group-kind
                               :ref-name ref-name)))
        (if (string= target "(absent)")
            (list :type line-type
                  :text colored-line
                  :value (append base '(:absent t)))
          (if-let* ((summary (majutsu-op--parse-commit-summary
                              target display-summary)))
              (list :type line-type
                    :text colored-line
                    :value (append base summary))
            (list :type 'raw-line :text colored-line)))))))