diff options
| author | Alan Mackenzie | 2012-12-11 19:06:57 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2012-12-11 19:06:57 +0000 |
| commit | 14b8c3d926ef813f621f95b0dcd059192d3d898c (patch) | |
| tree | 5d7ae93d96cf43cbc3cd6887afbe7483bc7bc838 | |
| parent | da187191154105389c8b6c8e538e34f3d22c588d (diff) | |
| download | emacs-14b8c3d926ef813f621f95b0dcd059192d3d898c.tar.gz emacs-14b8c3d926ef813f621f95b0dcd059192d3d898c.zip | |
Make CC Mode not hang when _some_ lines end in CRLF. Bug #11841.
cc-engine.el (c-backward-comments): Add code to work around
`forward-comment' not recognizing ^M as whitespace.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 17 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c77cc286c76..fb75b3678c7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-12-11 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | Make CC Mode not hang when _some_ lines end in CRLF. Bug #11841. | ||
| 4 | * progmodes/cc-engine.el (c-backward-comments): Add code to work | ||
| 5 | around `forward-comment' not recognizing ^M as whitespace. | ||
| 6 | |||
| 1 | 2012-12-11 Fabián Ezequiel Gallina <fgallina@cuca> | 7 | 2012-12-11 Fabián Ezequiel Gallina <fgallina@cuca> |
| 2 | 8 | ||
| 3 | * progmodes/python.el (python-skeleton-class) | 9 | * progmodes/python.el (python-skeleton-class) |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 10355451480..f7248e2d2d3 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -1452,8 +1452,21 @@ comment at the start of cc-engine.el for more info." | |||
| 1452 | ;; return t when moving backwards at bob. | 1452 | ;; return t when moving backwards at bob. |
| 1453 | (not (bobp)) | 1453 | (not (bobp)) |
| 1454 | 1454 | ||
| 1455 | (if (let (open-paren-in-column-0-is-defun-start) | 1455 | (if (let (open-paren-in-column-0-is-defun-start moved-comment) |
| 1456 | (forward-comment -1)) | 1456 | (while |
| 1457 | (and (not (setq moved-comment (forward-comment -1))) | ||
| 1458 | ;; Cope specifically with ^M^J here - | ||
| 1459 | ;; forward-comment sometimes gets stuck after ^Ms, | ||
| 1460 | ;; sometimes after ^M^J. | ||
| 1461 | (or | ||
| 1462 | (when (eq (char-before) ?\r) | ||
| 1463 | (backward-char) | ||
| 1464 | t) | ||
| 1465 | (when (and (eq (char-before) ?\n) | ||
| 1466 | (eq (char-before (1- (point))) ?\r)) | ||
| 1467 | (backward-char 2) | ||
| 1468 | t)))) | ||
| 1469 | moved-comment) | ||
| 1457 | (if (looking-at "\\*/") | 1470 | (if (looking-at "\\*/") |
| 1458 | ;; Emacs <= 20 and XEmacs move back over the | 1471 | ;; Emacs <= 20 and XEmacs move back over the |
| 1459 | ;; closer of a block comment that lacks an opener. | 1472 | ;; closer of a block comment that lacks an opener. |