ethan-leba / tree-edit

🌲 Structural editing in Emacs for any™ language!
GNU General Public License v3.0
389 stars 16 forks source link

tree-edit-install-grammars-wizard fails with Spacemacs and Emacs 29.1 #71

Open idanov opened 3 months ago

idanov commented 3 months ago

Trying to install the grammars on Spacemacs and GNU Emacs 29.1 (build 1, aarch64-apple-darwin22.6.0, Carbon Version 169 AppKit 2299.7) of 2023-10-02 (emacs-mac) on macOS.

This is the error backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp python)
  expand-file-name(python "/var/folders/h3/z04wl7k51xq60dm13cx9_g940000gn/T/t...")
  tree-edit-install-language-grammar(python)
  tree-edit-install-grammars-wizard(t t)

Is there a way to install the grammars manually?

ethan-leba commented 3 months ago

Hey there, thanks for checking out the project! I'm having trouble reproducing this unfortunately but I think I have a hunch... What's the value of treesit-language-source-alist in your Emacs? It looks like the error is originating from this line: https://github.com/ethan-leba/tree-edit/blob/b028c028d61fa73315c68a9f5cc824dbdccdfd00/tree-edit-build.el#L286-L288 My guess is you have it set with a python key that has the source-dir set to 'python? Could be off base though.

Unfortunately you need to install the grammars via tree-edit so it can generate some special files used for structural editing -- happy to help though, let me know if resetting treesit-language-source-alist works!

idanov commented 3 months ago

Thanks for responding!

I've never set it myself, the variable is nil and only after I run tree-edit-install-grammars-wizard, I get this error. And then the value of the variable is as follows:

Its value is (#1=(python . #1#))

After trying to set it as the example here, tree-edit-install-grammars-wizard inserts the same value to the front of the list and fails the same way. If I try to install it normally with treesit-install-language-grammar, this value doesn't get inserted to the list. So something in the code of the wizard is modifying the treesit-language-source-alist and then it's unhappy with the modification.

Hope that gives some more info.