2

I'm looking for a multiple-major-modes package that doesn't remove fontification of the host mode from its inner submodes?

I tried MMM Mode and Polymode, but they remove the initial fontification and put own faces with own background colors in regions with submodes.

What I'm trying to achieve is to fontify diff hunks in diff-mode syntactically according to the rules of their source code language, e.g. to highlight their keywords like it's done on diff pages of version control web sites like github/gitlab.

multiple-major-modes packages are able to detect diff hunks and their source language from file extensions in the diff header, find the corresponding major mode using auto-mode-alist, and fontify these diff hunks accordingly as submodes. But they don't keep fontification of diff-mode with faces diff-added and diff-removed that highlight changes using different background colors.

Is there a package that can do this?

link0ff
  • 1,081
  • 5
  • 14

1 Answers1

3

This is implemented now in Emacs 27 and available by default using the variable diff-font-lock-syntax.

link0ff
  • 1,081
  • 5
  • 14