]> git.eshelyaron.com Git - emacs.git/commit
Hideshow support for tree-sitter in hs-minor-mode (bug#75609)
authorJuri Linkov <juri@linkov.net>
Tue, 28 Jan 2025 19:07:16 +0000 (21:07 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 30 Jan 2025 18:12:39 +0000 (19:12 +0100)
commit65a0e2071ac25c9d536c286fde9375e942030fc9
tree2c7e28d64709ebd060b13a2544d730de5766944b
parentacd68c0133c09659ccbbd55fc190f03047e32f41
Hideshow support for tree-sitter in hs-minor-mode (bug#75609)

* lisp/progmodes/hideshow.el (hs-inside-comment-p-func):
New buffer-local variable.
(hs-hide-block-at-point): Check if 'hs-block-end-regexp' is
a string or a function.
(hs-inside-comment-p): Move body to 'hs-inside-comment-p--default'.
Call 'hs-inside-comment-p-func' if it's a function.
(hs-inside-comment-p--default): New function with body from
'hs-inside-comment-p'.
(hs-hide-all): Don't use 'hs-block-start-regexp' when it's not a string.
(hs-minor-mode): Don't call 'hs-grok-mode-type' when
'hs-inside-comment-p-func' already has a buffer-local value.

* lisp/treesit.el (treesit-hs-block-end)
(treesit-hs-find-block-beginning, treesit-hs-find-next-block)
(treesit-hs-looking-at-block-start-p)
(treesit-hs-inside-comment-p): New functions.
(treesit-major-mode-setup): Set hs-minor-mode buffer-local variables.

(cherry picked from commit 2e3b085d447bc2cd1a0e779145be9cab9a15d7af)
lisp/progmodes/hideshow.el
lisp/treesit.el