diff options
| author | Alan Mackenzie | 2013-09-28 17:17:01 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2013-09-28 17:17:01 +0000 |
| commit | 38de11bd5a80cf3de1f0d8dfa90f5faef1c4e2f9 (patch) | |
| tree | 6e4b2b9178a0fe316249de1c99e8d70c084deb57 | |
| parent | 1610938f74bd8cee71c0190deb470b5bd102d51f (diff) | |
| download | emacs-38de11bd5a80cf3de1f0d8dfa90f5faef1c4e2f9.tar.gz emacs-38de11bd5a80cf3de1f0d8dfa90f5faef1c4e2f9.zip | |
Fix indentation/fontification of Java enum with "implements".
* progmodes/cc-langs.el (c-postfix-decl-spec-key): New variable, a
regexp which matches "implements", etc., in Java.
* progmodes/cc-engine.el (c-inside-bracelist-p): Check for extra
specifier clauses coming after "enum".
* progmodes/cc-fonts.el (c-font-lock-declarations)
(c-font-lock-enum-tail): Check for extra specifier clauses coming
after "enum".
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 26 | ||||
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 47 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 6 |
4 files changed, 65 insertions, 26 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0affac1deaa..9a04acfa686 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2013-09-28 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | Fix indentation/fontification of Java enum with "implements". | ||
| 4 | |||
| 5 | * progmodes/cc-langs.el (c-postfix-decl-spec-key): New variable, a | ||
| 6 | regexp which matches "implements", etc., in Java. | ||
| 7 | * progmodes/cc-engine.el (c-inside-bracelist-p): Check for extra | ||
| 8 | specifier clauses coming after "enum". | ||
| 9 | * progmodes/cc-fonts.el (c-font-lock-declarations) | ||
| 10 | (c-font-lock-enum-tail): Check for extra specifier clauses coming | ||
| 11 | after "enum". | ||
| 12 | |||
| 1 | 2013-09-28 Jan Djärv <jan.h.d@swipnet.se> | 13 | 2013-09-28 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 14 | ||
| 3 | * faces.el (region): Change ns_selection_color to | 15 | * faces.el (region): Change ns_selection_color to |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index ce83efd114b..b3a6a0e3f03 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -8486,17 +8486,21 @@ comment at the start of cc-engine.el for more info." | |||
| 8486 | (or | 8486 | (or |
| 8487 | ;; This will pick up brace list declarations. | 8487 | ;; This will pick up brace list declarations. |
| 8488 | (c-safe | 8488 | (c-safe |
| 8489 | (save-excursion | 8489 | (save-excursion |
| 8490 | (goto-char containing-sexp) | 8490 | (goto-char containing-sexp) |
| 8491 | (c-forward-sexp -1) | 8491 | (let (before-identifier) |
| 8492 | (let (bracepos) | 8492 | (while |
| 8493 | (if (and (or (looking-at c-brace-list-key) | 8493 | (progn |
| 8494 | (progn (c-forward-sexp -1) | 8494 | (c-forward-sexp -1) |
| 8495 | (looking-at c-brace-list-key))) | 8495 | (cond |
| 8496 | (setq bracepos (c-down-list-forward (point))) | 8496 | ((c-on-identifier) (setq before-identifier t)) |
| 8497 | (not (c-crosses-statement-barrier-p (point) | 8497 | ((and before-identifier |
| 8498 | (- bracepos 2)))) | 8498 | (looking-at c-postfix-decl-spec-key)) |
| 8499 | (point))))) | 8499 | (setq before-identifier nil) |
| 8500 | t) | ||
| 8501 | ((looking-at c-brace-list-key) nil) | ||
| 8502 | (t nil)))) | ||
| 8503 | (looking-at c-brace-list-key)))) | ||
| 8500 | ;; this will pick up array/aggregate init lists, even if they are nested. | 8504 | ;; this will pick up array/aggregate init lists, even if they are nested. |
| 8501 | (save-excursion | 8505 | (save-excursion |
| 8502 | (let ((class-key | 8506 | (let ((class-key |
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 4e8ce6bac28..4f9289c307d 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1471,13 +1471,22 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1471 | (let ((paren-state (c-parse-state))) | 1471 | (let ((paren-state (c-parse-state))) |
| 1472 | (and | 1472 | (and |
| 1473 | (numberp (car paren-state)) | 1473 | (numberp (car paren-state)) |
| 1474 | (save-excursion | 1474 | (c-safe |
| 1475 | (goto-char (car paren-state)) | 1475 | (save-excursion |
| 1476 | (c-backward-token-2) | 1476 | (goto-char (car paren-state)) |
| 1477 | (or (looking-at c-brace-list-key) | 1477 | (let (before-identifier) |
| 1478 | (progn | 1478 | (while |
| 1479 | (c-backward-token-2) | 1479 | (progn |
| 1480 | (looking-at c-brace-list-key))))))) | 1480 | (c-forward-sexp -1) |
| 1481 | (cond | ||
| 1482 | ((c-on-identifier) (setq before-identifier t)) | ||
| 1483 | ((and before-identifier | ||
| 1484 | (looking-at c-postfix-decl-spec-key)) | ||
| 1485 | (setq before-identifier nil) | ||
| 1486 | t) | ||
| 1487 | ((looking-at c-brace-list-key) nil) ; "enum" | ||
| 1488 | (t nil)))) | ||
| 1489 | (looking-at c-brace-list-key))))))) | ||
| 1481 | (c-forward-token-2) | 1490 | (c-forward-token-2) |
| 1482 | nil) | 1491 | nil) |
| 1483 | 1492 | ||
| @@ -1565,14 +1574,22 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 1565 | (when (and | 1574 | (when (and |
| 1566 | encl-pos | 1575 | encl-pos |
| 1567 | (eq (char-after encl-pos) ?\{) | 1576 | (eq (char-after encl-pos) ?\{) |
| 1568 | (save-excursion | 1577 | (c-safe |
| 1569 | (goto-char encl-pos) | 1578 | (save-excursion |
| 1570 | (c-backward-syntactic-ws) | 1579 | (goto-char encl-pos) |
| 1571 | (c-simple-skip-symbol-backward) | 1580 | (let (before-identifier) |
| 1572 | (or (looking-at c-brace-list-key) ; "enum" | 1581 | (while |
| 1573 | (progn (c-backward-syntactic-ws) | 1582 | (progn |
| 1574 | (c-simple-skip-symbol-backward) | 1583 | (c-forward-sexp -1) |
| 1575 | (looking-at c-brace-list-key))))) | 1584 | (cond |
| 1585 | ((c-on-identifier) (setq before-identifier t)) | ||
| 1586 | ((and before-identifier | ||
| 1587 | (looking-at c-postfix-decl-spec-key)) | ||
| 1588 | (setq before-identifier nil) | ||
| 1589 | t) | ||
| 1590 | ((looking-at c-brace-list-key) nil) ; "enum" | ||
| 1591 | (t nil)))) | ||
| 1592 | (looking-at c-brace-list-key))))) | ||
| 1576 | (c-syntactic-skip-backward "^{," nil t) | 1593 | (c-syntactic-skip-backward "^{," nil t) |
| 1577 | (c-put-char-property (1- (point)) 'c-type 'c-decl-id-start) | 1594 | (c-put-char-property (1- (point)) 'c-type 'c-decl-id-start) |
| 1578 | 1595 | ||
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index c1e8a1524dc..bf72ab879af 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -2040,6 +2040,12 @@ declarations." | |||
| 2040 | ;; In CORBA PSDL: | 2040 | ;; In CORBA PSDL: |
| 2041 | "as" "const" "implements" "of" "ref")) | 2041 | "as" "const" "implements" "of" "ref")) |
| 2042 | 2042 | ||
| 2043 | (c-lang-defconst c-postfix-decl-spec-key | ||
| 2044 | ;; Regexp matching the keywords in `c-postfix-decl-spec-kwds'. | ||
| 2045 | t (c-make-keywords-re t (c-lang-const c-postfix-decl-spec-kwds))) | ||
| 2046 | (c-lang-defvar c-postfix-decl-spec-key | ||
| 2047 | (c-lang-const c-postfix-decl-spec-key)) | ||
| 2048 | |||
| 2043 | (c-lang-defconst c-nonsymbol-sexp-kwds | 2049 | (c-lang-defconst c-nonsymbol-sexp-kwds |
| 2044 | "Keywords that may be followed by a nonsymbol sexp before whatever | 2050 | "Keywords that may be followed by a nonsymbol sexp before whatever |
| 2045 | construct it's part of continues." | 2051 | construct it's part of continues." |