1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-18 10:16:51 +00:00

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.
This commit is contained in:
Alan Mackenzie 2012-12-11 19:06:57 +00:00
parent da18719115
commit 14b8c3d926
2 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2012-12-11 Alan Mackenzie <acm@muc.de>
Make CC Mode not hang when _some_ lines end in CRLF. Bug #11841.
* progmodes/cc-engine.el (c-backward-comments): Add code to work
around `forward-comment' not recognizing ^M as whitespace.
2012-12-11 Fabián Ezequiel Gallina <fgallina@cuca>
* progmodes/python.el (python-skeleton-class)

View File

@ -1452,8 +1452,21 @@ comment at the start of cc-engine.el for more info."
;; return t when moving backwards at bob.
(not (bobp))
(if (let (open-paren-in-column-0-is-defun-start)
(forward-comment -1))
(if (let (open-paren-in-column-0-is-defun-start moved-comment)
(while
(and (not (setq moved-comment (forward-comment -1)))
;; Cope specifically with ^M^J here -
;; forward-comment sometimes gets stuck after ^Ms,
;; sometimes after ^M^J.
(or
(when (eq (char-before) ?\r)
(backward-char)
t)
(when (and (eq (char-before) ?\n)
(eq (char-before (1- (point))) ?\r))
(backward-char 2)
t))))
moved-comment)
(if (looking-at "\\*/")
;; Emacs <= 20 and XEmacs move back over the
;; closer of a block comment that lacks an opener.