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

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

[nongnu] elpa/htmlize 9b49540 133/134: Replace cl with cl-lib


From: ELPA Syncer
Subject: [nongnu] elpa/htmlize 9b49540 133/134: Replace cl with cl-lib
Date: Sat, 7 Aug 2021 09:17:22 -0400 (EDT)

branch: elpa/htmlize
commit 9b49540fd624961893b98ad4b2a07bb236c955d0
Author: Alex Branham <alex.branham@gmail.com>
Commit: Hrvoje Nikšić <hniksic@gmail.com>

    Replace cl with cl-lib
---
 htmlize.el | 74 +++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/htmlize.el b/htmlize.el
index 89caf3b..a3738c2 100644
--- a/htmlize.el
+++ b/htmlize.el
@@ -82,7 +82,7 @@
 
 ;;; Code:
 
-(require 'cl)
+(require 'cl-lib)
 (eval-when-compile
   (defvar font-lock-auto-fontify)
   (defvar font-lock-support-mode)
@@ -550,7 +550,7 @@ list."
     (when (plist-get imgprops :file)
       (let ((location (plist-get (cdr (find-image (list imgprops))) :file)))
         (when location
-          (setq imgprops (plist-put (copy-list imgprops) :file location)))))
+          (setq imgprops (plist-put (cl-copy-list imgprops) :file location)))))
     (if htmlize-force-inline-images
         (let ((location (plist-get imgprops :file))
               data)
@@ -597,9 +597,9 @@ list."
 (put-text-property 0 (length htmlize-ellipsis) 'htmlize-ellipsis t 
htmlize-ellipsis)
 
 (defun htmlize-match-inv-spec (inv)
-  (member* inv buffer-invisibility-spec
-           :key (lambda (i)
-                  (if (symbolp i) i (car i)))))
+  (cl-member inv buffer-invisibility-spec
+             :key (lambda (i)
+                    (if (symbolp i) i (car i)))))
 
 (defun htmlize-decode-invisibility-spec (invisible)
   ;; Return t, nil, or `ellipsis', depending on how invisible text should be 
inserted.
@@ -619,7 +619,7 @@ list."
     ;; CDR, replace the invisible text with an ellipsis.
     (let ((match (if (symbolp invisible)
                      (htmlize-match-inv-spec invisible)
-                   (some #'htmlize-match-inv-spec invisible))))
+                   (cl-some #'htmlize-match-inv-spec invisible))))
       (cond ((null match) t)
             ((cdr-safe (car match)) 'ellipsis)
             (t nil)))))
@@ -643,7 +643,7 @@ list."
     (if additions
         (let ((textlist nil)
               (strpos 0))
-          (dolist (add (stable-sort additions #'< :key #'car))
+          (dolist (add (cl-stable-sort additions #'< :key #'car))
             (let ((addpos (car add))
                   (addtext (cdr add)))
               (push (substring text strpos addpos) textlist)
@@ -988,7 +988,7 @@ If no rgb.txt file is found, return nil."
 ;; type `htmlize-fstruct', while the term "face" is reserved for Emacs
 ;; faces.
 
-(defstruct htmlize-fstruct
+(cl-defstruct htmlize-fstruct
   foreground                           ; foreground color, #rrggbb
   background                           ; background color, #rrggbb
   size                                 ; size
@@ -1002,7 +1002,7 @@ If no rgb.txt file is found, return nil."
 
 (defun htmlize-face-set-from-keyword-attr (fstruct attr value)
   ;; For ATTR and VALUE, set the equivalent value in FSTRUCT.
-  (case attr
+  (cl-case attr
     (:foreground
      (setf (htmlize-fstruct-foreground fstruct) (htmlize-color-to-rgb value)))
     (:background
@@ -1035,7 +1035,7 @@ If no rgb.txt file is found, return nil."
     (while head
       (let ((inherit (face-attribute (car head) :inherit)))
         (cond ((listp inherit)
-               (setcdr tail (copy-list inherit))
+               (setcdr tail (cl-copy-list inherit))
                (setq tail (last tail)))
               ((eq inherit 'unspecified))
               (t
@@ -1043,11 +1043,11 @@ If no rgb.txt file is found, return nil."
                (setq tail (cdr tail)))))
       (pop head))
     (let ((size-list
-           (loop
+           (cl-loop
             for f in face-list
             for h = (face-attribute f :height)
             collect (if (eq h 'unspecified) nil h))))
-      (reduce 'htmlize-merge-size (cons nil size-list)))))
+      (cl-reduce 'htmlize-merge-size (cons nil size-list)))))
 
 (defun htmlize-face-css-name (face)
   ;; Generate the css-name property for the given face.  Emacs places
@@ -1115,10 +1115,10 @@ If no rgb.txt file is found, return nil."
   ;;   ...)
   ;; for the given list of boolean attributes.
   (cons 'progn
-       (loop for attr in attr-list
-             for attr-sym = (intern (format "htmlize-fstruct-%s" attr))
-             collect `(when (,attr-sym ,source)
-                         (setf (,attr-sym ,dest) (,attr-sym ,source))))))
+       (cl-loop for attr in attr-list
+                for attr-sym = (intern (format "htmlize-fstruct-%s" attr))
+                collect `(when (,attr-sym ,source)
+                            (setf (,attr-sym ,dest) (,attr-sym ,source))))))
 
 (defun htmlize-merge-size (merged next)
   ;; Calculate the size of the merge of MERGED and NEXT.
@@ -1146,8 +1146,8 @@ If no rgb.txt file is found, return nil."
         ;; return it.
         (car fstruct-list))
        (t
-        (reduce #'htmlize-merge-two-faces
-                (cons (make-htmlize-fstruct) fstruct-list)))))
+        (cl-reduce #'htmlize-merge-two-faces
+                   (cons (make-htmlize-fstruct) fstruct-list)))))
 
 ;; GNU Emacs 20+ supports attribute lists in `face' properties.  For
 ;; example, you can use `(:foreground "red" :weight bold)' as an
@@ -1263,14 +1263,14 @@ overlays that specify `face'."
       (while (< pos (point-max))
         (setq face-prop (get-text-property pos 'face)
               next (or (next-single-property-change pos 'face) (point-max)))
-        (setq faces (nunion (htmlize-decode-face-prop face-prop)
-                            faces :test 'equal))
+        (setq faces (cl-nunion (htmlize-decode-face-prop face-prop)
+                               faces :test 'equal))
         (setq pos next)))
     ;; Faces used by overlays.
     (dolist (overlay (overlays-in (point-min) (point-max)))
       (let ((face-prop (overlay-get overlay 'face)))
-        (setq faces (nunion (htmlize-decode-face-prop face-prop)
-                            faces :test 'equal))))
+        (setq faces (cl-nunion (htmlize-decode-face-prop face-prop)
+                               faces :test 'equal))))
     faces))
 
 (if (>= emacs-major-version 25)
@@ -1280,14 +1280,14 @@ overlays that specify `face'."
   (defun htmlize-sorted-overlays-at (pos)
     ;; Like OVERLAYS-AT with the SORTED argument, for older Emacsen.
     (let ((overlays (overlays-at pos)))
-      (setq overlays (sort* overlays #'<
-                            :key (lambda (o)
-                                   (- (overlay-end o) (overlay-start o)))))
+      (setq overlays (cl-sort overlays #'<
+                              :key (lambda (o)
+                                     (- (overlay-end o) (overlay-start o)))))
       (setq overlays
-            (stable-sort overlays #'<
-                         :key (lambda (o)
-                                (let ((prio (overlay-get o 'priority)))
-                                  (if (numberp prio) prio 0)))))
+            (cl-stable-sort overlays #'<
+                            :key (lambda (o)
+                                   (let ((prio (overlay-get o 'priority)))
+                                     (if (numberp prio) prio 0)))))
       (nreverse overlays))))
 
 
@@ -1308,9 +1308,9 @@ overlays that specify `face'."
     ;; Faces from overlays.
     (let ((overlays
            ;; Collect overlays at point that specify `face'.
-           (delete-if-not (lambda (o)
-                            (overlay-get o 'face))
-                          (nreverse (htmlize-sorted-overlays-at (point)))))
+           (cl-delete-if-not (lambda (o)
+                               (overlay-get o 'face))
+                             (nreverse (htmlize-sorted-overlays-at (point)))))
           list face-prop)
       (dolist (overlay overlays)
         (setq face-prop (overlay-get overlay 'face)
@@ -1422,9 +1422,9 @@ it's called with the same value of KEY.  All other times, 
the cached
                     (htmlize-css-specs (gethash 'default face-map))
                     "\n        ")
          "\n      }\n")
-  (dolist (face (sort* (copy-list buffer-faces) #'string-lessp
-                      :key (lambda (f)
-                             (htmlize-fstruct-css-name (gethash f face-map)))))
+  (dolist (face (cl-sort (cl-copy-list buffer-faces) #'string-lessp
+                        :key (lambda (f)
+                               (htmlize-fstruct-css-name (gethash f 
face-map)))))
     (let* ((fstruct (gethash face face-map))
           (cleaned-up-face-name
            (let ((s
@@ -1627,7 +1627,7 @@ it's called with the same value of KEY.  All other times, 
the cached
                 ;; happens in invisible regions).
                 (when (> (length text) 0)
                   ;; Open the new markup if necessary and insert the text.
-                  (when (not (equalp fstruct-list last-fstruct-list))
+                  (when (not (cl-equalp fstruct-list last-fstruct-list))
                     (funcall close-markup)
                     (setq last-fstruct-list fstruct-list
                           close-markup (funcall text-markup fstruct-list 
htmlbuf)))
@@ -1876,7 +1876,7 @@ corresponding source file."
 (provide 'htmlize)
 
 ;; Local Variables:
-;; byte-compile-warnings: (not cl-functions unresolved obsolete)
+;; byte-compile-warnings: (not unresolved obsolete)
 ;; End:
 
 ;;; htmlize.el ends here



reply via email to

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