Function: eglot--lookup-mode
eglot--lookup-mode is a byte-compiled function defined in eglot.el.gz.
Signature
(eglot--lookup-mode MODE)
Documentation
Lookup eglot-server-programs for MODE.
Return (MANAGED-MODES LANGUAGE-ID CONTACT-PROXY).
MANAGED-MODES is a list with MODE as its first element. Subsequent elements are other major modes also potentially managed by the server that is to manage MODE.
If not specified in eglot-server-programs (which see),
LANGUAGE-ID is determined from MODE's name.
CONTACT-PROXY is the value of the corresponding
eglot-server-programs entry.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/eglot.el.gz
(defun eglot--lookup-mode (mode)
"Lookup `eglot-server-programs' for MODE.
Return (MANAGED-MODES LANGUAGE-ID CONTACT-PROXY).
MANAGED-MODES is a list with MODE as its first element.
Subsequent elements are other major modes also potentially
managed by the server that is to manage MODE.
If not specified in `eglot-server-programs' (which see),
LANGUAGE-ID is determined from MODE's name.
CONTACT-PROXY is the value of the corresponding
`eglot-server-programs' entry."
(cl-loop
for (modes . contact) in eglot-server-programs
for mode-symbols = (cons mode
(delete mode
(mapcar #'car
(mapcar #'eglot--ensure-list
(eglot--ensure-list modes)))))
thereis (cl-some
(lambda (spec)
(cl-destructuring-bind (probe &key language-id &allow-other-keys)
(eglot--ensure-list spec)
(and (provided-mode-derived-p mode probe)
(list
mode-symbols
(or language-id
(or (get mode 'eglot-language-id)
(get spec 'eglot-language-id)
(string-remove-suffix "-mode" (symbol-name mode))))
contact))))
(if (or (symbolp modes) (keywordp (cadr modes)))
(list modes) modes))))