Subject: Re: bug#30640: [patch] replace last cl

From: Alex Branham <[email-masked]>
Date: Thu, 01 Mar 2018 09:43:24 -0600

On Thu 01 Mar 2018 at 09:35, Mosè Giordano <[email-masked]> wrote:

> Hi Alex,
>
> 2018-02-28 1:47 GMT+01:00 Alex Branham <[email-masked]>:
>> I think this takes case of the last (require 'cl) statement.
>
> thanks again for working on this!  However, I can't compile AUCTeX
> with your patch:
>
>     latex.el:6542:8:Error: Wrong type argument: sequencep, beg-col
>
> Could you please have a look at this?

Whoops! I didn't think about checking the other files for cl functions.
Since this removes the last cl function, the byte-compiler didn't know
about the cl functions anymore. There was one lurking in latex.el that
we must've missed before.

------------------------------------------------------------

>From 390cab172b779741ed64e382cf7c9abc60dfebe5 Mon Sep 17 00:00:00 2001
From: Alex Branham <[email-masked]>
Date: Thu, 1 Mar 2018 09:40:03 -0600
Subject: [PATCH] Remove cl from AuCTeX

* tex.el: replace last 'cl with 'cl-lib
* latex.el: replace cl function with cl-lib function
---
 latex.el | 58 +++++++++++++++++++++++++++++-----------------------------
 tex.el   | 19 ++++++++++---------
 2 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/latex.el b/latex.el
index 7354c23b..5c4a6383 100644
--- a/latex.el
+++ b/latex.el
@@ -6542,35 +6542,35 @@ function would return non-nil and `(match-string 1)' would return
 
 (defun LaTeX-indent-tabular ()
   "Return indent column for the current tabular-like line."
-  (destructuring-bind
-   (beg-pos . beg-col)
-   (LaTeX-env-beginning-pos-col)
-   (let ((tabular-like-end-regex
-	  (format "\\\\end{%s}"
-		  (regexp-opt
-		   (let (out)
-		     (mapc (lambda (x)
-                             (when (eq (cadr x) 'LaTeX-indent-tabular)
-                               (push (car x) out)))
-                           LaTeX-indent-environment-list)
-		     out)))))
-     (cond ((looking-at tabular-like-end-regex)
-	    beg-col)
-
-	   ((looking-at "\\\\\\\\")
-	    (+ 2 beg-col))
-
-	   ((looking-at "&")
-	    (LaTeX-hanging-ampersand-position))
-
-	   (t
-	    (+ 2
-	       (let ((any-col (save-excursion
-				(when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t)
-				  (current-column)))))
-		 (if (and any-col (= ?& (char-before (match-end 0))))
-		     (1+ any-col)
-		   beg-col))))))))
+  (cl-destructuring-bind
+      (beg-pos . beg-col)
+      (LaTeX-env-beginning-pos-col)
+    (let ((tabular-like-end-regex
+	   (format "\\\\end{%s}"
+		   (regexp-opt
+		    (let (out)
+		      (mapc (lambda (x)
+                              (when (eq (cadr x) 'LaTeX-indent-tabular)
+                                (push (car x) out)))
+                            LaTeX-indent-environment-list)
+		      out)))))
+      (cond ((looking-at tabular-like-end-regex)
+	     beg-col)
+
+	    ((looking-at "\\\\\\\\")
+	     (+ 2 beg-col))
+
+	    ((looking-at "&")
+	     (LaTeX-hanging-ampersand-position))
+
+	    (t
+	     (+ 2
+	        (let ((any-col (save-excursion
+				 (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t)
+				   (current-column)))))
+		  (if (and any-col (= ?& (char-before (match-end 0))))
+		      (1+ any-col)
+		    beg-col))))))))
 
 (provide 'latex)
 
diff --git a/tex.el b/tex.el
index 8863a886..b7891a14 100644
--- a/tex.el
+++ b/tex.el
@@ -1,6 +1,6 @@
 ;;; tex.el --- Support for TeX documents.
 
-;; Copyright (C) 1985-1987, 1991, 1993-2017 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1991, 1993-2018 Free Software Foundation, Inc.
 
 ;; Maintainer: [email-masked]
 ;; Keywords: tex
@@ -34,7 +34,7 @@
 (require 'custom)
 (require 'tex-site)
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup TeX-file nil
   "Files used by AUCTeX."
@@ -2710,11 +2710,11 @@ are returned."
 		(dolist (subdir subdirs)
 		  (setq path (file-name-as-directory (concat item subdir)))
 		  (when (file-exists-p path)
-		    (pushnew path input-dir-list :test #'equal)))
+		    (cl-pushnew path input-dir-list :test #'equal)))
 	      (setq path (file-name-as-directory item))
 	      (when (file-exists-p path)
-		(pushnew path input-dir-list :test #'equal))))
-	  ;; No duplication in result is assured since `pushnew' is
+		(cl-pushnew path input-dir-list :test #'equal))))
+	  ;; No duplication in result is assured since `cl-pushnew' is
 	  ;; used above.  Should we introduce an option for speed just
 	  ;; to accumulate all the results without care for
 	  ;; duplicates?
@@ -3131,6 +3131,7 @@ FORCE is not nil."
 
 (defcustom TeX-complete-word 'ispell-complete-word
   "*Function to call for completing non-macros in `tex-mode'."
+  :type 'function
   :group 'TeX-macro)
 
 (defcustom TeX-complete-expert-commands nil
@@ -4521,7 +4522,7 @@ EXTENSIONS defaults to `TeX-file-extensions'."
 				    "$TEXMFDIST")
                                   "latex"))
       (when (file-readable-p dir)
-        (pushnew dir list :test #'equal)))
+        (cl-pushnew dir list :test #'equal)))
     (nreverse list)))
 
 (defcustom TeX-tree-roots (TeX-tree-roots)
@@ -6404,7 +6405,7 @@ NAME may be a package, a command, or a document."
       (when (memq major-mode (nth 1 elt))
 	(let ((completions (funcall (nth 2 elt))))
 	  (unless (null completions)
-            (pushnew (cons completions (nth 0 elt)) docs :test #'equal)))))
+            (cl-pushnew (cons completions (nth 0 elt)) docs :test #'equal)))))
     (if (null docs)
 	(progn
 	  (if (executable-find "texdoc")
@@ -6528,7 +6529,7 @@ of the car of `ispell-tex-skip-alists'.  This only happens if
     (let ((raws (car ispell-tex-skip-alists))
 	  (envs (cadr ispell-tex-skip-alists)))
       (dolist (x skip)
-	(pushnew x raws :test #'equal))
+	(cl-pushnew x raws :test #'equal))
       (setq ispell-tex-skip-alists (list raws envs)))))
 
 (defun TeX-ispell-skip-setcdr (skip)
@@ -6541,7 +6542,7 @@ of the cdr of `ispell-tex-skip-alists'.  This only happens if
     (let ((raws (car ispell-tex-skip-alists))
 	  (envs (cadr ispell-tex-skip-alists)))
       (dolist (x skip)
-	(pushnew x envs :test #'equal))
+	(cl-pushnew x envs :test #'equal))
       (setq ispell-tex-skip-alists (list raws envs)))))
 
 (defun TeX-ispell-tex-arg-end (&optional arg1 arg2 arg3)
-- 
2.16.2

>From 390cab172b779741ed64e382cf7c9abc60dfebe5 Mon Sep 17 00:00:00 2001
From: Alex Branham <[email-masked]>
Date: Thu, 1 Mar 2018 09:40:03 -0600
Subject: [PATCH] Remove cl from AuCTeX

* tex.el: replace last 'cl with 'cl-lib
* latex.el: replace cl function with cl-lib function
---
 latex.el | 58 +++++++++++++++++++++++++++++-----------------------------
 tex.el   | 19 ++++++++++---------
 2 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/latex.el b/latex.el
index 7354c23b..5c4a6383 100644
--- a/latex.el
+++ b/latex.el
@@ -6542,35 +6542,35 @@ function would return non-nil and `(match-string 1)' would return
 
 (defun LaTeX-indent-tabular ()
   "Return indent column for the current tabular-like line."
-  (destructuring-bind
-   (beg-pos . beg-col)
-   (LaTeX-env-beginning-pos-col)
-   (let ((tabular-like-end-regex
-	  (format "\\\\end{%s}"
-		  (regexp-opt
-		   (let (out)
-		     (mapc (lambda (x)
-                             (when (eq (cadr x) 'LaTeX-indent-tabular)
-                               (push (car x) out)))
-                           LaTeX-indent-environment-list)
-		     out)))))
-     (cond ((looking-at tabular-like-end-regex)
-	    beg-col)
-
-	   ((looking-at "\\\\\\\\")
-	    (+ 2 beg-col))
-
-	   ((looking-at "&")
-	    (LaTeX-hanging-ampersand-position))
-
-	   (t
-	    (+ 2
-	       (let ((any-col (save-excursion
-				(when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t)
-				  (current-column)))))
-		 (if (and any-col (= ?& (char-before (match-end 0))))
-		     (1+ any-col)
-		   beg-col))))))))
+  (cl-destructuring-bind
+      (beg-pos . beg-col)
+      (LaTeX-env-beginning-pos-col)
+    (let ((tabular-like-end-regex
+	   (format "\\\\end{%s}"
+		   (regexp-opt
+		    (let (out)
+		      (mapc (lambda (x)
+                              (when (eq (cadr x) 'LaTeX-indent-tabular)
+                                (push (car x) out)))
+                            LaTeX-indent-environment-list)
+		      out)))))
+      (cond ((looking-at tabular-like-end-regex)
+	     beg-col)
+
+	    ((looking-at "\\\\\\\\")
+	     (+ 2 beg-col))
+
+	    ((looking-at "&")
+	     (LaTeX-hanging-ampersand-position))
+
+	    (t
+	     (+ 2
+	        (let ((any-col (save-excursion
+				 (when (re-search-backward "\\\\\\\\\\|[^\\]&" beg-pos t)
+				   (current-column)))))
+		  (if (and any-col (= ?& (char-before (match-end 0))))
+		      (1+ any-col)
+		    beg-col))))))))
 
 (provide 'latex)
 
diff --git a/tex.el b/tex.el
index 8863a886..b7891a14 100644
--- a/tex.el
+++ b/tex.el
@@ -1,6 +1,6 @@
 ;;; tex.el --- Support for TeX documents.
 
-;; Copyright (C) 1985-1987, 1991, 1993-2017 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1991, 1993-2018 Free Software Foundation, Inc.
 
 ;; Maintainer: [email-masked]
 ;; Keywords: tex
@@ -34,7 +34,7 @@
 (require 'custom)
 (require 'tex-site)
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup TeX-file nil
   "Files used by AUCTeX."
@@ -2710,11 +2710,11 @@ are returned."
 		(dolist (subdir subdirs)
 		  (setq path (file-name-as-directory (concat item subdir)))
 		  (when (file-exists-p path)
-		    (pushnew path input-dir-list :test #'equal)))
+		    (cl-pushnew path input-dir-list :test #'equal)))
 	      (setq path (file-name-as-directory item))
 	      (when (file-exists-p path)
-		(pushnew path input-dir-list :test #'equal))))
-	  ;; No duplication in result is assured since `pushnew' is
+		(cl-pushnew path input-dir-list :test #'equal))))
+	  ;; No duplication in result is assured since `cl-pushnew' is
 	  ;; used above.  Should we introduce an option for speed just
 	  ;; to accumulate all the results without care for
 	  ;; duplicates?
@@ -3131,6 +3131,7 @@ FORCE is not nil."
 
 (defcustom TeX-complete-word 'ispell-complete-word
   "*Function to call for completing non-macros in `tex-mode'."
+  :type 'function
   :group 'TeX-macro)
 
 (defcustom TeX-complete-expert-commands nil
@@ -4521,7 +4522,7 @@ EXTENSIONS defaults to `TeX-file-extensions'."
 				    "$TEXMFDIST")
                                   "latex"))
       (when (file-readable-p dir)
-        (pushnew dir list :test #'equal)))
+        (cl-pushnew dir list :test #'equal)))
     (nreverse list)))
 
 (defcustom TeX-tree-roots (TeX-tree-roots)
@@ -6404,7 +6405,7 @@ NAME may be a package, a command, or a document."
       (when (memq major-mode (nth 1 elt))
 	(let ((completions (funcall (nth 2 elt))))
 	  (unless (null completions)
-            (pushnew (cons completions (nth 0 elt)) docs :test #'equal)))))
+            (cl-pushnew (cons completions (nth 0 elt)) docs :test #'equal)))))
     (if (null docs)
 	(progn
 	  (if (executable-find "texdoc")
@@ -6528,7 +6529,7 @@ of the car of `ispell-tex-skip-alists'.  This only happens if
     (let ((raws (car ispell-tex-skip-alists))
 	  (envs (cadr ispell-tex-skip-alists)))
       (dolist (x skip)
-	(pushnew x raws :test #'equal))
+	(cl-pushnew x raws :test #'equal))
       (setq ispell-tex-skip-alists (list raws envs)))))
 
 (defun TeX-ispell-skip-setcdr (skip)
@@ -6541,7 +6542,7 @@ of the cdr of `ispell-tex-skip-alists'.  This only happens if
     (let ((raws (car ispell-tex-skip-alists))
 	  (envs (cadr ispell-tex-skip-alists)))
       (dolist (x skip)
-	(pushnew x envs :test #'equal))
+	(cl-pushnew x envs :test #'equal))
       (setq ispell-tex-skip-alists (list raws envs)))))
 
 (defun TeX-ispell-tex-arg-end (&optional arg1 arg2 arg3)
-- 
2.16.2