From: Alan Mackenzie Date: Sat, 22 Nov 2014 21:41:00 +0000 (+0000) Subject: Fix error with `mark-defun' and "protected:" in C++ Mode. X-Git-Tag: emacs-25.0.90~2635^2~384 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ec02f4fe1d5ac0f7e306872434f96fcdfe00aead;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4c7b58341dd..422336332bf 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-11-22 Alan Mackenzie + + 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 * net/newst-backend.el (newsticker--sentinel-work): Tell diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 5fa3b25401e..50cdd78ec36 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -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