Subject: Re: 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: Wed, 25 Dec 2024 14:29:19 -0500

>> Gentle reminder that `forward-sexp` is not a "list-navigation" function.
>> That would be `forward-list`.  We very often use sexp commands and
>> functions to manipulate non-lists such as identifiers.
> Do you think it would be better to override low-level functions 'scan-lists'
> and 'scan-sexps' with new variables like 'scan-lists-function'
> and 'scan-sexps-function', instead of adding more variables for
> overriding top-level commands such as a new variable 'forward-list-function'
> and 'down-list-function', like the existing 'forward-sexp-function'?

Don't know.

What I do know is that in general we'd also want an `up-sexp` operation.
Currently we have an ugly kludge in `up-list` to try and use
`forward-sexp-function` (which is ugly both because
`forward-sexp-function` doesn't really provide the functionality we
need, and because it mixes up sexp and list navigation), and it would be
good to clean it up.

AFAIK `up-list` is the only place where I've needed sexp-based
navigation and where `forward-sexp-function` didn't do the job.
In theory I guess `down-list` is another, but I've never found a use
for it.

        Stefan