diff options
| author | Chong Yidong | 2009-01-24 23:42:42 +0000 |
|---|---|---|
| committer | Chong Yidong | 2009-01-24 23:42:42 +0000 |
| commit | 5fe829521cfe73890a7ca3e5e39dac4ea21f51a1 (patch) | |
| tree | 19fe9d1136364e822d7206293539736d729ed1fd | |
| parent | 6ac30b5b14f4118bd3501a64f3f658500bce571c (diff) | |
| download | emacs-5fe829521cfe73890a7ca3e5e39dac4ea21f51a1.tar.gz emacs-5fe829521cfe73890a7ca3e5e39dac4ea21f51a1.zip | |
(align-region): Avoid infloop.
| -rw-r--r-- | lisp/align.el | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/align.el b/lisp/align.el index 911200f58ad..cb69bc51947 100644 --- a/lisp/align.el +++ b/lisp/align.el | |||
| @@ -1307,6 +1307,7 @@ aligner would have dealt with are." | |||
| 1307 | (rulesep (assq 'separate rule)) | 1307 | (rulesep (assq 'separate rule)) |
| 1308 | (thissep (if rulesep (cdr rulesep) separate)) | 1308 | (thissep (if rulesep (cdr rulesep) separate)) |
| 1309 | same (eol 0) | 1309 | same (eol 0) |
| 1310 | search-start | ||
| 1310 | group group-c | 1311 | group group-c |
| 1311 | spacing spacing-c | 1312 | spacing spacing-c |
| 1312 | tab-stop tab-stop-c | 1313 | tab-stop tab-stop-c |
| @@ -1412,6 +1413,7 @@ aligner would have dealt with are." | |||
| 1412 | ;; while we can find the rule in the alignment | 1413 | ;; while we can find the rule in the alignment |
| 1413 | ;; region.. | 1414 | ;; region.. |
| 1414 | (while (and (< (point) end-mark) | 1415 | (while (and (< (point) end-mark) |
| 1416 | (setq search-start (point)) | ||
| 1415 | (if regfunc | 1417 | (if regfunc |
| 1416 | (funcall regfunc end-mark nil) | 1418 | (funcall regfunc end-mark nil) |
| 1417 | (re-search-forward regexp | 1419 | (re-search-forward regexp |
| @@ -1436,7 +1438,7 @@ aligner would have dealt with are." | |||
| 1436 | ;; if the search ended us on the beginning of | 1438 | ;; if the search ended us on the beginning of |
| 1437 | ;; the next line, move back to the end of the | 1439 | ;; the next line, move back to the end of the |
| 1438 | ;; previous line. | 1440 | ;; previous line. |
| 1439 | (if (bolp) | 1441 | (if (and (bolp) (> (point) search-start)) |
| 1440 | (forward-char -1)) | 1442 | (forward-char -1)) |
| 1441 | 1443 | ||
| 1442 | ;; lookup the `group' attribute the first time | 1444 | ;; lookup the `group' attribute the first time |
| @@ -1576,7 +1578,12 @@ aligner would have dealt with are." | |||
| 1576 | ;; the next line; don't bother searching | 1578 | ;; the next line; don't bother searching |
| 1577 | ;; anymore on this one | 1579 | ;; anymore on this one |
| 1578 | (if (and (not repeat) (not (bolp))) | 1580 | (if (and (not repeat) (not (bolp))) |
| 1579 | (forward-line))))) | 1581 | (forward-line)) |
| 1582 | |||
| 1583 | ;; if the search did not change point, | ||
| 1584 | ;; move forward to avoid an infinite loop | ||
| 1585 | (if (= (point) search-start) | ||
| 1586 | (forward-char))))) | ||
| 1580 | 1587 | ||
| 1581 | ;; when they are no more matches for this rule, | 1588 | ;; when they are no more matches for this rule, |
| 1582 | ;; align whatever was left over | 1589 | ;; align whatever was left over |