emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master db2ee1c: c-forward-<>-arglist no longer directly ap


From: Alan Mackenzie
Subject: [Emacs-diffs] master db2ee1c: c-forward-<>-arglist no longer directly applies face properties in Java Mode.
Date: Mon, 25 Apr 2016 17:16:36 +0000

branch: master
commit db2ee1cd63ebebbe52099a1442dbc47f74135e5b
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    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.
---
 lisp/progmodes/cc-engine.el |   44 +++++++++++++++++++++----------------------
 lisp/progmodes/cc-langs.el  |    9 +++++++++
 lisp/progmodes/cc-mode.el   |    5 ++---
 3 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index c38a3a3..f7a850f 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 94005be..705f723 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 a53c86c..2ab1d6b 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]")



reply via email to

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