emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111024: Make CC Mode not hang whe


From: Alan Mackenzie
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111024: Make CC Mode not hang when _some_ lines end in CRLF. Bug #11841.
Date: Tue, 11 Dec 2012 19:06:57 +0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111024
committer: Alan Mackenzie <address@hidden>
branch nick: emacs-24
timestamp: Tue 2012-12-11 19:06:57 +0000
message:
  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.
modified:
  lisp/ChangeLog
  lisp/progmodes/cc-engine.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-12-11 07:22:55 +0000
+++ b/lisp/ChangeLog    2012-12-11 19:06:57 +0000
@@ -1,3 +1,9 @@
+2012-12-11  Alan Mackenzie  <address@hidden>
+
+       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  <address@hidden>
 
        * progmodes/python.el (python-skeleton-class)

=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el       2012-11-21 20:41:03 +0000
+++ b/lisp/progmodes/cc-engine.el       2012-12-11 19:06:57 +0000
@@ -1452,8 +1452,21 @@
            ;; 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]