[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
address@hidden
From: |
Luc Teirlinck |
Subject: |
address@hidden |
Date: |
Sat, 28 May 2005 14:24:36 -0500 (CDT) |
There appear to be several derived modes that do not yet properly
enclose the call to the parent mode in a delay-mode-hooks form.
Examples include sql-interactive-mode, inferior-emacs-lisp-mode and
inferior-lisp-mode.
Currently, we recommend to put the call to delay-mode-hooks around the
entire body, excluding the final call to run-mode-hooks. That is what
define-derived-mode does. It is strictly speaking the safest, just in
case anything else (except for the parent mode) should run a mode hook.
But that should really not happen. So it should be sufficient to
enclose the call to the parent mode inside a delay-mode-hooks form,
which results in less deeply nested code.
I will take care of inferior-emacs-lisp-mode, inferior-lisp-mode and
any other modes I find (although I will leave sql-interactive-mode to
Michael), once I know how we want to handle them. We could make them
all use define-derived-mode, but that has to be done carefully and has
the potential of introducing bugs. Enclosing stuff in a
delay-mode-hooks form is routine, especially if it is only the parent
mode that needs to be enclosed. This is important, as there may be
_many_ such modes.
So what do we do: insist on converting to define-derived-mode, using
delay-mode-hooks around the entire body except final call to
run-mode-hooks, or use delay-mode-hooks only around the call to the
parent mode?
If we decide on the latter, we could also make the following change to
modes.texi:
===File ~/modes.texi-diff===================================
*** modes.texi 23 May 2005 10:25:40 -0500 1.109
--- modes.texi 28 May 2005 14:06:53 -0500
***************
*** 437,446 ****
command (called the @dfn{parent mode}) and then alter some of its
settings. A mode that does this is called a @dfn{derived mode}. The
recommended way to define one is to use @code{define-derived-mode},
! but this is not required. Such a mode should use
! @code{delay-mode-hooks} around its entire body (including the call to
! the parent mode command) @emph{except} for the final call to
! @code{run-mode-hooks}, which runs the derived mode's hook. (Using
@code{define-derived-mode} does this automatically.) @xref{Derived
Modes}, and @ref{Mode Hooks}.
--- 437,444 ----
command (called the @dfn{parent mode}) and then alter some of its
settings. A mode that does this is called a @dfn{derived mode}. The
recommended way to define one is to use @code{define-derived-mode},
! but this is not required. Such a mode should call the parent mode
! command inside a @code{delay-mode-hooks} form. (Using
@code{define-derived-mode} does this automatically.) @xref{Derived
Modes}, and @ref{Mode Hooks}.
============================================================
- address@hidden,
Luc Teirlinck <=