emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 66ad986: CC Mode: In brace lists, anchor an elt on


From: Alan Mackenzie
Subject: [Emacs-diffs] master 66ad986: CC Mode: In brace lists, anchor an elt on its predecessor, not on first elt
Date: Sat, 9 Jun 2018 13:41:48 -0400 (EDT)

branch: master
commit 66ad98685afa9ee3bc1ec2aeb116f41a2a7875b3
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    CC Mode: In brace lists, anchor an elt on its predecessor, not on first elt
    
    * lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): At the end, 
accept
    "." as a unary operator (which it now is in brace lists in, e.g., C Mode).
    (c-guess-basic-syntax): Just before CASE 9C, move back to the previous brace
    list entry in the block, rather than to the first one.
---
 lisp/progmodes/cc-engine.el | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d1380ff..3d9e4fa 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1282,7 +1282,7 @@ comment at the start of cc-engine.el for more info."
               (c-backward-syntactic-ws)
               ;; protect AWK post-inc/decrement operators, etc.
               (and (not (c-at-vsemi-p (point)))
-                   (/= (skip-chars-backward "-+!*&address@hidden") 0)))
+                   (/= (skip-chars-backward "-.+!*&address@hidden") 0)))
        (setq pos (point)))
       (goto-char pos)
       ret)))
@@ -12608,18 +12608,21 @@ comment at the start of cc-engine.el for more info."
            (c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
 
         (t
-         ;; Prepare for the rest of the cases below by going to the
-         ;; token following the opening brace
-         (if (consp special-brace-list)
-             (progn
-               (goto-char (car (car special-brace-list)))
-               (c-forward-token-2 1 nil indent-point))
-           (goto-char containing-sexp))
-         (forward-char)
-         (let ((start (point)))
-           (c-forward-syntactic-ws indent-point)
-           (goto-char (max start (c-point 'bol))))
-         (c-skip-ws-forward indent-point)
+         ;; Prepare for the rest of the cases below by going back to the
+         ;; previous entry, or BOI before that, providing that this is
+         ;; inside the enclosing brace.
+         (goto-char indent-point)
+         (c-beginning-of-statement-1 containing-sexp nil nil t)
+         (when (/= (point) indent-point)
+           (if (> (c-point 'boi) containing-sexp)
+               (goto-char (c-point 'boi))
+             (if (consp special-brace-list)
+                 (progn
+                   (goto-char (caar special-brace-list))
+                   (c-forward-token-2 1 nil indent-point))
+               (goto-char containing-sexp))
+             (forward-char)
+             (c-skip-ws-forward indent-point)))
          (cond
 
           ;; CASE 9C: we're looking at the first line in a brace-list



reply via email to

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