Skip to content

Font and Syntax Highlighting (magit@^4.4.x) #20

@andycandy-dev

Description

@andycandy-dev

Problem

After updating Magit package in Doom Emacs, syntax highlighting and fonts stopped rendering correctly in PR diffs.

works with: https://github.com/magit/magit/commits/v4.3.8/
breaks at: https://github.com/magit/magit/commits/v4.4.0/

Root Cause

From the Magit v4.4.0 changelog:

"All text inserted into Magit buffers that previously used face now use font-lock-face and magit-section-mode can therefore set font-lock-defaults. Previously if some third-party packages used font-lock-add-keywords, some of Magit's own fontification would be lost. Third-party packages that use magit-section-mode, might need to be adjusted accordingly."

The Breaking Change:

  • Magit switched from using the face text property to font-lock-face
  • pr-review was only looking for overlays with the face property
  • pr-review buffers weren't activating font-lock-mode to render font-lock-face

The pr-review package transfers overlays to text properties (since overlays don't survive buffer copying), but the old detection logic only looked for overlays with the specific 'diff-mode property.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions