Function: jsonrpc--continue

jsonrpc--continue is a byte-compiled function defined in jsonrpc.el.gz.

Signature

(jsonrpc--continue CONN ID &optional CONT RESULT ERROR)

Source Code

;; Defined in /usr/src/emacs/lisp/jsonrpc.el.gz
(defun jsonrpc--continue (conn id &optional cont result error)
  (pcase-let* ((`(,cont-id ,_method ,success-fn ,error-fn ,_timer)
                cont)
               (head (pop (jsonrpc--sync-request-alist conn)))
               (anxious (cdr head)))
    (cond
     (anxious
      (when (not (= (car head) id)) ; sanity check
        (error "Internal error: please report this bug"))
      ;; If there are "anxious" `jsonrpc-request' continuations
      ;; that should already have been run, they should run now.
      ;; The main continuation -- if it exists -- should run
      ;; before them.  This order is important to preserve the
      ;; throw to the catch tags in `jsonrpc-request' in
      ;; order (bug#67945).
      (cl-flet ((later (f arg) (run-at-time 0 nil f arg)))
        (when cont-id
          (if error (later error-fn error)
            (later success-fn result)))
        (cl-loop
         for (acont ares aerr) in anxious
         for (anx-id _method success-fn error-fn) = acont
         do (jsonrpc--event
             conn 'internal
             :log-text (format "anxious continuation to %s running now" anx-id))
         if aerr do (later error-fn aerr)
         else do (later success-fn ares))))
     (cont-id
      ;; Else, just run the normal one, with plain funcall.
      (if error (funcall error-fn error)
        (funcall success-fn result)))
     (t
      ;; For clarity.  This happens if the `jsonrpc-request' was
      ;; canceled
      ))))