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: Carsten Dominik
Subject: Re: org-mode and mode hooks.
Date: Wed, 25 May 2005 17:20:29 +0200

I will change org-mode to use define-derived-mode.  When I started
writing this mode, some versions of define-derived-mode (maybe the one
in XEmacs, I don't remember) did not allow a BODY argument.  It seems
they now all do, so I will modify org-mode.  I don't really need the
argument to org-mode.



- Carsten

>>>>> "SM" == Stefan Monnier <address@hidden> writes:

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

SM> define-derived-mode doesn't support it because the elisp manual says:

SM>    23.1.1 Major Mode Conventions
SM>    -----------------------------
   
SM>    [...]
   
SM>       * Define a command whose name ends in `-mode', with no arguments,
SM>         that switches to the new mode in the current buffer.  This command
SM>         should set up the keymap, syntax table, and buffer-local variables
SM>         in an existing buffer, without changing the buffer's contents.

SM> Why doesn't org-mode use auto-insert-mode to handle the insertion of
SM> a template?  I.e. just add the relevant template to auto-insert-alist and
SM> let the users decide whether they want it or not by turning on
SM> 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?

SM> While I think that org-mode should use define-derived-mode, I'm wondering
SM> why it's a problem that after-change-major-mode-hook is run at the
SM> wrong time.  After all, such manual mode derivation (without using
SM> define-derived-mode) is pretty common, so if there's a problem with it, we
SM> should fix it.


SM>         Stefan

-- 
Carsten Dominik <address@hidden>        \ _ /
Sterrenkundig Instituut "Anton Pannekoek"        |X|               _
Kruislaan 403; NL-1098 SJ Amsterdam             /| |\   _  _     _/ \
phone +31 (20) 525-7477; FAX +31 (20) 525-7484 __|o|___/ ~~ \___/    ~~~




reply via email to

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