Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eglot failing even with mirrored dependencies #355

Closed
karljs opened this issue Feb 20, 2019 · 6 comments
Closed

Eglot failing even with mirrored dependencies #355

karljs opened this issue Feb 20, 2019 · 6 comments

Comments

@karljs
Copy link

karljs commented Feb 20, 2019

I am trying to install Eglot with straight.el, but am facing issues with its dependency on a newer version of flymake than is shipped with Emacs 26.1. The solution mentioned in #293 is to (setq straight-recipes-gnu-elpa-use-mirror t) before bootstrapping straight (this also seems to be the default now?).

Unfortunately this doesn't solve the problem for me. I see versions of flymake and jsonrpc (the Eglot dependencies) in my build/repos directories, but am still encountering errors related to a change in the signature of some flymake function, which tells me the newer version is being loaded correctly. I also tried putting explicit (use-package flymake) but that doesn't change anything.

Since I'm not initializing the package system, I don't know how to tell what version of those dependencies is actually loaded. There doesn't seem to be any kind of flymake-version-like function nor is it in the docs.

Any advice would be appreciated.

@raxod502
Copy link
Member

It works for me. I installed the following init-file into an empty ~/.emacs.d:

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'eglot)

Then I navigated to a Python file and invoked M-x eglot, after installing python-language-server via Pip. I received the message:

[eglot] Connected! Server `EGLOT (straight/python-mode)' now managing `python-mode' buffers in project `straight'.

I can see that Flymake is reporting errors and warnings that display a tooltip when I hover over them, and has installed an indicator in the mode line. I have never used Eglot or Flymake before, but this seems like correct functionality.

Could you please elaborate on what the problem is?

@karljs
Copy link
Author

karljs commented Feb 21, 2019

Weird, I tested it with a minimal setup like what you posted and didn't encounter the issue. After spending a little time trying to bisect my configuration, I couldn't narrow it down so I just wiped out everything except the actual elisp files in .emacs.d and now it works after re-building everything. Sorry for the noise.

@karljs karljs closed this as completed Feb 21, 2019
@raxod502
Copy link
Member

You probably needed to update your packages or recipe repositories, or you had local changes. See M-x straight-pull-all and M-x straight-normalize-all to manipulate the repositories without deleting everything :)

@karljs
Copy link
Author

karljs commented Feb 21, 2019

Thanks for the tips, but it looks like I closed this too quickly. While I can work around it, here's an easy way to repro: add (straight-use-package 'company-lsp) to your minimal init file just before the line loading eglot (I realize that company-lsp is only for lsp-mode and not eglot).

I'm a bit out of my depth. Could it be that company-lsp is somehow pulling in an older version of flymake, preventing eglot from getting what it needs?

@karljs karljs reopened this Feb 21, 2019
raxod502 added a commit that referenced this issue Feb 21, 2019
@raxod502
Copy link
Member

Yes, that is correct. company-lsp depends on lsp-mode. lsp-mode requires flymake, but does not declare a dependency on it in Package-Requires. Hence straight.el does not know to make flymake available, and since Emacs ships an obsolete version, that one is loaded instead.

The correct solution to this problem, in my opinion, would be for lsp-mode to declare flymake in its Package-Requires header. A workaround is to add

(straight-use-package 'flymake)

before you try to make lsp-mode or any package that depends on it available.

See the newly added FAQ section in the README :)

@karljs
Copy link
Author

karljs commented Feb 21, 2019

Thanks for the explanation and updated docs. Makes sense.

@karljs karljs closed this as completed Feb 21, 2019
hartzell pushed a commit to hartzell/straight.el that referenced this issue Jun 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants