Subject: bug#35351: 27.0.50; Enable derived modes to run their own very-early 'change-major-mode-hook' code

From: Stefan Monnier <[email-masked]>
Date: Mon, 22 Apr 2019 10:39:24 -0400

> Yes, I think I like that least of all -- having the macro set up
> everything based on a different name to the mode that people are
> expected to be using just seems wrong to me.

I tend to view this as the fact that those "modes" should distinguish
between the mode and the command that invokes it, because that command
does more than setup the mode (e.g. it arranges to be able to go back
to the earlier modes).

E.g. in your case the mode could be called `so-long-mode` and the
command to enter it could be `so-long`.

> I'm now unsure whether :after-hook was intended to be interpreted
> as "this is a bit like a *hook* which runs *after* everything
> else has happened"; or if it meant "do this thing *after* the
> mode *hook*" (or indeed after after-change-major-mode-hook).

Oh, you're absolutely right, it's called ":after-hook" because it runs
after the mode-hook.

> In the initial commit I've used an approach which will run the
> parent's :before-hook

That seems backward to me.

> Possibly it should be child-before-parent on the basis that the
> author then has more influence over the order in which things
> happen?

Exactly.

        Stefan