renzmann / treesit-auto

Automatic installation, usage, and fallback for tree-sitter major modes in Emacs 29
GNU General Public License v3.0
369 stars 28 forks source link

Error loading treesit-auto autoloads #36

Closed ckruse closed 1 year ago

ckruse commented 1 year ago

Hi there,

I just upgraded treesit-auto and now I get the following error:

Warning (emacs): Error loading "treesit-auto" autoloads: (void-variable treesit-auto-recipe-list)

Am I doing something wrong?

Best regards, CK

renzmann commented 1 year ago

Does your Emacs crash? Sorry I didn't catch this, I didn't notice it since it's just silently getting printed to the *Messages* buffer for me, but doesn't seem to be causing any unexpected behavior. I'm actually not sure how to make this go away, I'll need to spend some time looking into it

jsigman commented 1 year ago

It's something strange to do with compilation, I believe. I see the same issue using the emacs-29 branch and also the master branch of emacs on my macOS.

I think I fix it by adding :build (:not autoloads) and :build (:not compile)) to the straight.el recipe.

So my config looks thus:

  (use-package
   treesit-auto
   :straight
   '(treesit-auto
     :type git
     :host github
     :repo "renzmann/treesit-auto"
     :build (:not autoloads)
     :build (:not compile))
   :demand t
   :config
   (setq treesit-auto-install 't)
   (setq treesit-auto-opt-out-list '(protobuf))
   (global-treesit-auto-mode)
   (treesit-auto-install-all)
   (setq python-ts-mode-hook python-mode-hook)
   (setq yaml-ts-mode-hook yaml-mode-hook)
   (setq json-ts-mode-hook json-mode-hook)
   (setq markdown-ts-mode-hook markdown-mode-hook)
   (setq bash-ts-mode-hook sh-mode-hook))
jsigman commented 1 year ago

That makes it run without error (for me) but something else seems off, the symbol highlighting in python is still different than before, I believe.

abougouffa commented 1 year ago

I'm getting the same issue here!

abougouffa commented 1 year ago

I think I fix it by adding :build (:not autoloads) and :build (:not compile)) to the straight.el recipe.

I confirm that adding :build (:not autoloads) to the recipe fixes the problem, thanks @jsigman !

ronisbr commented 1 year ago

~Same problem in Doom emacs. In this case, we cannot use the default system to add a package (package! and use-package!). If we use the code proposed here, treesit-auto is installed correctly.~

EDIT: Actually no! I cannot use that proposed fix in Emacs 29 because the keyword :straight is not recognized.

EDIT 2: Just forgot everything I wrote. To make this fix works in Doom emacs, add this configuration to packages.el:

(package! treesit-auto
  :recipe (:host github :repo "renzmann/treesit-auto"
           :build (:not autoloads)
           :build (:not compile)))
renzmann commented 1 year ago

I guess just adding the autoload definitions isn't too offensive. If anyone else wants to check out #37, I'm going to pull that in in a little bit after a bit more testing on my end.

jsigman commented 1 year ago

The new hotfix improves this for me. I can take out the special keywords and load the package now using master-compiled emacs

ronisbr commented 1 year ago

Hi! In this new version, using Doom emacs, I see this error when loading emacs:

Symbol's value as variable is void: cl-struct-treesit-auto-recipe-tags
renzmann commented 1 year ago

The autoload thing is causing more trouble than it's worth. This is such a small package that it probably makes sense to just avoid it entirely via #41. Would any of the the doom/straight users like to try that branch? I am simply using vanilla Emacs 29 for testing this and haven't run into the error @ronisbr is now facing

ronisbr commented 1 year ago

Hi @renzmann !

I can confirm that the branch in that PR do not lead to initialization problems in Doom emacs.