emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master b0042b7: Make CC Mode load cl-lib rather than cl in


From: Alan Mackenzie
Subject: [Emacs-diffs] master b0042b7: Make CC Mode load cl-lib rather than cl in Emacs 26.
Date: Sun, 25 Jun 2017 10:00:57 -0400 (EDT)

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

    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.
---
 lisp/progmodes/cc-cmds.el   |  2 +-
 lisp/progmodes/cc-defs.el   | 32 ++++++++++++++------------------
 lisp/progmodes/cc-engine.el |  4 +---
 lisp/progmodes/cc-fonts.el  |  1 -
 lisp/progmodes/cc-langs.el  |  2 +-
 lisp/progmodes/cc-styles.el |  1 +
 6 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index c05200b..de25439 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -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)
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index dd8f8af..377a981 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -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))))
-
-(cc-external-require (if (eq c--mapcan-status 'cl-mapcan) 'cl-lib 'cl))
+  (defvar c--cl-library
+    (if (locate-library "cl-lib")
+       '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))))
 
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index aa84ade..955e1eb 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -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)
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 9bae7d9..98a4856 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -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
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index a9d5ac3..1ce0fbf 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -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.
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index b3848a7..b1c94c3 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -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
 
 



reply via email to

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