diff options
author | rekado <rekado@elephly.net> | 2015-02-01 20:59:53 +0100 |
---|---|---|
committer | rekado <rekado@elephly.net> | 2015-02-01 20:59:53 +0100 |
commit | b5f266de80dd68e590fa69b6c7692c666adaeb14 (patch) | |
tree | a9ccb7396bde4bd7e35eb6ee280a6bc988dfb66f /lisp | |
parent | 9d3694282c8116ab40e81cf95c0713c3a26aff46 (diff) |
add function to comment current line
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/init-my-stuff.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/init-my-stuff.el b/lisp/init-my-stuff.el index e42f4bc..6b82e22 100644 --- a/lisp/init-my-stuff.el +++ b/lisp/init-my-stuff.el @@ -93,3 +93,18 @@ Position the cursor at its beginning, according to the current mode." (loop for i from 1 to arg do (forward-sentence 1) (insert " ")))) + +;; by Artur Malabarba, on emacs-devel +(defun my/endless/comment-line (n) + "Comment or uncomment current line and leave point after it. +With positive prefix, apply to N lines including current one. +With negative prefix, apply to -N lines above." + (interactive "p") + (let ((range (list (line-beginning-position) + (goto-char (line-end-position n))))) + (comment-or-uncomment-region + (apply #'min range) + (apply #'max range))) + (forward-line 1) + (back-to-indentation)) +(global-set-key (kbd "C-c C-;") 'my/endless/comment-line) |