From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: [PATCH] newcomment.el (comment-line): New command. Date: Mon, 26 Jan 2015 17:17:28 -0200 Message-ID: Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=089e01227f2e3f2669050d92fd1f X-Trace: ger.gmane.org 1422299864 6541 80.91.229.3 (26 Jan 2015 19:17:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2015 19:17:44 +0000 (UTC) Cc: Stefan Monnier To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 26 20:17:44 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YFpAL-00032W-52 for ged-emacs-devel@m.gmane.org; Mon, 26 Jan 2015 20:17:41 +0100 Original-Received: from localhost ([::1]:43612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFpAK-0004bN-Bn for ged-emacs-devel@m.gmane.org; Mon, 26 Jan 2015 14:17:40 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFpAE-0004aA-5R for emacs-devel@gnu.org; Mon, 26 Jan 2015 14:17:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFpA9-0006ct-OP for emacs-devel@gnu.org; Mon, 26 Jan 2015 14:17:34 -0500 Original-Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:57252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFpA9-0006ck-IR for emacs-devel@gnu.org; Mon, 26 Jan 2015 14:17:29 -0500 Original-Received: by mail-oi0-f45.google.com with SMTP id g201so8777322oib.4 for ; Mon, 26 Jan 2015 11:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:date:message-id:subject:from:to:cc :content-type; bh=XvHnBVw+dbp1hLbhx9WjdtmkATZm1SOw1ydvABGLplQ=; b=VZi/ag+JJJ7nIRivUrO9SuVcVeBbYIWT72Hz17zd/WqGbXgOhkGvl5KWTynOjc6p1P ImC5OxUAD4gpxHwVPTJYeZOe7PPj48FmgcSpotXZSlRkilcfSpYws73KGBPNzg1hRCe3 6EPrNVynhBakY+U9d6UdDkhoeBLxSaa3K6wZYnDbEEz8s+LLXk2ma+6Mx6KebDhdyNXm MeeBKesyd2CRUP09nRkRZAj+8Ks8nG64A5IukATlCEldlIF9ARBFF+XrSIqoUcyL0usd IxR5cqYsNX6hb0YR9iy7OPSn0eJHbFEpNaHNr09maAdMIt3Qk0LJGOJrTv2Ds65vN4kq DCeQ== X-Received: by 10.182.104.42 with SMTP id gb10mr13693187obb.62.1422299848687; Mon, 26 Jan 2015 11:17:28 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Mon, 26 Jan 2015 11:17:28 -0800 (PST) X-Google-Sender-Auth: UCCaTWsjJMiexU24mSDOnNRfYtw X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::22d X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:181800 Archived-At: --089e01227f2e3f2669050d92fd1f Content-Type: text/plain; charset=UTF-8 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 + + * 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 --089e01227f2e3f2669050d92fd1f Content-Type: text/x-patch; charset=US-ASCII; name="0001-newcomment.el-comment-line-New-command.patch" Content-Disposition: attachment; filename="0001-newcomment.el-comment-line-New-command.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i5e8giey0 RnJvbSA1ZTMwYzVjNWI0MTIwMTIzYTk4MDIxZjQ5MDYyZWM1ZTM5YzA4M2RjIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBBcnR1ciBNYWxhYmFyYmEgPGJydWNlLmNvbm5vci5hbUBnbWFp bC5jb20+CkRhdGU6IE1vbiwgMjYgSmFuIDIwMTUgMTc6MTE6MjQgLTAyMDAKU3ViamVjdDogW1BB VENIXSBuZXdjb21tZW50LmVsIChjb21tZW50LWxpbmUpOiBOZXcgY29tbWFuZC4KCi0tLQogbGlz cC9DaGFuZ2VMb2cgICAgIHwgIDQgKysrKwogbGlzcC9uZXdjb21tZW50LmVsIHwgMTIgKysrKysr KysrK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