emacs-lsp / lsp-metals

lsp-mode :heart: metals
https://emacs-lsp.github.io/lsp-metals
GNU General Public License v3.0
58 stars 34 forks source link

Fix lsp-metals initialization #90

Closed prashantvithani closed 9 months ago

prashantvithani commented 1 year ago

Temporary fix for https://github.com/emacs-lsp/lsp-metals/issues/81 Eager macro-expansion failure: %S" (wrong-number-of-arguments (1 . 1) 0

This error is occurring even after (require treemacs-extensions) fix. Just passing an argument works.

kurnevsky commented 1 year ago

In which case does this error occur? I haven't seen it, and not a lot of people complain about it. I believe the function we want to use is this one: https://github.com/Alexander-Miller/treemacs/blob/f372f2cbfa443c97cb383c2b05a13cb13349cbb6/src/elisp/treemacs-extensions.el#L540 which doesn't take arguments.

prashantvithani commented 1 year ago

In which case does this error occur? I haven't seen it, and not a lot of people complain about it. I believe the function we want to use is this one: Alexander-Miller/treemacs@f372f2c/src/elisp/treemacs-extensions.el#L540 which doesn't take arguments. This patch solved the problem for me.

I'm not sure what exactly is happening here, The macro definition in treemacs-treelib has the same name treemacs-initialize and it requires an argument.

What seems to be happening here - even after explicit require treemacs-extensions - is the calling treemacs-initialize is referenced to the macro instead of function; hence throwing wrong-number-of-arguments error.

I'm open to an alternate, better solution if I can fix the function override from `treemacs-extensions.

kurnevsky commented 1 year ago

What do you get from C-h f treemacs-initialize? And what is your emacs and lsp-metals versions?

prashantvithani commented 11 months ago

What do you get from C-h f treemacs-initialize? And what is your emacs and lsp-metals versions?

@kurnevsky sorry for missing this, this is what I get:

treemacs-initialize is a macro defined in treemacs-treelib.el.

Signature
(treemacs-initialize EXTENSION &key (WITH-EXPAND-DEPTH 0) AND-DO)

Documentation
Initialise an external buffer for use with the given EXTENSION.

EXTENSION is the same symbol that was passed as a :key argument
to treemacs-define-variadic-entry-node-type.

WITH-EXPAND-DEPTH indicates the number of nodes that should be expanded *in
addition* to the default.  If a value is given that is not a number then
treemacs will assume that *all* possible nodes should be expanded.

AND-DO can be used to set up buffer-local variables after the buffer has
switched over to treemacs-mode.

References
treemacs-initialize is unused in treemacs-treelib.el.

The emacs version is: 30.0.50 master b9a910a70 ~/.emacs.d/ lsp-metals version is: a2df7263ece6ac69214e41c52d66aab8d3f650eb

kurnevsky commented 11 months ago

Do you get the same after executing (require 'treemacs-extensions)? It could be that they changed something in emacs 30. But if we just add an argument there it will break it for everyone else.

kurnevsky commented 9 months ago

Not relevant anymore, https://github.com/emacs-lsp/lsp-metals/pull/102