Function: magit-blame-mode

magit-blame-mode is a byte-compiled function defined in magit-blame.el.

Signature

(magit-blame-mode &optional ARG)

Documentation

Display blame information inline.

This is a minor mode. If called interactively, toggle the Magit-Blame mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate magit-blame-mode(var)/magit-blame-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-blame.el
;;; Modes
;;;; Base Mode

(define-minor-mode magit-blame-mode
  "Display blame information inline."
  :lighter magit-blame-mode-lighter
  :interactive nil
  (cond (magit-blame-mode
         (add-hook 'after-save-hook     #'magit-blame--refresh t t)
         (add-hook 'post-command-hook   #'magit-blame-goto-chunk-hook t t)
         (add-hook 'before-revert-hook  #'magit-blame--remove-overlays t t)
         (add-hook 'after-revert-hook   #'magit-blame--refresh t t)
         (add-hook 'read-only-mode-hook #'magit-blame-toggle-read-only t t)
         (setq magit-blame-buffer-read-only buffer-read-only)
         (when (or magit-blame-read-only magit-buffer-file-name)
           (read-only-mode 1))
         (dolist (mode magit-blame-disable-modes)
           (when (and (boundp mode) (symbol-value mode))
             (funcall mode -1)
             (push mode magit-blame-disabled-modes)))
         (setq magit-blame-separator (magit-blame--format-separator))
         (unless magit-blame--style
           (setq magit-blame--style (car magit-blame-styles)))
         (setq magit-blame--make-margin-overlays
               (and (cl-find-if (##assq 'margin-format (cdr %))
                                magit-blame-styles)))
         (magit-blame--update-margin 'enable))
        (t
         (when (process-live-p magit-blame-process)
           (kill-process magit-blame-process)
           (while magit-blame-process
             (sit-for 0.01))) ; avoid racing the sentinel
         (remove-hook 'after-save-hook     #'magit-blame--refresh t)
         (remove-hook 'post-command-hook   #'magit-blame-goto-chunk-hook t)
         (remove-hook 'before-revert-hook  #'magit-blame--remove-overlays t)
         (remove-hook 'after-revert-hook   #'magit-blame--refresh t)
         (remove-hook 'read-only-mode-hook #'magit-blame-toggle-read-only t)
         (unless magit-blame-buffer-read-only
           (read-only-mode -1))
         (magit-blame-read-only-mode -1)
         (dolist (mode magit-blame-disabled-modes)
           (funcall mode 1))
         (kill-local-variable 'magit-blame-disabled-modes)
         (kill-local-variable 'magit-blame-type)
         (kill-local-variable 'magit-blame--style)
         (magit-blame--update-margin 'disable)
         (magit-blame--remove-overlays))))