emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-mode and mode hooks.


From: Stefan Monnier
Subject: Re: org-mode and mode hooks.
Date: Wed, 25 May 2005 10:45:08 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]