Stefan Monnier wrote:

   While I think that org-mode should use define-derived-mode, I'm wondering
   why it's a problem that after-change-major-mode-hook is run at the
   wrong time.

Because users of after-change-major-mode-hook should be able to rely
on the fact that it is run at the very end of the mode.  Hooks should
be run as documented.

>From `(elisp)Mode Hooks':

 -- Variable: after-change-major-mode-hook
     Every major mode function should run this normal hook at its very
     end.  It normally does not need to do so explicitly.  Indeed, a
     major mode function should normally run its mode hook with
     `run-mode-hooks' as the very last thing it does and
     `run-mode-hooks' runs `after-change-major-mode-hook' at its very
     end.


   After all, such manual mode derivation (without using
   define-derived-mode) is pretty common, so if there's a problem with it, we
   should fix it.

I believe that we plan to eventually make all modes run
`after-change-major-mode-hook', usually as a byproduct of making them
run their mode hook with `run-mode-hooks'.  If we see one that does
not, we fix it.  In the meantime, if we use `after-change-mode-hook'
in a very general way, we need some fallback for modes that do not yet
use it.

Sincerely,

Luc.


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to