Allow the call of multiple closures when getting the server response.
Each closure is called in turn with the parsed data as argument.
This commit is contained in:
parent
08b12abc1a
commit
4575a05167
2 changed files with 10 additions and 6 deletions
5
TODO
5
TODO
|
|
@ -4,8 +4,9 @@
|
|||
CLOSED: [2011-07-28 Thu 14:28]
|
||||
Then add a vector that binds position to songid.
|
||||
|
||||
* TODO Allow the call of multiple closures when receiving server responses.
|
||||
Maybe use keywords as :before, :after and the likes.
|
||||
* DONE Allow the call of multiple closures when receiving server responses.
|
||||
CLOSED: [2011-08-05 Fri 14:59]
|
||||
Call all the closures specified in order.
|
||||
|
||||
* TODO Rewrite with-updated-status.
|
||||
If disconnected when using the `pause' command, it reconnects but uses wrong
|
||||
|
|
|
|||
11
empc.el
11
empc.el
|
|
@ -198,14 +198,17 @@ songs order is kept into an avector `empc-current-playlist'."
|
|||
(empc-send-status)
|
||||
(empc-send-playlistinfo)))))))
|
||||
|
||||
(defun empc-handle-response (closure msg)
|
||||
(defun empc-handle-response (closures msg)
|
||||
"Retrieve the response from the server.
|
||||
Check the error code and process it using CLOSURE."
|
||||
Check the error code and process it using CLOSURES."
|
||||
(let ((data (empc-response-parse-message msg)))
|
||||
(if (eq (car data) 'error)
|
||||
(empc-echo-error (cdr data))
|
||||
(if closure
|
||||
(funcall closure data))))
|
||||
(when closures
|
||||
(if (listp closures)
|
||||
(dolist (closure closures)
|
||||
(funcall closure data))
|
||||
(funcall closures data)))))
|
||||
(empc-maybe-enter-idle-state))
|
||||
|
||||
(defun empc-initialize ()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue