diff options
| author | João Távora | 2023-12-22 17:53:23 -0600 |
|---|---|---|
| committer | João Távora | 2023-12-22 17:53:23 -0600 |
| commit | 9cb85e950dac77b59d48d320c7d40689d019aad4 (patch) | |
| tree | c5252eacf1c42b8afe18b2b8a27c2d6de5d811d2 | |
| parent | 9c86dd52475e0ad65359bc964fbe0d62b9d3e464 (diff) | |
| download | emacs-9cb85e950dac77b59d48d320c7d40689d019aad4.tar.gz emacs-9cb85e950dac77b59d48d320c7d40689d019aad4.zip | |
Eglot: declare eglot-lsp-context bound to non-nil
Otherwise, it'll be really hard to use it in the recommended fashion:
(defun my/project-find-function (dir)
(when-let ((match
(and (bound-and-true-p eglot-lsp-context)
(locate-dominating-file dir "some-marker-file"))))
`(transient . ,match)))
(add-hook 'project-find-functions #'my/project-find-function)
because 'bound-and-true-p' will never return t even when the hook is called
from eglot--current-project.
Github-reference: https://github.com/joaotavora/eglot/discussions/1336
Github-reference: https://github.com/joaotavora/eglot/discussions/1337
* lisp/progmodes/eglot.el (eglot-lsp-context): Declare normally.
| -rw-r--r-- | lisp/progmodes/eglot.el | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index c849ff5c37e..fc26e8fabbf 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -1289,9 +1289,8 @@ be guessed." | |||
| 1289 | guess))) | 1289 | guess))) |
| 1290 | (list managed-modes (eglot--current-project) class contact language-ids))) | 1290 | (list managed-modes (eglot--current-project) class contact language-ids))) |
| 1291 | 1291 | ||
| 1292 | (defvar eglot-lsp-context) | 1292 | (defvar eglot-lsp-context nil |
| 1293 | (put 'eglot-lsp-context 'variable-documentation | 1293 | "Dynamically non-nil when searching for projects in LSP context.") |
| 1294 | "Dynamically non-nil when searching for projects in LSP context.") | ||
| 1295 | 1294 | ||
| 1296 | (defun eglot--current-project () | 1295 | (defun eglot--current-project () |
| 1297 | "Return a project object for Eglot's LSP purposes. | 1296 | "Return a project object for Eglot's LSP purposes. |