[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: outline-mode treesitter support?
From: |
Juri Linkov |
Subject: |
Re: outline-mode treesitter support? |
Date: |
Wed, 10 Jan 2024 09:19:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
>>> OK, one way to extract treesit information for outline-minor-mode is by
>>> using
>>> ‘treesit-simple-imenu’ because outline headings should correspond to imenu
>>> entries.
>>
>> I don't know if this is a good idea, but with
>>
>> (setq-local outline-search-function #'outline-search-imenu
>> outline-level (lambda () 1))
>>
>> this should do the trick:
>>
>> (defun outline-search-imenu (&optional bound move backward looking-at)
>> (unless imenu--index-alist
>> (imenu--make-index-alist))
>> (let* ((imenu-index (cdar imenu--index-alist))
>> [...]
>
> Thanks for the example!
After trying to use this, I came to conclusion that imenu--index-alist
is unsuitable for outline-minor-mode because imenu has a different
hierarchy than the source files, so outline-level can be only 1.
But without different levels for outline-level it's quite useless.
However, in the opposite direction mapping the outline hierarchy
to imenu is possible, and outline-imenu-generic-expression
does this, but only to a flat list that is sorted alphabetically.
- Re: outline-mode treesitter support?,
Juri Linkov <=