mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 15:41:37 -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
|
||||
(list (cons msg-type function))))))))))
|
||||
|
||||
(defun jupyter-wait-until (msg-type req timeout cond)
|
||||
"Wait until COND returns non-nil for a received message.
|
||||
COND is run for every received message that has a type of
|
||||
MSG-TYPE and whose parent header has a message ID of PMSG-ID. If
|
||||
no messages are received that pass these two conditions before
|
||||
TIMEOUT (in seconds), this function returns nil. Otherwise it
|
||||
returns the received message. Note that if TIMEOUT is nil, it
|
||||
(defun jupyter-wait-until (msg-type req timeout fun)
|
||||
"Wait until FUN returns non-nil for a received message.
|
||||
FUN is run on every received message for request, REQ, that has
|
||||
type, MSG-TYPE. If FUN does not return a non-nil value before
|
||||
TIMEOUT, return nil. Otherwise return the message which caused
|
||||
FUN to return a non-nil value. Note that if TIMEOUT is nil, it
|
||||
defaults to 1 second."
|
||||
(declare (indent 3))
|
||||
(setq timeout (or timeout 1))
|
||||
(cl-check-type timeout number)
|
||||
(lexical-let ((msg nil)
|
||||
(cond cond))
|
||||
(fun fun))
|
||||
(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)
|
||||
(while (null msg)
|
||||
(sleep-for 0.01))
|
||||
|
|
Loading…
Add table
Reference in a new issue