aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoni Rabkin <yoni@rabkins.net>2021-04-27 14:22:20 -0400
committerYoni Rabkin <yoni@rabkins.net>2021-04-27 14:22:20 -0400
commit7263ea6f64b1bbf4de89cac6501be2e5d8e3fe9c (patch)
tree125878391cf880337ca4f044875ae97d46c1a775
parent75563821de35dacceb7bb118ee031790d0225583 (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
-rw-r--r--emms-browser.el33
-rw-r--r--emms-cache.el2
-rw-r--r--emms-last-played.el10
-rw-r--r--emms-player-mpg321-remote.el3
-rw-r--r--emms-playlist-limit.el6
-rw-r--r--jack.el2
6 files changed, 28 insertions, 28 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
diff --git a/emms-cache.el b/emms-cache.el
index 9b5deb8..766af8c 100644
--- a/emms-cache.el
+++ b/emms-cache.el
@@ -105,7 +105,7 @@ This is used to cache over emacs sessions.")
(emms-cache-disable)
(emms-cache-enable)))
-(defsubst emms-cache-dirty (&rest ignored)
+(defsubst emms-cache-dirty (&rest _ignored)
"Mark the cache as dirty."
(setq emms-cache-dirty t))
diff --git a/emms-last-played.el b/emms-last-played.el
index 33f1c83..679e98a 100644
--- a/emms-last-played.el
+++ b/emms-last-played.el
@@ -1,6 +1,6 @@
;;; emms-last-played.el --- Support for last-played-time of a track -*- lexical-binding: t; -*-
-;; Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2021 Free Software Foundation, Inc.
;; Author: Lucas Bonnet <lucas@rincevent.net>
;; Keywords: emms, mp3, mpeg, multimedia
@@ -99,7 +99,7 @@ If non-existent, it is set to 1."
(* (- (string-to-number days) 1) 3600 24))))
(defun emms-last-played-format-date (messy-date)
- "Format the messy-date according to emms-last-played-format-alist.
+ "Format the messy-date according to `emms-last-played-format-alist'.
Returns \" ? \" if there's bad input or if an other error occurs.
Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
(condition-case ()
@@ -109,14 +109,14 @@ Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
(my-format "%b %d '%y"))
(let* ((difference (- now messy-date))
(templist emms-last-played-format-alist)
- (top (eval (caar templist))))
+ (top (eval (caar templist) t)))
(while (if (numberp top) (< top difference) (not top))
(progn
(setq templist (cdr templist))
- (setq top (eval (caar templist)))))
+ (setq top (eval (caar templist) t))))
(if (stringp (cdr (car templist)))
(setq my-format (cdr (car templist)))))
- (format-time-string (eval my-format) (seconds-to-time messy-date)))
+ (format-time-string (eval my-format t) (seconds-to-time messy-date)))
(error "Never.")))
(provide 'emms-last-played)
diff --git a/emms-player-mpg321-remote.el b/emms-player-mpg321-remote.el
index 5ed942b..43f2d7b 100644
--- a/emms-player-mpg321-remote.el
+++ b/emms-player-mpg321-remote.el
@@ -170,13 +170,14 @@ If the remote process is not running, launch it."
(emms-player-mpg321-remote-start-process))
(emms-player-mpg321-remote-play-track track))
+(defvar emms-player-ignore-stop)
+
(defun emms-player-mpg321-remote-notify-emms (&optional user-action)
"Tell emms that the current song has finished.
If USER-ACTION, set `emms-player-mpg321-remote-ignore-stop' so that we
ignore the next message from mpg321."
(if user-action
(let ((emms-player-ignore-stop t))
- (ignore emms-player-ignore-stop)
;; so we ignore the next stop message
(setq emms-player-mpg321-remote-ignore-stop
(1+ emms-player-mpg321-remote-ignore-stop))
diff --git a/emms-playlist-limit.el b/emms-playlist-limit.el
index ed6c8b9..8f274c8 100644
--- a/emms-playlist-limit.el
+++ b/emms-playlist-limit.el
@@ -183,12 +183,10 @@ is non-nil."
(emms-replace-regexp-in-string "info-" "" (symbol-name type)) regexp))))
(emms-playlist-limit--derive-playlist
playlist
- `(lambda (track) (let ((field (emms-playlist-limit-track-get track (quote ,type))))
- (and field (string-match ,regexp field))))
+ (lambda (track) (let ((field (emms-playlist-limit-track-get track type)))
+ (and field (string-match regexp field))))
bufname)))
-
-
(defun emms-playlist-limit-do (type regexp)
"Switch to a derived playlist containing the tracks with TYPE matching REGEXP.
e.g.,
diff --git a/jack.el b/jack.el
index 4d17526..cbef8e1 100644
--- a/jack.el
+++ b/jack.el
@@ -1,4 +1,4 @@
-;;; jack.el --- Jack Audio Connection Kit support
+;;; jack.el --- Jack Audio Connection Kit support -*- lexical-binding: t; -*-
;; Copyright (C) 2005-2021 Free Software Foundation, Inc.