emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 01/02: Fix error with `mark-defun' and "protected:"


From: Alan Mackenzie
Subject: [Emacs-diffs] master 01/02: Fix error with `mark-defun' and "protected:" in C++ Mode. Fixes: debbugs:19134.
Date: Sat, 22 Nov 2014 21:45:43 +0000

branch: master
commit ec02f4fe1d5ac0f7e306872434f96fcdfe00aead
Author: Alan Mackenzie <address@hidden>
Date:   Sat Nov 22 21:41:00 2014 +0000

    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.
---
 lisp/ChangeLog            |    8 ++++++++
 lisp/progmodes/cc-cmds.el |   12 ++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4c7b583..4223363 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-11-22  Alan Mackenzie  <address@hidden>
+
+       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  <address@hidden>
 
        * net/newst-backend.el (newsticker--sentinel-work): Tell
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 5fa3b25..50cdd78 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



reply via email to

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