From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: [PATCH] newcomment.el (comment-line): New command. Date: Sun, 1 Feb 2015 13:40:28 -0800 (PST) Message-ID: References: <68eca5a1-04b6-462a-bf70-4abb02b72460@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1422826840 30484 80.91.229.3 (1 Feb 2015 21:40:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Feb 2015 21:40:40 +0000 (UTC) Cc: Stefan Monnier , emacs-devel To: bruce.connor.am@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 01 22:40:36 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 1YI2Fu-00078b-N3 for ged-emacs-devel@m.gmane.org; Sun, 01 Feb 2015 22:40:34 +0100 Original-Received: from localhost ([::1]:51985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI2Fu-0007zp-0C for ged-emacs-devel@m.gmane.org; Sun, 01 Feb 2015 16:40:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI2Fq-0007wT-7d for emacs-devel@gnu.org; Sun, 01 Feb 2015 16:40:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YI2Fm-0006xC-Vx for emacs-devel@gnu.org; Sun, 01 Feb 2015 16:40:30 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:30934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YI2Fm-0006ww-QC for emacs-devel@gnu.org; Sun, 01 Feb 2015 16:40:26 -0500 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t11LeLUc021784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 1 Feb 2015 21:40:24 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t11LeK3B021539 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 1 Feb 2015 21:40:20 GMT Original-Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t11LeKIf021536; Sun, 1 Feb 2015 21:40:20 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 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:182218 Archived-At: > FWIW, the command I suggested is indeed repeatable because it moves > `forward-line' after commenting the line. So you can just invoke it > repeatedly to comment several lines (for those who don't use prefix > arguments). My bad; I didn't notice that it was repeatable. Yes, that's useful, and yes, it makes sense to use a repeatable key. Maybe `C-;'. (Fits with the repeatable versions of `C-a' and `C-e' that I use. ;-)) Consider letting a negative prefix arg be carried over to repetitions, so you can do C-- C-; C-; C-; ... to do it backwards. Currently you need to do C-- C-; C-- C-; C-- C-; ... E.g., something like this: (defun comment-line (n) "Comment or uncomment current line and leave point after it. 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) (unless (natnump n) (setq this-command 'comment-line-backward)))