emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3266e69: c-where-wrt-brace-construct: deal with poi


From: Alan Mackenzie
Subject: [Emacs-diffs] master 3266e69: c-where-wrt-brace-construct: deal with point following a struct's semicolon.
Date: Mon, 27 Aug 2018 15:50:50 -0400 (EDT)

branch: master
commit 3266e69dabfb36b2c9886a5e31b87e322d01ca7f
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    c-where-wrt-brace-construct: deal with point following a struct's semicolon.
    
    More precisely, when point is right after the terminating semicolon of a
    construct like "struct foo { .... } bar;", the function must return
    'at-function-end.
    
    * lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Surround an
    existing test for 'at-function-end with an `or' form, the other arm testing
    for being after the semicolon above.
---
 lisp/progmodes/cc-cmds.el | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 478ccf1..4f256e1 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1441,21 +1441,23 @@ No indentation or other \"electric\" behavior is 
performed."
        'in-block)
        ((c-in-function-trailer-p)
        'in-trailer)
-       ((and (not least-enclosing)
-            (consp paren-state)
-            (consp (car paren-state))
-            (eq start (cdar paren-state))
-            (or
-             (save-excursion
-               (c-forward-syntactic-ws)
-               (or (not (looking-at c-symbol-start))
-                   (looking-at c-keywords-regexp)))
-             (save-excursion
-               (goto-char (caar paren-state))
-               (c-beginning-of-decl-1
-                (and least-enclosing
-                     (c-safe-position least-enclosing paren-state)))
-               (not (looking-at c-defun-type-name-decl-key)))))
+       ((or (and (eq (char-before) ?\;)
+                (save-excursion
+                  (backward-char)
+                  (c-in-function-trailer-p)))
+           (and (not least-enclosing)
+                (consp paren-state)
+                (consp (car paren-state))
+                (eq start (cdar paren-state))
+                (or
+                 (save-excursion
+                   (c-forward-syntactic-ws)
+                   (or (not (looking-at c-symbol-start))
+                       (looking-at c-keywords-regexp)))
+                 (save-excursion
+                   (goto-char (caar paren-state))
+                   (c-beginning-of-decl-1)
+                   (not (looking-at c-defun-type-name-decl-key))))))
        'at-function-end)
        (t
        ;; Find the start of the current declaration.  NOTE: If we're in the



reply via email to

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