1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/655ca3305b88/
Changeset: 655ca3305b88
User: acm
Date: 2017-11-10 17:32:55+00:00
Summary: Correct the indentation of C99's compound literals.
* cc-engine.el (c-looking-at-statement-block): Amend so that if there is only
syntactic whitespace in a brace block, it is regarded as a statement block.
Also, if there is no semicolon or comma delimiter, treat as a statement block
when there is a keyword.
(c-guess-basic-syntax): CASE 9 test: Regard a brace as starting a brace block
when its contents indicate a brace block.
Affected #: 1 file
diff -r e1adcfb5afda08fc5cae38d673e756fd5023c8b1 -r
655ca3305b88fefc49a564bf97340b65da01da8f cc-engine.el
--- a/cc-engine.el
+++ b/cc-engine.el
@@ -10735,26 +10735,35 @@
(defun c-looking-at-statement-block ()
;; Point is at an opening brace. If this is a statement block (i.e. the
- ;; elements in it are terminated by semicolons) return t. Otherwise, return
- ;; nil.
+ ;; elements in the block are terminated by semicolons, or the block is
+ ;; empty, or the block contains a keyword) return t. Otherwise, return nil.
(let ((here (point)))
(prog1
(if (c-go-list-forward)
(let ((there (point)))
(backward-char)
- (c-syntactic-skip-backward
- "^;," here t)
+ (c-syntactic-skip-backward "^;," here t)
(cond
((eq (char-before) ?\;) t)
((eq (char-before) ?,) nil)
- (t (goto-char here)
- (forward-char)
- (and (c-syntactic-re-search-forward "{" there t t)
- (progn (backward-char)
- (c-looking-at-statement-block))))))
+ (t ; We're at (1+ here).
+ (cond
+ ((progn (c-forward-syntactic-ws)
+ (eq (point) (1- there)))
+ t)
+ ((c-syntactic-re-search-forward c-keywords-regexp there t)
+ t)
+ ((c-syntactic-re-search-forward "{" there t t)
+ (backward-char)
+ (c-looking-at-statement-block))
+ (t nil)))))
(forward-char)
- (and (c-syntactic-re-search-forward "[;,]" nil t t)
- (eq (char-before) ?\;)))
+ (cond
+ ((c-syntactic-re-search-forward "[;,]" nil t t)
+ (eq (char-before) ?\;))
+ ((c-syntactic-re-search-forward c-keywords-regexp nil t t)
+ t)
+ (t nil)))
(goto-char here))))
(defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end)
@@ -12546,7 +12555,11 @@
(save-excursion
(goto-char containing-sexp)
(c-looking-at-special-brace-list)))
- (c-inside-bracelist-p containing-sexp paren-state t))))
+ (c-inside-bracelist-p containing-sexp paren-state t)
+ (save-excursion
+ (goto-char containing-sexp)
+ (and (eq (char-after) ?{)
+ (not (c-looking-at-statement-block)))))))
(cond
;; CASE 9A: In the middle of a special brace list opener.
Repository URL:
https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.