Closed sorawee closed 9 months ago
Yeah, my initial reaction when I was reviewing things was too hasty: I saw the list of racket-lang special form names like cond
and match
-- as well as the whole paren vs. bracket distinction --- and decided "welp, that's super specific to racket-lang, definitely not generic hash-lang stuff: disable".
But I should relax the guard, so that people may enable it for racket-hash-lang-mode
as well as racket-mode
, if they want.
One tip here:
Someone could use racket-hash-lang-mode-hook
to enable racket-smart-open-bracket-mode
always. Then it could be enabled even for langs like rhombus
which would obviously be weird. [Maybe harmless (?) but weird. I don't know if DrRacket allows this intentionally, or it's an oversight or someday-to-do.]
Better: Instead use racket-hash-lang-module-language-hook
to enable racket-smart-open-bracket-mode
IFF the module language is on some whitelist they supply, including racket
.
That's pretty much the role of that hook -- instead of an unconditional mode hook, it's a kind of "sub-mode" or "conditional" mode hook. It's called when the user changes the #lang
line enough to matter. So much config in Emacs is centered around the idea of the major-mode and mode hooks. But racket-hash-lang-mode
is a kind of meta-mode, so the module-language hook is needed, too.
(Ideally the #lang
spec would cover everything, but the Emacs ecosystem is rich and there are simply always going to be config scenarios that need to be handled in Emacs. (Also in some cases the hook might be a work-around, until something is added to the #lang
spec proper.))
Having said all that, I have no idea how this hook fits in with Doom Emacs configuration mechanisms and assumptions (as in #669). Hopefully OK... ish...?
TL;DR, I'll:
racket-smart-open-bracket-mode
: prefer the module-language hook (over the mode hook).
It currently doesn't work, because of https://github.com/greghendershott/racket-mode/blob/master/racket-smart-open.el#L56.
But does it make sense to add its support anyway, just like what DrRacket does?