summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2016-04-25 17:08:26 +0000
committerAlan Mackenzie <acm@muc.de>2016-04-25 17:08:26 +0000
commitdb2ee1cd63ebebbe52099a1442dbc47f74135e5b (patch)
treeff2c48b1aadb81dae65526e02981b52d4f4175d3 /lisp/progmodes
parentff9de7b38a3a316529c73e36645182055e2addc4 (diff)
downloademacs-db2ee1cd63ebebbe52099a1442dbc47f74135e5b.tar.gz
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.
Diffstat (limited to 'lisp/progmodes')
-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."
;; `nconc' doesn't mind that the tail of
;; `c-record-found-types' is t.
(nconc c-record-found-types c-record-type-identifiers)))
- (if (c-major-mode-is 'java-mode) (c-fontify-recorded-types-and-refs))
t)
(goto-char start)
@@ -6072,28 +6071,31 @@ comment at the start of cc-engine.el for more info."
(progn
(c-forward-syntactic-ws)
(when (or (and c-record-type-identifiers all-types)
- (c-major-mode-is 'java-mode))
- ;; All encountered identifiers are types, so set the
- ;; promote flag and parse the type.
- (progn
- (c-forward-syntactic-ws)
- (if (looking-at "\\?")
- (forward-char)
- (when (looking-at c-identifier-start)
+ (not (equal c-inside-<>-type-key "\\(\\<\\>\\)")))
+ (c-forward-syntactic-ws)
+ (cond
+ ((eq (char-after) ??)
+ (forward-char))
+ ((and (looking-at c-identifier-start)
+ (not (looking-at c-keywords-regexp)))
+ (if (or (and all-types c-record-type-identifiers)
+ (c-major-mode-is 'java-mode))
+ ;; All encountered identifiers are types, so set the
+ ;; promote flag and parse the type.
(let ((c-promote-possible-types t)
(c-record-found-types t))
- (c-forward-type))))
+ (c-forward-type))
+ (c-forward-token-2))))
- (c-forward-syntactic-ws)
+ (c-forward-syntactic-ws)
- (when (or (looking-at "extends")
- (looking-at "super"))
- (forward-word-strictly)
- (c-forward-syntactic-ws)
- (let ((c-promote-possible-types t)
- (c-record-found-types t))
- (c-forward-type)
- (c-forward-syntactic-ws)))))
+ (when (looking-at c-inside-<>-type-key)
+ (goto-char (match-end 1))
+ (c-forward-syntactic-ws)
+ (let ((c-promote-possible-types t)
+ (c-record-found-types t))
+ (c-forward-type))
+ (c-forward-syntactic-ws)))
(setq pos (point)) ; e.g. first token inside the '<'
@@ -6414,9 +6416,7 @@ comment at the start of cc-engine.el for more info."
((and c-recognize-<>-arglists
(eq (char-after) ?<))
;; Maybe an angle bracket arglist.
- (when (let ((c-record-type-identifiers t)
- (c-record-found-types t)
- (c-last-identifier-range))
+ (when (let (c-last-identifier-range)
(c-forward-<>-arglist nil))
(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."
t (c-make-keywords-re t (c-lang-const c-<>-sexp-kwds)))
(c-lang-defvar c-opt-<>-sexp-key (c-lang-const c-opt-<>-sexp-key))
+(c-lang-defconst c-inside-<>-type-kwds
+ "Keywords which, used inside a C++ style template arglist, introduce a type."
+ t nil
+ java '("extends" "super"))
+
+(c-lang-defconst c-inside-<>-type-key
+ t (c-make-keywords-re t (c-lang-const c-inside-<>-type-kwds)))
+(c-lang-defvar c-inside-<>-type-key (c-lang-const c-inside-<>-type-key))
+
(c-lang-defconst c-brace-id-list-kwds
"Keywords that may be followed by a brace block containing a comma
separated 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."
(funcall fn (point-min) (point-max)))
c-get-state-before-change-functions)
(mapc (lambda (fn)
- (if (not (eq fn 'c-restore-<>-properties))
- (funcall fn (point-min) (point-max)
- (- (point-max) (point-min)))))
+ (funcall fn (point-min) (point-max)
+ (- (point-max) (point-min))))
c-before-font-lock-functions))))
(set (make-local-variable 'outline-regexp) "[^#\n\^M]")