[英]How to configure highlighting in Emacs diff mode?
I use mercurial.el
mode with Emacs. 我在Emacs中使用
mercurial.el
模式。 When I run vc-diff
, I can see the diff, but, unlike the source code, it is not nicely highlighted: 当我运行
vc-diff
,我可以看到差异,但是,与源代码不同,它没有很好地突出显示:
Reading such diffs is difficult. 阅读这些差异很困难。 How do I configure Emacs,
我如何配置Emacs,
-
and +
lines with different colors? -
和+
不同颜色的线条? (red and blue, for example) Try using Mx ediff-revision , which does an ediff
instead of just a regular diff. 尝试使用Mx ediff-revision ,它执行
ediff
而不仅仅是常规diff。 That will give you word-differences and a side-by-side (or top/bottom) display. 这将为您提供单词差异和并排(或顶部/底部)显示。 Check out the ediff manual .
查看ediff手册 。
The Emacs wiki also has a number of modes for just regular diff files (like what you're looking at) - check it out . Emacs wiki还有许多模式可用于常规差异文件(就像你正在查看的那样) - 检查出来 。
To just change the colors in the diff-mode
which you're currently using, you can do something like: 要更改您当前使用的
diff-mode
的颜色,您可以执行以下操作:
(defun update-diff-colors ()
"update the colors for diff faces"
(set-face-attribute 'diff-added nil
:foreground "white" :background "blue")
(set-face-attribute 'diff-removed nil
:foreground "white" :background "red3")
(set-face-attribute 'diff-changed nil
:foreground "white" :background "purple"))
(eval-after-load "diff-mode"
'(update-diff-colors))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.