reddit / emacs

why is melpa still necessary for stuff that is built-in to emacs?

RepublicWorried · 2022-11-22 21:30
talking about eglot or tree-sitter e.g. why does one still has to write ​ (require 'package) ;; Any add to list for package-archives (to add marmalade or melpa) goes here (add-to-list 'package-archives '("MELPA" . "http://melpa.org/packages/")) (package-initialize) before being able to use supposedly built-in packages? ​ And for that matter, what does require do then in this context?
danderzei · 2022-11-22 22:06
You need a package manager to update to newer versions. The default package repository is ELPA (See `(package-archives)`), which you enable with `(package-initialize)`. You only need to add other repositories if newer versions are unavailable in ELPA (eglot is on ELPA, tree-sitter is on MELPA).
globalcandyamnesia · 2022-11-22 22:12
For your first question, eglot and tree-sitter are only built in on Emacs 29. For the second question, require evaluates 'package.el', which sets up the variable 'package-archives. If you didn't have to modify 'package-archives, the require could be omitted.
[deleted] · 2022-11-23 01:20
[deleted]
RepublicWorried · 2022-11-23 05:01
Ich am in blessing edge 29 master. So Ist dort even have to require eglot then but just configure it then? But cuz tree sitter is in melpa In still Need to add melpa and install Vorrecht?
meedstrom · 2022-11-23 08:39
If I understand right no, you shouldn't need to add melpa. Just go ahead and configure tree-sitter.
7890yuiop · 2022-11-23 09:17
Why do you believe you need to do that?
RepublicWorried · 2022-11-23 10:47
Otherwise I get errors when trying to configure eglot
arthurno1 · 2022-11-23 15:31
You can safely skip (package-initialize) there.
arthurno1 · 2022-11-23 15:35
> talking about eglot or tree-sitter e.g. why does one still has to write ... You don't have to at all. I haven't built with tree-sitter, since I haven't rebuilt since last week; (require 'eglot) works just fine here. > And for that matter, what does require do then in this context? It loads a "feature", which is nowadays often synonymous with a library. You can type in your Emacs: C-h f require RET If it is not clear after reading the docs what require does, come back and ask about unclear parts.
arthurno1 · 2022-11-23 15:37
You ned to load it first: (require 'eglot) will do it.
RepublicWorried · 2022-11-23 19:22
thanks so if I build latest master (emacs 29) I should have build-in eglot and tree-sitter + packages? according to [https://emacs-tree-sitter.github.io/installation/](https://emacs-tree-sitter.github.io/installation/) I did ​ Run M-x package-refresh-contents.Install tree-sitter and tree-sitter-langs packages. Load the framework and the language bundle: (require 'tree-sitter) (require 'tree-sitter-langs) ​ still dont understand why I need melpa if its built-in -.-
RepublicWorried · 2022-11-23 19:47
melpa seems to be necessary according to [https://emacs-tree-sitter.github.io/installation/](https://emacs-tree-sitter.github.io/installation/) but why do I need Melpa when its supposed to be built-in?
RepublicWorried · 2022-11-23 19:58
with Melpa I got it to run but the output with hl-mode enabled is not what I expected [\[!\[r.png\](https://i.postimg.cc/tgR6vXxr/r.png)\](https://postimg.cc/QFPVHZS5)](https://postimg.cc/QFPVHZS5) ​ I thought e.g. that the local variable currentTime would be the same color in the function scope?
arthurno1 · 2022-11-23 20:33
You don't need Melpa.
Illiamen · 2022-11-23 21:11
I think that's a different Emacs+Treesitter. There have been multiple attempts to use Treesitter with Emacs. One is that package. Another is included in Emacs 29. There have been others.
danderzei · 2022-11-23 21:15
Excellent - one line less in my config. In other words, you don't need anything if you only use ELPA.
holgerschurig · 2022-11-23 21:34
Your german word correction obfuscated your text :-) So clearly I deduce that you used a smartphone or tablet with built-in "Verschlimmbesserung"
RepublicWorried · 2022-11-23 21:40
and morning tiredness ;)
jamez5800 · 2022-11-24 08:19
It’s worth mentioning that the tree-sitter included in emacs29 is not the same as the tree-sitter package on melpa: https://emacs-tree-sitter.github.io/ Just like there are multiple LSP implementations for emacs (lsp-mode, eglot, lsp-bridge), there are multiple tree-sitter implementations. The one recently included in emacs was never a standalone package, I believe (correct me if that’s wrong), but was created with the purpose of being included in emacs. You will need melpa to download the linked elisp-tree-sitter package (https://github.com/emacs-tree-sitter/elisp-tree-sitter), but not the built in one. You do have to make sure you download/compile a very recent version of emacs to get the built in version. It also might not be worth using right now - I don’t think any major modes have been updated to using it yet (again, could be wrong here). But over time it will become more used.
RepublicWorried · 2022-11-24 08:28
thanks for clarifying. I just tried building on latest master commit and during config it says with tree-sitter = no nor sth like that. How can I enable it ?
meedstrom · 2022-11-24 15:29
It's very, /very/ recently built-in, documentation falls behind. You realize it was like two days ago they put it into the bleeding Emacs 29? Have you had any actual problem just calling `(require 'tree-sitter)`?
sweetyhoneybee · 2022-11-25 00:02
I think, depending on your Emacs version, even packages from nonGNU ELPA are available this way.
danderzei · 2022-11-25 02:00
I assume it depends on the contents of the `package-archives` variable.
jamez5800 · 2022-11-26 11:23
It’s been a while since I have built emacs by hand, but I think you might want to add —with-tree-sitter as a build flag. I think these are passed to the configure command, so something like ./configure —with-tree-sitter Might be what you want.