From e4807ab7b2470dbb6fbc2b0d3a0139b9ff5f21a5 Mon Sep 17 00:00:00 2001
From: Feng Shu <tumashu@163.com>
Date: Fri, 14 Jul 2017 08:30:59 +0800
Subject: [PATCH] Use cl-lib instead of cl

---
 lisp/emms-browser.el       |  7 +++----
 lisp/emms-history.el       |  2 --
 lisp/emms-i18n.el          |  2 --
 lisp/emms-info-metaflac.el |  1 -
 lisp/emms-mark.el          | 11 +++++------
 lisp/emms-player-mpd.el    |  9 +++++----
 lisp/emms-playing-time.el  |  4 ++--
 lisp/emms-playlist-sort.el |  6 +++---
 lisp/emms-tag-editor.el    |  2 --
 lisp/emms-volume-pulse.el  | 26 +++++++++++++-------------
 10 files changed, 31 insertions(+), 39 deletions(-)

diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el
index 94f0072..590a736 100644
--- a/lisp/emms-browser.el
+++ b/lisp/emms-browser.el
@@ -286,14 +286,13 @@
 
 ;;; Code:
 
+(require 'cl-lib)
 (require 'emms)
 (require 'emms-cache)
 (require 'emms-source-file)
 (require 'emms-playlist-sort)
 (require 'sort)
 
-(eval-when-compile
-  (require 'cl))
 
 ;; --------------------------------------------------
 ;; Variables and configuration
@@ -1068,7 +1067,7 @@ If DIRECTION is 1, move forward, otherwise move backwards."
       (emms-browser-kill-subitems)
     (if (emms-browser-subitems-exist)
         (emms-browser-show-subitems)
-      (assert (emms-browser-move-up-level))
+      (cl-assert (emms-browser-move-up-level))
       (emms-browser-kill-subitems))))
 
 (defun emms-browser-show-subitems ()
@@ -1637,7 +1636,7 @@ Based on from `emms-browser-covers' and
                 emms-browser-covers)))
 
 (defun emms-browser-get-cover-from-album (bdata &optional size)
-  (assert (eq (emms-browser-bdata-type bdata) 'info-album))
+  (cl-assert (eq (emms-browser-bdata-type bdata) 'info-album))
   (let* ((track1data (emms-browser-bdata-data bdata))
          (track1 (car (emms-browser-bdata-data (car track1data))))
          (path (emms-track-get track1 'name)))
diff --git a/lisp/emms-history.el b/lisp/emms-history.el
index 4d3238b..9b913b2 100644
--- a/lisp/emms-history.el
+++ b/lisp/emms-history.el
@@ -36,8 +36,6 @@
 ;;; Code:
 
 (require 'emms)
-(eval-when-compile
-  (require 'cl))
 
 (defgroup emms-history nil
   "Saving and restoring all playlists when closing/restarting
diff --git a/lisp/emms-i18n.el b/lisp/emms-i18n.el
index 748f4aa..66a5eeb 100644
--- a/lisp/emms-i18n.el
+++ b/lisp/emms-i18n.el
@@ -46,8 +46,6 @@
 ;;; Code:
 
 (provide 'emms-i18n)
-(eval-when-compile
-  (require 'cl))
 
 ;; TODO: Use defcustom.
 (defvar emms-i18n-never-used-coding-system
diff --git a/lisp/emms-info-metaflac.el b/lisp/emms-info-metaflac.el
index 5e50578..5a9f517 100644
--- a/lisp/emms-info-metaflac.el
+++ b/lisp/emms-info-metaflac.el
@@ -38,7 +38,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'emms-info)
 
 (defvar emms-info-metaflac-version "0.1 $Revision: 1.10 $"
diff --git a/lisp/emms-mark.el b/lisp/emms-mark.el
index 4f02c75..696fe2d 100644
--- a/lisp/emms-mark.el
+++ b/lisp/emms-mark.el
@@ -36,18 +36,17 @@
 ;;; Code:
 
 (provide 'emms-mark)
+(require 'cl-lib)
 (require 'emms)
 (require 'emms-playlist-mode)
-(eval-when-compile
-  (require 'cl))
 
 ;;{{{  set new description-function
 (defun emms-mark-track-description (track)
   "Return a description of the current track."
-  (assert (not (eq (default-value 'emms-track-description-function)
-                   'emms-mark-track-description))
-          nil (concat "Do not set `emms-track-selection-function' to be"
-                      " emms-mark-track-description."))
+  (cl-assert (not (eq (default-value 'emms-track-description-function)
+		      'emms-mark-track-description))
+	     nil (concat "Do not set `emms-track-selection-function' to be"
+			 " emms-mark-track-description."))
   (concat "  " (funcall (default-value 'emms-track-description-function)
                         track)))
 
diff --git a/lisp/emms-player-mpd.el b/lisp/emms-player-mpd.el
index fdc3394..191d072 100644
--- a/lisp/emms-player-mpd.el
+++ b/lisp/emms-player-mpd.el
@@ -103,6 +103,7 @@
 
 ;; Adam Sjøgren implemented support for changing the volume.
 
+(require 'cl-lib)
 (require 'emms-player-simple)
 (require 'emms-source-playlist)  ; for emms-source-file-parse-playlist
 (require 'tq)
@@ -150,10 +151,10 @@ or nil if we cannot figure it out."
         (let* ((b (match-end 0))
                (e (string-match "Output plugins:$" out))
                (plugs (split-string (substring out b e) "\n" t))
-               (plugs (mapcan (lambda (x)
-                                (and (string-match " +\\[.*\\] +\\(.+\\)$" x)
-                                     (split-string (match-string 1 x) nil t)))
-                              plugs))
+               (plugs (cl-mapcan (lambda (x)
+                                   (and (string-match " +\\[.*\\] +\\(.+\\)$" x)
+                                        (split-string (match-string 1 x) nil t)))
+                                 plugs))
                (b (and (string-match "Protocols:$" out) (match-end 0)))
                (prots (and b (substring out (+ 2 b) -1)))
                (prots (split-string (or prots "") nil t)))
diff --git a/lisp/emms-playing-time.el b/lisp/emms-playing-time.el
index 54a7f12..9c4f96a 100644
--- a/lisp/emms-playing-time.el
+++ b/lisp/emms-playing-time.el
@@ -39,7 +39,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
 (require 'emms-info)
 (require 'emms-player-simple)
 
@@ -177,7 +177,7 @@ could call `emms-playing-time-enable-display' and
                 0))
            (total-min-only (/ total-playing-time 60))
            (total-sec-only (% total-playing-time 60)))
-      (case emms-playing-time-style
+      (cl-case emms-playing-time-style
         ((bar)                          ; `bar' style
          (if (zerop total-playing-time)
              (setq emms-playing-time-string "[==>........]")
diff --git a/lisp/emms-playlist-sort.el b/lisp/emms-playlist-sort.el
index 138308e..0c3b466 100644
--- a/lisp/emms-playlist-sort.el
+++ b/lisp/emms-playlist-sort.el
@@ -22,7 +22,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
 (require 'emms-last-played)
 (require 'emms-playlist-mode)
 
@@ -188,10 +188,10 @@ ie. by album name and then by track number."
 (defun emms-playlist-sort-by-list-p (a b)
   (catch 'return
     (dolist (info emms-playlist-sort-list)
-      (case info
+      (cl-case info
         ((name info-artist info-composer info-performer info-title info-album info-genre)
          (when (emms-string< (emms-track-get a info)
-                        (emms-track-get b info))
+                             (emms-track-get b info))
            (throw 'return t)))
         ((info-playing-time)
          (when (< (emms-track-get a info)
diff --git a/lisp/emms-tag-editor.el b/lisp/emms-tag-editor.el
index c57a111..022990b 100644
--- a/lisp/emms-tag-editor.el
+++ b/lisp/emms-tag-editor.el
@@ -27,8 +27,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
 (condition-case nil
     (require 'overlay)
   (error nil))
diff --git a/lisp/emms-volume-pulse.el b/lisp/emms-volume-pulse.el
index 7fc6de5..0e9a312 100644
--- a/lisp/emms-volume-pulse.el
+++ b/lisp/emms-volume-pulse.el
@@ -42,7 +42,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
 
 ;; TODO: it would be great if custom could have
 ;; choices based on pactl list short sinks | cut -f1-2
@@ -77,18 +77,18 @@ See full list of devices on your system by running
         (if sink-number-p 'assq 'assoc)
         emms-volume-pulse-sink
         (mapcar (if sink-number-p 'identity 'cdr)
-                (loop while
-                      (string-match
-                       (mapconcat 'identity
-                                  '(".*Sink[ \t]+\\#\\([0-9]\\)"
-                                    ".*Name:[ \t]\\([^\n]+\\)"
-                                    ".*Volume:.*?\\([0-9]+\\)%.*\n?")
-                                  "\n")
-                       output)
-                      collect (list (string-to-number (match-string 1 output))
-                                    (match-string 2 output)
-                                    (match-string 3 output))
-                      do (setq output (replace-match "" nil nil output))))))))))
+                (cl-loop while
+                         (string-match
+                          (mapconcat 'identity
+                                     '(".*Sink[ \t]+\\#\\([0-9]\\)"
+                                       ".*Name:[ \t]\\([^\n]+\\)"
+                                       ".*Volume:.*?\\([0-9]+\\)%.*\n?")
+                                     "\n")
+                          output)
+                         collect (list (string-to-number (match-string 1 output))
+                                       (match-string 2 output)
+                                       (match-string 3 output))
+                         do (setq output (replace-match "" nil nil output))))))))))
 
 
 ;;;###autoload
-- 
2.13.0

