emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/dracula-theme aa72f3d 182/187: Remove cl-lib dependency


From: ELPA Syncer
Subject: [nongnu] elpa/dracula-theme aa72f3d 182/187: Remove cl-lib dependency
Date: Thu, 21 Oct 2021 18:05:19 -0400 (EDT)

branch: elpa/dracula-theme
commit aa72f3d5c4d49cc0fb581d2f4eac528cf0278a11
Author: Étienne Deparis <etienne@depar.is>
Commit: Étienne Deparis <etienne@depar.is>

    Remove cl-lib dependency
    
    Honestly, this doesn’t improve readability, however cl powered code was not
    really readable itself, thus it’s kind of an improvement.
---
 dracula-theme.el | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/dracula-theme.el b/dracula-theme.el
index 3916472..d35f1f1 100644
--- a/dracula-theme.el
+++ b/dracula-theme.el
@@ -14,7 +14,6 @@
 ;; A dark color theme available for a number of editors.
 
 ;;; Code:
-(require 'cl-lib)
 (deftheme dracula)
 
 
@@ -767,25 +766,28 @@ read it before opening a new issue about your will.")
 
   (apply #'custom-theme-set-faces
          'dracula
-         (let ((color-names (mapcar #'car colors))
-               (graphic-colors (mapcar #'cadr colors))
-               (term-colors (mapcar #'caddr colors))
-               (tty-colors (mapcar #'cadddr colors))
-               (expand-for-kind
-                (lambda (kind spec)
-                  (when (and (eq kind 'term-colors)
+         (let ((expand-with-func
+                (lambda (func spec)
+                  (when (and (eq func 'caddr)
                              dracula-use-24-bit-colors-on-256-colors-terms)
-                    (setq kind 'graphic-colors))
-                  (cl-progv color-names (symbol-value kind)
-                    (eval `(backquote ,spec))))))
-           (cl-loop for (face . spec) in faces
-                    collect `(,face
-                              ((((min-colors 16777216)) ; fully graphical envs
-                                ,(funcall expand-for-kind 'graphic-colors 
spec))
-                               (((min-colors 256))      ; terminal withs 256 
colors
-                                ,(funcall expand-for-kind 'term-colors spec))
-                               (t                       ; should be only 
tty-like envs
-                                ,(funcall expand-for-kind 'tty-colors 
spec))))))))
+                    (setq func 'cadr))
+                  (let (reduced-color-list)
+                    (eval `(let ,(dolist (col colors reduced-color-list)
+                                   (push `(,(car col) ,(funcall func col))
+                                         reduced-color-list))
+                             (eval `(backquote ,spec)))))))
+               whole-theme)
+           (pcase-dolist (`(,face . ,spec) faces)
+             (push `(,face
+                     ((((min-colors 16777216)) ; fully graphical envs
+                       ,(funcall expand-with-func 'cadr spec))
+                      (((min-colors 256))      ; terminal withs 256 colors
+                       ,(funcall expand-with-func 'caddr spec))
+                      (t                       ; should be only tty-like envs
+                       ,(funcall expand-with-func 'cadddr spec))))
+                   whole-theme))
+           whole-theme)))
+
 
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]