* bug#3424: align-regexp: Infinite loop with default regexp
@ 2009-05-30 17:37 ` Teemu Likonen
2009-05-30 18:24 ` Lennart Borgman
2009-06-14 5:55 ` bug#3424: marked as done (align-regexp: Infinite loop with default regexp) Emacs bug Tracking System
0 siblings, 2 replies; 5+ messages in thread
From: Teemu Likonen @ 2009-05-30 17:37 UTC (permalink / raw
To: bug-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 505 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: align-regexp.patch --]
[-- Type: text/x-diff, Size: 892 bytes --]
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#3424: align-regexp: Infinite loop with default regexp
2009-05-30 17:37 ` bug#3424: align-regexp: Infinite loop with default regexp Teemu Likonen
@ 2009-05-30 18:24 ` Lennart Borgman
2009-05-30 18:46 ` Teemu Likonen
2009-06-14 5:55 ` bug#3424: marked as done (align-regexp: Infinite loop with default regexp) Emacs bug Tracking System
1 sibling, 1 reply; 5+ messages in thread
From: Lennart Borgman @ 2009-05-30 18:24 UTC (permalink / raw
To: Teemu Likonen, 3424; +Cc: bug-gnu-emacs
On Sat, May 30, 2009 at 7:37 PM, Teemu Likonen <tlikonen@iki.fi> 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:
>
> 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.
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.
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#3424: align-regexp: Infinite loop with default regexp
2009-05-30 18:24 ` Lennart Borgman
@ 2009-05-30 18:46 ` Teemu Likonen
2009-05-30 18:47 ` Lennart Borgman
0 siblings, 1 reply; 5+ messages in thread
From: Teemu Likonen @ 2009-05-30 18:46 UTC (permalink / raw
To: Lennart Borgman; +Cc: 3424
On 2009-05-30 20:24 (+0200), Lennart Borgman wrote:
> On Sat, May 30, 2009 at 7:37 PM, Teemu Likonen <tlikonen@iki.fi> 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-+
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#3424: align-regexp: Infinite loop with default regexp
2009-05-30 18:46 ` Teemu Likonen
@ 2009-05-30 18:47 ` Lennart Borgman
0 siblings, 0 replies; 5+ messages in thread
From: Lennart Borgman @ 2009-05-30 18:47 UTC (permalink / raw
To: Teemu Likonen; +Cc: 3424
On Sat, May 30, 2009 at 8:46 PM, Teemu Likonen <tlikonen@iki.fi> wrote:
> On 2009-05-30 20:24 (+0200), Lennart Borgman wrote:
>
>> On Sat, May 30, 2009 at 7:37 PM, Teemu Likonen <tlikonen@iki.fi> 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-+
Seems like a good idea to me.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#3424: marked as done (align-regexp: Infinite loop with default regexp)
2009-05-30 17:37 ` bug#3424: align-regexp: Infinite loop with default regexp Teemu Likonen
2009-05-30 18:24 ` Lennart Borgman
@ 2009-06-14 5:55 ` Emacs bug Tracking System
1 sibling, 0 replies; 5+ messages in thread
From: Emacs bug Tracking System @ 2009-06-14 5:55 UTC (permalink / raw
To: Teemu Likonen
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
Your message dated Sun, 14 Jun 2009 08:52:52 +0300
with message-id <87ljnv5pl7.fsf@iki.fi>
and subject line Re: align-regexp: Infinite loop with default regexp
has caused the Emacs bug report #3424,
regarding align-regexp: Infinite loop with default regexp
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)
--
3424: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=3424
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems
[-- Attachment #2: Type: message/rfc822, Size: 3631 bytes --]
[-- Attachment #2.1.1: Type: text/plain, Size: 505 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2.1.2: align-regexp.patch --]
[-- Type: text/x-diff, Size: 892 bytes --]
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
[-- Attachment #3: Type: message/rfc822, Size: 2006 bytes --]
From: Teemu Likonen <tlikonen@iki.fi>
To: 3424-done@emacsbugs.donarmstrong.com
Subject: Re: align-regexp: Infinite loop with default regexp
Date: Sun, 14 Jun 2009 08:52:52 +0300
Message-ID: <87ljnv5pl7.fsf@iki.fi>
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.
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-06-14 5:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <87ljnv5pl7.fsf@iki.fi>
2009-05-30 17:37 ` bug#3424: align-regexp: Infinite loop with default regexp Teemu Likonen
2009-05-30 18:24 ` Lennart Borgman
2009-05-30 18:46 ` Teemu Likonen
2009-05-30 18:47 ` Lennart Borgman
2009-06-14 5:55 ` bug#3424: marked as done (align-regexp: Infinite loop with default regexp) Emacs bug Tracking System
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.