简体   繁体   English

我想要 python 样式评论在我的 emacs 模式

[英]I want python style comments in my emacs mode

I am making a emacs mode for my own language, and my language has python like comments,我正在为我自己的语言制作一个 emacs 模式,我的语言有 python 喜欢评论,

example例子

func hello_world()
    printh("Hello, World") # this prints hello world
end 

In this example, I want everything that is after the # to change in color, like a comment.在此示例中,我希望 # 之后的所有内容都改变颜色,例如注释。

right now, I am able to figure out how to do c/c++ type of comment highlighting in emacs, but I am not able to understand how to do for python type of comments现在,我能够弄清楚如何在 emacs 中突出显示 c/c++ 类型的评论,但我无法理解如何为 python 类型的评论做

// this comment will be highlighted 
# but I want this type of comment to be highlighted

Use the following in your syntax highlighting definition:在语法高亮定义中使用以下内容:

("#.*" . font-lock-comment-face)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM