mooz / js2-mode

Improved JavaScript editing mode for GNU Emacs
GNU General Public License v3.0
1.33k stars 186 forks source link

How can I use /* ... */ comments instead of // comments? #509

Open lumenwrites opened 6 years ago

lumenwrites commented 6 years ago

Hi! I'm new to this mode, can you help me to figure out how to tell emacs to comment stuff like this /* ...*/ when I press M-;? All my comments are using this format, and without this feature it becomes very difficult to adjust.

lambdadog commented 5 years ago

This should work pretty well (stolen from css-mode)

(add-hook 'js2-mode-hook
      (lambda ()
        (setq-local comment-start "/*")
        (setq-local comment-start-skip "/\\*+[ \t]*")
        (setq-local comment-end "*/")
        (setq-local comment-end-skip "[ \t]*\\*+/")))