From unknown Sat Jun 21 03:08:17 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#3424 <3424@debbugs.gnu.org> To: bug#3424 <3424@debbugs.gnu.org> Subject: Status: align-regexp: Infinite loop with default regexp Reply-To: bug#3424 <3424@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:08:17 +0000 retitle 3424 align-regexp: Infinite loop with default regexp reassign 3424 emacs submitter 3424 Teemu Likonen severity 3424 normal thanks From tlikonen@iki.fi Sat May 30 10:38:26 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 30 May 2009 17:38:27 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.3 required=4.0 tests=AWL,MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4UHcL62003470 for ; Sat, 30 May 2009 10:38:23 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MASVd-0001gQ-Dc for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:38:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MASVY-0001fg-Ig for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:38:17 -0400 Received: from [199.232.76.173] (port=58935 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MASVY-0001fd-EX for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:38:12 -0400 Received: from mta-out.inet.fi ([195.156.147.13]:48323 helo=jenni1.inet.fi) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MASVV-0003dh-41 for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:38:10 -0400 Received: from mithlond.arda.local (80.220.180.181) by jenni1.inet.fi (8.5.014) id 49F5976601498B4E for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 20:38:00 +0300 Received: from dtw by mithlond.arda.local with local (Exim 4.69) (envelope-from ) id 1MASV6-00015K-Gl for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 20:37:44 +0300 To: bug-gnu-emacs@gnu.org Subject: align-regexp: Infinite loop with default regexp From: Teemu Likonen Date: Sat, 30 May 2009 20:37:44 +0300 Message-ID: <87my8upk47.fsf@iki.fi> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) --=-=-= The align-regexp command enters infinite loop when it is used with the default regexp and with REPEAT argument. It's seems to be because the regexp \s-* matches also zero-length strings. Steps to reproduce: 1. Put the following line to the *scratch* buffer: foo bar 2. Put the line inside a region 3. Type command: C-u M-x align-regexp RET \(\s-*\) RET 1 RET 1 RET y 4. Loop infinitely. I suggest changing the default regexp to \(\s-+\), like the attached patch illustrates. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=align-regexp.patch diff --git i/lisp/align.el w/lisp/align.el index 0917e7d..ea36302 100644 --- i/lisp/align.el +++ w/lisp/align.el @@ -933,7 +933,7 @@ region, call `align-regexp' and type in that regular expression." (list (region-beginning) (region-end)) (if current-prefix-arg (list (read-string "Complex align using regexp: " - "\\(\\s-*\\)") + "\\(\\s-+\\)") (string-to-number (read-string "Parenthesis group to modify (justify if negative): " "1")) @@ -941,7 +941,7 @@ region, call `align-regexp' and type in that regular expression." (read-string "Amount of spacing (or column if negative): " (number-to-string align-default-spacing))) (y-or-n-p "Repeat throughout line? ")) - (list (concat "\\(\\s-*\\)" + (list (concat "\\(\\s-+\\)" (read-string "Align regexp: ")) 1 align-default-spacing nil)))) (let ((rule --=-=-=-- From lennart.borgman@gmail.com Sat May 30 11:24:54 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 30 May 2009 18:24:54 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4UIOoNb013663 for ; Sat, 30 May 2009 11:24:51 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MATEf-0003yb-SI for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 14:24:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MATEb-0003qz-7i for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 14:24:49 -0400 Received: from [199.232.76.173] (port=56626 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MATEb-0003qf-1f for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 14:24:45 -0400 Received: from mail-bw0-f161.google.com ([209.85.218.161]:54334) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MATEa-0005LN-N2 for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 14:24:44 -0400 Received: by bwz5 with SMTP id 5so7386968bwz.42 for ; Sat, 30 May 2009 11:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=mBotuwh/T6DjFuvYPg/e2xsYX6B3HjXCAzaL26EO9S8=; b=dh1a7yM27+j2L1S3WpvlEYXgdYy09C27DtNijjM6CJ4RvR/813rLBYovaVIyVo1L55 XziltfQHWZRCpBfuScl2ETnsr60aFLddPukPR0T5NG/KOPN52KPcsq6bAeAOGIO7FkU7 hLI6Uub313HyEESmGJdQN7JqLkEiamsPeTj9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=d/VUyZkdptTxTEoPX567uRDqCRiJq0bBhtGK/oVmu+NvXCojqO74V3K1r3KDh1HjWL p2kX5r/E3r8ohV/+99yyaH3eMqYjXBEMc2aHcVeC92Hs9hD613OkIY2tQ6iJPsQuBa1y lzIic/3ILqh+Du/lpT35ZaKc+sXwDltIb4jUs= MIME-Version: 1.0 Received: by 10.239.163.69 with SMTP id o5mr284181hbd.40.1243707883562; Sat, 30 May 2009 11:24:43 -0700 (PDT) In-Reply-To: <87my8upk47.fsf@iki.fi> References: <87my8upk47.fsf@iki.fi> Date: Sat, 30 May 2009 20:24:43 +0200 Message-ID: Subject: Re: bug#3424: align-regexp: Infinite loop with default regexp From: Lennart Borgman To: Teemu Likonen , 3424@debbugs.gnu.org Cc: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) On Sat, May 30, 2009 at 7:37 PM, Teemu Likonen wrote: > The align-regexp command enters infinite loop when it is used with the > default regexp and with REPEAT argument. It's seems to be because the > regexp \s-* matches also zero-length strings. > > Steps to reproduce: > > =C2=A01. Put the following line to the *scratch* buffer: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0foo bar > > =C2=A02. Put the line inside a region > > =C2=A03. Type command: > > =C2=A0 =C2=A0 =C2=A0 =C2=A0C-u M-x align-regexp RET \(\s-*\) RET 1 RET 1 = RET y > > =C2=A04. Loop infinitely. This does not happen for me with the latest pretest Emacs 23. Have you tested there? > I suggest changing the default regexp to \(\s-+\), like the attached > patch illustrates. > > From tlikonen@iki.fi Sat May 30 11:46:36 2009 Received: (at 3424) by emacsbugs.donarmstrong.com; 30 May 2009 18:46:36 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from kirsi2.inet.fi (mta-out.inet.fi [195.156.147.13]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4UIkV4g018513 for <3424@emacsbugs.donarmstrong.com>; Sat, 30 May 2009 11:46:32 -0700 Received: from mithlond.arda.local (80.220.180.181) by kirsi2.inet.fi (8.5.014) id 49F6DD58013D53D7; Sat, 30 May 2009 21:46:30 +0300 Received: from dtw by mithlond.arda.local with local (Exim 4.69) (envelope-from ) id 1MATZb-0001Em-QR; Sat, 30 May 2009 21:46:27 +0300 To: Lennart Borgman Cc: 3424@debbugs.gnu.org Subject: Re: bug#3424: align-regexp: Infinite loop with default regexp In-Reply-To: (Lennart Borgman's message of "Sat\, 30 May 2009 20\:24\:43 +0200") References: <87my8upk47.fsf@iki.fi> From: Teemu Likonen Date: Sat, 30 May 2009 21:46:27 +0300 Message-ID: <87hbz2ig3g.fsf@iki.fi> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit On 2009-05-30 20:24 (+0200), Lennart Borgman wrote: > On Sat, May 30, 2009 at 7:37 PM, Teemu Likonen wrote: >>  4. Loop infinitely. > > This does not happen for me with the latest pretest Emacs 23. Have you > tested there? Ah, true. I use Emacs 22.2 (as packaged by Debian) and only checked that Emacs 23 uses the same regexp. Hence I assumed that it had the same problem. Now I tried some quite up-to-date development version of Emacs 23 and it produces f o o b a r instead. So no infinite looping there. I think the result is not what user expects, though. I'd still suggest changing the default regexp to match one or more whitespaces: \s-+ From lennart.borgman@gmail.com Sat May 30 11:47:55 2009 Received: (at 3424) by emacsbugs.donarmstrong.com; 30 May 2009 18:47:55 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mail-bw0-f205.google.com (mail-bw0-f205.google.com [209.85.218.205]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4UIlpuF018676 for <3424@emacsbugs.donarmstrong.com>; Sat, 30 May 2009 11:47:52 -0700 Received: by bwz1 with SMTP id 1so7500633bwz.1 for <3424@emacsbugs.donarmstrong.com>; Sat, 30 May 2009 11:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Q/qSCjdDiyDXPqFNrgmz4Ipo6Fk5li6a0sSIOGyWChg=; b=BYF19xisI6d/ghvQMkCYH8AllW8bis1t6ReYCr8Gi2jwJG1jW+cYbDYwvFBb2ZTzk9 dUzJEfMIpO36jLjyAcPbokWP9Z5qzzZfGp7MdH52eAcNA7PQJlyzv9bXaTaxNGk+NVaM vAStcVQgHmrJxD1BtUUTGBDoqdx0PSd8tXeM8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=dezwYaU5vk5cpAIdDkljYnKqeoQvrZpmpyQzSUJBXo3tH99Th/P9e/5rICctYcGhqj sOqHRm+zuI9jkpOrg9V+Rfs4c0qxacDfPY8IeSMonzEyS4Bk3rTACVEASrYH36iERAWz 0x94x6TCu51ejO3vrGbovc0kfQQ0/xibjsGWE= MIME-Version: 1.0 Received: by 10.239.134.132 with SMTP id 4mr268456hbz.131.1243709265302; Sat, 30 May 2009 11:47:45 -0700 (PDT) In-Reply-To: <87hbz2ig3g.fsf@iki.fi> References: <87my8upk47.fsf@iki.fi> <87hbz2ig3g.fsf@iki.fi> Date: Sat, 30 May 2009 20:47:45 +0200 Message-ID: Subject: Re: bug#3424: align-regexp: Infinite loop with default regexp From: Lennart Borgman To: Teemu Likonen Cc: 3424@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, May 30, 2009 at 8:46 PM, Teemu Likonen wrote: > On 2009-05-30 20:24 (+0200), Lennart Borgman wrote: > >> On Sat, May 30, 2009 at 7:37 PM, Teemu Likonen wrote: >>> =C2=A04. Loop infinitely. >> >> This does not happen for me with the latest pretest Emacs 23. Have you >> tested there? > > Ah, true. I use Emacs 22.2 (as packaged by Debian) and only checked that > Emacs 23 uses the same regexp. Hence I assumed that it had the same > problem. Now I tried some quite up-to-date development version of Emacs > 23 and it produces > > =C2=A0 =C2=A0f o o =C2=A0b a r > > instead. So no infinite looping there. I think the result is not what > user expects, though. I'd still suggest changing the default regexp to > match one or more whitespaces: \s-+ Seems like a good idea to me. From tlikonen@iki.fi Sat Jun 13 22:52:58 2009 Received: (at 3424-done) by emacsbugs.donarmstrong.com; 14 Jun 2009 05:52:58 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.0 required=4.0 tests=AWL autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from jenni2.inet.fi (mta-out.inet.fi [195.156.147.13]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n5E5qrDR015214 for <3424-done@emacsbugs.donarmstrong.com>; Sat, 13 Jun 2009 22:52:55 -0700 Received: from mithlond.arda.local (80.220.180.181) by jenni2.inet.fi (8.5.014) id 49F5CB6401C49619 for 3424-done@emacsbugs.donarmstrong.com; Sun, 14 Jun 2009 08:52:52 +0300 Received: from dtw by mithlond.arda.local with local (Exim 4.69) (envelope-from ) id 1MFieC-0000wr-5G for 3424-done@emacsbugs.donarmstrong.com; Sun, 14 Jun 2009 08:52:52 +0300 From: Teemu Likonen To: 3424-done@debbugs.gnu.org Subject: Re: align-regexp: Infinite loop with default regexp In-Reply-To: <87my8upk47.fsf@iki.fi> (Teemu Likonen's message of "Sat, 30 May 2009 20:37:44 +0300") References: <87my8upk47.fsf@iki.fi> Date: Sun, 14 Jun 2009 08:52:52 +0300 Message-ID: <87ljnv5pl7.fsf@iki.fi> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On 2009-05-30 20:37 (+0300), Teemu Likonen wrote: > The align-regexp command enters infinite loop when it is used with the > default regexp and with REPEAT argument. It's seems to be because the > regexp \s-* matches also zero-length strings. I have misunderstood the behaviour of the regexp. The default space group \s-* is about the spaces to modify before some other matching regexp. It's a bit unexpected to me but I originally reported about infinite loop which is indeed fixed in Emacs 23. So let's close this bug. From unknown Sat Jun 21 03:08:17 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Sun, 12 Jul 2009 14:24:09 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator