mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-23 07:19:15 +00:00
Make CC Mode load cl-lib rather than cl in Emacs 26.
* lisp/progmodes/cc-cmds.el (c-declaration-limits): Remove unused local variable. * lisp/progmodes/cc-defs.el (c--mapcan-status): Remove. (c--cl-library): New variable. (Top level): Amend the form which requires library cl or cl-lib. (c--mapcan, c--set-difference, c--intersection, c--macroexpand-all) (c--delete-duplicate): Amend to use c--cl-library instead of c--mapcan-status. * lisp/progmodes/cc-engine.el (c-syntactic-skip-backward) (c-back-over-compound-identifier): Remove unused local variables. * lisp/progmodes/cc-fonts.el (c-font-lock-declarations): Remove an unused local variable. * lisp/progmodes/cc-langs.el (Top level): Amend to use c--cl-library instead of c--mapcan-status. * lisp/progmodes/cc-styles.el (Top level): Add a cc-bytecomp-defun to try to silence a compiler warning.
This commit is contained in:
parent
1886246f6f
commit
b0042b7678
@ -1915,7 +1915,7 @@ with a brace block."
|
||||
(save-restriction
|
||||
(let ((start (point))
|
||||
(paren-state (c-parse-state))
|
||||
lim pos end-pos encl-decl-block where)
|
||||
lim pos end-pos where)
|
||||
;; Narrow enclosing brace blocks out, as required by the values of
|
||||
;; `c-defun-tactic', `near', and the position of point.
|
||||
(when (eq c-defun-tactic 'go-outward)
|
||||
|
@ -44,19 +44,12 @@
|
||||
(load "cc-bytecomp" nil t)))
|
||||
|
||||
(eval-and-compile
|
||||
(defvar c--mapcan-status
|
||||
(cond ((and (fboundp 'mapcan)
|
||||
(subrp (symbol-function 'mapcan)))
|
||||
;; XEmacs
|
||||
'mapcan)
|
||||
((locate-file "cl-lib.elc" load-path)
|
||||
;; Emacs >= 24.3
|
||||
'cl-mapcan)
|
||||
(t
|
||||
;; Emacs <= 24.2
|
||||
nil))))
|
||||
(defvar c--cl-library
|
||||
(if (locate-library "cl-lib")
|
||||
'cl-lib
|
||||
'cl)))
|
||||
|
||||
(cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl))
|
||||
(cc-external-require c--cl-library)
|
||||
; was (cc-external-require 'cl). ACM 2005/11/29.
|
||||
; Changed from (eval-when-compile (require 'cl)) back to
|
||||
; cc-external-require, 2015-08-12.
|
||||
@ -182,9 +175,12 @@ This variant works around bugs in `eval-when-compile' in various
|
||||
;; The motivation for this macro is to avoid the irritating message
|
||||
;; "function `mapcan' from cl package called at runtime" produced by Emacs.
|
||||
(cond
|
||||
((eq c--mapcan-status 'mapcan)
|
||||
((and (fboundp 'mapcan)
|
||||
(subrp (symbol-function 'mapcan)))
|
||||
;; XEmacs and Emacs >= 26.
|
||||
`(mapcan ,fun ,liszt))
|
||||
((eq c--mapcan-status 'cl-mapcan)
|
||||
((eq c--cl-library 'cl-lib)
|
||||
;; Emacs >= 24.3, < 26.
|
||||
`(cl-mapcan ,fun ,liszt))
|
||||
(t
|
||||
;; Emacs <= 24.2. It would be nice to be able to distinguish between
|
||||
@ -193,13 +189,13 @@ This variant works around bugs in `eval-when-compile' in various
|
||||
|
||||
(defmacro c--set-difference (liszt1 liszt2 &rest other-args)
|
||||
;; Macro to smooth out the renaming of `set-difference' in Emacs 24.3.
|
||||
(if (eq c--mapcan-status 'cl-mapcan)
|
||||
(if (eq c--cl-library 'cl-lib)
|
||||
`(cl-set-difference ,liszt1 ,liszt2 ,@other-args)
|
||||
`(set-difference ,liszt1 ,liszt2 ,@other-args)))
|
||||
|
||||
(defmacro c--intersection (liszt1 liszt2 &rest other-args)
|
||||
;; Macro to smooth out the renaming of `intersection' in Emacs 24.3.
|
||||
(if (eq c--mapcan-status 'cl-mapcan)
|
||||
(if (eq c--cl-library 'cl-lib)
|
||||
`(cl-intersection ,liszt1 ,liszt2 ,@other-args)
|
||||
`(intersection ,liszt1 ,liszt2 ,@other-args)))
|
||||
|
||||
@ -212,7 +208,7 @@ This variant works around bugs in `eval-when-compile' in various
|
||||
|
||||
(defmacro c--delete-duplicates (cl-seq &rest cl-keys)
|
||||
;; Macro to smooth out the renaming of `delete-duplicates' in Emacs 24.3.
|
||||
(if (eq c--mapcan-status 'cl-mapcan)
|
||||
(if (eq c--cl-library 'cl-lib)
|
||||
`(cl-delete-duplicates ,cl-seq ,@cl-keys)
|
||||
`(delete-duplicates ,cl-seq ,@cl-keys))))
|
||||
|
||||
|
@ -4809,7 +4809,6 @@ comment at the start of cc-engine.el for more info."
|
||||
|
||||
(c-self-bind-state-cache
|
||||
(let ((start (point))
|
||||
state-2
|
||||
;; A list of syntactically relevant positions in descending
|
||||
;; order. It's used to avoid scanning repeatedly over
|
||||
;; potentially large regions with `parse-partial-sexp' to verify
|
||||
@ -7809,8 +7808,7 @@ comment at the start of cc-engine.el for more info."
|
||||
;; looking (in C++) like this "FQN::of::base::Class". Move to the start of
|
||||
;; this construct and return t. If the parsing fails, return nil, leaving
|
||||
;; point unchanged.
|
||||
(let ((here (point))
|
||||
end)
|
||||
(let (end)
|
||||
(if (not (c-on-identifier))
|
||||
nil
|
||||
(c-simple-skip-symbol-backward)
|
||||
|
@ -1375,7 +1375,6 @@ casts and declarations are fontified. Used on level 2 and higher."
|
||||
;; it finds any. That's necessary so that we later will
|
||||
;; stop inside them to fontify types there.
|
||||
(c-parse-and-markup-<>-arglists t)
|
||||
lbrace ; position of some {.
|
||||
;; The font-lock package in Emacs is known to clobber
|
||||
;; `parse-sexp-lookup-properties' (when it exists).
|
||||
(parse-sexp-lookup-properties
|
||||
|
@ -130,7 +130,7 @@
|
||||
|
||||
|
||||
;; This file is not always loaded. See note above.
|
||||
(cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl))
|
||||
(cc-external-require (if (eq c--cl-library 'cl-lib) 'cl-lib 'cl))
|
||||
|
||||
|
||||
;;; Setup for the `c-lang-defvar' system.
|
||||
|
@ -47,6 +47,7 @@
|
||||
;; `c-add-style' often contains references to functions defined there.
|
||||
|
||||
;; Silence the compiler.
|
||||
(cc-bytecomp-defun c-guess-basic-syntax)
|
||||
(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user