Subject: bug#30424: [patch] replace cl with cl-lib

From: Mosè Giordano <[email-masked]>
Date: Fri, 16 Feb 2018 09:14:05 +0100

Hi Alex,

thanks for this new patch.  From what I've seen this doesn't introduce
runtime dependence on cl-lib but just replaces cl macros with
corresponding cl-lib macros, is this correct?

Bye,
Mosè

2018-02-11 19:10 GMT+01:00 Alex Branham <[email-masked]>:
> The attached patch replaces cl with cl-lib.
>
> From 6bc94eaee8a189af5f847878b6280c6a1a0e4b54 Mon Sep 17 00:00:00 2001
> From: Alex Branham <[email-masked]>
> Date: Tue, 30 Jan 2018 20:56:13 -0600
> Subject: [PATCH] Replace cl with cl-lib
>
> ---
>  bib-cite.el        |  5 +++--
>  font-latex.el      |  2 +-
>  latex.el           |  3 ++-
>  style/babel.el     |  3 ++-
>  style/caption.el   | 22 +++++++++++-----------
>  style/empheq.el    | 12 ++++++------
>  style/enumitem.el  | 18 +++++++++---------
>  style/floatrow.el  | 17 +++++++++--------
>  style/fvextra.el   |  9 +++++----
>  style/listings.el  | 11 ++++++-----
>  style/mdframed.el  | 13 +++++++------
>  style/tcolorbox.el |  7 ++++---
>  12 files changed, 65 insertions(+), 57 deletions(-)
>
> diff --git a/bib-cite.el b/bib-cite.el
> index 0be0eb0b..5cb8a1d2 100644
> --- a/bib-cite.el
> +++ b/bib-cite.el
> @@ -589,7 +589,8 @@
>  ;; ----------------------------------------------------------------------------
>  ;;; Code:
>
> -(eval-when-compile (require 'cl))
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  (defgroup bib-cite nil
>    "bib-cite, LaTeX minor-mode to display \\cite, \\ref and \\label commands."
> @@ -2427,7 +2428,7 @@ bib-dos-or-os2-variable affects:
>                          (or (and (fboundp 'TeX-split-string)
>                                   (TeX-split-string sep-char value))
>                              (dired-split sep-char value)))))
> -      (loop for x in entries if (bib-cite-file-directory-p x) collect x))))
> +      (cl-loop for x in entries if (bib-cite-file-directory-p x) collect x))))
>
>  (provide 'bib-cite)
>  ;;; bib-cite.el ends here
> diff --git a/font-latex.el b/font-latex.el
> index 9b621985..1df751ad 100644
> --- a/font-latex.el
> +++ b/font-latex.el
> @@ -43,7 +43,7 @@
>  (require 'tex)
>
>  (eval-when-compile
> -  (require 'cl))
> +  (require 'cl-lib))
>
>  (defgroup font-latex nil
>    "Font-latex text highlighting package."
> diff --git a/latex.el b/latex.el
> index c2d8a4ca..05d6f55c 100644
> --- a/latex.el
> +++ b/latex.el
> @@ -31,7 +31,8 @@
>  (require 'tex)
>  (require 'tex-style)
>  (require 'tex-ispell)
> -(eval-when-compile (require 'cl))       ;FIXME: Use cl-lib.
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;;; Syntax
>
> diff --git a/style/babel.el b/style/babel.el
> index c1119b9b..d8c5e3ff 100644
> --- a/style/babel.el
> +++ b/style/babel.el
> @@ -30,7 +30,8 @@
>
>  ;;; Code:
>
> -(eval-when-compile (require 'cl))
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  (defvar LaTeX-babel-language-list
>    '("afrikaans"
> diff --git a/style/caption.el b/style/caption.el
> index df6328e3..f23e59da 100644
> --- a/style/caption.el
> +++ b/style/caption.el
> @@ -34,8 +34,8 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; Needed for auto-parsing.
>  (require 'tex)
> @@ -168,19 +168,19 @@ in `caption'-completions."
>        ;; For `\DeclareCaptionOption', only add the value
>        ;; (remember:      key=^^^^^^, val="defined key")
>        (if (string-equal key "option")
> -         (pushnew (list val) opts :test #'equal)
> +         (cl-pushnew (list val) opts :test #'equal)
>         ;; For anything but `\DeclareCaptionOption', do the standard
>         ;; procedure.  Again, take care of `subrefformat' for `subcaption.el'.
>         (if val-match
>             (progn
>               (when (and (string-equal key "labelformat")
>                          (boundp 'LaTeX-subcaption-key-val-options))
> -               (pushnew (list "subrefformat"
> -                              (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> -                        opts :test #'equal))
> -             (pushnew (list key (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> -                      opts :test #'equal))
> -         (pushnew (list key (list val)) opts :test #'equal)))
> +               (cl-pushnew (list "subrefformat"
> +                                 (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> +                           opts :test #'equal))
> +             (cl-pushnew (list key (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> +                         opts :test #'equal))
> +         (cl-pushnew (list key (list val)) opts :test #'equal)))
>        (setq LaTeX-caption-key-val-options-local (copy-alist opts))))
>    ;; Support for environments defined with newfloat.sty: These
>    ;; environments are added to "type" and "type*" key:
> @@ -192,8 +192,8 @@ in `caption'-completions."
>              (val-match (cdr (assoc key LaTeX-caption-key-val-options-local)))
>              (temp (copy-alist LaTeX-caption-key-val-options-local))
>              (opts (assq-delete-all (car (assoc key temp)) temp)))
> -       (pushnew (list key (TeX-delete-duplicate-strings (apply #'append val val-match)))
> -                opts :test #'equal)
> +       (cl-pushnew (list key (TeX-delete-duplicate-strings (apply #'append val val-match)))
> +                   opts :test #'equal)
>         (setq LaTeX-caption-key-val-options-local (copy-alist opts))))))
>
>  (defun LaTeX-arg-caption-command (optional &optional prompt)
> diff --git a/style/empheq.el b/style/empheq.el
> index 4365136e..b0231e82 100644
> --- a/style/empheq.el
> +++ b/style/empheq.el
> @@ -31,8 +31,8 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; Needed for auto-parsing.
>  (require 'tex)
> @@ -142,11 +142,11 @@
>               (where (cadr delims)))
>           (if (string= where "Left")
>               (progn
> -               (pushnew (concat TeX-esc "empheq" delim) lval :test #'equal)
> -               (pushnew (concat TeX-esc "empheqbig" delim) lval :test #'equal))
> +               (cl-pushnew (concat TeX-esc "empheq" delim) lval :test #'equal)
> +               (cl-pushnew (concat TeX-esc "empheqbig" delim) lval :test #'equal))
>             (progn
> -             (pushnew (concat TeX-esc "empheq" delim) rval :test #'equal)
> -             (pushnew (concat TeX-esc "empheqbig" delim) rval :test #'equal)))))
> +             (cl-pushnew (concat TeX-esc "empheq" delim) rval :test #'equal)
> +             (cl-pushnew (concat TeX-esc "empheqbig" delim) rval :test #'equal)))))
>        (when lval
>         (setq tmp (assq-delete-all (car (assoc "left" tmp)) tmp))
>         (setq lvals (append lval lvals))
> diff --git a/style/enumitem.el b/style/enumitem.el
> index f347446a..1518a7a6 100644
> --- a/style/enumitem.el
> +++ b/style/enumitem.el
> @@ -38,8 +38,8 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; Needed for auto-parsing.
>  (require 'tex)
> @@ -266,9 +266,9 @@ in `enumitem'-completions."
>            (temp (copy-alist LaTeX-enumitem-key-val-options-local))
>            (opts (assq-delete-all (car (assoc key temp)) temp)))
>        (if val-match
> -         (pushnew (list key (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> -                  opts :test #'equal)
> -       (pushnew (list key (list val)) opts :test #'equal))
> +         (cl-pushnew (list key (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> +                     opts :test #'equal)
> +       (cl-pushnew (list key (list val)) opts :test #'equal))
>        (setq LaTeX-enumitem-key-val-options-local (copy-alist opts))))
>    (dolist (newalign (LaTeX-enumitem-SetLabelAlign-list))
>      (let* ((key "align")
> @@ -276,8 +276,8 @@ in `enumitem'-completions."
>            (val-match (cdr (assoc key LaTeX-enumitem-key-val-options-local)))
>            (temp (copy-alist LaTeX-enumitem-key-val-options-local))
>            (opts (assq-delete-all (car (assoc key temp)) temp)))
> -      (pushnew (list key (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> -              opts :test #'equal)
> +      (cl-pushnew (list key (TeX-delete-duplicate-strings (apply #'append (list val) val-match)))
> +                 opts :test #'equal)
>        (setq LaTeX-enumitem-key-val-options-local (copy-alist opts)))))
>
>  (TeX-add-style-hook
> @@ -405,13 +405,13 @@ in `enumitem'-completions."
>         (lambda ()
>          (let ((enums '("enumerate")))
>            (when (LaTeX-provided-package-options-member "enumitem" "inline")
> -            (pushnew "enumerate*" enums :test #'equal))
> +            (cl-pushnew "enumerate*" enums :test #'equal))
>            (dolist (env-type (LaTeX-enumitem-newlist-list))
>              (let ((env   (car env-type))
>                    (type  (cadr env-type)))
>                (when (or (string-equal type "enumerate")
>                          (string-equal type "enumerate*"))
> -                (pushnew env enums :test #'equal))))
> +                (cl-pushnew env enums :test #'equal))))
>            (completing-read "List name: " enums)))))
>
>      ;; "Align" is added as new value to "align" key in key-val list.
> diff --git a/style/floatrow.el b/style/floatrow.el
> index 5beb1096..bc358d1b 100644
> --- a/style/floatrow.el
> +++ b/style/floatrow.el
> @@ -58,8 +58,9 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +;; Needed for compiling `cl-pushnew':
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; Needed for auto-parsing.
>  (require 'tex)
> @@ -317,15 +318,15 @@
>                           (assq-delete-all (car (assoc key temp)) temp)))))
>         (cond ((string= key "precode")
>                (dolist (x vcode-keys)
> -                (pushnew (list x (TeX-delete-duplicate-strings (append (list val) val-match)))
> -                         opts :test #'equal)))
> +                (cl-pushnew (list x (TeX-delete-duplicate-strings (append (list val) val-match)))
> +                            opts :test #'equal)))
>               ((string= key "floatrowsep")
>                (dolist (x sep-keys)
> -                (pushnew (list x (TeX-delete-duplicate-strings (append (list val) val-match)))
> -                         opts :test #'equal)))
> +                (cl-pushnew (list x (TeX-delete-duplicate-strings (append (list val) val-match)))
> +                            opts :test #'equal)))
>               (t
> -              (pushnew (list key (TeX-delete-duplicate-strings (append (list val) val-match)))
> -                       opts :test #'equal)))
> +              (cl-pushnew (list key (TeX-delete-duplicate-strings (append (list val) val-match)))
> +                          opts :test #'equal)))
>         (setq LaTeX-floatrow-key-val-options-local (copy-alist opts))))))
>
>  (defun LaTeX-floatrow-arg-floatbox (optional)
> diff --git a/style/fvextra.el b/style/fvextra.el
> index eeb7d37a..7f49d6cc 100644
> --- a/style/fvextra.el
> +++ b/style/fvextra.el
> @@ -31,8 +31,9 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +;; Needed for compiling `cl-pushnew':
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  (defvar LaTeX-fvextra-key-val-options
>    '(;; 3 General options
> @@ -99,8 +100,8 @@
>        (dolist (x keys)
>         (setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
>         (if (string= x "highlightcolor")
> -           (pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test #'equal)
> -         (pushnew (list x (append '("none") (mapcar #'car (funcall colorcmd)))) tmp :test #'equal)))
> +           (cl-pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test #'equal)
> +         (cl-pushnew (list x (append '("none") (mapcar #'car (funcall colorcmd)))) tmp :test #'equal)))
>        (setq LaTeX-fancyvrb-key-val-options-local
>             (copy-alist tmp)))))
>
> diff --git a/style/listings.el b/style/listings.el
> index 73ddc00f..52adba34 100644
> --- a/style/listings.el
> +++ b/style/listings.el
> @@ -40,8 +40,9 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +;; Needed for compiling `cl-pushnew':
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; The following are options taken from chapter 4 of the listings
>  ;; manual (2007/02/22 Version 1.4).
> @@ -284,9 +285,9 @@ with user-defined values via the \"lstdefinestyle\" macro."
>          (key (car elt))
>          (temp (copy-alist LaTeX-listings-key-val-options-local))
>          (opts (assq-delete-all (car (assoc key temp)) temp)))
> -    (pushnew (list key (TeX-delete-duplicate-strings
> -                       (mapcar #'car (LaTeX-listings-lstdefinestyle-list))))
> -            opts :test #'equal)
> +    (cl-pushnew (list key (TeX-delete-duplicate-strings
> +                          (mapcar #'car (LaTeX-listings-lstdefinestyle-list))))
> +               opts :test #'equal)
>      (setq LaTeX-listings-key-val-options-local
>           (copy-alist opts))))
>
> diff --git a/style/mdframed.el b/style/mdframed.el
> index cd26e3fd..ed643dac 100644
> --- a/style/mdframed.el
> +++ b/style/mdframed.el
> @@ -37,8 +37,9 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +;; Needed for compiling `cl-pushnew':
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; Needed for auto-parsing.
>  (require 'tex)
> @@ -214,9 +215,9 @@
>            (val (cadr (assoc "style" LaTeX-mdframed-key-val-options)))
>            (temp (copy-alist LaTeX-mdframed-key-val-options-local))
>            (opts (assq-delete-all (car (assoc key temp)) temp)))
> -      (pushnew (list key (TeX-delete-duplicate-strings
> -                         (append val (mapcar #'car (LaTeX-mdframed-mdfdefinestyle-list)))))
> -              opts :test #'equal)
> +      (cl-pushnew (list key (TeX-delete-duplicate-strings
> +                            (append val (mapcar #'car (LaTeX-mdframed-mdfdefinestyle-list)))))
> +                 opts :test #'equal)
>        (setq LaTeX-mdframed-key-val-options-local
>             (copy-alist opts))))
>    ;;
> @@ -242,7 +243,7 @@
>            (tmp (copy-alist LaTeX-mdframed-key-val-options-local)))
>        (dolist (x keys)
>         (setq tmp (assq-delete-all (car (assoc x tmp)) tmp))
> -       (pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test #'equal))
> +       (cl-pushnew (list x (mapcar #'car (funcall colorcmd))) tmp :test #'equal))
>        (setq LaTeX-mdframed-key-val-options-local
>             (copy-alist tmp)))))
>
> diff --git a/style/tcolorbox.el b/style/tcolorbox.el
> index 6805983b..b8e65122 100644
> --- a/style/tcolorbox.el
> +++ b/style/tcolorbox.el
> @@ -40,8 +40,9 @@
>
>  ;;; Code:
>
> -;; Needed for compiling `pushnew':
> -(eval-when-compile (require 'cl))
> +;; Needed for compiling `cl-pushnew':
> +(eval-when-compile
> +  (require 'cl-lib))
>
>  ;; Needed for auto-parsing.
>  (require 'tex)
> @@ -476,7 +477,7 @@ e.g. \"tcolorboxlib-raster.el\"."
>          (tmp (copy-alist LaTeX-tcolorbox-keyval-options-local)))
>      (dolist (key keys)
>        (setq tmp (assq-delete-all (car (assoc key tmp)) tmp))
> -      (pushnew
> +      (cl-pushnew
>         (list key (mapcar #'car (LaTeX-xcolor-definecolor-list))) tmp :test #'equal))
>      (setq LaTeX-tcolorbox-keyval-options-local (copy-alist tmp)))
>    (setq LaTeX-tcolorbox-keyval-options-full
> --
> 2.16.1
>
>
>
>
> _______________________________________________
> bug-auctex mailing list
> [email-masked]
> https://lists.gnu.org/mailman/listinfo/bug-auctex
>