diff options
| author | Alan Mackenzie | 2015-08-12 21:28:55 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2015-08-12 21:28:55 +0000 |
| commit | e4de91d8dd2a06125140fb42772ec84a2f7ab290 (patch) | |
| tree | e329ae1c9b9ab02d0832d99c06a7abc922443fec | |
| parent | 401bc8b28d47db697e4997d35059ce5bc45f5648 (diff) | |
| download | emacs-e4de91d8dd2a06125140fb42772ec84a2f7ab290.tar.gz emacs-e4de91d8dd2a06125140fb42772ec84a2f7ab290.zip | |
Introduce new macros to cover Emacs's new names in cl-lib.el.
This also eliminates `mapcan' warnings in XEmacs.
progmodes/cc-defs.el (c--mapcan-status): new variable to characterise
[X]Emacs versions.
(top-level): Require either 'cl or 'cl-lib, depending on
c--mapcan-status.
Change this back to cc-external-require from an eval-when-compile
require.
(c--mapcan, c--set-difference, c--intersection, c--macroexpand-all)
(c--delete-duplicates): New macros which expand into either old or new
names.
(c-make-keywords-re, c-lang-defconst, c-lang-const) Use the new macros
rather than the old names.
progmodes/cc-engine.el (c-declare-lang-variables): Use c--mapcan rather
than mapcan.
progmodes/cc-fonts.el (c-compose-keywords-list): Use c--mapcan.
progmodes/cc-langs.el (top-level): Require either 'cl or 'cl-lib,
depending on c--mapcan-status.
(c-filter-ops, c-all-op-syntax-tokens, c-assignment-op-regexp)
(c-type-start-kwds, c-prefix-spec-kwds, c-specifier-key)
(c-not-decl-init-keywords, c-not-primitive-type-keywords)
(c-paren-any-kwds, c-<>-sexp-kwds, c-block-stmt-kwds, c-expr-kwds)
(c-decl-block-key, c-keywords, c-keywords-obarray)
(c-regular-keywords-regexp, c-primary-expr-regexp,
c-primary-expr-regexp)
(c-block-prefix-disallowed-chars, c-known-type-key,
c-nonlabel-token-key)
(c-make-init-lang-vars-fun): Use the new macros rather than the old
names.
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 73 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 12 | ||||
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 25 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 201 |
4 files changed, 181 insertions, 130 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index fd4bfb3b921..9e750a48eb3 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -43,7 +43,23 @@ | |||
| 43 | load-path))) | 43 | load-path))) |
| 44 | (load "cc-bytecomp" nil t))) | 44 | (load "cc-bytecomp" nil t))) |
| 45 | 45 | ||
| 46 | (eval-when-compile (require 'cl)) ; was (cc-external-require 'cl). ACM 2005/11/29. | 46 | (eval-and-compile |
| 47 | (defvar c--mapcan-status | ||
| 48 | (cond ((and (fboundp 'mapcan) | ||
| 49 | (subrp (symbol-function 'mapcan))) | ||
| 50 | ;; XEmacs | ||
| 51 | 'mapcan) | ||
| 52 | ((locate-file "cl-lib.elc" load-path) | ||
| 53 | ;; Emacs >= 24.3 | ||
| 54 | 'cl-mapcan) | ||
| 55 | (t | ||
| 56 | ;; Emacs <= 24.2 | ||
| 57 | nil)))) | ||
| 58 | |||
| 59 | (cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl)) | ||
| 60 | ; was (cc-external-require 'cl). ACM 2005/11/29. | ||
| 61 | ; Changed from (eval-when-compile (require 'cl)) back to | ||
| 62 | ; cc-external-require, 2015-08-12. | ||
| 47 | (cc-external-require 'regexp-opt) | 63 | (cc-external-require 'regexp-opt) |
| 48 | 64 | ||
| 49 | ;; Silence the compiler. | 65 | ;; Silence the compiler. |
| @@ -173,12 +189,47 @@ This variant works around bugs in `eval-when-compile' in various | |||
| 173 | 189 | ||
| 174 | (put 'cc-eval-when-compile 'lisp-indent-hook 0)) | 190 | (put 'cc-eval-when-compile 'lisp-indent-hook 0)) |
| 175 | 191 | ||
| 176 | (eval-and-compile | ||
| 177 | (defalias 'c--macroexpand-all | ||
| 178 | (if (fboundp 'macroexpand-all) | ||
| 179 | 'macroexpand-all 'cl-macroexpand-all))) | ||
| 180 | 192 | ||
| 181 | ;;; Macros. | 193 | ;;; Macros. |
| 194 | (defmacro c--mapcan (fun liszt) | ||
| 195 | ;; CC Mode equivalent of `mapcan' which bridges the difference | ||
| 196 | ;; between the host [X]Emacsen." | ||
| 197 | ;; The motivation for this macro is to avoid the irritating message | ||
| 198 | ;; "function `mapcan' from cl package called at runtime" produced by Emacs. | ||
| 199 | (cond | ||
| 200 | ((eq c--mapcan-status 'mapcan) | ||
| 201 | `(mapcan ,fun ,liszt)) | ||
| 202 | ((eq c--mapcan-status 'cl-mapcan) | ||
| 203 | `(cl-mapcan ,fun ,liszt)) | ||
| 204 | (t | ||
| 205 | ;; Emacs <= 24.2. It would be nice to be able to distinguish between | ||
| 206 | ;; compile-time and run-time use here. | ||
| 207 | `(apply 'nconc (mapcar ,fun ,liszt))))) | ||
| 208 | |||
| 209 | (defmacro c--set-difference (liszt1 liszt2 &rest other-args) | ||
| 210 | ;; Macro to smooth out the renaming of `set-difference' in Emacs 24.3. | ||
| 211 | (if (eq c--mapcan-status 'cl-mapcan) | ||
| 212 | `(cl-set-difference ,liszt1 ,liszt2 ,@other-args) | ||
| 213 | `(set-difference ,liszt1 ,liszt2 ,@other-args))) | ||
| 214 | |||
| 215 | (defmacro c--intersection (liszt1 liszt2 &rest other-args) | ||
| 216 | ;; Macro to smooth out the renaming of `intersection' in Emacs 24.3. | ||
| 217 | (if (eq c--mapcan-status 'cl-mapcan) | ||
| 218 | `(cl-intersection ,liszt1 ,liszt2 ,@other-args) | ||
| 219 | `(intersection ,liszt1 ,liszt2 ,@other-args))) | ||
| 220 | |||
| 221 | (eval-and-compile | ||
| 222 | (defmacro c--macroexpand-all (form &optional environment) | ||
| 223 | ;; Macro to smooth out the renaming of `cl-macroexpand-all' in Emacs 24.3. | ||
| 224 | (if (eq c--mapcan-status 'cl-mapcan) | ||
| 225 | `(macroexpand-all ,form ,environment) | ||
| 226 | `(cl-macroexpand-all ,form ,environment))) | ||
| 227 | |||
| 228 | (defmacro c--delete-duplicates (cl-seq &rest cl-keys) | ||
| 229 | ;; Macro to smooth out the renaming of `delete-duplicates' in Emacs 24.3. | ||
| 230 | (if (eq c--mapcan-status 'cl-mapcan) | ||
| 231 | `(cl-delete-duplicates ,cl-seq ,@cl-keys) | ||
| 232 | `(delete-duplicates ,cl-seq ,@cl-keys)))) | ||
| 182 | 233 | ||
| 183 | (defmacro c-point (position &optional point) | 234 | (defmacro c-point (position &optional point) |
| 184 | "Return the value of certain commonly referenced POSITIONs relative to POINT. | 235 | "Return the value of certain commonly referenced POSITIONs relative to POINT. |
| @@ -2228,12 +2279,12 @@ quoted." | |||
| 2228 | ;; are no file dependencies needed. | 2279 | ;; are no file dependencies needed. |
| 2229 | (nreverse | 2280 | (nreverse |
| 2230 | ;; Reverse to get the right load order. | 2281 | ;; Reverse to get the right load order. |
| 2231 | (apply 'nconc | 2282 | (c--mapcan (lambda (elem) |
| 2232 | (mapcar (lambda (elem) | 2283 | (if (eq file (car elem)) |
| 2233 | (if (eq file (car elem)) | 2284 | nil ; Exclude our own file. |
| 2234 | nil ; Exclude our own file. | 2285 | (list (car elem)))) |
| 2235 | (list (car elem)))) | 2286 | (get sym 'source))))) |
| 2236 | (get sym 'source)))))) | 2287 | |
| 2237 | ;; Make some effort to do a compact call to | 2288 | ;; Make some effort to do a compact call to |
| 2238 | ;; `c-get-lang-constant' since it will be compiled in. | 2289 | ;; `c-get-lang-constant' since it will be compiled in. |
| 2239 | (args (and mode `(',mode)))) | 2290 | (args (and mode `(',mode)))) |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 06b03a24bd6..f5285a6bcfe 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -154,12 +154,12 @@ | |||
| 154 | 154 | ||
| 155 | (defmacro c-declare-lang-variables () | 155 | (defmacro c-declare-lang-variables () |
| 156 | `(progn | 156 | `(progn |
| 157 | ,@(mapcan (lambda (init) | 157 | ,@(c--mapcan (lambda (init) |
| 158 | `(,(if (elt init 2) | 158 | `(,(if (elt init 2) |
| 159 | `(defvar ,(car init) nil ,(elt init 2)) | 159 | `(defvar ,(car init) nil ,(elt init 2)) |
| 160 | `(defvar ,(car init) nil)) | 160 | `(defvar ,(car init) nil)) |
| 161 | (make-variable-buffer-local ',(car init)))) | 161 | (make-variable-buffer-local ',(car init)))) |
| 162 | (cdr c-lang-variable-inits)))) | 162 | (cdr c-lang-variable-inits)))) |
| 163 | (c-declare-lang-variables) | 163 | (c-declare-lang-variables) |
| 164 | 164 | ||
| 165 | 165 | ||
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 0f9b2d3c9c1..02599e83f38 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -1958,19 +1958,18 @@ higher." | |||
| 1958 | (cdr-safe (or (assq c-buffer-is-cc-mode c-doc-comment-style) | 1958 | (cdr-safe (or (assq c-buffer-is-cc-mode c-doc-comment-style) |
| 1959 | (assq 'other c-doc-comment-style))) | 1959 | (assq 'other c-doc-comment-style))) |
| 1960 | c-doc-comment-style)) | 1960 | c-doc-comment-style)) |
| 1961 | (list (nconc (apply 'nconc | 1961 | (list (nconc (c--mapcan |
| 1962 | (mapcar | 1962 | (lambda (doc-style) |
| 1963 | (lambda (doc-style) | 1963 | (let ((sym (intern |
| 1964 | (let ((sym (intern | 1964 | (concat (symbol-name doc-style) |
| 1965 | (concat (symbol-name doc-style) | 1965 | "-font-lock-keywords")))) |
| 1966 | "-font-lock-keywords")))) | 1966 | (cond ((fboundp sym) |
| 1967 | (cond ((fboundp sym) | 1967 | (funcall sym)) |
| 1968 | (funcall sym)) | 1968 | ((boundp sym) |
| 1969 | ((boundp sym) | 1969 | (append (eval sym) nil))))) |
| 1970 | (append (eval sym) nil))))) | 1970 | (if (listp doc-keywords) |
| 1971 | (if (listp doc-keywords) | 1971 | doc-keywords |
| 1972 | doc-keywords | 1972 | (list doc-keywords))) |
| 1973 | (list doc-keywords)))) | ||
| 1974 | base-list))) | 1973 | base-list))) |
| 1975 | 1974 | ||
| 1976 | ;; Kludge: If `c-font-lock-complex-decl-prepare' is on the list we | 1975 | ;; Kludge: If `c-font-lock-complex-decl-prepare' is on the list we |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 07f5ef44d11..f97195611c5 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -130,7 +130,7 @@ | |||
| 130 | 130 | ||
| 131 | 131 | ||
| 132 | ;; This file is not always loaded. See note above. | 132 | ;; This file is not always loaded. See note above. |
| 133 | (cc-external-require 'cl) | 133 | (cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl)) |
| 134 | 134 | ||
| 135 | 135 | ||
| 136 | ;;; Setup for the `c-lang-defvar' system. | 136 | ;;; Setup for the `c-lang-defvar' system. |
| @@ -251,19 +251,19 @@ the evaluated constant value at compile time." | |||
| 251 | (unless xlate | 251 | (unless xlate |
| 252 | (setq xlate 'identity)) | 252 | (setq xlate 'identity)) |
| 253 | (c-with-syntax-table (c-lang-const c-mode-syntax-table) | 253 | (c-with-syntax-table (c-lang-const c-mode-syntax-table) |
| 254 | (delete-duplicates | 254 | (c--delete-duplicates |
| 255 | (mapcan (lambda (opgroup) | 255 | (c--mapcan (lambda (opgroup) |
| 256 | (when (if (symbolp (car opgroup)) | 256 | (when (if (symbolp (car opgroup)) |
| 257 | (when (funcall opgroup-filter (car opgroup)) | 257 | (when (funcall opgroup-filter (car opgroup)) |
| 258 | (setq opgroup (cdr opgroup)) | 258 | (setq opgroup (cdr opgroup)) |
| 259 | t) | 259 | t) |
| 260 | t) | 260 | t) |
| 261 | (mapcan (lambda (op) | 261 | (c--mapcan (lambda (op) |
| 262 | (when (funcall op-filter op) | 262 | (when (funcall op-filter op) |
| 263 | (let ((res (funcall xlate op))) | 263 | (let ((res (funcall xlate op))) |
| 264 | (if (listp res) res (list res))))) | 264 | (if (listp res) res (list res))))) |
| 265 | opgroup))) | 265 | opgroup))) |
| 266 | ops) | 266 | ops) |
| 267 | :test 'equal)))) | 267 | :test 'equal)))) |
| 268 | 268 | ||
| 269 | 269 | ||
| @@ -1165,9 +1165,9 @@ operators." | |||
| 1165 | (c-lang-defconst c-all-op-syntax-tokens | 1165 | (c-lang-defconst c-all-op-syntax-tokens |
| 1166 | ;; List of all tokens in the punctuation and parenthesis syntax | 1166 | ;; List of all tokens in the punctuation and parenthesis syntax |
| 1167 | ;; classes. | 1167 | ;; classes. |
| 1168 | t (delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) | 1168 | t (c--delete-duplicates (append (c-lang-const c-other-op-syntax-tokens) |
| 1169 | (c-lang-const c-operator-list)) | 1169 | (c-lang-const c-operator-list)) |
| 1170 | :test 'string-equal)) | 1170 | :test 'string-equal)) |
| 1171 | 1171 | ||
| 1172 | (c-lang-defconst c-nonsymbol-token-char-list | 1172 | (c-lang-defconst c-nonsymbol-token-char-list |
| 1173 | ;; List containing all chars not in the word, symbol or | 1173 | ;; List containing all chars not in the word, symbol or |
| @@ -1204,9 +1204,9 @@ operators." | |||
| 1204 | "=\\([^=]\\|$\\)" | 1204 | "=\\([^=]\\|$\\)" |
| 1205 | "\\|" | 1205 | "\\|" |
| 1206 | (c-make-keywords-re nil | 1206 | (c-make-keywords-re nil |
| 1207 | (set-difference (c-lang-const c-assignment-operators) | 1207 | (c--set-difference (c-lang-const c-assignment-operators) |
| 1208 | '("=") | 1208 | '("=") |
| 1209 | :test 'string-equal))) | 1209 | :test 'string-equal))) |
| 1210 | "\\<\\>")) | 1210 | "\\<\\>")) |
| 1211 | (c-lang-defvar c-assignment-op-regexp | 1211 | (c-lang-defvar c-assignment-op-regexp |
| 1212 | (c-lang-const c-assignment-op-regexp)) | 1212 | (c-lang-const c-assignment-op-regexp)) |
| @@ -1256,7 +1256,7 @@ operators." | |||
| 1256 | ;; multicharacter tokens that begin with ">" except for those beginning with | 1256 | ;; multicharacter tokens that begin with ">" except for those beginning with |
| 1257 | ;; ">>". | 1257 | ;; ">>". |
| 1258 | t (c-make-keywords-re nil | 1258 | t (c-make-keywords-re nil |
| 1259 | (set-difference | 1259 | (c--set-difference |
| 1260 | (c-lang-const c->-op-cont-tokens) | 1260 | (c-lang-const c->-op-cont-tokens) |
| 1261 | (c-filter-ops (c-lang-const c-all-op-syntax-tokens) | 1261 | (c-filter-ops (c-lang-const c-all-op-syntax-tokens) |
| 1262 | t | 1262 | t |
| @@ -1765,10 +1765,10 @@ not the type face." | |||
| 1765 | (c-lang-defconst c-type-start-kwds | 1765 | (c-lang-defconst c-type-start-kwds |
| 1766 | ;; All keywords that can start a type (i.e. are either a type prefix | 1766 | ;; All keywords that can start a type (i.e. are either a type prefix |
| 1767 | ;; or a complete type). | 1767 | ;; or a complete type). |
| 1768 | t (delete-duplicates (append (c-lang-const c-primitive-type-kwds) | 1768 | t (c--delete-duplicates (append (c-lang-const c-primitive-type-kwds) |
| 1769 | (c-lang-const c-type-prefix-kwds) | 1769 | (c-lang-const c-type-prefix-kwds) |
| 1770 | (c-lang-const c-type-modifier-kwds)) | 1770 | (c-lang-const c-type-modifier-kwds)) |
| 1771 | :test 'string-equal)) | 1771 | :test 'string-equal)) |
| 1772 | 1772 | ||
| 1773 | (c-lang-defconst c-class-decl-kwds | 1773 | (c-lang-defconst c-class-decl-kwds |
| 1774 | "Keywords introducing declarations where the following block (if any) | 1774 | "Keywords introducing declarations where the following block (if any) |
| @@ -2030,16 +2030,16 @@ one of `c-type-list-kwds', `c-ref-list-kwds', | |||
| 2030 | ;; something is a type or just some sort of macro in front of the | 2030 | ;; something is a type or just some sort of macro in front of the |
| 2031 | ;; declaration. They might be ambiguous with types or type | 2031 | ;; declaration. They might be ambiguous with types or type |
| 2032 | ;; prefixes. | 2032 | ;; prefixes. |
| 2033 | t (delete-duplicates (append (c-lang-const c-class-decl-kwds) | 2033 | t (c--delete-duplicates (append (c-lang-const c-class-decl-kwds) |
| 2034 | (c-lang-const c-brace-list-decl-kwds) | 2034 | (c-lang-const c-brace-list-decl-kwds) |
| 2035 | (c-lang-const c-other-block-decl-kwds) | 2035 | (c-lang-const c-other-block-decl-kwds) |
| 2036 | (c-lang-const c-typedef-decl-kwds) | 2036 | (c-lang-const c-typedef-decl-kwds) |
| 2037 | (c-lang-const c-typeless-decl-kwds) | 2037 | (c-lang-const c-typeless-decl-kwds) |
| 2038 | (c-lang-const c-modifier-kwds) | 2038 | (c-lang-const c-modifier-kwds) |
| 2039 | (c-lang-const c-other-decl-kwds) | 2039 | (c-lang-const c-other-decl-kwds) |
| 2040 | (c-lang-const c-decl-start-kwds) | 2040 | (c-lang-const c-decl-start-kwds) |
| 2041 | (c-lang-const c-decl-hangon-kwds)) | 2041 | (c-lang-const c-decl-hangon-kwds)) |
| 2042 | :test 'string-equal)) | 2042 | :test 'string-equal)) |
| 2043 | 2043 | ||
| 2044 | (c-lang-defconst c-prefix-spec-kwds-re | 2044 | (c-lang-defconst c-prefix-spec-kwds-re |
| 2045 | ;; Adorned regexp of `c-prefix-spec-kwds'. | 2045 | ;; Adorned regexp of `c-prefix-spec-kwds'. |
| @@ -2052,10 +2052,10 @@ one of `c-type-list-kwds', `c-ref-list-kwds', | |||
| 2052 | ;; ambiguous with types or type prefixes. These are the keywords (like | 2052 | ;; ambiguous with types or type prefixes. These are the keywords (like |
| 2053 | ;; extern, namespace, but NOT template) that can modify a declaration. | 2053 | ;; extern, namespace, but NOT template) that can modify a declaration. |
| 2054 | t (c-make-keywords-re t | 2054 | t (c-make-keywords-re t |
| 2055 | (set-difference (c-lang-const c-prefix-spec-kwds) | 2055 | (c--set-difference (c-lang-const c-prefix-spec-kwds) |
| 2056 | (append (c-lang-const c-type-start-kwds) | 2056 | (append (c-lang-const c-type-start-kwds) |
| 2057 | (c-lang-const c-<>-arglist-kwds)) | 2057 | (c-lang-const c-<>-arglist-kwds)) |
| 2058 | :test 'string-equal))) | 2058 | :test 'string-equal))) |
| 2059 | (c-lang-defvar c-specifier-key (c-lang-const c-specifier-key)) | 2059 | (c-lang-defvar c-specifier-key (c-lang-const c-specifier-key)) |
| 2060 | 2060 | ||
| 2061 | (c-lang-defconst c-postfix-spec-kwds | 2061 | (c-lang-defconst c-postfix-spec-kwds |
| @@ -2068,19 +2068,19 @@ one of `c-type-list-kwds', `c-ref-list-kwds', | |||
| 2068 | ;; Adorned regexp matching all keywords that can't appear at the | 2068 | ;; Adorned regexp matching all keywords that can't appear at the |
| 2069 | ;; start of a declaration. | 2069 | ;; start of a declaration. |
| 2070 | t (c-make-keywords-re t | 2070 | t (c-make-keywords-re t |
| 2071 | (set-difference (c-lang-const c-keywords) | 2071 | (c--set-difference (c-lang-const c-keywords) |
| 2072 | (append (c-lang-const c-type-start-kwds) | 2072 | (append (c-lang-const c-type-start-kwds) |
| 2073 | (c-lang-const c-prefix-spec-kwds) | 2073 | (c-lang-const c-prefix-spec-kwds) |
| 2074 | (c-lang-const c-typeof-kwds)) | 2074 | (c-lang-const c-typeof-kwds)) |
| 2075 | :test 'string-equal))) | 2075 | :test 'string-equal))) |
| 2076 | (c-lang-defvar c-not-decl-init-keywords | 2076 | (c-lang-defvar c-not-decl-init-keywords |
| 2077 | (c-lang-const c-not-decl-init-keywords)) | 2077 | (c-lang-const c-not-decl-init-keywords)) |
| 2078 | 2078 | ||
| 2079 | (c-lang-defconst c-not-primitive-type-keywords | 2079 | (c-lang-defconst c-not-primitive-type-keywords |
| 2080 | "List of all keywords apart from primitive types (like \"int\")." | 2080 | "List of all keywords apart from primitive types (like \"int\")." |
| 2081 | t (set-difference (c-lang-const c-keywords) | 2081 | t (c--set-difference (c-lang-const c-keywords) |
| 2082 | (c-lang-const c-primitive-type-kwds) | 2082 | (c-lang-const c-primitive-type-kwds) |
| 2083 | :test 'string-equal) | 2083 | :test 'string-equal) |
| 2084 | ;; The "more" for C++ is the QT keyword (as in "more slots:"). | 2084 | ;; The "more" for C++ is the QT keyword (as in "more slots:"). |
| 2085 | ;; This variable is intended for use in c-beginning-of-statement-1. | 2085 | ;; This variable is intended for use in c-beginning-of-statement-1. |
| 2086 | c++ (append (c-lang-const c-not-primitive-type-keywords) '("more"))) | 2086 | c++ (append (c-lang-const c-not-primitive-type-keywords) '("more"))) |
| @@ -2224,9 +2224,9 @@ type identifiers separated by arbitrary tokens." | |||
| 2224 | pike '("array" "function" "int" "mapping" "multiset" "object" "program")) | 2224 | pike '("array" "function" "int" "mapping" "multiset" "object" "program")) |
| 2225 | 2225 | ||
| 2226 | (c-lang-defconst c-paren-any-kwds | 2226 | (c-lang-defconst c-paren-any-kwds |
| 2227 | t (delete-duplicates (append (c-lang-const c-paren-nontype-kwds) | 2227 | t (c--delete-duplicates (append (c-lang-const c-paren-nontype-kwds) |
| 2228 | (c-lang-const c-paren-type-kwds)) | 2228 | (c-lang-const c-paren-type-kwds)) |
| 2229 | :test 'string-equal)) | 2229 | :test 'string-equal)) |
| 2230 | 2230 | ||
| 2231 | (c-lang-defconst c-<>-type-kwds | 2231 | (c-lang-defconst c-<>-type-kwds |
| 2232 | "Keywords that may be followed by an angle bracket expression | 2232 | "Keywords that may be followed by an angle bracket expression |
| @@ -2250,9 +2250,9 @@ assumed to be set if this isn't nil." | |||
| 2250 | 2250 | ||
| 2251 | (c-lang-defconst c-<>-sexp-kwds | 2251 | (c-lang-defconst c-<>-sexp-kwds |
| 2252 | ;; All keywords that can be followed by an angle bracket sexp. | 2252 | ;; All keywords that can be followed by an angle bracket sexp. |
| 2253 | t (delete-duplicates (append (c-lang-const c-<>-type-kwds) | 2253 | t (c--delete-duplicates (append (c-lang-const c-<>-type-kwds) |
| 2254 | (c-lang-const c-<>-arglist-kwds)) | 2254 | (c-lang-const c-<>-arglist-kwds)) |
| 2255 | :test 'string-equal)) | 2255 | :test 'string-equal)) |
| 2256 | 2256 | ||
| 2257 | (c-lang-defconst c-opt-<>-sexp-key | 2257 | (c-lang-defconst c-opt-<>-sexp-key |
| 2258 | ;; Adorned regexp matching keywords that can be followed by an angle | 2258 | ;; Adorned regexp matching keywords that can be followed by an angle |
| @@ -2310,9 +2310,9 @@ Keywords here should also be in `c-block-stmt-1-kwds'." | |||
| 2310 | 2310 | ||
| 2311 | (c-lang-defconst c-block-stmt-kwds | 2311 | (c-lang-defconst c-block-stmt-kwds |
| 2312 | ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'. | 2312 | ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'. |
| 2313 | t (delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) | 2313 | t (c--delete-duplicates (append (c-lang-const c-block-stmt-1-kwds) |
| 2314 | (c-lang-const c-block-stmt-2-kwds)) | 2314 | (c-lang-const c-block-stmt-2-kwds)) |
| 2315 | :test 'string-equal)) | 2315 | :test 'string-equal)) |
| 2316 | 2316 | ||
| 2317 | (c-lang-defconst c-opt-block-stmt-key | 2317 | (c-lang-defconst c-opt-block-stmt-key |
| 2318 | ;; Regexp matching the start of any statement that has a | 2318 | ;; Regexp matching the start of any statement that has a |
| @@ -2417,7 +2417,7 @@ This construct is \"<keyword> <expression> :\"." | |||
| 2417 | (c-lang-defconst c-expr-kwds | 2417 | (c-lang-defconst c-expr-kwds |
| 2418 | ;; Keywords that can occur anywhere in expressions. Built from | 2418 | ;; Keywords that can occur anywhere in expressions. Built from |
| 2419 | ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'. | 2419 | ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'. |
| 2420 | t (delete-duplicates | 2420 | t (c--delete-duplicates |
| 2421 | (append (c-lang-const c-primary-expr-kwds) | 2421 | (append (c-lang-const c-primary-expr-kwds) |
| 2422 | (c-filter-ops (c-lang-const c-operator-list) | 2422 | (c-filter-ops (c-lang-const c-operator-list) |
| 2423 | t | 2423 | t |
| @@ -2468,12 +2468,12 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2468 | t (let* ((decl-kwds (append (c-lang-const c-class-decl-kwds) | 2468 | t (let* ((decl-kwds (append (c-lang-const c-class-decl-kwds) |
| 2469 | (c-lang-const c-other-block-decl-kwds) | 2469 | (c-lang-const c-other-block-decl-kwds) |
| 2470 | (c-lang-const c-inexpr-class-kwds))) | 2470 | (c-lang-const c-inexpr-class-kwds))) |
| 2471 | (unambiguous (set-difference decl-kwds | 2471 | (unambiguous (c--set-difference decl-kwds |
| 2472 | (c-lang-const c-type-start-kwds) | 2472 | (c-lang-const c-type-start-kwds) |
| 2473 | :test 'string-equal)) | 2473 | :test 'string-equal)) |
| 2474 | (ambiguous (intersection decl-kwds | 2474 | (ambiguous (c--intersection decl-kwds |
| 2475 | (c-lang-const c-type-start-kwds) | 2475 | (c-lang-const c-type-start-kwds) |
| 2476 | :test 'string-equal))) | 2476 | :test 'string-equal))) |
| 2477 | (if ambiguous | 2477 | (if ambiguous |
| 2478 | (concat (c-make-keywords-re t unambiguous) | 2478 | (concat (c-make-keywords-re t unambiguous) |
| 2479 | "\\|" | 2479 | "\\|" |
| @@ -2521,7 +2521,7 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2521 | 2521 | ||
| 2522 | (c-lang-defconst c-keywords | 2522 | (c-lang-defconst c-keywords |
| 2523 | ;; All keywords as a list. | 2523 | ;; All keywords as a list. |
| 2524 | t (delete-duplicates | 2524 | t (c--delete-duplicates |
| 2525 | (c-lang-defconst-eval-immediately | 2525 | (c-lang-defconst-eval-immediately |
| 2526 | `(append ,@(mapcar (lambda (kwds-lang-const) | 2526 | `(append ,@(mapcar (lambda (kwds-lang-const) |
| 2527 | `(c-lang-const ,kwds-lang-const)) | 2527 | `(c-lang-const ,kwds-lang-const)) |
| @@ -2585,6 +2585,7 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2585 | (setplist (intern kwd obarray) | 2585 | (setplist (intern kwd obarray) |
| 2586 | ;; Emacs has an odd bug that causes `mapcan' to fail | 2586 | ;; Emacs has an odd bug that causes `mapcan' to fail |
| 2587 | ;; with unintelligible errors. (XEmacs works.) | 2587 | ;; with unintelligible errors. (XEmacs works.) |
| 2588 | ;; (2015-06-24): This bug has not yet been fixed. | ||
| 2588 | ;;(mapcan (lambda (lang-const) | 2589 | ;;(mapcan (lambda (lang-const) |
| 2589 | ;; (list lang-const t)) | 2590 | ;; (list lang-const t)) |
| 2590 | ;; lang-const-list) | 2591 | ;; lang-const-list) |
| @@ -2597,10 +2598,10 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2597 | ;; Adorned regexp matching all keywords that should be fontified | 2598 | ;; Adorned regexp matching all keywords that should be fontified |
| 2598 | ;; with the keywords face. I.e. that aren't types or constants. | 2599 | ;; with the keywords face. I.e. that aren't types or constants. |
| 2599 | t (c-make-keywords-re t | 2600 | t (c-make-keywords-re t |
| 2600 | (set-difference (c-lang-const c-keywords) | 2601 | (c--set-difference (c-lang-const c-keywords) |
| 2601 | (append (c-lang-const c-primitive-type-kwds) | 2602 | (append (c-lang-const c-primitive-type-kwds) |
| 2602 | (c-lang-const c-constant-kwds)) | 2603 | (c-lang-const c-constant-kwds)) |
| 2603 | :test 'string-equal))) | 2604 | :test 'string-equal))) |
| 2604 | (c-lang-defvar c-regular-keywords-regexp | 2605 | (c-lang-defvar c-regular-keywords-regexp |
| 2605 | (c-lang-const c-regular-keywords-regexp)) | 2606 | (c-lang-const c-regular-keywords-regexp)) |
| 2606 | 2607 | ||
| @@ -2635,12 +2636,12 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2635 | right-assoc-sequence) | 2636 | right-assoc-sequence) |
| 2636 | t)) | 2637 | t)) |
| 2637 | 2638 | ||
| 2638 | (unambiguous-prefix-ops (set-difference nonkeyword-prefix-ops | 2639 | (unambiguous-prefix-ops (c--set-difference nonkeyword-prefix-ops |
| 2639 | in-or-postfix-ops | 2640 | in-or-postfix-ops |
| 2640 | :test 'string-equal)) | 2641 | :test 'string-equal)) |
| 2641 | (ambiguous-prefix-ops (intersection nonkeyword-prefix-ops | 2642 | (ambiguous-prefix-ops (c--intersection nonkeyword-prefix-ops |
| 2642 | in-or-postfix-ops | 2643 | in-or-postfix-ops |
| 2643 | :test 'string-equal))) | 2644 | :test 'string-equal))) |
| 2644 | 2645 | ||
| 2645 | (concat | 2646 | (concat |
| 2646 | "\\(" | 2647 | "\\(" |
| @@ -2648,14 +2649,14 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2648 | ;; first submatch from them together with `c-primary-expr-kwds'. | 2649 | ;; first submatch from them together with `c-primary-expr-kwds'. |
| 2649 | (c-make-keywords-re t | 2650 | (c-make-keywords-re t |
| 2650 | (append (c-lang-const c-primary-expr-kwds) | 2651 | (append (c-lang-const c-primary-expr-kwds) |
| 2651 | (set-difference prefix-ops nonkeyword-prefix-ops | 2652 | (c--set-difference prefix-ops nonkeyword-prefix-ops |
| 2652 | :test 'string-equal))) | 2653 | :test 'string-equal))) |
| 2653 | 2654 | ||
| 2654 | "\\|" | 2655 | "\\|" |
| 2655 | ;; Match all ambiguous operators. | 2656 | ;; Match all ambiguous operators. |
| 2656 | (c-make-keywords-re nil | 2657 | (c-make-keywords-re nil |
| 2657 | (intersection nonkeyword-prefix-ops in-or-postfix-ops | 2658 | (c--intersection nonkeyword-prefix-ops in-or-postfix-ops |
| 2658 | :test 'string-equal)) | 2659 | :test 'string-equal)) |
| 2659 | "\\)" | 2660 | "\\)" |
| 2660 | 2661 | ||
| 2661 | "\\|" | 2662 | "\\|" |
| @@ -2670,8 +2671,8 @@ Note that Java specific rules are currently applied to tell this from | |||
| 2670 | "\\|" | 2671 | "\\|" |
| 2671 | ;; The unambiguous operators from `prefix-ops'. | 2672 | ;; The unambiguous operators from `prefix-ops'. |
| 2672 | (c-make-keywords-re nil | 2673 | (c-make-keywords-re nil |
| 2673 | (set-difference nonkeyword-prefix-ops in-or-postfix-ops | 2674 | (c--set-difference nonkeyword-prefix-ops in-or-postfix-ops |
| 2674 | :test 'string-equal)) | 2675 | :test 'string-equal)) |
| 2675 | 2676 | ||
| 2676 | "\\|" | 2677 | "\\|" |
| 2677 | ;; Match string and character literals. | 2678 | ;; Match string and character literals. |
| @@ -2816,7 +2817,7 @@ possible for good performance." | |||
| 2816 | 2817 | ||
| 2817 | ;; Default to all chars that only occurs in nonsymbol tokens outside | 2818 | ;; Default to all chars that only occurs in nonsymbol tokens outside |
| 2818 | ;; identifiers. | 2819 | ;; identifiers. |
| 2819 | t (set-difference | 2820 | t (c--set-difference |
| 2820 | (c-lang-const c-nonsymbol-token-char-list) | 2821 | (c-lang-const c-nonsymbol-token-char-list) |
| 2821 | (c-filter-ops (append (c-lang-const c-identifier-ops) | 2822 | (c-filter-ops (append (c-lang-const c-identifier-ops) |
| 2822 | (list (cons nil | 2823 | (list (cons nil |
| @@ -2833,26 +2834,26 @@ possible for good performance." | |||
| 2833 | 2834 | ||
| 2834 | ;; Allow cpp operations (where applicable). | 2835 | ;; Allow cpp operations (where applicable). |
| 2835 | t (if (c-lang-const c-opt-cpp-prefix) | 2836 | t (if (c-lang-const c-opt-cpp-prefix) |
| 2836 | (set-difference (c-lang-const c-block-prefix-disallowed-chars) | 2837 | (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) |
| 2837 | '(?#)) | 2838 | '(?#)) |
| 2838 | (c-lang-const c-block-prefix-disallowed-chars)) | 2839 | (c-lang-const c-block-prefix-disallowed-chars)) |
| 2839 | 2840 | ||
| 2840 | ;; Allow ':' for inherit list starters. | 2841 | ;; Allow ':' for inherit list starters. |
| 2841 | (c++ objc idl) (set-difference (c-lang-const c-block-prefix-disallowed-chars) | 2842 | (c++ objc idl) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) |
| 2842 | '(?:)) | 2843 | '(?:)) |
| 2843 | 2844 | ||
| 2844 | ;; Allow ',' for multiple inherits. | 2845 | ;; Allow ',' for multiple inherits. |
| 2845 | (c++ java) (set-difference (c-lang-const c-block-prefix-disallowed-chars) | 2846 | (c++ java) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) |
| 2846 | '(?,)) | 2847 | '(?,)) |
| 2847 | 2848 | ||
| 2848 | ;; Allow parentheses for anonymous inner classes in Java and class | 2849 | ;; Allow parentheses for anonymous inner classes in Java and class |
| 2849 | ;; initializer lists in Pike. | 2850 | ;; initializer lists in Pike. |
| 2850 | (java pike) (set-difference (c-lang-const c-block-prefix-disallowed-chars) | 2851 | (java pike) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) |
| 2851 | '(?\( ?\))) | 2852 | '(?\( ?\))) |
| 2852 | 2853 | ||
| 2853 | ;; Allow '"' for extern clauses (e.g. extern "C" {...}). | 2854 | ;; Allow '"' for extern clauses (e.g. extern "C" {...}). |
| 2854 | (c c++ objc) (set-difference (c-lang-const c-block-prefix-disallowed-chars) | 2855 | (c c++ objc) (c--set-difference (c-lang-const c-block-prefix-disallowed-chars) |
| 2855 | '(?\" ?'))) | 2856 | '(?\" ?'))) |
| 2856 | 2857 | ||
| 2857 | (c-lang-defconst c-block-prefix-charset | 2858 | (c-lang-defconst c-block-prefix-charset |
| 2858 | ;; `c-block-prefix-disallowed-chars' as an inverted charset suitable | 2859 | ;; `c-block-prefix-disallowed-chars' as an inverted charset suitable |
| @@ -3157,10 +3158,10 @@ i.e. before \":\". Only used if `c-recognize-colon-labels' is set." | |||
| 3157 | t (concat | 3158 | t (concat |
| 3158 | ;; All keywords except `c-label-kwds' and `c-protection-kwds'. | 3159 | ;; All keywords except `c-label-kwds' and `c-protection-kwds'. |
| 3159 | (c-make-keywords-re t | 3160 | (c-make-keywords-re t |
| 3160 | (set-difference (c-lang-const c-keywords) | 3161 | (c--set-difference (c-lang-const c-keywords) |
| 3161 | (append (c-lang-const c-label-kwds) | 3162 | (append (c-lang-const c-label-kwds) |
| 3162 | (c-lang-const c-protection-kwds)) | 3163 | (c-lang-const c-protection-kwds)) |
| 3163 | :test 'string-equal))) | 3164 | :test 'string-equal))) |
| 3164 | ;; Don't allow string literals, except in AWK. Character constants are OK. | 3165 | ;; Don't allow string literals, except in AWK. Character constants are OK. |
| 3165 | (c objc java pike idl) (concat "\"\\|" | 3166 | (c objc java pike idl) (concat "\"\\|" |
| 3166 | (c-lang-const c-nonlabel-token-key)) | 3167 | (c-lang-const c-nonlabel-token-key)) |
| @@ -3280,16 +3281,16 @@ accomplish that conveniently." | |||
| 3280 | ;; `c-lang-const' will expand to the evaluated | 3281 | ;; `c-lang-const' will expand to the evaluated |
| 3281 | ;; constant immediately in `c--macroexpand-all' | 3282 | ;; constant immediately in `c--macroexpand-all' |
| 3282 | ;; below. | 3283 | ;; below. |
| 3283 | (mapcan | 3284 | (c--mapcan |
| 3284 | (lambda (init) | 3285 | (lambda (init) |
| 3285 | `(current-var ',(car init) | 3286 | `(current-var ',(car init) |
| 3286 | ,(car init) ,(c--macroexpand-all | 3287 | ,(car init) ,(c--macroexpand-all |
| 3287 | (elt init 1)))) | 3288 | (elt init 1)))) |
| 3288 | ;; Note: The following `append' copies the | 3289 | ;; Note: The following `append' copies the |
| 3289 | ;; first argument. That list is small, so | 3290 | ;; first argument. That list is small, so |
| 3290 | ;; this doesn't matter too much. | 3291 | ;; this doesn't matter too much. |
| 3291 | (append (cdr c-emacs-variable-inits) | 3292 | (append (cdr c-emacs-variable-inits) |
| 3292 | (cdr c-lang-variable-inits))))) | 3293 | (cdr c-lang-variable-inits))))) |
| 3293 | 3294 | ||
| 3294 | ;; This diagnostic message isn't useful for end | 3295 | ;; This diagnostic message isn't useful for end |
| 3295 | ;; users, so it's disabled. | 3296 | ;; users, so it's disabled. |