diff options
| author | Yoni Rabkin <yoni@rabkins.net> | 2021-04-27 14:22:20 -0400 | 
|---|---|---|
| committer | Yoni Rabkin <yoni@rabkins.net> | 2021-04-27 14:22:20 -0400 | 
| commit | 7263ea6f64b1bbf4de89cac6501be2e5d8e3fe9c (patch) | |
| tree | 125878391cf880337ca4f044875ae97d46c1a775 /emms-browser.el | |
| parent | 75563821de35dacceb7bb118ee031790d0225583 (diff) | |
*.el: Misc improvements and fixes w.r.t lexical binding
* jack.el: Enable lexical-binding.
* emms-playlist-limit.el (emms-playlist-limit--limit-playlist):
Use a closure.
* emms-player-mpg321-remote.el (emms-player-ignore-stop): Declare,
so as to fix a mis-compilation in `emms-player-mpg321-remote-notify-emms`.
* emms-last-played.el (emms-last-played-format-date): Use lexical binding.
* emms-browser.el (emms-browser-filter-only-dir)
(emms-browser-filter-only-type, emms-browser-filter-only-recent):
Return a closure.
Patch by Stefan Monnier
Diffstat (limited to 'emms-browser.el')
| -rw-r--r-- | emms-browser.el | 33 | 
1 files changed, 17 insertions, 16 deletions
diff --git a/emms-browser.el b/emms-browser.el index 5f97104..1ae727b 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -2058,30 +2058,31 @@ This does not refresh the current buffer."    (interactive)    (emms-browser-next-filter t)) -(defun emms-browser-filter-only-dir (path) -  "Generate a function which checks if a track is in path. -If the track is not in path, return t." -  `(lambda (track) -     (not (string-match ,(concat "^" (expand-file-name path)) -                        (emms-track-get track 'name))))) +(defun emms-browser-filter-only-dir (dirname) +  "Generate a function which checks if a track is in DIRNAME. +If the track is not in DIRNAME, return t." +  (let ((re (concat "^" (expand-file-name dirname)))) +    (lambda (track) +      (not (string-match re (emms-track-get track 'name))))))  (defun emms-browser-filter-only-type (type)    "Generate a function which checks a track's type.  If the track is not of TYPE, return t." -  `(lambda (track) -     (not (eq (quote ,type) (emms-track-get track 'type))))) +  (lambda (track) +    (not (eq type (emms-track-get track 'type)))))  ;; seconds in a day (* 60 60 24) = 86400  (defun emms-browser-filter-only-recent (days)    "Show only tracks played within the last number of DAYS." -  `(lambda (track) -     (let ((min-date (time-subtract -                      (current-time) -                      (seconds-to-time (* ,days 86400)))) -           last-played) -       (not (and (setq last-played -                       (emms-track-get track 'last-played nil)) -                 (time-less-p min-date last-played)))))) +  (lambda (track) +    (let ((min-date (time-subtract +                     (current-time) +                     (seconds-to-time (* days 86400)))) +          last-played) +      (not (and (setq last-played +                      (emms-track-get track 'last-played nil)) +                (time-less-p min-date last-played)))))) +  ;; TODO: Add function to clear the cache from thumbnails that have no associated  ;; cover folders.  This is especially useful in case the music library path  | 
