comment or uncomment region in emacs: M-;

so often times in emacs u may want to comment or uncomment a region in emacs. michael zeller presents a way to create a simple macro, save it, and bind it to some keys here.

however, by default in emacs, there is a command called ‘comment-or-uncomment-region’ that is bound to ‘M-;’ . if emacs recognize a syntax or the mode of the buffer, the correct comment character will be inserted or removed. if emacs doesn’t know the default, it will ask u, and u can insert it in. for example, in .conkerorrc, there is no default. i will put ‘//’ when emacs asks me, and i can use ‘M-;’. very cool!

About Vinh Nguyen

Statistician

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>