Variable: magit-diff-fontify-hunk

magit-diff-fontify-hunk is a customizable variable defined in magit-diff.el.

Value

nil

Documentation

Whether to apply syntax highlighting to diff hunks.

nil Never fontify diff hunks.
all Fontify all diff hunks.
t Fontify each hunk once it becomes the current section.
       Keep the fontification when another section is selected.
       Refreshing the buffer removes all fontification. This
       variant is only provided for performance reasons.

If this is enabled, then magit-diff-specify-hunk-foreground should be disabled. Also consider enabling magit-diff-use-indicator-faces. Emacs has to be restarted, after changing the value of the former.

This is considered experimental and is disabled by default, because the fontification is done synchronously, and that can lead to a noticeable delay. The plan is to make it asynchronous, probably with the help of the new futur package, which itself still under heavy development.

This variable was added, or its default value changed, in magit version 4.6.0.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-diff.el
(defcustom magit-diff-fontify-hunk nil
  "Whether to apply syntax highlighting to diff hunks.

`nil'  Never fontify diff hunks.
`all'  Fontify all diff hunks.
`t'    Fontify each hunk once it becomes the current section.
       Keep the fontification when another section is selected.
       Refreshing the buffer removes all fontification.  This
       variant is only provided for performance reasons.

If this is enabled, then `magit-diff-specify-hunk-foreground' should
be disabled.  Also consider enabling `magit-diff-use-indicator-faces'.
Emacs has to be restarted, after changing the value of the former.

This is considered experimental and is disabled by default, because the
fontification is done synchronously, and that can lead to a noticeable
delay.  The plan is to make it asynchronous, probably with the help of
the new `futur' package, which itself still under heavy development."
  :package-version '(magit . "4.6.0")
  :group 'magit-diff
  :safe (##memq % '(nil t all))
  :type '(choice (const :tag "No fontification" nil)
                 (const :tag "Immediately fontify all hunks" all)
                 (const :tag "Fontify each hunk when moving to it" t)))