1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

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.
This commit is contained in:
Mark Oteiza 2016-12-03 13:05:39 -05:00
parent a486fabb41
commit ac83325b1d

View file

@ -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.