[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#3424: align-regexp: Infinite loop with default regexp
From: |
Teemu Likonen |
Subject: |
bug#3424: align-regexp: Infinite loop with default regexp |
Date: |
Sat, 30 May 2009 20:37:44 +0300 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
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.
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
- bug#3424: align-regexp: Infinite loop with default regexp,
Teemu Likonen <=