[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Plug treesit.el into other emacs constructs
From: |
Theodor Thornhill |
Subject: |
Re: Plug treesit.el into other emacs constructs |
Date: |
Wed, 28 Dec 2022 10:26:48 +0100 |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I think I managed to keep the semantics as they are now. What do you
>> think? Does this seem like a sane approach?
>
> Yes, LGTM. See nitpicks below.
>
>> +** New function 'treesit-trnspose-sexps'
> ^^
> a
>
>> +(defvar-local transpose-sexps-function
>
> I'd keep it a plain `defvar`.
>
>> + "If non-nil, `transpose-sexps' delegates to this function.
>> +
>> +This function takes one argument ARG, a number as provided
>> +through running `transpose-sexps'. Its expected return value is
>> +a position pair, which is a cons (BEG . END), where BEG and END
>> +are buffer positions.")
>
> The ARG is not quite the same as the one passed to `transpose-sexps`.
> I think we should say something like ".. ARG, a number. Its expected
> return value is a pair of positions (BEG . END) delimiting the ARGth
> sibling".
>
> The rest looks great, thanks.
>
>
Something like this?
If you're ok with this, maybe you can install for me, as I can't? Then I
can close the relevant bugreport.
Oh, and one more thing. There is a bug in in 'transpose-subr' in the
case where (> arg 0). Transpose-subr-1 makes an effort to swap the
conses around so that we have ranges that makes sense. However, the
case in question then unconditionally jumps to (car pos2), which would
be the wrong position. Either we need to change that, or add something
like this to the docstring for the MOVER function:
```
The MOVER function is expected to return its conses in different
orders. if `forward-word' is used for the mover function the
conses will be like this, where the number is the order the
position is calculated ('|' is where point is initially):
first| second
^ ^ ^ ^
(2 . 1) (4 . 3)
```
What do you think? I'll open a bug report for it if the docstring isn't
enough.
Theo
0001-Add-treesit-transpose-sexps-bug-60128.patch
Description: Text Data
- Re: Plug treesit.el into other emacs constructs, (continued)
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/24
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/24
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/26
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/26
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/26
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/27
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/27
- Re: Plug treesit.el into other emacs constructs,
Theodor Thornhill <=
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/28
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/28
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/26
- Re: Plug treesit.el into other emacs constructs, Lynn Winebarger, 2022/12/27
- Re: Plug treesit.el into other emacs constructs, Yuan Fu, 2022/12/14
- Re: Plug treesit.el into other emacs constructs, Yuan Fu, 2022/12/14
- Re: Plug treesit.el into other emacs constructs, Eli Zaretskii, 2022/12/15
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/15
- Re: Plug treesit.el into other emacs constructs, Stefan Monnier, 2022/12/14
- Re: Plug treesit.el into other emacs constructs, Theodor Thornhill, 2022/12/15