diff options
author | William Xu <william.xwl@gmail.com> | 2007-10-08 07:09:00 +0000 |
---|---|---|
committer | William Xu <william.xwl@gmail.com> | 2007-10-08 07:09:00 +0000 |
commit | 9a84f872262624868c41c7dda9b907026f68304d (patch) | |
tree | d7d0109c638785b9bd3ee0abeed518d04f8a37fb | |
parent | 9a5aa42b2720a37eb7113453130e580ee4a3fbac (diff) |
emms-playlist-limit.el: Fix typos and minor updates.
darcs-hash:20071008070917-cfa61-fbc445a6004e8c20ed9e516ab5cbc157e21d95ed.gz
-rw-r--r-- | emms-playlist-limit.el | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/emms-playlist-limit.el b/emms-playlist-limit.el index 6b67986..a8c40f8 100644 --- a/emms-playlist-limit.el +++ b/emms-playlist-limit.el @@ -1,4 +1,4 @@ -;;; emms-playlist-limit.el --- limit playlist by various info +;;; emms-playlist-limit.el --- Limit playlist by various info ;; Copyright (C) 2007 William Xu @@ -24,7 +24,7 @@ (require 'emms-playlist-mode) -;;; User Interfacs +;;; User Interfaces (defvar emms-playlist-limit-enabled-p nil "If non-nil, emms playlist limit is enabled.") @@ -112,14 +112,15 @@ ;;; Low Level Functions (defvar emms-playlist-limit-tracks nil - "All tracks in playlist buffer.") + "All tracks in playlist buffer(unlimited).") (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))))) + (with-current-emms-playlist + (emms-playlist-ensure-playlist-buffer) + (setq emms-playlist-limit-tracks + (emms-with-widened-buffer + (emms-playlist-tracks-in-region (point-min) (point-max)))))) ;; FIXME: When user deletes some tracks, `emms-playlist-limit-tracks' ;; should be updated. @@ -139,27 +140,26 @@ When NAME is nil, show all tracks again. See `emms-info-mp3find-arguments' for possible options for NAME." (with-current-emms-playlist - (save-excursion - (emms-playlist-ensure-playlist-buffer) - (let ((curr (emms-playlist-current-selected-track)) - (tracks - (emms-playlist-tracks-in-region (point-min) (point-max)))) - (erase-buffer) - (run-hooks 'emms-playlist-cleared-hook) - (if name - (mapc (lambda (track) - (let ((track-value (emms-track-get track name))) - (when (and track-value (string-match value track-value)) - (emms-playlist-insert-track track)))) - tracks) + (emms-playlist-ensure-playlist-buffer) + (let ((curr (emms-playlist-current-selected-track)) + (tracks (emms-playlist-tracks-in-region (point-min) (point-max)))) + (erase-buffer) + (run-hooks 'emms-playlist-cleared-hook) + (if name (mapc (lambda (track) - (emms-playlist-insert-track track)) - emms-playlist-limit-tracks)) - (let ((pos (text-property-any (point-min) (point-max) - 'emms-track curr))) - (if pos - (emms-playlist-select pos) - (emms-playlist-first))))))) + (let ((track-value (emms-track-get track name))) + (when (and track-value (string-match value track-value)) + (emms-playlist-insert-track track)))) + tracks) + (mapc (lambda (track) + (emms-playlist-insert-track track)) + emms-playlist-limit-tracks)) + (let ((pos (text-property-any (point-min) (point-max) + 'emms-track curr))) + (if pos + (emms-playlist-select pos) + (emms-playlist-first))) + (emms-playlist-mode-center-current)))) (provide 'emms-playlist-limit) |