From 5e30c5c5b4120123a98021f49062ec5e39c083dc Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 26 Jan 2015 17:11:24 -0200 Subject: [PATCH] newcomment.el (comment-line): New command. --- lisp/ChangeLog | 4 ++++ lisp/newcomment.el | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff352a2..9e6d18f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2015-01-26 Artur Malabarba + + * newcomment.el (comment-line): New command. + 2015-01-26 Stefan Monnier diff --git a/lisp/newcomment.el b/lisp/newcomment.el index e307eac..8f6ac5a 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1451,6 +1451,18 @@ unless optional argument SOFT is non-nil." (end-of-line 0) (insert comend)))))))))))) +;;;###autoload +(defun 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") + (comment-or-uncomment-region + (line-beginning-position) + (goto-char (line-end-position n))) + (forward-line 1) + (back-to-indentation)) + (provide 'newcomment) ;;; newcomment.el ends here -- 2.2.2