renzmann / treesit-auto

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

None of the package functions show up when I install this package (either from VC or MELPA) under DOOM Emacs #105

Closed alexispurslane closed 4 months ago

alexispurslane commented 4 months ago

What the title says. If I do M-x package-install treesit-auto, it says it was successfully installed, but I get nothing. No treesit-auto-install-all, no global-treesit-auto-mode, nothing at all.

Here's my emacs information according to doom info:

generated  May 15, 2024 16:49:49
system     Fedora Linux 41 (Container Image Prerelease) Linux 6.8.8-300.fc40.x86_64 x86_64
emacs      29.3 EMACSDIR=~/.emacs.d/ EMACS=/usr/bin/emacs
doom       3.0.0-pre PROFILE=_@0 grafted, HEAD -> master, origin/master, origin/HEAD 9620bb4
       2024-04-18 14:20:48 -0400 ~/.doom.d/
shell      /bin/bash
features   ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF
       LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG
       RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM
       XWIDGETS GTK3 ZLIB
traits     batch server-running custom-file
modules    :config use-package :completion company (vertico +icons) :ui doom doom-dashboard
       (emoji +unicode) hl-todo ligatures modeline nav-flash ophints (popup +defaults)
       treemacs unicode vc-gutter vi-tilde-fringe :editor (evil +everywhere) fold
       (format +onsave) snippets word-wrap :emacs dired electric undo vc :checkers
       syntax (spell +flyspell) grammar :tools debugger editorconfig (eval +overlay)
       lookup (lsp +eglot) magit make pdf :lang (cc +lsp) common-lisp data emacs-lisp
       json (javascript +lsp) (latex +fold +lsp) lua markdown (python +lsp +pyright) qt
       (rust +lsp) sh web yaml :config (default +bindings +smartparens)
packages   (dtrt-indent) (paredit) (evil-numbers) (prettier) (writeroom-mode) (focus)
       (eldoc-box) (treesit-auto)
elpa       treesit-auto
alexispurslane commented 4 months ago

But, notably, manually downloading, adding to my load path, and requiring the package works.

renzmann commented 4 months ago

It isn't clear from your description whether you're using one of the recommended configurations. You're not seeing global-treesit-auto-mode even after using one of use-package or require?

alexispurslane commented 4 months ago

It isn't clear from your description whether you're using one of the recommended configurations. You're not seeing global-treesit-auto-mode even after using one of use-package or require?

I tried Doom Emacs's custom package management solution that replaces both of those, and then package-install, naively assuming on no evidence that Doom's package management solution and package-install just did a use-package or a require under the hood. But apparently they don't, since once I did a use-package or require it worked just fine, as mentioned above lol. So this appears to be a doom-specific thing. I resolved the problem by ceasing to use doom and writing my own vanilla emacs config from scratch lol, at which point treesit-auto proceeded to work like a dream come true!

rafaeloledo commented 2 months ago

@alexispurslane i think it's using straight, i've remeber reading about it in the README, i'm going to investigate it more and see on their docs

Edit 1: use a macro layer gived by the straight.el README's and see if it works https://github.com/radian-software/straight.el?tab=readme-ov-file#integration-with-use-package

(straight-use-package 'use-package)

Edit 2: i've hadn't success using this layer

since i want to keep using doom, i hovered to emacs-tree-sitter official docs

https://emacs-tree-sitter.github.io/syntax-highlighting/

config.el

(add-hook 'javascript-mode-hook #'tree-sitter-hl-mode)
(add-hook 'nix-mode-hook #'tree-sitter-hl-mode)
(add-hook 'c-mode-hook #'tree-sitter-hl-mode)
(global-tree-sitter-mode)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)

manually adding hooks for languages that i want tree-sitter-hl to be used, "similar" to vim's autocmds and augroups