emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.75k stars 873 forks source link

Running `lsp-plain-start` in Emacs 29 fails to load lsp modules #3738

Open justinbarclay opened 1 year ago

justinbarclay commented 1 year ago

Thank you for the bug report

Bug description

When I run lsp-plain-start on Emacs 29, it fails to load lsp

Debugger entered--Lisp error: (error "Eager macro-expansion failure: (error \"Keyword arg...")
  error("Eager macro-expansion failure: %S" (error "Keyword argument (lsp-treemacs--set-mode-line-form..."))
  internal-macroexpand-for-load((defalias 'lsp-treemacs-render #'(lambda (tree title expand-depth &optional buffer-name right-click-actions _clear-cache?) (let ((buffer (get-buffer-create ...))) (with-current-buffer buffer (treemacs-initialize 'lsp-treemacs-generic-root (lsp-treemacs--set-mode-line-format buffer title) (setq-local face-remapping-alist ...) (setq-local lsp-treemacs-tree tree) (setq-local treemacs-default-visit-action ...) (setq-local lsp-treemacs--right-click-actions right-click-actions) (setq-local window-size-fixed nil) (setq-local treemacs--width-is-locked nil) (setq-local treemacs-space-between-root-nodes nil) (when treemacs-text-scale ...) (lsp-treemacs-generic-mode t)) (current-buffer))))) t)
  load-with-code-conversion("/tmp/lsp-tmp-elpagtehGt/lsp-treemacs-20220918.742/..." "/tmp/lsp-tmp-elpagtehGt/lsp-treemacs-20220918.742/..." nil t)
  require(lsp-treemacs-generic)
  load-with-code-conversion("/tmp/lsp-tmp-elpagtehGt/lsp-treemacs-20220918.742/..." "/tmp/lsp-tmp-elpagtehGt/lsp-treemacs-20220918.742/..." nil t)
  require(lsp-treemacs)
  load-with-code-conversion("/tmp/lsp-tmp-elpagtehGt/lsp-java-20220825.450/lsp-..." "/tmp/lsp-tmp-elpagtehGt/lsp-java-20220825.450/lsp-..." nil t)
  require(lsp-java)
  (closure ((pkg-list lsp-mode lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs dap-mode lsp-origami lsp-dart company flycheck lsp-pyright rust-mode php-mode scala-mode dart-mode clojure-mode typescript-mode csharp-mode) t) (pkg) (if (package-installed-p pkg) nil (package-install pkg)) (require pkg))(lsp-java)
  mapc((closure ((pkg-list lsp-mode lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs dap-mode lsp-origami lsp-dart company flycheck lsp-pyright rust-mode php-mode scala-mode dart-mode clojure-mode typescript-mode csharp-mode) t) (pkg) (if (package-installed-p pkg) nil (package-install pkg)) (require pkg)) (lsp-mode lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs dap-mode lsp-origami lsp-dart company flycheck lsp-pyright rust-mode php-mode scala-mode dart-mode clojure-mode typescript-mode csharp-mode))
  (let* ((pkg-list '(lsp-mode lsp-ui yasnippet lsp-java lsp-python-ms lsp-haskell helm-lsp lsp-treemacs dap-mode lsp-origami lsp-dart company flycheck lsp-pyright rust-mode php-mode scala-mode dart-mode clojure-mode typescript-mode csharp-mode))) (package-initialize) (package-refresh-contents) (mapc #'(lambda (pkg) (if (package-installed-p pkg) nil (package-install pkg)) (require pkg)) pkg-list) (yas-global-mode) (add-hook 'prog-mode-hook 'lsp) (add-hook 'kill-emacs-hook (list 'lambda nil (cons 'delete-directory (cons package-user-dir '(t))))))
  load-with-code-conversion("/tmp/plainEJ0DWs.el" "/tmp/plainEJ0DWs.el" nil t)
  command-line-1(("-l" "/tmp/plainEJ0DWs.el"))
  command-line()
  normal-top-level()

This is a recent change with Emacs 29 as I was able to run this successfully ~2 weeks ago

Steps to reproduce

Run lsp-plain-start on Emacs 29 compiled with a hash from commits released on September 27, 2022 or from a commit around 604b541d5ce394a1e4f157a81a0cf77df98d61d0.

Expected behavior

Emacs starts with no warnings

Which Language Server did you use?

none, this is purely in instantiating lsp through lsp-plain-start

OS

Windows

Error callstack

No response

Anything else?

I use WSL2 on Windows 11

schellj commented 1 year ago

I've also run into this issue on Mac OS using the builds from https://github.com/jimeh/emacs-builds. The newest build that doesn't have this error when loading lsp-plain-start.el is https://github.com/jimeh/emacs-builds/releases/tag/Emacs.2022-06-29.fb3d582.master. The next build (https://github.com/jimeh/emacs-builds/releases/tag/Emacs.2022-06-30.85c2f3b.master) does have the error reported here when loading lsp-plain-start.el. In testing, I deleted my ~/.emacs.d/eln-cache and ~/.emacs.d/elpa directories between running each build.

Thus, the breakage seems to start with one of the commits between https://github.com/emacs-mirror/emacs/commit/fb3d582e7ba595b7680e2c2adf22c7ab699e5792 and https://github.com/emacs-mirror/emacs/commit/85c2f3bc3efd9cdd092a6d4fadca5cc04642a2a5

schellj commented 1 year ago

Looks like eager expansions were changed from a warning to an error: https://github.com/emacs-mirror/emacs/commit/80cf13a3d27d8a967feafeec32fd130529635592

ileixe commented 1 year ago

I've also encountered this issue. Is there any viable workaround?