From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Re: master 97cb255: newcomment.el (comment-line): New command on C-x C-; . Date: Sun, 08 Feb 2015 21:07:18 +0100 Message-ID: <87lhk8w4jt.fsf@gmx.net> References: <20150208190338.30436.1351@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423426063 7028 80.91.229.3 (8 Feb 2015 20:07:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 8 Feb 2015 20:07:43 +0000 (UTC) Cc: Artur Malabarba To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 08 21:07:39 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 1YKY8o-0001dP-GC for ged-emacs-devel@m.gmane.org; Sun, 08 Feb 2015 21:07:38 +0100 Original-Received: from localhost ([::1]:57681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKY8n-0004J4-PO for ged-emacs-devel@m.gmane.org; Sun, 08 Feb 2015 15:07:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKY8b-0004Io-FL for emacs-devel@gnu.org; Sun, 08 Feb 2015 15:07:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YKY8Y-0003XM-5q for emacs-devel@gnu.org; Sun, 08 Feb 2015 15:07:25 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:56570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YKY8X-0003XD-TU for emacs-devel@gnu.org; Sun, 08 Feb 2015 15:07:22 -0500 Original-Received: from rosalinde ([89.245.104.129]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0LlYrb-1XjIJ615hH-00bGxo; Sun, 08 Feb 2015 21:07:19 +0100 In-Reply-To: (Artur Malabarba's message of "Sun, 08 Feb 2015 19:03:38 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:z6R1YOF3pSxhyPg0jYa4Aikgvh+KhhPtOZn+Jfg3zpu/nW85Avy zBDNu6q6ED+KKrovZeViTXyY86VXdJ4lHd110rti06ZsvqekRSVjnXJq20lYeDRtgL4Pu/u x+Nv503vl5/g39al/1QWnnadSmwdvXJ4sJNG5v2+sFsRkl5HBE+kuLoF1w9l6VKIVEUe6bu 5Nj8Ldbi1cjb8EzCGkPaA== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.17.21 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:182639 Archived-At: This patch is missing a final `)', see below. Please fix, and before you push, trying compiling or at least using check-parens. Thanks. Steve Berman On Sun, 08 Feb 2015 19:03:38 +0000 Artur Malabarba wrote: > +;;;###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. Also, further > +consecutive invocations of this command will inherit the negative > +argument. > + > +If region is active, comment lines in active region instead. > +Unlike `comment-dwim', this always comments whole lines." > + (interactive "p") > + (if (use-region-p) > + (comment-or-uncomment-region > + (save-excursion > + (goto-char (region-beginning)) > + (line-beginning-position)) > + (save-excursion > + (goto-char (region-end)) > + (line-end-position))) > + (when (and (eq last-command 'comment-line-backward) > + (natnump n)) > + (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))) ) ; <== here > + > (provide 'newcomment) > > ;;; newcomment.el ends here