[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r114650: Fix indentation/fontification of Java enum
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] trunk r114650: Fix indentation/fontification of Java enum with "implements"/generic. |
Date: |
Sun, 13 Oct 2013 19:58:58 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 114650
revision-id: address@hidden
parent: address@hidden
committer: Alan Mackenzie <address@hidden>
branch nick: trunk
timestamp: Sun 2013-10-13 19:54:46 +0000
message:
Fix indentation/fontification of Java enum with "implements"/generic.
* progmodes/cc-engine.el (c-backward-over-enum-header): Extracted from
the three other places and enhanced to handle generics.
(c-inside-bracelist-p): Uses new function above.
* progmodes/cc-fonts.el (c-font-lock-declarations): Uses new function
above.
(c-font-lock-enum-tail): Uses new function above.
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
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-10-13 11:55:00 +0000
+++ b/lisp/ChangeLog 2013-10-13 19:54:46 +0000
@@ -1,3 +1,15 @@
+2013-10-13 Alan Mackenzie <address@hidden>
+
+ Fix indentation/fontification of Java enum with
+ "implements"/generic.
+
+ * progmodes/cc-engine.el (c-backward-over-enum-header): Extracted
+ from the three other places and enhanced to handle generics.
+ (c-inside-bracelist-p): Uses new function above.
+ * progmodes/cc-fonts.el (c-font-lock-declarations): Uses new
+ function above.
+ (c-font-lock-enum-tail): Uses new function above.
+
2013-10-13 Kenichi Handa <address@hidden>
* international/mule-cmds.el (select-safe-coding-system): Remove a
=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el 2013-09-28 17:17:01 +0000
+++ b/lisp/progmodes/cc-engine.el 2013-10-13 19:54:46 +0000
@@ -8471,6 +8471,32 @@
(not (looking-at "=")))))
b-pos)))
+(defun c-backward-over-enum-header ()
+ ;; We're at a "{". Move back to the enum-like keyword that starts this
+ ;; declaration and return t, otherwise don't move and return nil.
+ (let ((here (point))
+ up-sexp-pos before-identifier)
+ (while
+ (and
+ (eq (c-backward-token-2) 0)
+ (or (not (looking-at "\\s)"))
+ (c-go-up-list-backward))
+ (cond
+ ((and (looking-at c-symbol-key) (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)
+ ((and c-recognize-<>-arglists
+ (eq (char-after) ?<)
+ (looking-at "\\s("))
+ t)
+ (t nil))))
+ (or (looking-at c-brace-list-key)
+ (progn (goto-char here) nil))))
+
(defun c-inside-bracelist-p (containing-sexp paren-state)
;; return the buffer position of the beginning of the brace list
;; statement if we're inside a brace list, otherwise return nil.
@@ -8485,22 +8511,9 @@
;; This function might do hidden buffer changes.
(or
;; This will pick up brace list declarations.
- (c-safe
- (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))))
+ (save-excursion
+ (goto-char containing-sexp)
+ (c-backward-over-enum-header))
;; 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-09-28 17:17:01 +0000
+++ b/lisp/progmodes/cc-fonts.el 2013-10-13 19:54:46 +0000
@@ -1471,22 +1471,9 @@
(let ((paren-state (c-parse-state)))
(and
(numberp (car paren-state))
- (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)))))))
+ (save-excursion
+ (goto-char (car paren-state))
+ (c-backward-over-enum-header)))))
(c-forward-token-2)
nil)
@@ -1574,22 +1561,9 @@
(when (and
encl-pos
(eq (char-after encl-pos) ?\{)
- (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)))))
+ (save-excursion
+ (goto-char encl-pos)
+ (c-backward-over-enum-header)))
(c-syntactic-skip-backward "^{," nil t)
(c-put-char-property (1- (point)) 'c-type 'c-decl-id-start)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r114650: Fix indentation/fontification of Java enum with "implements"/generic.,
Alan Mackenzie <=