如何在Emacs中对某些东西进行着色? [英] How can I color certain things in Emacs?

查看:103
本文介绍了如何在Emacs中对某些东西进行着色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在emacs中编程Django / Python,我想像{%comment%} FOO {%endcomment%}变成橙色。



为重要的Django模板标签设置一些颜色?

解决方案

您可以使用专门的模式,如 django-mode MuMaMo



如果你想要一些非常基本的东西,并且假设你在 html-mode 您可以尝试以下操作:

 (defun django-highlight-comments()
(interactivep)
(highlight-regexp{%。*?%}'hi-orange))
(add-hook'html-mode-hook'django-highlight-comments)

(只需将上述行添加到您的 .emacs init.el ,并对其进行评估或重新启动emacs)。


I program Django/Python in emacs, and I would like things like {% comment %} FOO {% endcomment %} to turn orange.

How can I set up some colors for important Django template tags?

解决方案

You could use dedicated modes like django-mode or MuMaMo.

If you want something very basic, and assuming you're editing in html-mode, you could try the following:

(defun django-highlight-comments ()
  (interactive "p")
  (highlight-regexp "{%.*?%}" 'hi-orange))
(add-hook 'html-mode-hook 'django-highlight-comments)

(Just add the above lines to your .emacs or init.el, and eval it or restart emacs).

这篇关于如何在Emacs中对某些东西进行着色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆