From: Alan Mackenzie Date: Sat, 9 Jun 2018 17:34:46 +0000 (+0000) Subject: CC Mode: In brace lists, anchor an elt on its predecessor, not on first elt X-Git-Tag: emacs-27.0.90~4900 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=66ad98685afa9ee3bc1ec2aeb116f41a2a7875b3;p=emacs.git 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. --- 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." (c-backward-syntactic-ws) ;; protect AWK post-inc/decrement operators, etc. (and (not (c-at-vsemi-p (point))) - (/= (skip-chars-backward "-+!*&~@`#") 0))) + (/= (skip-chars-backward "-.+!*&~@`#") 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