]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-mode.el
Merge from emacs-24, up to 2012-04-10T02:06:19Z!larsi@gnus.org
[gnu-emacs] / lisp / progmodes / cc-mode.el
index 0c86b68f1d949d0e25d54a2b5b94cc2cbd38e5ce..7c018feefbb631ba7c85c178e904f072ad285f2d 100644 (file)
@@ -925,8 +925,8 @@ Note that the style variables are always made local to the buffer."
     ;; inside a string, comment, or macro.
     (setq new-bounds (c-extend-font-lock-region-for-macros
                      c-new-BEG c-new-END old-len))
-    (setq c-new-BEG (car new-bounds)
-         c-new-END (cdr new-bounds))
+    (setq c-new-BEG (max (car new-bounds) (c-determine-limit 500 begg))
+         c-new-END (min (cdr new-bounds) (c-determine-+ve-limit 500 endd)))
     ;; Clear all old relevant properties.
     (c-clear-char-property-with-value c-new-BEG c-new-END 'syntax-table '(1))
     (c-clear-char-property-with-value c-new-BEG c-new-END 'category 'c-cpp-delimiter)
@@ -1114,7 +1114,7 @@ Note that the style variables are always made local to the buffer."
     (goto-char (c-point 'bol new-pos))
     (when lit-limits                   ; Comment or string.
       (goto-char (car lit-limits)))
-    (setq bod-lim (max (- (point) 500) (point-min)))
+    (setq bod-lim (c-determine-limit 500))
 
     (while
        ;; Go to a less nested declaration each time round this loop.
@@ -1132,11 +1132,12 @@ Note that the style variables are always made local to the buffer."
         ;; Try and go out a level to search again.
         (progn
           (c-backward-syntactic-ws bod-lim)
-          (or (memq (char-before) '(?\( ?\[))
-              (and (eq (char-before) ?\<)
-                   (eq (c-get-char-property
-                        (1- (point)) 'syntax-table)
-                       c-<-as-paren-syntax))))
+          (and (> (point) bod-lim)
+               (or (memq (char-before) '(?\( ?\[))
+                   (and (eq (char-before) ?\<)
+                        (eq (c-get-char-property
+                             (1- (point)) 'syntax-table)
+                            c-<-as-paren-syntax)))))
         (not (bobp)))
       (backward-char))
     new-pos))                          ; back over (, [, <.