]> git.eshelyaron.com Git - emacs.git/commitdiff
(c-beginning-of-member-init-list):
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 24 Oct 2001 16:07:06 +0000 (16:07 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 24 Oct 2001 16:07:06 +0000 (16:07 +0000)
Better handling of C++ template args to avoid confusion with `<'
and `>' used as operators in member init expressions.
From Martin Stjernholm  <bug-cc-mode@gnu.org>.

lisp/progmodes/cc-engine.el

index f76e1e38912730d6ad8f8ea370a8adf588e8acc4..a30798d4b0f0e991a8759ffa00d9c1af30fab8cb 100644 (file)
@@ -1028,31 +1028,30 @@ brace."
   (if (eq (char-after) ?,)
       (forward-char 1)
     (c-backward-syntactic-ws limit))
-  (c-with-syntax-table (if (c-major-mode-is 'c++-mode)
-                          c++-template-syntax-table
-                        (syntax-table))
-    (while (and (< limit (point))
-               (eq (char-before) ?,))
-      ;; this will catch member inits with multiple
-      ;; line arglists
-      (forward-char -1)
-      (c-backward-syntactic-ws)
-      (if (eq (char-before) ?\))
-         (c-backward-sexp 2)
+  (while (and (< limit (point))
+             (eq (char-before) ?,))
+    ;; this will catch member inits with multiple
+    ;; line arglists
+    (forward-char -1)
+    (c-backward-syntactic-ws limit)
+    (if (eq (char-before) ?\))
        (c-backward-sexp 1))
-      ;; Skip over any template arg to the class.
-      (if (eq (char-after) ?<)
-         (c-backward-sexp 1))
-      ;; Skip backwards over a fully::qualified::name.
-      (c-backward-syntactic-ws limit)
-      (while (and (eq (char-before) ?:)
-                 (save-excursion
-                   (forward-char -1)
-                   (eq (char-before) ?:)))
-       (backward-char 2)
-       (c-backward-sexp 1))
-      ;; now continue checking
-      (c-backward-syntactic-ws limit)))
+    (c-backward-syntactic-ws limit)
+    ;; Skip over any template arg to the class.
+    (if (eq (char-before) ?>)
+       (c-with-syntax-table c++-template-syntax-table
+         (c-backward-sexp 1)))
+    (c-backward-sexp 1)
+    (c-backward-syntactic-ws limit)
+    ;; Skip backwards over a fully::qualified::name.
+    (while (and (eq (char-before) ?:)
+               (save-excursion
+                 (forward-char -1)
+                 (eq (char-before) ?:)))
+      (backward-char 2)
+      (c-backward-sexp 1))
+    ;; now continue checking
+    (c-backward-syntactic-ws limit))
   (and (< limit (point))
        (eq (char-before) ?:)))