emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114474: Fix indentation/fontification of Java enum


From: Alan Mackenzie
Subject: [Emacs-diffs] trunk r114474: Fix indentation/fontification of Java enum with "implements".
Date: Sat, 28 Sep 2013 17:19:45 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114474
revision-id: address@hidden
parent: address@hidden
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Sat 2013-09-28 17:17:01 +0000
message:
  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".
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/progmodes/cc-engine.el    
ccengine.el-20091113204419-o5vbwnq5f7feedwu-1227
  lisp/progmodes/cc-fonts.el     ccfonts.el-20091113204419-o5vbwnq5f7feedwu-2930
  lisp/progmodes/cc-langs.el     cclangs.el-20091113204419-o5vbwnq5f7feedwu-1228
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-09-28 10:01:50 +0000
+++ b/lisp/ChangeLog    2013-09-28 17:17:01 +0000
@@ -1,3 +1,15 @@
+2013-09-28  Alan Mackenzie  <address@hidden>
+
+       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".
+
 2013-09-28  Jan Djärv  <address@hidden>
 
        * faces.el (region): Change ns_selection_color to

=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el       2013-09-21 17:21:29 +0000
+++ b/lisp/progmodes/cc-engine.el       2013-09-28 17:17:01 +0000
@@ -8486,17 +8486,21 @@
   (or
    ;; This will pick up brace list declarations.
    (c-safe
-    (save-excursion
-      (goto-char containing-sexp)
-      (c-forward-sexp -1)
-      (let (bracepos)
-       (if (and (or (looking-at c-brace-list-key)
-                    (progn (c-forward-sexp -1)
-                           (looking-at c-brace-list-key)))
-                (setq bracepos (c-down-list-forward (point)))
-                (not (c-crosses-statement-barrier-p (point)
-                                                    (- bracepos 2))))
-           (point)))))
+     (save-excursion
+       (goto-char containing-sexp)
+       (let (before-identifier)
+        (while
+            (progn
+              (c-forward-sexp -1)
+              (cond
+               ((c-on-identifier) (setq before-identifier t))
+               ((and before-identifier
+                     (looking-at c-postfix-decl-spec-key))
+                (setq before-identifier nil)
+                t)
+               ((looking-at c-brace-list-key) nil)
+               (t nil))))
+        (looking-at c-brace-list-key))))
    ;; this will pick up array/aggregate init lists, even if they are nested.
    (save-excursion
      (let ((class-key

=== modified file 'lisp/progmodes/cc-fonts.el'
--- a/lisp/progmodes/cc-fonts.el        2013-07-27 12:07:43 +0000
+++ b/lisp/progmodes/cc-fonts.el        2013-09-28 17:17:01 +0000
@@ -1471,13 +1471,22 @@
                   (let ((paren-state (c-parse-state)))
                     (and
                      (numberp (car paren-state))
-                     (save-excursion
-                       (goto-char (car paren-state))
-                       (c-backward-token-2)
-                       (or (looking-at c-brace-list-key)
-                           (progn
-                             (c-backward-token-2)
-                             (looking-at c-brace-list-key)))))))
+                     (c-safe
+                       (save-excursion
+                         (goto-char (car paren-state))
+                         (let (before-identifier)
+                           (while
+                               (progn
+                                 (c-forward-sexp -1)
+                                 (cond
+                                  ((c-on-identifier) (setq before-identifier 
t))
+                                  ((and before-identifier
+                                        (looking-at c-postfix-decl-spec-key))
+                                   (setq before-identifier nil)
+                                   t)
+                                  ((looking-at c-brace-list-key) nil) ; "enum"
+                                  (t nil))))
+                           (looking-at c-brace-list-key)))))))
              (c-forward-token-2)
              nil)
 
@@ -1565,14 +1574,22 @@
     (when (and
           encl-pos
           (eq (char-after encl-pos) ?\{)
-          (save-excursion
-            (goto-char encl-pos)
-            (c-backward-syntactic-ws)
-            (c-simple-skip-symbol-backward)
-            (or (looking-at c-brace-list-key) ; "enum"
-                (progn (c-backward-syntactic-ws)
-                       (c-simple-skip-symbol-backward)
-                       (looking-at c-brace-list-key)))))
+          (c-safe
+            (save-excursion
+              (goto-char encl-pos)
+              (let (before-identifier)
+                (while
+                    (progn
+                     (c-forward-sexp -1)
+                     (cond
+                      ((c-on-identifier) (setq before-identifier t))
+                      ((and before-identifier
+                            (looking-at c-postfix-decl-spec-key))
+                       (setq before-identifier nil)
+                       t)
+                      ((looking-at c-brace-list-key) nil) ; "enum"
+                      (t nil))))
+                (looking-at c-brace-list-key)))))
       (c-syntactic-skip-backward "^{," nil t)
       (c-put-char-property (1- (point)) 'c-type 'c-decl-id-start)
 

=== modified file 'lisp/progmodes/cc-langs.el'
--- a/lisp/progmodes/cc-langs.el        2013-09-21 17:21:29 +0000
+++ b/lisp/progmodes/cc-langs.el        2013-09-28 17:17:01 +0000
@@ -2040,6 +2040,12 @@
         ;; In CORBA PSDL:
         "as" "const" "implements" "of" "ref"))
 
+(c-lang-defconst c-postfix-decl-spec-key
+  ;; Regexp matching the keywords in `c-postfix-decl-spec-kwds'.
+  t (c-make-keywords-re t (c-lang-const c-postfix-decl-spec-kwds)))
+(c-lang-defvar c-postfix-decl-spec-key
+  (c-lang-const c-postfix-decl-spec-key))
+
 (c-lang-defconst c-nonsymbol-sexp-kwds
   "Keywords that may be followed by a nonsymbol sexp before whatever
 construct it's part of continues."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]