]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix error with `mark-defun' and "protected:" in C++ Mode.
authorAlan Mackenzie <acm@muc.de>
Sat, 22 Nov 2014 21:41:00 +0000 (21:41 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 22 Nov 2014 21:41:00 +0000 (21:41 +0000)
Fixes: debbugs:19134.
progmodes/cc-cmds.el (c-where-wrt-brace-construct): Handle a return code
of (label) from c-beginning-of-decl-1.

lisp/ChangeLog
lisp/progmodes/cc-cmds.el

index 4c7b58341dd4d06227ec2f9c89bc82a164e6fffd..422336332bfca2c428e2c3ac8bac2c6f33fc2f5b 100644 (file)
@@ -1,3 +1,11 @@
+2014-11-22  Alan Mackenzie  <acm@muc.de>
+
+       Fix error with `mark-defun' and "protected:" in C++ Mode.
+       Fixes: debbugs:19134.
+
+       * progmodes/cc-cmds.el (c-where-wrt-brace-construct): Handle a
+       return code of (label) from c-beginning-of-decl-1.
+
 2014-11-22  Ulf Jasper  <ulf.jasper@web.de>
 
        * net/newst-backend.el (newsticker--sentinel-work): Tell
index 5fa3b25401e733c4a965e160d865da659f7b9280..50cdd78ec365dd365e75266a2f0124260b066c8a 100644 (file)
@@ -1417,12 +1417,15 @@ No indentation or other \"electric\" behavior is performed."
              (car (c-beginning-of-decl-1
                    ;; NOTE: If we're in a K&R region, this might be the start
                    ;; of a parameter declaration, not the actual function.
+                   ;; It might also leave us at a label or "label" like
+                   ;; "private:".
                    (and least-enclosing ; LIMIT for c-b-of-decl-1
                         (c-safe-position least-enclosing paren-state)))))
 
        ;; Has the declaration we've gone back to got braces?
-       (setq brace-decl-p
-             (save-excursion
+       (or (eq decl-result 'label)
+           (setq brace-decl-p
+                 (save-excursion
                    (and (c-syntactic-re-search-forward "[;{]" nil t t)
                         (or (eq (char-before) ?\{)
                             (and c-recognize-knr-p
@@ -1430,10 +1433,11 @@ No indentation or other \"electric\" behavior is performed."
                                  ;; ';' in a K&R argdecl.  In
                                  ;; that case the declaration
                                  ;; should contain a block.
-                                 (c-in-knr-argdecl))))))
+                                 (c-in-knr-argdecl)))))))
 
        (cond
-        ((= (point) kluge-start)       ; might be BOB or unbalanced parens.
+        ((or (eq decl-result 'label)   ; e.g. "private:" or invalid syntax.
+             (= (point) kluge-start))  ; might be BOB or unbalanced parens.
          'outwith-function)
         ((eq decl-result 'same)
          (if brace-decl-p