From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27112: Setting comment-continue to " " causes uncomment-region-default to infloop Date: Thu, 01 Jun 2017 23:18:22 -0400 Message-ID: <877f0v2i2p.fsf@users.sourceforge.net> References: <871sr63ry0.fsf@users.sourceforge.net> <0908e61a-6aab-13f9-5938-a6c02ff7f1ea@live.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1496373538 4780 195.159.176.226 (2 Jun 2017 03:18:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 2 Jun 2017 03:18:58 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27112@debbugs.gnu.org To: =?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jun 02 05:18:53 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGd6x-0000mS-JY for geb-bug-gnu-emacs@m.gmane.org; Fri, 02 Jun 2017 05:18:51 +0200 Original-Received: from localhost ([::1]:47647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGd71-0000on-Ao for geb-bug-gnu-emacs@m.gmane.org; Thu, 01 Jun 2017 23:18:55 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53017) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGd5H-0008Dk-CP for bug-gnu-emacs@gnu.org; Thu, 01 Jun 2017 23:17:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGd5D-0003Z1-5n for bug-gnu-emacs@gnu.org; Thu, 01 Jun 2017 23:17:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGd5C-0003Xq-VR for bug-gnu-emacs@gnu.org; Thu, 01 Jun 2017 23:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dGd5C-0003SV-IY for bug-gnu-emacs@gnu.org; Thu, 01 Jun 2017 23:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Jun 2017 03:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27112 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27112-submit@debbugs.gnu.org id=B27112.149637341413275 (code B ref 27112); Fri, 02 Jun 2017 03:17:02 +0000 Original-Received: (at 27112) by debbugs.gnu.org; 2 Jun 2017 03:16:54 +0000 Original-Received: from localhost ([127.0.0.1]:50238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGd53-0003Rz-Oz for submit@debbugs.gnu.org; Thu, 01 Jun 2017 23:16:53 -0400 Original-Received: from mail-io0-f174.google.com ([209.85.223.174]:36785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGd50-0003Re-Al; Thu, 01 Jun 2017 23:16:50 -0400 Original-Received: by mail-io0-f174.google.com with SMTP id o12so47786924iod.3; Thu, 01 Jun 2017 20:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=vtN4S5mMhOte7iagPDtWBtOjjCZNqZiyCF9AaSmrLCQ=; b=DUMpix1hx8z0z8fFSpXbmNvmJ9xvHeiG9ixLbAF/zUJG4bYnqUf5jiyZ0JM6UqY08p o17u0VlZ40um/G0X8NYA+y2YY9yzGJxTspidKKDDULSLUHF+kkNuOZY5ZcSy2HU/HqQ+ 3GLKvv6z0U9AS4hTvI4jvAHmL7nvIxwnQOzVGAfiYCQ85ShG96d28I9QtWePB95NXR8u OsxIVzHOPRm6j1EVBh/UBdDFrHOB2+F70YmCjWoYi58feNRY7Yl1tQCks6kOx60RbLWY 5k2Cx0ZMfawvhwdIc13w5NPndm6YZEU+JDrAYw3VZF8/IlruvXijduzz/LaAjESZ7OcY 3aYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=vtN4S5mMhOte7iagPDtWBtOjjCZNqZiyCF9AaSmrLCQ=; b=TIZz7spWRVif7aPuY1md5Wvkirzp3CsvN0qXXPZs8GRIoGDn3kUilOomGnToLvxK/Z y6N1j88EnuadfGcgP36kwlY6C+5jBT7y+D0m7X9EvoVKmMiwgWOwyKnu0pMz/CbYFZbk 20SnrqYA3Rho5lpVRM0DOJKWDdYdhYCFv46QSrNIxYZcRLdSYrKxuerz43qtLA/Tt5k/ Nzgv0molxX3R/7PHGIH39MhnUBuK8zo8GbkNdnQC+MKt2R/0yV/1o5JhPGt+vSG67F4Z XZ9CAK5zS9WLzm/HH0g3BNkPrdWMH88utFpwdkMzpsWu9r8nWwjcDvDt/5UawUVgNpR9 mqhg== X-Gm-Message-State: AODbwcCMKnBBIjQp7xhGapXON1fKLKqDHlDXImDR7hDtx89SJHoElwg+ Eup0BjOR6ZbVcHi2 X-Received: by 10.107.57.198 with SMTP id g189mr5494378ioa.123.1496373404711; Thu, 01 Jun 2017 20:16:44 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id y79sm9439494iod.13.2017.06.01.20.16.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Jun 2017 20:16:44 -0700 (PDT) In-Reply-To: <0908e61a-6aab-13f9-5938-a6c02ff7f1ea@live.com> ("=?UTF-8?Q?Cl=C3=A9ment?= Pit--Claudel"'s message of "Tue, 30 May 2017 19:02:03 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133148 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tags 27112 patch quit Cl=C3=A9ment Pit--Claudel writes: >> Can you give a full recipe? > > Sure thing: > > emacs -Q --eval '(setq comment-continue " ")' --eval '(save-excursion (i= nsert ";; AAA\n"))' --eval '(comment-line 1)' Oh it triggers in lisp mode, I somehow got the idea that it needed a mode with C like comments from initial report. How about this patch: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Fix-infloop-in-uncomment-region-default-Bug-27112.patch Content-Description: patch >From d7030832e1aecbb04affe52453fa32ea19ed7ded Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Thu, 1 Jun 2017 23:09:36 -0400 Subject: [PATCH v1] Fix infloop in uncomment-region-default (Bug#27112) When `comment-continue' has only blank lines, `comment-padright' produces a regexp that matches the empty string, so `uncomment-region-default' will loop infinitely. * lisp/newcomment.el (comment-padright): Check for non-padding characters in STR. --- lisp/newcomment.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 4b261c34c6..118549f421 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -815,7 +815,7 @@ (defun comment-padright (str &optional n) If N is `re', a regexp is returned instead, that would match the string for any N." (setq n (or n 0)) - (when (and (stringp str) (not (string= "" str))) + (when (and (stringp str) (string-match "\\S-" str)) ;; Separate the actual string from any leading/trailing padding (string-match "\\`\\s-*\\(.*?\\)\\s-*\\'" str) (let ((s (match-string 1 str)) ;actual string -- 2.11.1 --=-=-=--