diff options
author | Michael Olson <mwolson@gnu.org> | 2006-05-25 01:42:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-05-25 01:42:00 +0000 |
commit | 2bf79de2c33f1f35bafb5b8db8b75af3253b45b8 (patch) | |
tree | f6662c1c17964ea1e294afc38ed392a6498fd46e | |
parent | c08efad3544fa9f924dc2d16cd26fb67f5f09804 (diff) |
emms-player-mpd: Use more robust method of detecting whether we need to force-feed MusicPD our playlist.
darcs-hash:20060525014253-1bfb2-8dc73d1dcd1c3e70703f4a377cfd18d29725c378.gz
-rw-r--r-- | emms-player-mpd.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el index fe4cdcf..6756bfb 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -307,6 +307,8 @@ that's how we tell where the answer ends." (defvar emms-player-mpd-queue nil) (defvar emms-player-mpd-playlist-id nil) +(make-variable-buffer-local 'emms-player-mpd-playlist-id) + (defvar emms-player-mpd-current-song nil) (defvar emms-player-mpd-status-timer nil) @@ -590,6 +592,7 @@ errors." (let ((emms-playlist-buffer buffer)) (with-current-emms-playlist (setq emms-player-mpd-playlist-id id) + (set-buffer-modified-p nil) (if song (progn (goto-line (1+ (string-to-number song))) @@ -818,6 +821,7 @@ playlist." (let ((emms-playlist-buffer buffer)) (with-current-emms-playlist (setq emms-player-mpd-playlist-id id) + (set-buffer-modified-p nil) (emms-player-mpd-play (1- (emms-line-number-at-pos emms-playlist-selected-marker))))))) @@ -829,11 +833,13 @@ This is called if `emms-player-mpd-sync-playlist' is non-nil." (emms-player-mpd-get-playlist-id nil (lambda (closure id) - (if (and (stringp emms-player-mpd-playlist-id) - (string= emms-player-mpd-playlist-id id)) - (emms-player-mpd-start-and-sync-1 emms-playlist-buffer id) - (emms-player-mpd-sync-from-emms - #'emms-player-mpd-start-and-sync-1))))) + (let ((buf-id (with-current-emms-playlist emms-player-mpd-playlist-id))) + (if (and (not (buffer-modified-p emms-playlist-buffer)) + (stringp buf-id) + (string= buf-id id)) + (emms-player-mpd-start-and-sync-1 emms-playlist-buffer id) + (emms-player-mpd-sync-from-emms + #'emms-player-mpd-start-and-sync-1)))))) (defun emms-player-mpd-connect-1 (closure info) (setq emms-player-mpd-current-song nil) @@ -881,7 +887,6 @@ from other functions." (setq emms-player-mpd-status-timer nil) (setq emms-player-mpd-current-song nil) (unless no-stop - (setq emms-player-mpd-playlist-id nil) (let ((emms-player-stopped-p t)) (emms-player-stopped)))) |