From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.bugs Subject: bug#3424: align-regexp: Infinite loop with default regexp Date: Sat, 30 May 2009 20:37:44 +0300 Message-ID: <87my8upk47.fsf@iki.fi> Reply-To: Teemu Likonen , 3424@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1243706329 4687 80.91.229.12 (30 May 2009 17:58:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 May 2009 17:58:49 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 30 19:58:46 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MASpQ-0001IE-OZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 May 2009 19:58:45 +0200 Original-Received: from localhost ([127.0.0.1]:54164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MASpQ-0000Ig-2m for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 May 2009 13:58:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MASo9-0007qV-Am for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:57:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MASo4-0007id-LP for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:57:24 -0400 Original-Received: from [199.232.76.173] (port=59736 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MASo4-0007iG-3R for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:57:20 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:45304) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MASo3-0000OM-I6 for bug-gnu-emacs@gnu.org; Sat, 30 May 2009 13:57:19 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n4UHvHuX007386; Sat, 30 May 2009 10:57:17 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n4UHe8Zh003690; Sat, 30 May 2009 10:40:08 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Teemu Likonen Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sat, 30 May 2009 17:40:08 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 3424 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12437051073486 (code B ref -1); Sat, 30 May 2009 17:40:08 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 30 May 2009 17:38:27 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Sat, 30 May 2009 13:57:24 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:28329 Archived-At: --=-=-= 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 --=-=-=--