Make origami-treesit a proper minor mode
This commit is contained in:
parent
d46352276a
commit
650a90b812
@ -114,6 +114,7 @@
|
||||
:ensure nil
|
||||
:load-path "packages/origami-treesit"
|
||||
:after origami
|
||||
:hook (origami-mode . origami-treesit-mode)
|
||||
:custom
|
||||
(origami-treesit-level 4))
|
||||
|
||||
|
@ -199,11 +199,25 @@
|
||||
(child-nodes (list value)))
|
||||
(list start end offset child-nodes)))))))
|
||||
|
||||
(with-eval-after-load 'origami
|
||||
(add-to-list 'origami-parser-alist '(yaml-ts-mode . origami-yaml-treesit-parser))
|
||||
(add-to-list 'origami-parser-alist '(yaml-mode . origami-yaml-treesit-parser))
|
||||
(add-to-list 'origami-parser-alist '(ruby-ts-mode . origami-ruby-treesit-parser))
|
||||
(add-to-list 'origami-parser-alist '(ruby-mode . origami-ruby-treesit-parser)))
|
||||
(defvar origami-treesit-parser-alist
|
||||
'((yaml-ts-mode . origami-yaml-treesit-parser)
|
||||
(yaml-mode . origami-yaml-treesit-parser)
|
||||
(ruby-ts-mode . origami-ruby-treesit-parser)
|
||||
(ruby-mode . origami-ruby-treesit-parser))
|
||||
"Alist mapping major-mode to origami-treesit parser function.")
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode origami-treesit-mode
|
||||
"Minor mode for folding code using tree-sitter."
|
||||
:group 'origami
|
||||
:lighter nil
|
||||
:init-value nil
|
||||
(if origami-treesit-mode
|
||||
(setq-local origami-parser-alist
|
||||
(append origami-treesit-parser-alist origami-parser-alist))
|
||||
(setq-local origami-parser-alist
|
||||
(-difference origami-parser-alist origami-treesit-parser-alist))))
|
||||
|
||||
|
||||
(provide 'origami-treesit)
|
||||
;;; origami-treesit.el ends here
|
||||
|
Loading…
Reference in New Issue
Block a user