From cd4eabe65f738a162e9a5705fac42cfcaa16a0e8 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:22 +0900 Subject: [PATCH] Don't try to send a command if we know it isn't available --- empc.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/empc.el b/empc.el index 9158864..95dd37a 100644 --- a/empc.el +++ b/empc.el @@ -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