Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to comment out a large chunk of code?

Tags:

comments

emacs

I'm trying to comment out a large piece of code in a program but it's too difficult to do it manually. Is there a program to do it for me? (making such program doesn't seem hard anyway) Also, I'm using emacs. Does emacs have such a function? (or an emacs Lisp file at least?)

like image 379
erkin Avatar asked Apr 10 '11 13:04

erkin


People also ask

How do you comment a long code?

use % for a single line. Everything from the % to the end of that line of the file is ignored by the program and is only for use by the human reader of the code. use %{ comment %} for Multiline comments (or repeat the % down the left side of your paragraph).

How do you comment out a large block of code in M script?

To comment out a selection, select the lines of code, go to the Editor or Live Editor tab, and in the Code section, click the comment button . You also can type Ctrl+R. To uncomment the selected lines code, click the uncomment button or type Ctrl+Shift+R.


2 Answers

In emacs, you can use M-x comment-region and M-x uncomment-region.

like image 67
dfan Avatar answered Oct 05 '22 23:10

dfan


The comment-region method bound to key M-;. You can select region using marker and then use M-; to comment/uncomment.

like image 38
Mohanraj Avatar answered Oct 05 '22 22:10

Mohanraj