I add a help function to wait the value changing to non-nil. To avoid blocking main thread, a timer is used. I have no better ideas to do this.
Fix: #30
I add a help function to wait the value changing to non-nil. To avoid blocking main thread, a timer is used. I have no better ideas to do this.
I suggest adding an optional callback to libmpdel-refresh-status. This callback would be called when refreshing is finished.
Then you need to pass the lambda below as argument to libmpdel-refresh-status.
If you do that, the code below don't need a timer anymore as it is only executed when the value is already there (you have to replace the unless above with if).
I suggest adding an optional callback to `libmpdel-refresh-status`. This callback would be called when refreshing is finished.
Then you need to pass the lambda below as argument to `libmpdel-refresh-status`.
If you do that, the code below don't need a timer anymore as it is only executed when the value is already there (you have to replace the `unless` above with `if`).
I suggest passing the variable value as argument to `handler`. Something like (untested):
```emacs
(let ((call-handler (lambda ()
(funcall handler (funcall fstate)))))
(if (...)
(funcall call-handler)
(libmpdel-refresh-status call-handler)))
```
Fix: #30
I add a help function to wait the value changing to non-nil. To avoid blocking main thread, a timer is used. I have no better ideas to do this.
Thank you very much. I suggested some changes.
I suggest adding an optional callback to
libmpdel-refresh-status
. This callback would be called when refreshing is finished.Then you need to pass the lambda below as argument to
libmpdel-refresh-status
.If you do that, the code below don't need a timer anymore as it is only executed when the value is already there (you have to replace the
unless
above withif
).Here are some more suggestions. Thank you for your great work!
I suggest passing the variable value as argument to
handler
. Something like (untested):if you apply my suggestion above, you get the
play-state
as argument here so you don't have to call(libmpdel-play-state)
below.I suggest only calling
libmpdel-send-command
once:Perfect, thank you very much!
Reviewers
0ccf76c860
.