GNU bug report logs - #77906
31.0.50; php-js-mode and js-ts-mode: treesit-show-paren-data--categorize: peculiar error: ("Cannot find the definition of the predicate in `treesit-thing-settings'" list)

Previous Next

Package: emacs;

Reported by: Vincenzo Pupillo <v.pupillo <at> gmail.com>

Date: Fri, 18 Apr 2025 18:58:05 UTC

Severity: normal

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


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

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Vincenzo Pupillo <v.pupillo <at> gmail.com>, 77906 <at> debbugs.gnu.org
Subject: Re: bug#77906: 31.0.50; php-js-mode and js-ts-mode:
 treesit-show-paren-data--categorize: peculiar error: ("Cannot find the
 definition of the predicate in `treesit-thing-settings'" list)
Date: Wed, 23 Apr 2025 19:55:34 +0300
> Now added this docstring to the internal function
> 'treesit-show-paren-data--categorize':
>
>     "Return a list suitable for `show-paren-data-function' (which see).
>   If the optional argument END-P is non-nil, interpret the position POS
>   as belonging to the node that ends before POS (by subtracting 1 from POS)."
>
> I guess more functions will need such flag, e.g. 'backward-sexp'
> at the end of the range doesn't skip to the embedded node's start.

This patch is not for immediate installation, but
it demonstrates how this problem can be fixed:

  diff --git a/lisp/treesit.el b/lisp/treesit.el
  index bf5c1ed5f6c..c73b380f38c 100644
  --- a/lisp/treesit.el
  +++ b/lisp/treesit.el
  @@ -869,7 +869,7 @@ treesit-parsers-at
     (let ((res nil))
       ;; Refer to (ref:local-parser-overlay) for more explanation of local
       ;; parser overlays.
  -    (dolist (ov (overlays-at (or pos (point))))
  +    (dolist (ov (overlays-at (1- (or pos (point)))))
         (when-let* ((parser (overlay-get ov 'treesit-parser))
                     (host-parser (or (null with-host)
                                      (overlay-get ov 'treesit-host-parser)))

With this patch the following case works correctly in test.heex:

  <%= if true do %>
    <p>hello, tree-sitter!</p>
  <% end| %>

With point at "|" the command 'backward-sexp' (C-M-b)
correctly jumps to the beginning of "if".




This bug report was last modified 5 days ago.

Previous Next


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