GNU bug report logs -
#3424
align-regexp: Infinite loop with default regexp
Previous Next
Reported by: Teemu Likonen <tlikonen <at> iki.fi>
Date: Sat, 30 May 2009 17:40:08 UTC
Severity: normal
Done: Teemu Likonen <tlikonen <at> iki.fi>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This is an automatic notification regarding your bug report
which was filed against the emacs package:
#3424: align-regexp: Infinite loop with default regexp
It has been closed by Teemu Likonen <tlikonen <at> iki.fi>.
Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Teemu Likonen <tlikonen <at> iki.fi> by
replying to this email.
--
3424: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3424
Emacs Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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.
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
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.
[align-regexp.patch (text/x-diff, inline)]
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
This bug report was last modified 15 years and 347 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.