branch: externals/ampc commit 62764ad47a68c17d4796bb9f76c78362f6ff4112 Author: Christopher Schmidt <christop...@ch.ristopher.com> Commit: Christopher Schmidt <christop...@ch.ristopher.com>
* ampc.el (ampc-send-command-impl): Only send commands if the connection live. (ampc-send-next-command, ampc-quit): Only wait for process output if the connection is live. --- ampc.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ampc.el b/ampc.el index 0c13350165..d652902f4d 100644 --- a/ampc.el +++ b/ampc.el @@ -1527,7 +1527,8 @@ modified." (defun ampc-send-command-impl (command) (when ampc-debug (message "ampc: -> %s" command)) - (process-send-string ampc-connection (concat command "\n"))) + (when (ampc-on-p) + (process-send-string ampc-connection (concat command "\n")))) (defun* ampc-send-command (command &optional props &rest args) (destructuring-bind (&key (front nil) (callback nil) (keep-prev nil) @@ -1598,6 +1599,7 @@ modified." do (loop with head = ampc-outstanding-commands with ampc-no-implicit-next-dispatch = t with ampc-yield-redisplay = t + while (ampc-on-p) while (eq head ampc-outstanding-commands) do (accept-process-output ampc-connection 0 100))) (unless ampc-outstanding-commands @@ -3026,6 +3028,7 @@ ampc is connected to." (with-current-buffer (process-buffer ampc-connection) (loop do (goto-char (point-min)) until (search-forward-regexp "^\\(ACK\\)\\|\\(OK\\).*\n\\'" nil t) + while (ampc-on-p) do (accept-process-output ampc-connection nil 50)))) (ampc-send-command-impl (if arg "kill" "close")) (delete-process ampc-connection))