unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mmaug@yahoo.com
@ 2005-05-28 19:24 Luc Teirlinck
  2005-05-29 12:04 ` mmaug@yahoo.com Richard Stallman
  2005-05-29 13:40 ` mmaug@yahoo.com Stefan Monnier
  0 siblings, 2 replies; 6+ messages in thread
From: Luc Teirlinck @ 2005-05-28 19:24 UTC (permalink / raw)


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}.
  
============================================================

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-05-30 21:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-28 19:24 mmaug@yahoo.com Luc Teirlinck
2005-05-29 12:04 ` mmaug@yahoo.com Richard Stallman
2005-05-29 13:40 ` mmaug@yahoo.com Stefan Monnier
2005-05-29 16:57   ` mmaug@yahoo.com Luc Teirlinck
2005-05-30 21:08     ` mmaug@yahoo.com Stefan Monnier
2005-05-29 17:21   ` Wrong subject (Re: mmaug@yahoo.com) Luc Teirlinck

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).