From: Mark Oteiza Date: Sat, 3 Dec 2016 18:05:39 +0000 (-0500) Subject: Clean up uses of cl-foo in image-dired X-Git-Tag: emacs-26.0.90~1217 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ac83325b1d302a96cac096c527ef096ce168b20c;p=emacs.git 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. --- 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.