diff options
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 52 |
2 files changed, 40 insertions, 18 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cbeea784579..cf0864561aa 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,11 @@ | |||
| 1 | 2013-08-25 Alan Mackenzie <acm@muc.de> | 1 | 2013-08-25 Alan Mackenzie <acm@muc.de> |
| 2 | 2 | ||
| 3 | Improve indentation of bracelists defined by macros (without "="). | ||
| 4 | |||
| 5 | * progmodes/cc-engine.el (c-inside-bracelist-p): When a macro | ||
| 6 | expansion begins with "{", regard it as bracelist when it doesn't | ||
| 7 | contain a ";". | ||
| 8 | |||
| 3 | Parse C++ inher-intro when there's a template split over 2 lines. | 9 | Parse C++ inher-intro when there's a template split over 2 lines. |
| 4 | 10 | ||
| 5 | * progmodes/cc-engine.el (c-guess-basic-syntax CASE 5C): Code more | 11 | * progmodes/cc-engine.el (c-guess-basic-syntax CASE 5C): Code more |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 3d6398014db..b9345b2ae6a 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -8476,10 +8476,10 @@ comment at the start of cc-engine.el for more info." | |||
| 8476 | ;; check for the class key here. | 8476 | ;; check for the class key here. |
| 8477 | (and (c-major-mode-is 'pike-mode) | 8477 | (and (c-major-mode-is 'pike-mode) |
| 8478 | c-decl-block-key)) | 8478 | c-decl-block-key)) |
| 8479 | bufpos braceassignp lim next-containing) | 8479 | bufpos braceassignp lim next-containing macro-start) |
| 8480 | (while (and (not bufpos) | 8480 | (while (and (not bufpos) |
| 8481 | containing-sexp) | 8481 | containing-sexp) |
| 8482 | (when paren-state | 8482 | (when paren-state |
| 8483 | (if (consp (car paren-state)) | 8483 | (if (consp (car paren-state)) |
| 8484 | (setq lim (cdr (car paren-state)) | 8484 | (setq lim (cdr (car paren-state)) |
| 8485 | paren-state (cdr paren-state)) | 8485 | paren-state (cdr paren-state)) |
| @@ -8560,22 +8560,38 @@ comment at the start of cc-engine.el for more info." | |||
| 8560 | )))) | 8560 | )))) |
| 8561 | nil) | 8561 | nil) |
| 8562 | (t t)))))) | 8562 | (t t)))))) |
| 8563 | (if (and (eq braceassignp 'dontknow) | 8563 | (if (and (eq braceassignp 'dontknow) |
| 8564 | (/= (c-backward-token-2 1 t lim) 0)) | 8564 | (/= (c-backward-token-2 1 t lim) 0)) |
| 8565 | (setq braceassignp nil))) | 8565 | (setq braceassignp nil))) |
| 8566 | (if (not braceassignp) | 8566 | (cond |
| 8567 | (if (eq (char-after) ?\;) | 8567 | (braceassignp |
| 8568 | ;; Brace lists can't contain a semicolon, so we're done. | 8568 | ;; We've hit the beginning of the aggregate list. |
| 8569 | (setq containing-sexp nil) | 8569 | (c-beginning-of-statement-1 |
| 8570 | ;; Go up one level. | 8570 | (c-most-enclosing-brace paren-state)) |
| 8571 | (setq containing-sexp next-containing | 8571 | (setq bufpos (point))) |
| 8572 | lim nil | 8572 | ((eq (char-after) ?\;) |
| 8573 | next-containing nil)) | 8573 | ;; Brace lists can't contain a semicolon, so we're done. |
| 8574 | ;; we've hit the beginning of the aggregate list | 8574 | (setq containing-sexp nil)) |
| 8575 | (c-beginning-of-statement-1 | 8575 | ((and (setq macro-start (point)) |
| 8576 | (c-most-enclosing-brace paren-state)) | 8576 | (c-forward-to-cpp-define-body) |
| 8577 | (setq bufpos (point)))) | 8577 | (eq (point) containing-sexp)) |
| 8578 | ) | 8578 | ;; We've a macro whose expansion starts with the '{'. |
| 8579 | ;; Heuristically, if we have a ';' in it we've not got a | ||
| 8580 | ;; brace list, otherwise we have. | ||
| 8581 | (let ((macro-end (progn (c-end-of-macro) (point)))) | ||
| 8582 | (goto-char containing-sexp) | ||
| 8583 | (forward-char) | ||
| 8584 | (if (and (c-syntactic-re-search-forward "[;,]" macro-end t t) | ||
| 8585 | (eq (char-before) ?\;)) | ||
| 8586 | (setq bufpos nil | ||
| 8587 | containing-sexp nil) | ||
| 8588 | (setq bufpos macro-start)))) | ||
| 8589 | (t | ||
| 8590 | ;; Go up one level | ||
| 8591 | (setq containing-sexp next-containing | ||
| 8592 | lim nil | ||
| 8593 | next-containing nil))))) | ||
| 8594 | |||
| 8579 | bufpos)) | 8595 | bufpos)) |
| 8580 | )) | 8596 | )) |
| 8581 | 8597 | ||