unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Subject: mmaug@yahoo.com
Date: Sat, 28 May 2005 14:24:36 -0500 (CDT)	[thread overview]
Message-ID: <200505281924.j4SJOav09582@raven.dms.auburn.edu> (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}.
  
============================================================

             reply	other threads:[~2005-05-28 19:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-28 19:24 Luc Teirlinck [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200505281924.j4SJOav09582@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).