bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68824: treesitter support for outline-minor-mode


From: john muhl
Subject: bug#68824: treesitter support for outline-minor-mode
Date: Tue, 30 Jan 2024 12:46:50 -0600

Juri Linkov <juri@linkov.net> writes:

> Tags: patch
>
> 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 for working on this. It works well with lua-ts-mode too.
If you want you can add the diff to your patch.

diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el
index 05a3ff6d7c6..dc2a8fcec1e 100644
--- a/lisp/progmodes/lua-ts-mode.el
+++ b/lisp/progmodes/lua-ts-mode.el
@@ -774,7 +774,7 @@ lua-ts-mode
                                       "vararg_expression"))))
                    (text "comment"))))
 
-    ;; Imenu.
+    ;; Imenu/Outline.
     (setq-local treesit-simple-imenu-settings
                 `(("Requires"
                    "\\`function_call\\'"
@@ -789,15 +789,5 @@ lua-ts-mode
     ;; Which-function.
     (setq-local which-func-functions (treesit-defun-at-point))
 
-    ;; Outline.
-    (setq-local outline-regexp
-                (rx (seq (0+ space)
-                         (or (seq "--[[" (0+ space) eol)
-                             (seq symbol-start
-                                  (or "do" "for" "if" "repeat" "while"
-                                      (seq (? (seq "local" (1+ space)))
-                                           "function"))
-                                  symbol-end)))))
-
     ;; Align.
     (setq-local align-indent-before-aligning t)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]