unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Aleksandar Dimitrov <code@aleks.bg>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62204@debbugs.gnu.org, Aleksandar Dimitrov <code@aleks.bg>
Subject: bug#62204: 30.0.50; Feature Request: treesit-major-mode-hook
Date: Sun, 19 Mar 2023 23:35:25 +0100	[thread overview]
Message-ID: <86ttygjrcm.fsf@aleks.bg> (raw)
In-Reply-To: <83fsa5qjyt.fsf@gnu.org>

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





  reply	other threads:[~2023-03-19 22:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 11:50 bug#62204: 30.0.50; Feature Request: treesit-major-mode-hook Aleksandar Dimitrov
2023-03-15 14:24 ` Eli Zaretskii
2023-03-16  0:35   ` Aleksandar Dimitrov
2023-03-16  6:38     ` Eli Zaretskii
2023-03-19 22:35       ` Aleksandar Dimitrov [this message]
2023-03-18  7:49 ` Yuan Fu
2023-03-19 22:26   ` Aleksandar Dimitrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86ttygjrcm.fsf@aleks.bg \
    --to=code@aleks.bg \
    --cc=62204@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).