(let ((dir (file-name-directory (cdr (assq 'file info)))))
;; (debug)
(setq pred
- (lambda (info)
- (and (funcall pred info)
- (equal dir (file-name-directory
- (cdr (assq 'file info)))))))
+ ;; We want the closure to capture the current
+ ;; value of `pred' and not a reference to the
+ ;; variable itself.
+ (let ((oldpred pred))
+ (lambda (info)
+ (and (funcall oldpred info)
+ (equal dir (file-name-directory
+ (cdr (assq 'file info))))))))
(if-let* ((covers '(".folder.png" "cover.jpg" "folder.jpg"))
(cover (cl-loop for file in (directory-files (mpc-file-local-copy dir))
if (member (downcase file) covers)
(when (and (null val) (eq tag 'Title))
(setq val (cdr (assq 'file info))))
(setq pred
- (lambda (info)
- (and (funcall pred info)
- (equal val (cdr (assq ',tag info))))))
+ ;; We want the closure to capture the current
+ ;; value of `pred' and not a reference to the
+ ;; variable itself.
+ (let ((oldpred pred))
+ (lambda (info)
+ (and (funcall oldpred info)
+ (equal val (cdr (assq tag info)))))))
(cond
((not (and (eq tag 'Date) (stringp val))) val)
;; For "date", only keep the year!