GNU bug report logs -
#78402
treesit after-change-functions
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Tue, 13 May 2025 06:34:02 UTC
Severity: normal
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #44 received at 78402 <at> debbugs.gnu.org (full text, mbox):
> On Jun 3, 2025, at 8:29 AM, Juri Linkov <juri <at> linkov.net> wrote:
>
>>>>> @@ -4064,6 +4065,7 @@ treesit-outline-search
>>>>> "Search for the next outline heading in the syntax tree.
>>>>> For BOUND, MOVE, BACKWARD, LOOKING-AT, see the descriptions in
>>>>> `outline-search-function'."
>>>>> + (treesit--pre-redisplay)
>>>>> (if looking-at
>>>>> (when (treesit-outline--at-point) (pos-bol))
>>>>
>>>> Alas, the same error:
>>>
>>> Gah! Sorry, I don’t have time to properly look into this right now. But I’ll try to find some time as soon as possible (pinky promise).
>>
>> Hi Juri, how did you produce this error? I tried to use the
>> liquid-generic-ts-mode example in bug#77256 but that didn’t trigger
>> the error.
>
> You can produce this error by visiting test/manual/indent/html-multi.html
> with enabled liquid-generic-ts-mode, then delete the word "script"
> (outside of comments).
Hmm, not sure what I’m doing wrong but I still can’t trigger the error. I’m using emacs -q, with Stefan’s patch, enabled liquid mode and outline-minor-mode, and deleted the <script> tag on line 19. Any ideas?
>
>> BTW, I noticed that when tree-sitter-provided outline is in effect,
>> pressing tab on the lines determined as outline titles—like first line
>> of a defun—toggles folding instead of indenting the code. That feels
>> intrusive IMHO. It’s not a problem for “traditional” kind of outline
>> headers in comments, but code is another story.
>>
>> Take this code as example:
>>
>> function MyBigFunc(param1
>> param2) {
>> const abc = 'def';
>> function embed() {
>> return true;
>> }
>> }
>>
>> Right now I can’t indent the embed function, because pressing TAB
>> folds it. Another common practice is to select the whole MyBigFunc
>> function and press TAB to indent everything in the region, that
>> wouldn’t work if point happens to be on the first line, which is
>> common.
>
> Indeed, there is a clash between TAB keybindings.
> So to address this ambiguity we created a special option
> 'outline-minor-mode-cycle-filter' that defines in what context
> TAB should fold outlines. For example, you can customize:
>
> (setopt outline-minor-mode-cycle-filter (lambda () (bolp)))
>
> Then TAB will fold only when pressed at the beginning of the line.
> Anywhere else TAB will indent the line.
Thanks. Digging further, I’m only hitting this problem because I have outline-minor-mode-cycle set to t. So technically with default settings, one wouldn’t have this problem.
But I can’t be the only one that sets outline-minor-mode-cycle to t, expecting to only cycle outline sections in comments. Can we do something to prevent people tripping on this? Maybe change the default value of outline-minor-mode-cycle-filter to exclude code?
Yuan
This bug report was last modified today.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.