>> As discussed on https://lists.gnu.org/archive/html/emacs-devel/2024-01/msg00916.html >> here is the patch that adds the support for outline-minor-mode to treesit.el. >> It has been tested on c-ts-mode, dockerfile-ts-mode, elixir-ts-mode, heex-ts-mode, >> java-ts-mode, js-ts-mode, typescript-ts-mode, css-ts-mode, html-ts-mode, toml-ts-mode. > > Thanks, but shouldn't this minor mode be documented more prominently > in the Emacs user manual, now that there are so many major modes that > support it? And since major modes that want to support it have to set > up its support, I would say the ELisp manual should document that > setup. > > IOW, it makes little sense to make this minor mode more and more > prolific in Emacs, and still have almost nothing about it in our > manuals. I agree. Also could add corresponding menu item to the global menu-bar, or at least to menus of major modes deriving from prog-mode/text-mode. >> +(defvar-local treesit-outline-predicate nil >> + "Predicate used to find outline headings in a sparse tree. > > How do "sparse trees" enter the scene here? AFAICS, "sparse trees" is > mentioned only once in the entire chapter dedicated to Tree Sitter > support in the ELisp manual. Is it important to mention here the fact > that the tree is sparse? Actually I realized now there is no need to use sparse trees here. Below is a new implementation that directly traverses the syntax tree. This implementation is much better than sparse trees because sparse trees can be created only once when the file is visited, but when the buffer is modified it takes too much time to regenerate sparse trees completely after every change. So a new implementation below uses the search on the syntax tree that is much faster to do after every buffer modification. >> diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el >> + ;; Outline minor mode >> + ;; Restore default value for `treesit-outline-search'. >> + (kill-local-variable 'outline-regexp) >> + (kill-local-variable 'outline-heading-end-regexp) >> + (kill-local-variable 'outline-level) > > This mode seems to do something to support outline-minor-mode that is > not mentioned in the NEWS entry, and neither is treesit-outline-search. This just disables outline settings inherited from html-mode. I will add more explanations. Here is a new patch with a shorter implementation. And I will send a complete patch with documentation changes later.