Created
April 5, 2013 14:40
-
-
Save prakashk/5319782 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 copy-comment-paste () | |
"copy active region/current line, comment, and then paste" | |
(interactive) | |
(unless (use-region-p) | |
(progn | |
(beginning-of-line 2) | |
(push-mark (line-beginning-position 0)))) | |
(kill-ring-save (region-beginning) (region-end)) | |
(comment-region (region-beginning) (region-end)) | |
(yank) | |
(exchange-point-and-mark) | |
(indent-according-to-mode)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I do this all the time, and never automated it! Your version inspired me
to write this alternative with a couple of useful features:
Thanks for the inspiration!