GNU bug report logs - #60453
29.0.60; treesit-range-rules throw an error without tree-sitter

Previous Next

Package: emacs;

Reported by: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>

Date: Sat, 31 Dec 2022 15:01:02 UTC

Severity: normal

Found in version 29.0.60

Full log


Message #8 received at 60453 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
Cc: 60453 <at> debbugs.gnu.org
Subject: Re: bug#60453: 29.0.60;
 treesit-range-rules throw an error without tree-sitter
Date: Sat, 31 Dec 2022 18:37:55 +0200
> From: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
> Date: Sat, 31 Dec 2022 16:53:08 +0200
> 
> 
> With the following code without tree-sitter library:
> 
> (defvar elixir-ts-mode--treesit-range-rules
>   (treesit-range-rules
>    :embed 'heex
>    :host 'elixir
>    '((sigil (sigil_name) @name (:match "^[H]$" @name) 
>    (quoted_content)
>   @heex))))
> 
> upon loading the mode I get the following error:
> 
> treesit-range-rules: Symbol’s function definition is void:
> treesit-query-compile
> 
> This can easily be mitigated with (when (treesit-available-p)...)
> but think it should function similar to how (treesit-font-lock-rules
> work.

Why does it make sense to protect treesit.el's code with
treesit-available-p?  You aren't supposed to use treesit.el functions
when the tree-sitter library is not available.  IOW, Lisp programs
that want to use treesit-range-rules and other functions from
treesit.el should make the treesit-available-p test _before_ that.




This bug report was last modified 2 years and 246 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.