From 076ea9d295de15d5b8085ecc69a88f5b3c5f0ce5 Mon Sep 17 00:00:00 2001 From: Renaud Casenave-Pere Date: Fri, 14 Jun 2013 15:36:42 +0900 Subject: [PATCH] When mpd is paused or stopped, kill the streaming process --- empc.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/empc.el b/empc.el index 0f9dadb..5011931 100644 --- a/empc.el +++ b/empc.el @@ -443,7 +443,8 @@ According to what is in the diff, several actions can be performed: (setq notify '(lambda () (when (empc-playlist-songs empc-object) (empc-echo-song))))) (empc-stream-start)) - (setq notify '(lambda () (empc-echo-notify (symbol-name (plist-get status-diff :state))))))) + (setq notify '(lambda () (empc-echo-notify (symbol-name (plist-get status-diff :state))))) + (empc-stream-stop))) (when (or (plist-member status-diff :repeat) (plist-member status-diff :random) (plist-member status-diff :single) (plist-member status-diff :consume) (plist-member status-diff :xfade)) @@ -806,6 +807,12 @@ If the stream process is killed for whatever the reason, pause mpd if possible." (set-process-sentinel stream-process 'empc-stream-process-sentinel) (setq empc-stream-process stream-process)))) +(defun empc-stream-stop() + "Stop the stream process." + (let ((stream-process (empc-stream empc-object))) + (when stream-process + (delete-process stream-process)))) + (defun empc-playlist-mode () "empc playlist mode." (use-local-map empc-playlist-map)