(defun comment-or-uncomment-line-or-region () "Comments or uncomments the current line or region." (interactive) (if (region-active-p) (comment-or-uncomment-region (region-beginning) (region-end)) (comment-or-uncomment-region (line-beginning-position) (line-end-position)) ) ) (define-key c-mode-base-map (kbd "C-/") 'comment-or-uncomment-line-or-region)See also the corresponding Stackoverflow question.
2012-07-17
Commenting out line or region in Emacs
What I always wanted: commenting or uncommenting a line or region using emacs. Of course, there is comment-region, but this is much nicer:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment