GNU bug report logs -
#74412
31.0.50; Treesit-outline conflict with outli in Emacs 31
Previous Next
Reported by: Taka Obsid <liaotx2 <at> gmail.com>
Date: Mon, 18 Nov 2024 05:05:03 UTC
Severity: normal
Found in version 31.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #67 received at 74412 <at> debbugs.gnu.org (full text, mbox):
> The above is my use of outline-minor-mode, maybe other people have
> different use cases. treesit.el makes the configuration harder by the
> additional variable setting. I wish there's a hook like
> treesit-after-major-mode-setup-hook to let people fine-tune or even undo
> settings, but of course treesit-disable-features to prevent any
> execution from the start is still better.
If a ts-mode doesn't allow using a hook to override
mode's default settings, this would be a serious limitation.
But does such a limitation really exist?
It seems there is no need to add treesit-after-major-mode-setup-hook,
since I see no problem with using the existing hooks.
For example, such customization correctly overrides outline settings
for both non-ts and ts-modes:
;; non-ts
(add-hook 'ruby-base-mode-hook
(lambda ()
;; Add more Rails spec keywords
(setq-local outline-regexp
(concat "^\\s *"
(regexp-opt '("module" "class" "def" "private"
"describe" "feature" "context" "before" "after"
"it" "fit" "xit"))
"\\_>"))))
;; same for ts-mode
(add-hook 'ruby-ts-mode-hook
(lambda ()
;; Add more Rails spec keywords
(setq-local
treesit-outline-predicate
(lambda (node)
(or (string-match-p
(rx bos (or "module"
"class"
"singleton_class"
"method"
"singleton_method"
"alias")
eos)
(treesit-node-type node))
(and (equal (treesit-node-type node) "call")
(if-let ((method (treesit-node-child-by-field-name
node "method")))
(string-match-p
(rx bos (or "describe"
"feature"
"context"
"before"
"after"
"it"
"fit"
"test")
eos)
(treesit-node-text method)))))))))
This bug report was last modified 237 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.