[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62204: 30.0.50; Feature Request: treesit-major-mode-hook
From: |
Aleksandar Dimitrov |
Subject: |
bug#62204: 30.0.50; Feature Request: treesit-major-mode-hook |
Date: |
Sun, 19 Mar 2023 23:35:25 +0100 |
User-agent: |
mu4e 1.8.14; emacs 30.0.50 |
Hi Eli,
Eli Zaretskii <eliz@gnu.org> writes:
> Something like that. Basically, any function that wants to do
> something that depends on tree-sitter being available for the major
> mode should make such a test to determine whether tree-sitter support
> is available.
As mentioned in the other email to Yuan Fu, my goal was to avoid such a check,
and
only install those functions that depend on treesitter when treesitter
was available. The reason is less performance-driven and more about my
subjective goal to avoid cluttering functions with conditionals whenever
possible.
> They are, but they are not the only such place. Many features in
> Emacs use buffer-local variables and keybindings without a special
> hook.
>
> Please also keep in mind that proliferation of general-purpose hooks
> is not without disadvantages. For starters, a hook disconnects the
> cause from the effect, and makes it harder to track the control flow
> and thus harder to understand how a given Lisp program works.
I agree that hooks add indirection. They were the first tool I pulled
out of my (very limited) Emacs toolbox, because I'm very used to working
with them.
But if such a hook isn't desirable in the grand scheme of things, that's
OK! There are certainly viable alternatives.
Thanks for taking your time to explain this.
Aleks