aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2016-04-25 17:08:26 +0000
committerAlan Mackenzie2016-04-25 17:08:26 +0000
commitdb2ee1cd63ebebbe52099a1442dbc47f74135e5b (patch)
treeff2c48b1aadb81dae65526e02981b52d4f4175d3
parentff9de7b38a3a316529c73e36645182055e2addc4 (diff)
downloademacs-db2ee1cd63ebebbe52099a1442dbc47f74135e5b.tar.gz
emacs-db2ee1cd63ebebbe52099a1442dbc47f74135e5b.zip
c-forward-<>-arglist no longer directly applies face properties in Java Mode.
This allows the calling of c-restore-<>-properties from c-common-init without the test suite giving spurious errors. * lisp/progmodes/cc-engine.el (c-forward-<>-arglist): Remove the form that sets face properties. (c-forward-<>-arglist-recur): Reformulate the bit that handles types inside template brackets using c-inside-<>-type-key. Don't bind c-record-type-identifiers or c-record-found-types around the recursive call, allowing positions of found types to flow back to the caller. * lisp/progmodes/cc-langs.el (c-inside-<>-type-kwds, c-inside-<>-type-key): new lang consts/var. * lisp/progmodes/cc-mode.el (c-common-init): Don't remove c-restore-<>-properties from the list of functions called at mode initialization.
-rw-r--r--lisp/progmodes/cc-engine.el44
-rw-r--r--lisp/progmodes/cc-langs.el9
-rw-r--r--lisp/progmodes/cc-mode.el5
3 files changed, 33 insertions, 25 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index c38a3a3b100..f7a850f4118 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6026,7 +6026,6 @@ comment at the start of cc-engine.el for more info."
6026 ;; `nconc' doesn't mind that the tail of 6026 ;; `nconc' doesn't mind that the tail of
6027 ;; `c-record-found-types' is t. 6027 ;; `c-record-found-types' is t.
6028 (nconc c-record-found-types c-record-type-identifiers))) 6028 (nconc c-record-found-types c-record-type-identifiers)))
6029 (if (c-major-mode-is 'java-mode) (c-fontify-recorded-types-and-refs))
6030 t) 6029 t)
6031 6030
6032 (goto-char start) 6031 (goto-char start)
@@ -6072,28 +6071,31 @@ comment at the start of cc-engine.el for more info."
6072 (progn 6071 (progn
6073 (c-forward-syntactic-ws) 6072 (c-forward-syntactic-ws)
6074 (when (or (and c-record-type-identifiers all-types) 6073 (when (or (and c-record-type-identifiers all-types)
6075 (c-major-mode-is 'java-mode)) 6074 (not (equal c-inside-<>-type-key "\\(\\<\\>\\)")))
6076 ;; All encountered identifiers are types, so set the 6075 (c-forward-syntactic-ws)
6077 ;; promote flag and parse the type. 6076 (cond
6078 (progn 6077 ((eq (char-after) ??)
6079 (c-forward-syntactic-ws) 6078 (forward-char))
6080 (if (looking-at "\\?") 6079 ((and (looking-at c-identifier-start)
6081 (forward-char) 6080 (not (looking-at c-keywords-regexp)))
6082 (when (looking-at c-identifier-start) 6081 (if (or (and all-types c-record-type-identifiers)
6082 (c-major-mode-is 'java-mode))
6083 ;; All encountered identifiers are types, so set the
6084 ;; promote flag and parse the type.
6083 (let ((c-promote-possible-types t) 6085 (let ((c-promote-possible-types t)
6084 (c-record-found-types t)) 6086 (c-record-found-types t))
6085 (c-forward-type)))) 6087 (c-forward-type))
6088 (c-forward-token-2))))
6086 6089
6087 (c-forward-syntactic-ws) 6090 (c-forward-syntactic-ws)
6088 6091
6089 (when (or (looking-at "extends") 6092 (when (looking-at c-inside-<>-type-key)
6090 (looking-at "super")) 6093 (goto-char (match-end 1))
6091 (forward-word-strictly) 6094 (c-forward-syntactic-ws)
6092 (c-forward-syntactic-ws) 6095 (let ((c-promote-possible-types t)
6093 (let ((c-promote-possible-types t) 6096 (c-record-found-types t))
6094 (c-record-found-types t)) 6097 (c-forward-type))
6095 (c-forward-type) 6098 (c-forward-syntactic-ws)))
6096 (c-forward-syntactic-ws)))))
6097 6099
6098 (setq pos (point)) ; e.g. first token inside the '<' 6100 (setq pos (point)) ; e.g. first token inside the '<'
6099 6101
@@ -6414,9 +6416,7 @@ comment at the start of cc-engine.el for more info."
6414 ((and c-recognize-<>-arglists 6416 ((and c-recognize-<>-arglists
6415 (eq (char-after) ?<)) 6417 (eq (char-after) ?<))
6416 ;; Maybe an angle bracket arglist. 6418 ;; Maybe an angle bracket arglist.
6417 (when (let ((c-record-type-identifiers t) 6419 (when (let (c-last-identifier-range)
6418 (c-record-found-types t)
6419 (c-last-identifier-range))
6420 (c-forward-<>-arglist nil)) 6420 (c-forward-<>-arglist nil))
6421 6421
6422 (c-forward-syntactic-ws) 6422 (c-forward-syntactic-ws)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 94005be9075..705f723d55d 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -2310,6 +2310,15 @@ assumed to be set if this isn't nil."
2310 t (c-make-keywords-re t (c-lang-const c-<>-sexp-kwds))) 2310 t (c-make-keywords-re t (c-lang-const c-<>-sexp-kwds)))
2311(c-lang-defvar c-opt-<>-sexp-key (c-lang-const c-opt-<>-sexp-key)) 2311(c-lang-defvar c-opt-<>-sexp-key (c-lang-const c-opt-<>-sexp-key))
2312 2312
2313(c-lang-defconst c-inside-<>-type-kwds
2314 "Keywords which, used inside a C++ style template arglist, introduce a type."
2315 t nil
2316 java '("extends" "super"))
2317
2318(c-lang-defconst c-inside-<>-type-key
2319 t (c-make-keywords-re t (c-lang-const c-inside-<>-type-kwds)))
2320(c-lang-defvar c-inside-<>-type-key (c-lang-const c-inside-<>-type-key))
2321
2313(c-lang-defconst c-brace-id-list-kwds 2322(c-lang-defconst c-brace-id-list-kwds
2314 "Keywords that may be followed by a brace block containing a comma 2323 "Keywords that may be followed by a brace block containing a comma
2315separated list of identifier definitions, i.e. like the list of 2324separated list of identifier definitions, i.e. like the list of
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index a53c86c342c..2ab1d6b0d70 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -686,9 +686,8 @@ compatible with old code; callers should always specify it."
686 (funcall fn (point-min) (point-max))) 686 (funcall fn (point-min) (point-max)))
687 c-get-state-before-change-functions) 687 c-get-state-before-change-functions)
688 (mapc (lambda (fn) 688 (mapc (lambda (fn)
689 (if (not (eq fn 'c-restore-<>-properties)) 689 (funcall fn (point-min) (point-max)
690 (funcall fn (point-min) (point-max) 690 (- (point-max) (point-min))))
691 (- (point-max) (point-min)))))
692 c-before-font-lock-functions)))) 691 c-before-font-lock-functions))))
693 692
694 (set (make-local-variable 'outline-regexp) "[^#\n\^M]") 693 (set (make-local-variable 'outline-regexp) "[^#\n\^M]")