If there is no alive process, don't try to send commands but store then into the queue
This commit is contained in:
parent
cd4eabe65f
commit
18d96b8a8f
1 changed files with 7 additions and 6 deletions
13
empc.el
13
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)
|
(defun empc-queue-push (object command closure fn)
|
||||||
"Enqueue '(COMMAND . (CLOSURE . FN)) to the queue of OBJECT.
|
"Enqueue '(COMMAND . (CLOSURE . FN)) to the queue of OBJECT.
|
||||||
Leave the idle state beforehand if necessary."
|
Leave the idle state beforehand if necessary."
|
||||||
(if (empc-queue object)
|
(when (empc-process object)
|
||||||
(when (string= (empc-queue-head-command object) "idle\n")
|
(if (empc-queue object)
|
||||||
(setcar (caaar object) "noidle\n")
|
(when (string= (empc-queue-head-command object) "idle\n")
|
||||||
(process-send-string (empc-process object) "noidle\n"))
|
(setcar (caaar object) "noidle\n")
|
||||||
(when command
|
(process-send-string (empc-process object) "noidle\n"))
|
||||||
(process-send-string (empc-process object) command)))
|
(when command
|
||||||
|
(process-send-string (empc-process object) command))))
|
||||||
(setcar (car object)
|
(setcar (car object)
|
||||||
(nconc (empc-queue object)
|
(nconc (empc-queue object)
|
||||||
(list (cons command (cons closure fn))))))
|
(list (cons command (cons closure fn))))))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue