summaryrefslogtreecommitdiff
path: root/lisp/init-my-stuff.el
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2015-03-03 09:18:27 +0100
committerrekado <rekado@elephly.net>2015-03-03 09:18:27 +0100
commita025bf14f3c2a16e37596e88940ee4b2ffc2a8a2 (patch)
tree5d7873ccd0a09d83f8eaffcf6212a6d46b103282 /lisp/init-my-stuff.el
parent5ecf84e3fc0461f4203bd7517fd15078e22eff2e (diff)
update endless comment function
Diffstat (limited to 'lisp/init-my-stuff.el')
-rw-r--r--lisp/init-my-stuff.el14
1 files changed, 9 insertions, 5 deletions
diff --git a/lisp/init-my-stuff.el b/lisp/init-my-stuff.el
index 6b82e22..3e670b9 100644
--- a/lisp/init-my-stuff.el
+++ b/lisp/init-my-stuff.el
@@ -94,17 +94,21 @@ Position the cursor at its beginning, according to the current mode."
(forward-sentence 1)
(insert " "))))
-;; by Artur Malabarba, on emacs-devel
+;; by Artur Malabarba and Drew, 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."
+With positive prefix arg, apply to N lines including current one.
+With negative prefix arg, apply to -N lines above.
+When repeated, a negative prefix arg switches direction."
(interactive "p")
+ (when (eq last-command 'comment-line-backward) (setq n (- n)))
(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)
+ (back-to-indentation)
+ (unless (natnump n) (setq this-command 'comment-line-backward)))
+
+(global-set-key (kbd "C-;") 'my/endless/comment-line)