Subject: bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes

From: Stefan Monnier <[email-masked]>
Date: Tue, 07 Jan 2025 14:25:24 -0500

> Indeed, symbols are more traditional.
>
> However, the problem arose only because
> 'treesit_traverse_validate_predicate' accepts a symbol
> for both a function and a thing, that caused ambiguity.
>
> So there are two variants to resolve this ambiguity:
>
> 1. use keywords like
>
>   (setq-local treesit-thing-settings
>               `((html
>                  (:sexp ,(regexp-opt '("element" "text" "attribute" "value")))
>                  (:list ,(regexp-opt '("element"")))
>                  (:sentence "tag")
>                  (:text ,(regexp-opt '("comment" "text"))))))
>
> 2. use a symbol property like (put 'list 'treesit-thing t)
>
> You decide ;-)

Of course, there are more alternatives:

- Use a symbol property like (put 'list 'treesit--this-is-a-function t)
- Refuse functions represented as symbols (callers need to use an
  eta-wrapper).
- Distinguish the two cases via a more verbose representation like
  `(thing list)` vs `(function list)`.
- Use a string rather than a symbol.
- <I'm sure you can come up with more options>

        Stefan