Don't try to send a command if we know it isn't available

This commit is contained in:
Renaud Casenave-Péré 2011-08-27 22:07:22 +09:00
parent 48a87e927c
commit cd4eabe65f

11
empc.el
View file

@ -670,10 +670,13 @@ Send the password or retrieve available commands."
"Send COMMAND to the mpd server.
CLOSURE will be called on the parsed response."
(empc-ensure-connected)
(unless (string= (substring command -1) "\n")
(setq command (concat command "\n")))
(empc-queue-push empc-object command closure
(if handler handler 'empc-handle-response)))
(if (memq command (empc-commands empc-object))
(progn
(unless (string= (substring command -1) "\n")
(setq command (concat command "\n")))
(empc-queue-push empc-object command closure
(if handler handler 'empc-handle-response)))
(message "empc: Command `%s' is not available (not supported by the server or forbidden to you)" command))
(defun empc-send-sync (command &optional closure handler)
"Send COMMAND synchronously. That means empc will push the