Function: eglot--inferior-bootstrap
eglot--inferior-bootstrap is a byte-compiled function defined in
eglot.el.gz.
Signature
(eglot--inferior-bootstrap NAME CONTACT &optional CONNECT-ARGS)
Documentation
Use CONTACT to start a server, then connect to it.
Return a cons of two process objects (CONNECTION . INFERIOR).
Name both based on NAME.
CONNECT-ARGS are passed as additional arguments to
open-network-stream.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(defun eglot--inferior-bootstrap (name contact &optional connect-args)
"Use CONTACT to start a server, then connect to it.
Return a cons of two process objects (CONNECTION . INFERIOR).
Name both based on NAME.
CONNECT-ARGS are passed as additional arguments to
`open-network-stream'."
(let* ((port-probe (make-network-process :name "eglot-port-probe-dummy"
:server t
:host "localhost"
:service 0))
(port-number (unwind-protect
(process-contact port-probe :service)
(delete-process port-probe)))
inferior connection)
(unwind-protect
(progn
(setq inferior
(make-process
:name (format "autostart-inferior-%s" name)
:stderr (format "*%s stderr*" name)
:noquery t
:command (cl-subst
(format "%s" port-number) :autoport contact)))
(setq connection
(cl-loop
repeat 10 for i from 1
do (accept-process-output nil 0.5)
while (process-live-p inferior)
do (eglot--message
"Trying to connect to localhost and port %s (attempt %s)"
port-number i)
thereis (ignore-errors
(apply #'open-network-stream
(format "autoconnect-%s" name)
nil
"localhost" port-number connect-args))))
(cons connection inferior))
(cond ((and (process-live-p connection)
(process-live-p inferior))
(eglot--message "Done, connected to %s!" port-number))
(t
(when inferior (delete-process inferior))
(when connection (delete-process connection))
(eglot--error "Could not start and connect to server%s"
(if inferior
(format " started with %s"
(process-command inferior))
"!")))))))