From 66842d545a6307ede24ea30ed098e5c8f73beeb8 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 13 Feb 2024 14:04:20 -0700 Subject: [PATCH] [Emacs] Add imalison:lsp-deferred-when-enabled --- dotfiles/emacs.d/README.org | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 76ee24bc..40b8c4d7 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -3303,10 +3303,15 @@ emr (emacs refactor) provides support for refactoring in many programming langua #+END_SRC ** language-server-protocol (lsp) #+BEGIN_SRC emacs-lisp +(defvar imalison:use-lsp nil) (use-package lsp-mode - :defer 3 :commands lsp :preface + (defun imalison:lsp-deferred-when-enabled () + (add-hook 'hack-local-variables-hook + (lambda () + (when imalison:use-lsp + (lsp-deferred))) nil t)) (defun imalison:nix-develop-lsp-wrapper-function (argv) (append (append (list "nix" "develop" "-I" "." "--impure" "--command") @@ -3317,6 +3322,7 @@ emr (emacs refactor) provides support for refactoring in many programming langua (use-package lsp-ui :config (progn + (add-hook 'prog-mode-hook 'imalison:lsp-deferred-when-enabled) (add-hook 'lsp-mode-hook 'lsp-ui-mode) (setq lsp-ui-doc-position 'bottom))))) #+END_SRC