Created
May 6, 2017 07:09
-
-
Save tamouse/66d4533360521d14d4373bc369b95ba3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun comment-or-uncomment-line-or-region () | |
"DWIM comment or uncomment line or region" | |
(interactive) | |
(let (start end ) | |
(if mark-active | |
(progn | |
(setq start (mark)) | |
(setq end (point))) | |
(progn | |
(setq start (line-beginning-position)) | |
(setq end (line-end-position)))) | |
(comment-or-uncomment-region start end))) | |
(global-set-key (kbd "C-x /") 'comment-or-uncomment-line-or-region) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment