aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2018-06-09 17:34:46 +0000
committerAlan Mackenzie2018-06-09 17:34:46 +0000
commit66ad98685afa9ee3bc1ec2aeb116f41a2a7875b3 (patch)
tree0ecd2fbaf836eedc0c94b30ee1e835ad43a90dd9
parentb4dcac2d6ae376788dca11b88b874a9ecaf986df (diff)
downloademacs-66ad98685afa9ee3bc1ec2aeb116f41a2a7875b3.tar.gz
emacs-66ad98685afa9ee3bc1ec2aeb116f41a2a7875b3.zip
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.
-rw-r--r--lisp/progmodes/cc-engine.el29
1 files changed, 16 insertions, 13 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index d1380ff6f69..3d9e4fa0d35 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."
1282 (c-backward-syntactic-ws) 1282 (c-backward-syntactic-ws)
1283 ;; protect AWK post-inc/decrement operators, etc. 1283 ;; protect AWK post-inc/decrement operators, etc.
1284 (and (not (c-at-vsemi-p (point))) 1284 (and (not (c-at-vsemi-p (point)))
1285 (/= (skip-chars-backward "-+!*&~@`#") 0))) 1285 (/= (skip-chars-backward "-.+!*&~@`#") 0)))
1286 (setq pos (point))) 1286 (setq pos (point)))
1287 (goto-char pos) 1287 (goto-char pos)
1288 ret))) 1288 ret)))
@@ -12608,18 +12608,21 @@ comment at the start of cc-engine.el for more info."
12608 (c-add-stmt-syntax 'brace-list-close nil t lim paren-state))) 12608 (c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
12609 12609
12610 (t 12610 (t
12611 ;; Prepare for the rest of the cases below by going to the 12611 ;; Prepare for the rest of the cases below by going back to the
12612 ;; token following the opening brace 12612 ;; previous entry, or BOI before that, providing that this is
12613 (if (consp special-brace-list) 12613 ;; inside the enclosing brace.
12614 (progn 12614 (goto-char indent-point)
12615 (goto-char (car (car special-brace-list))) 12615 (c-beginning-of-statement-1 containing-sexp nil nil t)
12616 (c-forward-token-2 1 nil indent-point)) 12616 (when (/= (point) indent-point)
12617 (goto-char containing-sexp)) 12617 (if (> (c-point 'boi) containing-sexp)
12618 (forward-char) 12618 (goto-char (c-point 'boi))
12619 (let ((start (point))) 12619 (if (consp special-brace-list)
12620 (c-forward-syntactic-ws indent-point) 12620 (progn
12621 (goto-char (max start (c-point 'bol)))) 12621 (goto-char (caar special-brace-list))
12622 (c-skip-ws-forward indent-point) 12622 (c-forward-token-2 1 nil indent-point))
12623 (goto-char containing-sexp))
12624 (forward-char)
12625 (c-skip-ws-forward indent-point)))
12623 (cond 12626 (cond
12624 12627
12625 ;; CASE 9C: we're looking at the first line in a brace-list 12628 ;; CASE 9C: we're looking at the first line in a brace-list