emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
822 stars 74 forks source link

Process running from dynamic link #110

Open jcs090218 opened 3 years ago

jcs090218 commented 3 years ago

If I have tree-sitter running with dynamic link file (dll) then I am not able to upgrade tree-sitter-langs package.

Steps of reproduce

  1. Open any file with tree-sitter support (ensure there is process running with dll file)
  2. package-list-packages, and try to remove package tree-sitter-langs

Then you should get an error with process running, not able to delete package, etc.

Environments

ubolonton commented 3 years ago

Windows seems to disallow deleting loaded dll files.

I'm not familiar enough with Windows to fix this, or to suggest workarounds.

kiennq commented 3 years ago

I think you can customize tree-sitter-langs-grammar-dir for that. So the langs dll is stored outside of package and will not be delete when upgrading.

(use-package tree-sitter-langs
  :ensure t
  :defer t
  :custom
  (tree-sitter-langs-grammar-dir (expand-file-name ".cache/tree-sitter-langs/" user-emacs-directory)))

In Windows, loaded dll cannot be deleted online but can be moved and marked to delete next time PC reboot. Perhaps package.el should use that, i.e, move loaded dll file to $TEMP and mark it as delete on reboot, then we can cleanly upgrade package on Windows without worry about file deletion error.