[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] newcomment.el (comment-line): New command.
From: |
Artur Malabarba |
Subject: |
[PATCH] newcomment.el (comment-line): New command. |
Date: |
Mon, 26 Jan 2015 17:17:28 -0200 |
Is there any particular reason why there's no `comment-line' command in Emacs?
If not, I'd like to propose the following patch to newcomment.el
---
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 <address@hidden>
+
+ * newcomment.el (comment-line): New command.
+
2015-01-26 Stefan Monnier <address@hidden>
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
0001-newcomment.el-comment-line-New-command.patch
Description: Text Data
- [PATCH] newcomment.el (comment-line): New command.,
Artur Malabarba <=