Emacs: Do what I mean when commenting

I should know this command earlier. It’s so convenient.

M-x comment-dwim

I always run M-x comment-region and M-x uncomment-region manually except when using C Mode since I can use C-c C-c when commenting.

Don’t do it that way any more. And even fortunately, M-x comment-dwim is bound to M-; by default.

According to help, this command runs different commenting command on different situation. For example, if you mark a region, this command comments code in the region. If you mark comments, this command uncomments them. Read more on help, and read now.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s