Search code examples
pythoncemacscommentselisp

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,

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

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

Solution

  • Use the following in your syntax highlighting definition:

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