Function: dape--with-request-bind
dape--with-request-bind is a macro defined in dape.el.
Signature
(dape--with-request-bind VARS FN-ARGS &rest BODY)
Documentation
Call FN with ARGS and execute BODY on callback with VARS bound.
VARS are bound from the arguments that the callback is invoked
with. FN-ARGS is a list of (FN . ARGS). FN is called with ARGS
followed by a callback function. BODY is evaluated in the buffer that
was active when this macro was invoked. If that buffer is no longer
live, BODY is evaluated in the buffer current at callback execution
time.
See cl-destructuring-bind for details on valid bind forms for
VARS.
Source Code
;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defmacro dape--with-request-bind (vars fn-args &rest body)
"Call FN with ARGS and execute BODY on callback with VARS bound.
VARS are bound from the arguments that the callback is invoked
with. FN-ARGS is a list of (FN . ARGS). FN is called with ARGS
followed by a callback function. BODY is evaluated in the buffer that
was active when this macro was invoked. If that buffer is no longer
live, BODY is evaluated in the buffer current at callback execution
time.
See `cl-destructuring-bind' for details on valid bind forms for
VARS."
(declare (indent 2))
(let ((old-buffer (make-symbol "old-buffer")))
`(let ((,old-buffer (current-buffer)))
(,(car fn-args) ,@(cdr fn-args)
(cl-function
(lambda ,vars
(with-current-buffer (if (buffer-live-p ,old-buffer)
,old-buffer
(current-buffer))
,@body)))))))