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

Previous Next

Package: emacs;

Reported by: Mickey Petersen <mickey <at> masteringemacs.org>

Date: Sat, 21 Sep 2024 05:13:01 UTC

Severity: normal

Merged with 74366

Found in version 30.0.50

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 #244 received at 73404 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
Cc: Theodor Thornhill <theo <at> thornhill.no>, Eli Zaretskii <eliz <at> gnu.org>,
 Mickey Petersen <mickey <at> masteringemacs.org>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 73404 <at> debbugs.gnu.org
Subject: Re: bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not
 behave as expected in tree-sitter modes
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 ;-)




This bug report was last modified 131 days ago.

Previous Next


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