3

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?

1 Answer 1

4

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

3
  • Could you expand your answer to show how to configure it? Commented Dec 25, 2018 at 20:39
  • Actually there is no need to configure it, because it's enabled by default. Commented Dec 25, 2018 at 21:03
  • Great! Could you just add that point to your answer for future readers? Commented Dec 25, 2018 at 21:28

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.