diff options
-rw-r--r-- | emms-playlist-limit.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/emms-playlist-limit.el b/emms-playlist-limit.el index 429d5b2..578098b 100644 --- a/emms-playlist-limit.el +++ b/emms-playlist-limit.el @@ -32,9 +32,9 @@ (interactive "p") (if (and arg (> arg 0)) (add-hook 'emms-playlist-source-inserted-hook - 'emms-playlist-limit-update-tracks) + 'emms-playlist-limit-insert) (remove-hook 'emms-playlist-source-inserted-hook - 'emms-playlist-limit-update-tracks))) + 'emms-playlist-limit-insert))) (defmacro define-emms-playlist-limit (attribute) "Macro for defining emms playlist limit functions." @@ -80,13 +80,22 @@ (defvar emms-playlist-limit-tracks nil "All tracks in playlist buffer.") -(defun emms-playlist-limit-update-tracks () - "Update `emms-playlist-limit-tracks'." +(defun emms-playlist-limit-insert () + "Run in `emms-playlist-source-inserted-hook'." (setq emms-playlist-limit-tracks (append emms-playlist-limit-tracks (emms-playlist-tracks-in-region (point-min) (point-max))))) +;; FIXME: When user deletes some tracks, `emms-playlist-limit-tracks' +;; should be updated. +;; (defun emms-playlist-limit-clear () +;; "Run in `emms-playlist-cleared-hook'." +;; (setq emms-playlist-limit-tracks +;; (append emms-playlist-limit-tracks +;; (emms-playlist-tracks-in-region +;; (point-min) (point-max))))) + (defun emms-playlist-limit-do (name value) "Limit by NAME with VALUE. e.g., |