Subject: bug#73557: closed (Re: bug#73557: c-ts-mode 'emacs-c broken with treesit-load-name-override-list)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 30 Sep 2024 14:11:02 +0000

Your bug report

#73557: c-ts-mode 'emacs-c broken with treesit-load-name-override-list

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73557: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73557
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73557: c-ts-mode 'emacs-c broken with treesit-load-name-override-list
From: Eli Zaretskii <[email-masked]>
To: Ship Mints <[email-masked]>
Cc: [email-masked]
Date: Mon, 30 Sep 2024 17:10:11 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Ship Mints <[email-masked]>
> Date: Mon, 30 Sep 2024 08:51:41 -0400
> Cc: [email-masked]
> 
> Please close. If this comes up for other Emacs 29 users, a workaround is as I did: use a symlink.

Thanks, closing.

Subject: c-ts-mode 'emacs-c broken with treesit-load-name-override-list
From: Ship Mints <[email-masked]>
To: [email-masked]
Date: Sun, 29 Sep 2024 15:08:29 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

The c-ts-mode "fake" emacs-c grammar does not work in the presence of a 'c
grammar provided in treesit-load-name-override-list.

For example, I set this override to point to my treesitter c grammar which
uses the file name "c.dylib" on Mac, not "tree_sitter_c.dylib":

(add-to-list 'treesit-load-name-override-list '(c "c" "tree_sitter_c"))

c-ts-mode says:
(define-derived-mode c-ts-mode c-ts-base-mode "C"
...
    (setf (alist-get 'emacs-c treesit-load-name-override-list)
          '("libtree-sitter-c" "tree_sitter_c"))

I think this code should first look for the 'c grammar in
'treesit-load-name-override-list before setting a hard-coded file name that
may not work for everyone.

I can get around this, temporarily, by setting a symlink from c.dylib to
libtree-sitter-c.dylib. It took a while to figure out what was going on,
though. This is surely going to confuse other people.

Thank you,

Stephane