aboutsummaryrefslogtreecommitdiff
path: root/emms-player-mpd.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-01-30 06:39:00 +0000
committerMichael Olson <mwolson@gnu.org>2008-01-30 06:39:00 +0000
commit639b1fed1ceff6cbc64f2e5724f82d31b271d0ef (patch)
treed382f8f4bdefde68405f1b445f867a32ebbdefd5 /emms-player-mpd.el
parent87d38abc15487493da80afc3ecf92e32ed815ccd (diff)
emms-player-mpd (clear): Use current buffer if it is an EMMS playlist buffer.
darcs-hash:20080130063956-1bfb2-dfa5407041c7f4c4ab5622636c405901bd480bc2.gz
Diffstat (limited to 'emms-player-mpd.el')
-rw-r--r--emms-player-mpd.el13
1 files 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))