diff options
author | Michael Olson <mwolson@gnu.org> | 2006-05-30 14:42:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-05-30 14:42:00 +0000 |
commit | 0ff8ab2087e548609e0439cc345e45a8915be064 (patch) | |
tree | e4519ad6ca6685b441344ac03ddec0def35c2036 | |
parent | a16b4f99aca1581ef60cb7845a706f7c4d7e8e5d (diff) |
emms-streams: When the user wants emms-streams to play the selected stream instead of add it, create our own playlist buffer. When quitting, if we own the current playlist buffer, kill it.
darcs-hash:20060530144243-1bfb2-c740d27615c65016b8516ee90d4db07b7e08fb4a.gz
-rw-r--r-- | emms-streams.el | 14 | ||||
-rw-r--r-- | emms.el | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/emms-streams.el b/emms-streams.el index 7371324..b50bc18 100644 --- a/emms-streams.el +++ b/emms-streams.el @@ -83,6 +83,11 @@ needed info.") (defvar emms-stream-last-stream nil "The last stream added/played by EMMS.") +(defvar emms-stream-owns-buffer nil + "Indicate whether the current EMMS playlist buffer is owned by +emms-streams.") +(make-variable-buffer-local 'emms-stream-owns-buffer) + ;; Format: (("descriptive name" url feed-number type)) ;; type could be either url or playlist. If url, then it represents a ;; direct IP, otherwite it's a stream playlist @@ -168,6 +173,10 @@ needed info.") (kill-buffer (get-buffer-create emms-stream-buffer-name)) (set-buffer (get-buffer-create emms-stream-buffer-name)) (erase-buffer) + (when (string= emms-stream-default-action "play") + (save-excursion + (with-current-buffer (setq emms-playlist-buffer (emms-playlist-new)) + (setq emms-stream-owns-buffer t)))) (emms-stream-mode) (switch-to-buffer emms-stream-buffer-name)) @@ -483,6 +492,11 @@ Don't forget to save your modifications !" (defun emms-stream-quit () (interactive) + (save-excursion + (when (and (buffer-live-p emms-playlist-buffer) + (with-current-emms-playlist emms-stream-owns-buffer)) + (emms-stop) + (emms-playlist-current-kill))) (kill-this-buffer) (run-hooks 'emms-stream-quit-hook)) @@ -558,7 +558,7 @@ so on." "Kill the current EMMS playlist buffer and switch to the next one." (interactive) (let ((new (cadr (emms-playlist-buffer-list)))) - (if new + (if (buffer-live-p new) (progn (when (buffer-live-p emms-playlist-buffer) (kill-buffer emms-playlist-buffer)) |