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

From: Juri Linkov <[email-masked]>
Date: Tue, 07 Jan 2025 19:56:11 +0200

>>> I admit that hard-coding one symbol is not the right thing to do.
>>> So here is a better patch that checks for the symbol property:
>> 
>> That's better but I still wonder why we don't want to use a keyword.
>
> My impression is that Elisp has “traditionally” used symbols?  Like
> symbol properties, text properties, thing-at-point, etc.  Keywords are
> really only seen in plists, face attributes, and keyword arguments,
> all of which involves a key-value relationship.

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 ;-)