Function: magit-blame--format-string-1

magit-blame--format-string-1 is a byte-compiled function defined in magit-blame.el.

Signature

(magit-blame--format-string-1 REV REVINFO FORMAT FACE)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-blame.el
(defun magit-blame--format-string-1 (rev revinfo format face)
  (let ((str
         (if (string-match-p "\\`0\\{40,\\}\\'" rev)
             (propertize (concat (if (string-prefix-p "\s" format) "\s" "")
                                 "Not Yet Committed"
                                 (if (string-suffix-p "\n" format) "\n" ""))
                         'font-lock-face face)
           (magit--format-spec
            (propertize format 'font-lock-face face)
            (cl-flet* ((p0 (s f)
                         (propertize s 'font-lock-face
                                     (if face (cons f (ensure-list face)) f)))
                       (p1 (k f)
                         (p0 (cdr (assoc k revinfo)) f))
                       (p2 (k1 k2 f)
                         (p0 (magit-blame--format-time-string
                              (cdr (assoc k1 revinfo))
                              (cdr (assoc k2 revinfo)))
                             f)))
              `((?H . ,(p0 rev         'magit-blame-hash))
                (?h . ,(p0 (magit-blame--abbrev-hash rev)  'magit-blame-hash))
                (?s . ,(p1 "summary"   'magit-blame-summary))
                (?a . ,(p1 "author"    'magit-blame-name))
                (?c . ,(p1 "committer" 'magit-blame-name))
                (?A . ,(p2 "author-time"    "author-tz"    'magit-blame-date))
                (?C . ,(p2 "committer-time" "committer-tz" 'magit-blame-date))
                (?f . "")))))))
    (if-let ((width (and (string-suffix-p "%f" format)
                         (magit-blame--style-get 'margin-width))))
        (concat str
                (propertize (make-string (max 0 (- width (length str))) ?\s)
                            'font-lock-face face))
      str)))