unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Difficulty building tree-sitter grammars [was: Help sought from C++ expert: ....]
Date: Thu, 19 Jan 2023 20:56:13 +0000	[thread overview]
Message-ID: <Y8mubWj6GHxTRUIA@ACM> (raw)
In-Reply-To: <83tu0mo1ft.fsf@gnu.org>

Hello, Eli.

On Thu, Jan 19, 2023 at 19:53:58 +0200, Eli Zaretskii wrote:
> > Date: Thu, 19 Jan 2023 17:14:43 +0000
> > Cc: emacs-devel@gnu.org
> > From: Alan Mackenzie <acm@muc.de>

> > > > Just as a matter of interest, in c++-ts-mode a treesit-query-error gets
> > > > thrown.

> > > I don't see any such error.  Maybe this is again your outdated grammar
> > > library?

> > Heh!  Maybe you're right.  So time to get around to installing one from
> > github.  So I look at the Emacs-29 NEWS for instructions on how to do
> > this.  These instructions are glib and insufficiently helpful.

> Nothing is ever good enough, eh?

Emacs isn't good enough.  That's why we're continually working on it.
;-)

[ .... ]

> If you don't know how to do this given what's in NEWS, then I'm sorry,
> but these instructions are not for you.  You will have to wait until
> someone else (your distro?) produces the grammar library and lets you
> download and install it like you download and install all the image
> libraries and the rest of the optional stuff for Emacs.

> I'm not going to make NEWS a step-by-step tutorial for how to compile
> a bunch of files into a shared library.  That is too much to expect
> from us.  It is NOT our job to teach people how to do that.

Believe it or not, I've never built a shared library in my life (aside
from invoking makefiles) and I'm sure I'm far from being alone.

> > (iv) Then we have precise instructions on where to put the newly built
> > ..so file.  This is good!

> This is the only part that is specific to Emacs, so I deliberately
> included there all the details, since you are unlikely to find it
> elsewhere.

> > This process has so far taken me over an hour, which is too long for
> > something which should be purely routine.  It is likely to take a
> > typical Emacs user even longer.

> Typical Emacs users who don't know how to build libraries from sources
> will need someone else to do the job for them.  Exactly like they do
> with GMP or librsvg or HarfBuzz or any other library that Emacs can
> link against.  Eventually, there's no way around this.

These libraries come with makefiles, so there is no need to get into the
details of how to build them.

> > I suggest that these instructions in NEWS should be enhanced with (i)
> > Tips on downloading stuff from github; (ii) A sample command line for
> > compiling the C/C++ source files; (iii) A sample command line for
> > linking these to the needed .so file.  Possibly two or three versions of
> > these would be needed for the different environments Emacs runs in.

> Sorry, but NO!!

At Dmitry pointed out, it turns out there's a makefile-equivalent for
these grammar libraries, namely treesit-install-language-grammar.  This
worked well for me.

Why is it not mentioned first in NEWS, something like "Typically you can
build and install a grammar with ....." followed by "To build a grammar
outside of Emacs ..." and the description of compiling linking and so on?
Then I would have seen it, and the noise of this thread would have been
avoided.  Again, I doubt I'm the only user who'll not see past the end of
a first unconditional instruction.

-- 
Alan Mackenzie (Nuremberg, Germany).



  reply	other threads:[~2023-01-19 20:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-19 14:53 Help sought from C++ expert: is this `value' a type or something else (what)? Alan Mackenzie
2023-01-19 14:59 ` Eli Zaretskii
2023-01-19 17:14   ` Difficulty building tree-sitter grammars [was: Help sought from C++ expert: ....] Alan Mackenzie
2023-01-19 17:53     ` Dmitry Gutov
2023-01-19 18:06       ` Eli Zaretskii
2023-01-19 18:16         ` Dmitry Gutov
2023-01-19 17:53     ` Eli Zaretskii
2023-01-19 20:56       ` Alan Mackenzie [this message]
2023-01-20  6:44         ` Eli Zaretskii
2023-01-19 15:41 ` Help sought from C++ expert: is this `value' a type or something else (what)? Michael Welsh Duggan
2023-01-21 14:34   ` Alan Mackenzie
2023-01-19 16:22 ` Óscar Fuentes
2023-01-21 14:59   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8mubWj6GHxTRUIA@ACM \
    --to=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).