From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: mmaug@yahoo.com Date: Sat, 28 May 2005 14:24:36 -0500 (CDT) Message-ID: <200505281924.j4SJOav09582@raven.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1117308416 32602 80.91.229.2 (28 May 2005 19:26:56 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 28 May 2005 19:26:56 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 28 21:26:55 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dc6x3-0008OI-Sd for ged-emacs-devel@m.gmane.org; Sat, 28 May 2005 21:26:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dc71a-0006lz-Bb for ged-emacs-devel@m.gmane.org; Sat, 28 May 2005 15:31:10 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dc719-0006eZ-OL for emacs-devel@gnu.org; Sat, 28 May 2005 15:30:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dc716-0006ce-Ab for emacs-devel@gnu.org; Sat, 28 May 2005 15:30:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dc716-0006b7-1t for emacs-devel@gnu.org; Sat, 28 May 2005 15:30:40 -0400 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dc6wp-0004EQ-7A for emacs-devel@gnu.org; Sat, 28 May 2005 15:26:15 -0400 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.12.10/8.12.10) with ESMTP id j4SJP3CK018008 for ; Sat, 28 May 2005 14:25:03 -0500 (CDT) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id j4SJOav09582; Sat, 28 May 2005 14:24:36 -0500 (CDT) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:37834 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37834 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}. ============================================================