From 18d96b8a8ff0ace755bcde15c974f13ced7aefc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Renaud=20Casenave-P=C3=A9r=C3=A9?= Date: Sat, 27 Aug 2011 22:07:59 +0900 Subject: [PATCH] If there is no alive process, don't try to send commands but store then into the queue --- empc.el | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/empc.el b/empc.el index 95dd37a..101d642 100644 --- a/empc.el +++ b/empc.el @@ -104,12 +104,13 @@ playlist is a vector of song ids, keeping the order of the songs (defun empc-queue-push (object command closure fn) "Enqueue '(COMMAND . (CLOSURE . FN)) to the queue of OBJECT. Leave the idle state beforehand if necessary." - (if (empc-queue object) - (when (string= (empc-queue-head-command object) "idle\n") - (setcar (caaar object) "noidle\n") - (process-send-string (empc-process object) "noidle\n")) - (when command - (process-send-string (empc-process object) command))) + (when (empc-process object) + (if (empc-queue object) + (when (string= (empc-queue-head-command object) "idle\n") + (setcar (caaar object) "noidle\n") + (process-send-string (empc-process object) "noidle\n")) + (when command + (process-send-string (empc-process object) command)))) (setcar (car object) (nconc (empc-queue object) (list (cons command (cons closure fn))))))