I try to install Microsoft’s python-language-server on NixOS, and integrate it with emacs, following https://github.com/emacs-lsp/lsp-python-ms.
I have installed Microsoft’s python-language-server on NixOS, by adding `python-language-server` to `configuration.nix`.
Then I try to integrate it into Emacs.
I copy the following into `~/.emacs.d/init.el`:
;; Include lsp-python-ms in the configuration file:
(require 'lsp-python-ms)
(setq lsp-python-ms-auto-install-server t)
(add-hook 'python-mode-hook #'lsp) ; or lsp-deferred
;; initialization
(use-package lsp-python-ms
:ensure t
:hook (python-mode . (lambda ()
(require 'lsp-python-ms)
(lsp)))
:init (setq lsp-python-ms-executable (executable-find "python-language-server")))
(1) I don't want to restart emacs for reloading the above added code in `~/.emacs.d/init.el`, because I don't want to kill the programs run from a shell inside emacs. Can I select the above added code region , and hit C-x C-e?
(2) When I did that, I saw in the Backtrace buffer:
Debugger entered--Lisp error: (void-function use-package)
(use-package lsp-python-ms :ensure t :hook (python-mode lambda nil (require 'lsp-python-ms) (lsp)) :init (setq lsp-python-ms-executable (executable-find "python-language-server")))
eval((use-package lsp-python-ms :ensure t :hook (python-mode lambda nil (require 'lsp-python-ms) (lsp)) :init (setq lsp-python-ms-executable (executable-find "python-language-server"))) nil)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)
I was wondering if there is something wrong by `Debugger entered--Lisp error`? How shall I make the lsp work in emacs?
Thanks.