emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch to suppress "deprecated cl" warnings plus few others
@ 2020-08-22 18:14 Richard Kim
  2020-08-26  5:05 ` Kyle Meyer
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Kim @ 2020-08-22 18:14 UTC (permalink / raw)
  To: Org-Mode mailing list


[-- Attachment #1.1: Type: text/plain, Size: 414 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 454 bytes --]

[-- Attachment #2: 0001-Suppressed-all-deprecated-cl-warnings-plus-few-other.patch --]
[-- Type: text/x-patch, Size: 12128 bytes --]

From bc6e0dd7c1f3bc8c7d78c4c38eb04140d99001fc Mon Sep 17 00:00:00 2001
From: Richard Kim <emacs18@gmail.com>
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 &optional 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 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'org-element)
 
 (declare-function appt-delete-window    "appt"          ())
diff --git a/contrib/lisp/org-registry.el b/contrib/lisp/org-registry.el
index 402ce3082..17fbeb872 100644
--- a/contrib/lisp/org-registry.el
+++ b/contrib/lisp/org-registry.el
@@ -64,7 +64,7 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup org-registry nil
   "A registry for Org."
diff --git a/contrib/lisp/org-toc.el b/contrib/lisp/org-toc.el
index e05c4bdf8..865ab38f8 100644
--- a/contrib/lisp/org-toc.el
+++ b/contrib/lisp/org-toc.el
@@ -33,7 +33,7 @@
 
 (provide 'org-toc)
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 ;;; Custom variables:
 (defvar org-toc-base-buffer nil)
@@ -201,10 +201,10 @@ specified, then make `org-toc-recenter' use this value."
 	   (message "CHILDREN")
 	   (overlay-put ov 'status 'children))
 	  ((eq status 'children)
-	   (show-branches)
+	   (outline-show-branches)
 	   (message "BRANCHES")
 	   (overlay-put ov 'status 'branches))
-	  (t (hide-subtree)
+	  (t (outline-hide-subtree)
 	     (message "FOLDED")
 	     (overlay-put ov 'status 'folded)))))
 
@@ -223,7 +223,7 @@ specified, then make `org-toc-recenter' use this value."
       (progn (setq org-toc-base-buffer (current-buffer))
 	     (setq org-toc-odd-levels-only org-odd-levels-only))
     (if (eq major-mode 'org-toc-mode)
-	(org-pop-to-buffer-same-window org-toc-base-buffer)
+	(pop-to-buffer-same-window org-toc-base-buffer)
       (error "Not in an Org buffer")))
   ;; create the new window display
   (let ((pos (or position
@@ -363,13 +363,13 @@ If DELETE is non-nil, delete other windows when in the Org buffer."
   "Toggle columns view in the Org buffer from Org TOC."
   (interactive)
   (let ((indirect-buffer (current-buffer)))
-    (org-pop-to-buffer-same-window org-toc-base-buffer)
+    (pop-to-buffer-same-window org-toc-base-buffer)
     (if (not org-toc-columns-shown)
 	(progn (org-columns)
 	       (setq org-toc-columns-shown t))
       (progn (org-columns-remove-overlays)
 	     (setq org-toc-columns-shown nil)))
-    (org-pop-to-buffer-same-window indirect-buffer)))
+    (pop-to-buffer-same-window indirect-buffer)))
 
 (defun org-toc-info ()
   "Show properties of current subtree in the echo-area."
@@ -377,7 +377,7 @@ If DELETE is non-nil, delete other windows when in the Org buffer."
   (let ((pos (point))
 	(indirect-buffer (current-buffer))
 	props prop msg)
-    (org-pop-to-buffer-same-window org-toc-base-buffer)
+    (pop-to-buffer-same-window org-toc-base-buffer)
     (goto-char pos)
     (setq props (org-entry-properties))
     (while (setq prop (pop props))
@@ -390,7 +390,7 @@ If DELETE is non-nil, delete other windows when in the Org buffer."
 	  (setq p (concat p ":"))
 	  (add-text-properties 0 (length p) '(face org-special-keyword) p)
 	  (setq msg (concat msg p " " v "  ")))))
-    (org-pop-to-buffer-same-window indirect-buffer)
+    (pop-to-buffer-same-window indirect-buffer)
     (message msg)))
 
 ;;; Store and restore TOC configuration:
@@ -445,7 +445,7 @@ current table of contents to it."
 		 (message "CHILDREN")
 		 (overlay-put ov 'status 'children))
 		((eq (cdr hlcfg0) 'branches)
-		 (show-branches)
+		 (outline-show-branches)
 		 (message "BRANCHES")
 		 (overlay-put ov 'status 'branches))))))
     (goto-char pos)
diff --git a/contrib/lisp/org-wikinodes.el b/contrib/lisp/org-wikinodes.el
index e44ac9870..bc35a1a41 100644
--- a/contrib/lisp/org-wikinodes.el
+++ b/contrib/lisp/org-wikinodes.el
@@ -25,7 +25,7 @@
 
 (require 'org)
 (eval-when-compile
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup org-wikinodes nil
   "Wiki-like CamelCase links words to outline nodes in Org mode."
@@ -154,7 +154,7 @@ setting of `org-wikinodes-create-targets'."
        ((stringp create)
 	;; Make new node in another file
 	(org-mark-ring-push (point))
-	(org-pop-to-buffer-same-window (find-file-noselect create))
+	(pop-to-buffer-same-window (find-file-noselect create))
 	(goto-char (point-max))
 	(or (bolp) (newline))
 	(insert "\n* " target "\n")
@@ -279,8 +279,8 @@ with working links."
     (while (re-search-forward re nil t)
       (unless (save-match-data
 		(or (org-at-heading-p)
-		    (org-in-regexp org-bracket-link-regexp)
-		    (org-in-regexp org-plain-link-re)
+		    (org-in-regexp org-link-bracket-re)
+		    (org-in-regexp org-link-plain-re)
 		    (org-in-regexp "<<[^<>]+>>")))
 	(setq link (match-string 0))
 	(delete-region (match-beginning 0) (match-end 0))
diff --git a/contrib/lisp/ox-deck.el b/contrib/lisp/ox-deck.el
index 3b911e16e..a4280306d 100644
--- a/contrib/lisp/ox-deck.el
+++ b/contrib/lisp/ox-deck.el
@@ -45,7 +45,7 @@
 ;; for missing values.
 
 (require 'ox-html)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (org-export-define-derived-backend 'deck 'html
   :menu-entry
@@ -91,7 +91,7 @@ modernizr; core, extensions and themes directories.)"
   :type '(repeat (string :tag "Directory")))
 
 (defun org-deck--cleanup-components (components)
-  (remove-duplicates
+  (cl-remove-duplicates
    (car (remove 'nil components))
    :test (lambda (x y)
            (string= (file-name-nondirectory x)
diff --git a/contrib/lisp/ox-groff.el b/contrib/lisp/ox-groff.el
index 9f0a32432..a2ad14c1c 100644
--- a/contrib/lisp/ox-groff.el
+++ b/contrib/lisp/ox-groff.el
@@ -37,7 +37,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'ox)
 
 (defvar orgtbl-exp-regexp)
diff --git a/contrib/lisp/ox-s5.el b/contrib/lisp/ox-s5.el
index 243332519..5088a6165 100644
--- a/contrib/lisp/ox-s5.el
+++ b/contrib/lisp/ox-s5.el
@@ -55,7 +55,7 @@
 ;; for missing values.
 
 (require 'ox-html)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (org-export-define-derived-backend 's5 'html
   :menu-entry
diff --git a/contrib/lisp/ox-taskjuggler.el b/contrib/lisp/ox-taskjuggler.el
index 8ce598949..15448344e 100644
--- a/contrib/lisp/ox-taskjuggler.el
+++ b/contrib/lisp/ox-taskjuggler.el
@@ -145,7 +145,7 @@
 ;;
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'ox)
 
diff --git a/contrib/scripts/org-docco.org b/contrib/scripts/org-docco.org
index bfa5040c5..4031e1f7c 100644
--- a/contrib/scripts/org-docco.org
+++ b/contrib/scripts/org-docco.org
@@ -68,7 +68,7 @@ below e.g., =push= and =incf=.  It looks like a namespace-safe version
 of =cl= may soon be permissible for use in official Emacs packages.
 #+begin_src emacs-lisp
 ;;; Code:
-(require 'cl)
+(require 'cl-lib)
 #+end_src
 
 This is a function which returns the buffer positions of matching
@@ -94,12 +94,12 @@ regular expressions.  It has two special features...
         (when (re-search-forward beg-re nil t)
           (goto-char (match-beginning 0))
           (setq beg (point-marker))
-          (incf beg-count)
+          (cl-incf beg-count)
           (goto-char (match-end 0))
           (while (and (not end) (re-search-forward both-re nil t))
             (goto-char (match-beginning 0))
-            (cond ((looking-at beg-re) (incf beg-count))
-                  ((looking-at end-re) (incf end-count))
+            (cond ((looking-at beg-re) (cl-incf beg-count))
+                  ((looking-at end-re) (cl-incf end-count))
                   (:otherwise (error "miss-matched")))
             (goto-char (match-end 0))
             (when (= beg-count end-count) (setq end (point-marker))))
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: patch to suppress "deprecated cl" warnings plus few others
  2020-08-22 18:14 patch to suppress "deprecated cl" warnings plus few others Richard Kim
@ 2020-08-26  5:05 ` Kyle Meyer
  0 siblings, 0 replies; 2+ messages in thread
From: Kyle Meyer @ 2020-08-26  5:05 UTC (permalink / raw)
  To: Richard Kim; +Cc: Org-Mode mailing list

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?


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-26  5:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-22 18:14 patch to suppress "deprecated cl" warnings plus few others Richard Kim
2020-08-26  5:05 ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).