From unknown Fri Jun 20 07:18:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#35600 <35600@debbugs.gnu.org> To: bug#35600 <35600@debbugs.gnu.org> Subject: Status: 27.0.50; uncomment-region fails correctly to reverse the action of comment-region. Reply-To: bug#35600 <35600@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:18:26 +0000 retitle 35600 27.0.50; uncomment-region fails correctly to reverse the acti= on of comment-region. reassign 35600 emacs submitter 35600 Alan Mackenzie severity 35600 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon May 06 06:11:17 2019 Received: (at submit) by debbugs.gnu.org; 6 May 2019 10:11:17 +0000 Received: from localhost ([127.0.0.1]:55765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNaab-0007V9-53 for submit@debbugs.gnu.org; Mon, 06 May 2019 06:11:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58989) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNaaY-0007Uv-OE for submit@debbugs.gnu.org; Mon, 06 May 2019 06:11:15 -0400 Received: from lists.gnu.org ([209.51.188.17]:58678) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hNaaT-0001WM-Lz for submit@debbugs.gnu.org; Mon, 06 May 2019 06:11:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45134) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNaaS-0008Pz-NE for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 06:11:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNaaR-0001VV-NS for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 06:11:08 -0400 Received: from colin.muc.de ([193.149.48.1]:11357 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hNaaR-0001Sh-DA for bug-gnu-emacs@gnu.org; Mon, 06 May 2019 06:11:07 -0400 Received: (qmail 27547 invoked by uid 3782); 6 May 2019 10:11:02 -0000 Received: from acm.muc.de (p4FE15DE3.dip0.t-ipconnect.de [79.225.93.227]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 06 May 2019 12:11:01 +0200 Received: (qmail 4371 invoked by uid 1000); 6 May 2019 10:11:00 -0000 Date: Mon, 6 May 2019 10:11:00 +0000 To: bug-gnu-emacs@gnu.org Subject: 27.0.50; uncomment-region fails correctly to reverse the action of comment-region. Message-ID: <20190506101100.GA4300@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Hello, Emacs. In the master branch: With indent-tabs-mode t, and tab-width (say) 8, start off with the following two line of Emacs lisp: (if (null bs-state) (ignore) ^ (the first of these lines being indented by four spaces, the second by a ). Mark the two lines, and execute M-x comment-region. We get this: ;; (if (null bs-state) ;; (ignore) ^ (where all the space is space characters except for the just before "(ignore)"). Now execute M-x uncomment-region. This should restore the region to what it started as. Instead one gets: (if (null bs-state) (ignore) ^^^^ ^ SPCs , there now being four spurious spaces before the preceding "(ignore)". This is a bug. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; In uncomment-region-default-1, the variable `spt' gets set to the result of comment-search-forward, the ";" at the beginning of the comment on the current line. The function then narrows to between `spt' and BO next line. In this narrowed region, the function removes the comment starter. Because of the narrowing, it cannot take any account of the spaces at the start of the line. Possibly, uncomment-region needs to be amended so that that narrowing includes any space preceding the comment starter, and that space gets properly handled. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue May 07 05:00:01 2019 Received: (at 35600) by debbugs.gnu.org; 7 May 2019 09:00:01 +0000 Received: from localhost ([127.0.0.1]:58196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNvxB-0002m3-1n for submit@debbugs.gnu.org; Tue, 07 May 2019 05:00:01 -0400 Received: from colin.muc.de ([193.149.48.1]:36855 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hNvx8-0002ls-K2 for 35600@debbugs.gnu.org; Tue, 07 May 2019 04:59:59 -0400 Received: (qmail 16276 invoked by uid 3782); 7 May 2019 08:59:54 -0000 Received: from acm.muc.de (p4FE15AB1.dip0.t-ipconnect.de [79.225.90.177]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 07 May 2019 10:59:53 +0200 Received: (qmail 4782 invoked by uid 1000); 7 May 2019 08:59:53 -0000 Date: Tue, 7 May 2019 08:59:53 +0000 To: 35600@debbugs.gnu.org Subject: [Patch]: Re: bug#35600: 27.0.50; uncomment-region fails correctly to reverse the action of comment-region. Message-ID: <20190507085953.GA4671@ACM> References: <20190506101100.GA4300@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190506101100.GA4300@ACM> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 35600 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Emacs. On Mon, May 06, 2019 at 10:11:00 +0000, Alan Mackenzie wrote: > In the master branch: > With indent-tabs-mode t, and tab-width (say) 8, start off with the > following two line of Emacs lisp: > (if (null bs-state) > (ignore) > ^ > > (the first of these lines being indented by four spaces, the second by a > ). > Mark the two lines, and execute M-x comment-region. We get this: > ;; (if (null bs-state) > ;; (ignore) > ^ > > (where all the space is space characters except for the just > before "(ignore)"). > Now execute M-x uncomment-region. This should restore the region to > what it started as. Instead one gets: > (if (null bs-state) > (ignore) > ^^^^ ^ > SPCs > , there now being four spurious spaces before the preceding > "(ignore)". This is a bug. > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > In uncomment-region-default-1, the variable `spt' gets set to the result > of comment-search-forward, the ";" at the beginning of the comment on > the current line. The function then narrows to between `spt' and BO > next line. > In this narrowed region, the function removes the comment starter. > Because of the narrowing, it cannot take any account of the spaces at > the start of the line. > Possibly, uncomment-region needs to be amended so that that narrowing > includes any space preceding the comment starter, and that space gets > properly handled. Here is a patch which fixes the bug a little differently. After removing a comment starter, if there are obtrusive spaces left before a , they get removed: diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 9d919ccbbe..ab2be080a3 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -1001,7 +1001,15 @@ uncomment-region-default-1 (re-search-forward sre (line-end-position) t)) (replace-match "" t t nil (if (match-end 2) 2 1))))) ;; Go to the end for the next comment. - (goto-char (point-max)))))) + (goto-char (point-max))) + ;; Remove any obtrusive spaces left preceding a tab at `spt'. + (when (and (eq (char-after spt) ?\t) (eq (char-before spt) ? ) + (> tab-width 0)) + (save-excursion + (goto-char spt) + (let* ((fcol (current-column)) + (slim (- (point) (mod fcol tab-width)))) + (delete-char (- (skip-chars-backward " " slim))))))))) (set-marker end nil)) (defun uncomment-region-default (beg end &optional arg) -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri May 10 03:36:33 2019 Received: (at 35600-done) by debbugs.gnu.org; 10 May 2019 07:36:33 +0000 Received: from localhost ([127.0.0.1]:37003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hP053-0001ph-Ct for submit@debbugs.gnu.org; Fri, 10 May 2019 03:36:33 -0400 Received: from colin.muc.de ([193.149.48.1]:34512 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hP051-0001pY-AO for 35600-done@debbugs.gnu.org; Fri, 10 May 2019 03:36:32 -0400 Received: (qmail 82903 invoked by uid 3782); 10 May 2019 07:36:29 -0000 Received: from acm.muc.de (p4FE15D99.dip0.t-ipconnect.de [79.225.93.153]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 10 May 2019 09:36:28 +0200 Received: (qmail 4566 invoked by uid 1000); 10 May 2019 07:36:28 -0000 Date: Fri, 10 May 2019 07:36:28 +0000 To: 35600-done@debbugs.gnu.org Subject: Re: bug#35600: 27.0.50; uncomment-region fails correctly to reverse the action of comment-region. Message-ID: <20190510073628.GA4560@ACM> References: <20190506101100.GA4300@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35600-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) The bug has been fixed in master. -- Alan Mackenzie (Nuremberg, Germany). On Mon, May 06, 2019 at 10:12:02 +0000, GNU bug Tracking System wrote: > Thank you for filing a new bug report with debbugs.gnu.org. > This is an automatically generated reply to let you know your message > has been received. > Your message is being forwarded to the package maintainers and other > interested parties for their attention; they will reply in due course. > Your message has been sent to the package maintainer(s): > bug-gnu-emacs@gnu.org > If you wish to submit further information on this problem, please > send it to 35600@debbugs.gnu.org. > Please do not send mail to help-debbugs@gnu.org unless you wish > to report a problem with the Bug-tracking system. > -- > 35600: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35600 > GNU Bug Tracking System > Contact help-debbugs@gnu.org with problems From unknown Fri Jun 20 07:18:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 07 Jun 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator