From 639b1fed1ceff6cbc64f2e5724f82d31b271d0ef Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Wed, 30 Jan 2008 06:39:00 +0000 Subject: emms-player-mpd (clear): Use current buffer if it is an EMMS playlist buffer. darcs-hash:20080130063956-1bfb2-dfa5407041c7f4c4ab5622636c405901bd480bc2.gz --- emms-player-mpd.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/emms-player-mpd.el b/emms-player-mpd.el index b1a0d04..f291668 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -630,7 +630,14 @@ errors." (defun emms-player-mpd-sync-from-mpd (&optional closure callback) "Synchronize the EMMS playlist with the contents of the current -MusicPD playlist." +MusicPD playlist. Namely, clear the EMMS playlist buffer and add +tracks to it that are present in the MusicPD playlist. + +If the current buffer is an EMMS playlist buffer, make it the +main EMMS playlist buffer." + (when (and emms-playlist-buffer-p + (not (eq (current-buffer) emms-playlist-buffer))) + (emms-playlist-set-playlist-buffer (current-buffer))) (with-current-emms-playlist (emms-player-mpd-get-tracks (cons emms-playlist-buffer (cons callback closure)) @@ -690,8 +697,10 @@ info from MusicPD." (emms-replace-regexp-in-string "\\\\" "\\\\\\\\" file)) "\"")) +;;;###autoload (defun emms-player-mpd-clear () - "Clear the playlist." + "Clear the MusicPD playlist." + (interactive) (when emms-player-mpd-status-timer (emms-cancel-timer emms-player-mpd-status-timer) (setq emms-player-mpd-status-timer nil)) -- cgit v1.2.3