From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: org-mode and mode hooks. Date: Wed, 25 May 2005 10:45:08 -0400 Message-ID: <87ll63weye.fsf-monnier+emacs@gnu.org> References: <87y8a3mnz8.fsf@xs4all.nl> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1117033186 9384 80.91.229.2 (25 May 2005 14:59:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 25 May 2005 14:59:46 +0000 (UTC) Cc: Carsten Dominik , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 25 16:59:35 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DaxL0-0006lV-0v for ged-emacs-devel@m.gmane.org; Wed, 25 May 2005 16:58:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DaxOr-0007HI-BP for ged-emacs-devel@m.gmane.org; Wed, 25 May 2005 11:02:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DaxL0-0005Y4-BC for emacs-devel@gnu.org; Wed, 25 May 2005 10:58:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DaxKu-0005Tz-3d for emacs-devel@gnu.org; Wed, 25 May 2005 10:58:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DaxKr-0005Qp-2S for emacs-devel@gnu.org; Wed, 25 May 2005 10:58:17 -0400 Original-Received: from [209.226.175.25] (helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Dax8a-0007IS-9T for emacs-devel@gnu.org; Wed, 25 May 2005 10:45:36 -0400 Original-Received: from alfajor ([70.49.81.51]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20050525144509.IBZU26128.tomts5-srv.bellnexxia.net@alfajor>; Wed, 25 May 2005 10:45:09 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id B411ED7700; Wed, 25 May 2005 10:45:08 -0400 (EDT) Original-To: Lute Kamstra In-Reply-To: <87y8a3mnz8.fsf@xs4all.nl> (Lute Kamstra's message of "Wed, 25 May 2005 15:31:07 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:37613 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:37613 > org-mode in lisp/textmodes/org.el is derived from outline-mode, but it > doesn't use define-derived-mode to accomplish this. Instead, it just > calls outline-mode as the first thing it does. (I guess this is > because org-mode accepts an argument, which define-derived-mode > doesn't support.) define-derived-mode doesn't support it because the elisp manual says: 23.1.1 Major Mode Conventions ----------------------------- [...] * Define a command whose name ends in `-mode', with no arguments, that switches to the new mode in the current buffer. This command should set up the keymap, syntax table, and buffer-local variables in an existing buffer, without changing the buffer's contents. Why doesn't org-mode use auto-insert-mode to handle the insertion of a template? I.e. just add the relevant template to auto-insert-alist and let the users decide whether they want it or not by turning on auto-insert-mode. > The problem with this approach is that outline-mode's mode hook and > after-change-major-mode-hook are run at the wrong time. What about the > following patch to fix this? 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. 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. Stefan