mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 23:41:38 -05:00
Don't use cond
as a variable name
This commit is contained in:
parent
bcaa7ef2d7
commit
5ab0534eb4
1 changed files with 8 additions and 9 deletions
|
@ -759,21 +759,20 @@ can be done like so:
|
||||||
(nconc callbacks
|
(nconc callbacks
|
||||||
(list (cons msg-type function))))))))))
|
(list (cons msg-type function))))))))))
|
||||||
|
|
||||||
(defun jupyter-wait-until (msg-type req timeout cond)
|
(defun jupyter-wait-until (msg-type req timeout fun)
|
||||||
"Wait until COND returns non-nil for a received message.
|
"Wait until FUN returns non-nil for a received message.
|
||||||
COND is run for every received message that has a type of
|
FUN is run on every received message for request, REQ, that has
|
||||||
MSG-TYPE and whose parent header has a message ID of PMSG-ID. If
|
type, MSG-TYPE. If FUN does not return a non-nil value before
|
||||||
no messages are received that pass these two conditions before
|
TIMEOUT, return nil. Otherwise return the message which caused
|
||||||
TIMEOUT (in seconds), this function returns nil. Otherwise it
|
FUN to return a non-nil value. Note that if TIMEOUT is nil, it
|
||||||
returns the received message. Note that if TIMEOUT is nil, it
|
|
||||||
defaults to 1 second."
|
defaults to 1 second."
|
||||||
(declare (indent 3))
|
(declare (indent 3))
|
||||||
(setq timeout (or timeout 1))
|
(setq timeout (or timeout 1))
|
||||||
(cl-check-type timeout number)
|
(cl-check-type timeout number)
|
||||||
(lexical-let ((msg nil)
|
(lexical-let ((msg nil)
|
||||||
(cond cond))
|
(fun fun))
|
||||||
(jupyter-add-callback msg-type req
|
(jupyter-add-callback msg-type req
|
||||||
(lambda (m) (setq msg (when (funcall cond m) m))))
|
(lambda (m) (setq msg (when (funcall fun m) m))))
|
||||||
(with-timeout (timeout nil)
|
(with-timeout (timeout nil)
|
||||||
(while (null msg)
|
(while (null msg)
|
||||||
(sleep-for 0.01))
|
(sleep-for 0.01))
|
||||||
|
|
Loading…
Add table
Reference in a new issue