emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9cb85e950da: Eglot: declare eglot-lsp-context bound to non-nil


From: João Távora
Subject: master 9cb85e950da: Eglot: declare eglot-lsp-context bound to non-nil
Date: Fri, 22 Dec 2023 18:53:27 -0500 (EST)

branch: master
commit 9cb85e950dac77b59d48d320c7d40689d019aad4
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    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.
---
 lisp/progmodes/eglot.el | 5 ++---
 1 file 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."
             guess)))
     (list managed-modes (eglot--current-project) class contact language-ids)))
 
-(defvar eglot-lsp-context)
-(put 'eglot-lsp-context 'variable-documentation
-     "Dynamically non-nil when searching for projects in LSP context.")
+(defvar eglot-lsp-context nil
+  "Dynamically non-nil when searching for projects in LSP context.")
 
 (defun eglot--current-project ()
   "Return a project object for Eglot's LSP purposes.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]