Brad Lucas

A blog mostly about programming
October 13, 2008

Set The Comment Syntax For A File In Emacs

The other day I was editing a httpd.conf file and wanted to comment a large section. On the server I was using the comment syntax wasn’t setup for these types of files.

So, to quickly accomplish I just needed to set the comment-start variable to “#”.

For example,

M-: (setq comment-start "#") RET

Then with the block marked, a comment-region worked perfectly.

Tags: emacs