Re: patch to suppress "deprecated cl" warnings plus few others

2020-08-25 Thread Kyle Meyer
Richard Kim writes:

> Attached patch suppresses byte compiler warnings.

Thanks.  contrib/ doesn't receive much love when it comes to these sorts
of things, and byte-compiling its files is not a pretty sight.

> Subject: [PATCH] Suppressed all "deprecated cl" warnings plus few others.

A "contrib: " prefix on this subject would be useful for orienting log
readers.

Convention nit-pick: Drop the period from the subject.

> diff --git a/contrib/lisp/ob-tcl.el b/contrib/lisp/ob-tcl.el
> index 091eb5d09..d269ad38a 100644
> --- a/contrib/lisp/ob-tcl.el
> +++ b/contrib/lisp/ob-tcl.el
> @@ -31,7 +31,7 @@
>  ;;; Code:
>  (require 'ob)
>  (require 'ob-eval)
> -(eval-when-compile (require 'cl))
> +(eval-when-compile (require 'cl-lib))

The byte-compiler complains after your change:

contrib/lisp/ob-tcl.el:129:1:Warning: the following functions are
not known to be defined: case, output, value

These all come from a missed s/case/cl-case/.

>  (defvar org-babel-tangle-lang-exts)
>  (add-to-list 'org-babel-tangle-lang-exts '("tcl" . "tcl"))
> diff --git a/contrib/lisp/org-choose.el b/contrib/lisp/org-choose.el
> index c1006d095..799fd917f 100644
> --- a/contrib/lisp/org-choose.el
> +++ b/contrib/lisp/org-choose.el
> @@ -62,9 +62,7 @@
>  ;;; Requires
>  
>  (require 'org)
> - ;(eval-when-compile
> - ;   (require 'cl))
> -(require 'cl)
> +(require 'cl-lib)

Same applies here.  You took care of s/position/cl-position/ below, but
there are a good number of other symbols that now require a prefix:
defstruct, destructuring-bind, incf, pushnew, first, and second.

>  ;;; Body
>  ;;; The variables
> @@ -357,7 +355,7 @@ setting was changed."
>  (defun org-choose-get-index-in-keywords (ix all-keywords)
>"Return the index of the current entry."
>(if ix
> -  (position ix all-keywords
> +  (cl-position ix all-keywords
>   :test #'equal)))
>

I haven't yet looked beyond the first two files, though I suspect the
other files may have similar issues.  Could you take a closer look and
send an updated patch?



patch to suppress "deprecated cl" warnings plus few others

2020-08-22 Thread Richard Kim
Attached patch suppresses byte compiler warnings.

Most changes are to replace (require 'cl) with (require 'cl-lib). Few other
changes were also made simply by following messages printed by the byte
compiler, e.g., replacing show-branches with outline-show-branches,
org-pop-to-buffer-same-window with pop-to-buffer-same-window, and declaring
new-of as a dynamic variable to prevent it from being a free variable.
From bc6e0dd7c1f3bc8c7d78c4c38eb04140d99001fc Mon Sep 17 00:00:00 2001
From: Richard Kim 
Date: Sat, 22 Aug 2020 11:05:30 -0700
Subject: [PATCH] Suppressed all "deprecated cl" warnings plus few others.

---
 contrib/lisp/ob-tcl.el |  2 +-
 contrib/lisp/org-choose.el |  6 ++
 contrib/lisp/org-depend.el | 11 +--
 contrib/lisp/org-invoice.el|  2 +-
 contrib/lisp/org-learn.el  |  6 +++---
 contrib/lisp/org-notify.el |  2 +-
 contrib/lisp/org-registry.el   |  2 +-
 contrib/lisp/org-toc.el| 18 +-
 contrib/lisp/org-wikinodes.el  |  8 
 contrib/lisp/ox-deck.el|  4 ++--
 contrib/lisp/ox-groff.el   |  2 +-
 contrib/lisp/ox-s5.el  |  2 +-
 contrib/lisp/ox-taskjuggler.el |  2 +-
 contrib/scripts/org-docco.org  |  8 
 14 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/contrib/lisp/ob-tcl.el b/contrib/lisp/ob-tcl.el
index 091eb5d09..d269ad38a 100644
--- a/contrib/lisp/ob-tcl.el
+++ b/contrib/lisp/ob-tcl.el
@@ -31,7 +31,7 @@
 ;;; Code:
 (require 'ob)
 (require 'ob-eval)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("tcl" . "tcl"))
diff --git a/contrib/lisp/org-choose.el b/contrib/lisp/org-choose.el
index c1006d095..799fd917f 100644
--- a/contrib/lisp/org-choose.el
+++ b/contrib/lisp/org-choose.el
@@ -62,9 +62,7 @@
 ;;; Requires
 
 (require 'org)
-	;(eval-when-compile
-	;   (require 'cl))
-(require 'cl)
+(require 'cl-lib)
 
 ;;; Body
 ;;; The variables
@@ -357,7 +355,7 @@ setting was changed."
 (defun org-choose-get-index-in-keywords (ix all-keywords)
   "Return the index of the current entry."
   (if ix
-  (position ix all-keywords
+  (cl-position ix all-keywords
 		:test #'equal)))
 
 ;;; org-choose-get-entry-index
diff --git a/contrib/lisp/org-depend.el b/contrib/lisp/org-depend.el
index 263cd7175..6d0aaba2e 100644
--- a/contrib/lisp/org-depend.el
+++ b/contrib/lisp/org-depend.el
@@ -155,8 +155,7 @@
 ;;
 
 (require 'org)
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defcustom org-depend-tag-blocked t
   "Whether to indicate blocked TODO items by a special tag."
@@ -281,13 +280,13 @@ This does two different kinds of triggers:
 			  (from-bottom items)
 			  ((or from-current no-wrap)
 			   (let* ((items (nreverse items))
-  (pos (position this-item items :key #'first))
-  (items-before (subseq items 0 pos))
-  (items-after (subseq items pos)))
+  (pos (cl-position this-item items :key #'first))
+  (items-before (cl-subseq items 0 pos))
+  (items-after (cl-subseq items pos)))
  (if no-wrap items-after
    (append items-after items-before
 			  (t (nreverse items
-		  (setq items (remove-if
+		  (setq items (cl-remove-if
 			   (lambda (item)
  (or (equal (first item) this-item)
  (and (not todo-and-done-only)
diff --git a/contrib/lisp/org-invoice.el b/contrib/lisp/org-invoice.el
index 686889411..8d9f1a8ba 100644
--- a/contrib/lisp/org-invoice.el
+++ b/contrib/lisp/org-invoice.el
@@ -52,7 +52,7 @@
 ;;
 ;; git clone git://pmade.com/elisp
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'org))
 
 (declare-function org-duration-from-minutes "org-duration" (minutes  fmt fractional))
diff --git a/contrib/lisp/org-learn.el b/contrib/lisp/org-learn.el
index dfce196b1..50e9fa22c 100644
--- a/contrib/lisp/org-learn.el
+++ b/contrib/lisp/org-learn.el
@@ -35,7 +35,7 @@
 
 (require 'org)
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup org-learn nil
   "Options concerning the learning code in Org-mode."
@@ -112,7 +112,7 @@ OF matrix."
 	(mod2 (/ (1- interval-used) interval-used))
 	;; the number determining how many times the OF value will
 	;; increase or decrease
-	modifier)
+	modifier new-of)
 (if (< mod5 1.05)
 	(setq mod5 1.05))
 (if (< mod2 0.75)
@@ -159,7 +159,7 @@ OF matrix."
   (let* ((learn-str (org-entry-get (point) "LEARN_DATA"))
 	 (learn-data (or (and learn-str
 			  (read learn-str))
-			 (copy-list initial-repetition-state)))
+			 (cl-copy-list initial-repetition-state)))
 	 closed-dates)
 (setq learn-data
 	  (determine-next-interval (nth 1 learn-data)
diff --git a/contrib/lisp/org-notify.el b/contrib/lisp/org-notify.el
index 9f8677871..ce0bc07c9 100644
--- a/contrib/lisp/org-notify.el
+++ b/contrib/lisp/org-notify.el
@@ -57,7 +57,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require