Beacon Hill, Inc. Technology Solutions

Home > Knowledge Base > Emacs > Omitting Files in Dired

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.

See

http://www.beaconhill.com/blog/?p=42