From 563011ec640f91799c22b9d9bb5b6eb6087dd5bd Mon Sep 17 00:00:00 2001 From: Michal Krzywkowski Date: Thu, 9 Aug 2018 12:20:36 +0200 Subject: [PATCH] Allow function contacts to be interactive * eglot.el (eglot-server-programs): Mention that the function must accept one argument. (eglot--guess-contact): Pass to functional contacts the interactive value. GitHub-reference: per https://github.com/joaotavora/eglot/issues/63 --- lisp/progmodes/eglot.el | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 57d19b33c1d..4376d3af7b0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -124,8 +124,14 @@ of those modes. CONTACT can be: `jsonrpc-process-connection', which you should see for the semantics of the mandatory :PROCESS argument. -* A function of no arguments producing any of the above values - for CONTACT.") +* A function of a single argument producing any of the above + values for CONTACT. The argument's value is non-nil if the + connection was requested interactively (e.g. from the `eglot' + command), and nil if it wasn't (e.g. from `eglot-ensure'). If + the call is interactive, the function can ask the user for + hints on finding the required programs, etc. Otherwise, it + should not ask the user for any input, and return nil or signal + an error if it can't produce a valid CONTACT.") (defface eglot-mode-line '((t (:inherit font-lock-constant-face :weight bold))) @@ -353,7 +359,9 @@ be guessed." (lambda (m1 m2) (or (eq m1 m2) (and (listp m1) (memq m2 m1))))))) - (guess (if (functionp guess) (funcall guess) guess)) + (guess (if (functionp guess) + (funcall guess interactive) + guess)) (class (or (and (consp guess) (symbolp (car guess)) (prog1 (car guess) (setq guess (cdr guess)))) 'eglot-lsp-server)) -- 2.39.2