From ac83325b1d302a96cac096c527ef096ce168b20c Mon Sep 17 00:00:00 2001 From: Mark Oteiza Date: Sat, 3 Dec 2016 13:05:39 -0500 Subject: [PATCH] Clean up uses of cl-foo in image-dired Both instances here are just emulating cl-find-if. * lisp/image-dired.el: Use cl-lib at compile time. (image-dired-dired-toggle-marked-thumbs): Don't need let* at the top. Replace the cl-foo instances with equivalent cl-loops. --- lisp/image-dired.el | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lisp/image-dired.el b/lisp/image-dired.el index 67fbc029236..cf7ef53310f 100644 --- a/lisp/image-dired.el +++ b/lisp/image-dired.el @@ -156,9 +156,8 @@ (require 'format-spec) (require 'widget) -(require 'cl-lib) - (eval-when-compile + (require 'cl-lib) (require 'wid-edit)) (defgroup image-dired nil @@ -656,25 +655,22 @@ of the marked files. If ARG is an integer, use the next ARG (or previous -ARG, if ARG<0) files." (interactive "P") (dired-map-over-marks - (let* ((image-pos (dired-move-to-filename)) - (image-file (dired-get-filename nil t)) - thumb-file - overlay) + (let ((image-pos (dired-move-to-filename)) + (image-file (dired-get-filename nil t)) + thumb-file + overlay) (when (and image-file (string-match-p (image-file-name-regexp) image-file)) (setq thumb-file (image-dired-get-thumbnail-image image-file)) ;; If image is not already added, then add it. - (let* ((cur-ovs (overlays-in (point) (1+ (point)))) - (thumb-ov (car (cl-remove-if-not - (lambda (ov) (overlay-get ov 'thumb-file)) - cur-ovs)))) + (let ((thumb-ov (cl-loop for ov in (overlays-in (point) (1+ (point))) + if (overlay-get ov 'thumb-file) return ov))) (if thumb-ov (delete-overlay thumb-ov) (put-image thumb-file image-pos) (setq overlay - (cl-loop for o in (overlays-in (point) (1+ (point))) - when (overlay-get o 'put-image) collect o into ov - finally return (car ov))) + (cl-loop for ov in (overlays-in (point) (1+ (point))) + if (overlay-get ov 'put-image) return ov)) (overlay-put overlay 'image-file image-file) (overlay-put overlay 'thumb-file thumb-file))))) arg ; Show or hide image on ARG next files. -- 2.39.2