emacs-tree-sitter / elisp-tree-sitter

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

`Unsupported Operating System: OpenBSD` #243

Closed anoduck closed 1 year ago

anoduck commented 2 years ago

Excited to see tree-sitter was available for EMACS. Then I went to install it, and learned I had to disable downloading binaries from github, which is ok. I have installed packages with rust before, it is no big deal. Learned how to manually compile the needed binary tsc-dyn, went to do it, and received the bad news. Unsupported Operating System: OpenBSD.

Not sure why OpenBSD is "Unsupported" since it does have the rust toolkit and stuff.

anoduck commented 1 year ago

With a few modifications, tsc-dyn.so was successfully built in the terminal, but not within EMACS itself. This is because in order for cargo to build packages for my system, cargo needs root permission, as such sudo is employed. This is the crux of the issue, emacs cannot use sudo to compile the library.

nbonfils commented 1 year ago

Tree-sitter is also directly available in the OpenBSD ports, so it definitely is supported on OpenBSD. I'd be interested to see it work under OpenBSD, I am not sure myself how to modify this package to make it work with the tree-sitter available in ports.

anoduck commented 1 year ago

@nbonfils I had placed it on the back burner after encountering issues compiling all the language files.

As far as elisp-tree-sitter itself is concerned, I was able to get it installed in my local emacs using straight.el. Although, it installed without generating an error, and tree-sitter-mode was enabled, it wasn't actively doing anything I could notice. Which lead me to look into the language files.

Right now, it seems to be compiling the language files without a hitch. So, I will enable it, and give it another try.

sogaiu commented 1 year ago

Perhaps it's obvious / known but FWIW...

Note that according to this section, the version of the tree-sitter cli may be important to be wary of:

Install tree-sitter CLI tool: (Its binary can also be downloaded directly from GitHub.) Note: version 0.20+ cannot be used, as they introduced https://github.com/tree-sitter/tree-sitter/pull/1157 in binary storage location.

anoduck commented 1 year ago

@sogaiu Right now it appears moot, external dependencies from EMACS can be installed and or compiled from source if needed. Tree Sitter is installed in EMACS and is responsive, it just outputs an error that grammar files cannot be found. Installation of the accompanying language files is what is problematic.

sogaiu commented 1 year ago

Are you using a version of emacs 28 or below?

May be you know this already but FWIW the following text was added to this repository's README recently:

For Emacs 29+, please use the built-in integration instead of this package.

Although not on OpenBSD, I've had luck with compiling and using emacs with tree-sitter support from the emacs-29 branch and master branch recently.

The guide I followed mostly is here: https://github.com/emacs-mirror/emacs/blob/master/admin/notes/tree-sitter/starter-guide

It explains how to cope with ending up with the appropriate shared object files for the various grammars as well.

I think version 29 of emacs may be out before long (famous last words): https://lists.gnu.org/archive/html/emacs-devel/2022-12/msg01285.html

anoduck commented 1 year ago

@sogaiu I am running 28.2.

Since tree-sitter integration is so close to being integrated into a release of EMACS, I think the best thing is to not fruitlessly expend energy and time attempting to facilitate the technology at this moment. EMACS appears to distribute a new release after only two sub-releases. Which means, 29.0 should be the next official release of EMACS, which would only be a few months away.