Hi Carsten, > I remember trying to do define-derived mode, but not doing it for a > number of reasons which I do not exactly remember. The argument was > one reason. Another was that older versions of define-derived-mode > did not allow a BODY arguments which I needed.
> A third one was that org-mode hacks away the Show and Hide menus of > outline mode, and I did not want a mode hood to fail because is > tries to add entries to non-existing menus. With my patch, running outline-mode's mode hook (and after-change-major-mode-hook) is delayed; it is run at the end of org-mode. So it introduces the problem that a mode hook will fail when it tries to change those menus. > An important problem always is that I am writing code for Emacs and > XEmacs, so my code needs to be compatible with both distributions. AFAIK, XEmacs has delay-mode-hooks and run-mode-hooks as well. > I did not know about delay-mode-hooks and run-mode-hooks - I'll check > it out. > > What is actually the problem created by the current setup? What are > you trying to do in the outline-mode-hook, and how does it interfer > with what org-mode is doing? My problem is not with outline-mode-hook but with after-change-major-mode-hook. In Emacs, global-font-lock-mode (and any other global minor mode defined with define-global-minor-mode) adds one function to change-major-mode-hook and a second function to after-change-major-mode-hook to enable Font Lock mode. The first functions adds the current buffer to a list variable. The second function enables Font Lock mode for all buffers in that list and clears the list. change-major-mode-hook is run by kill-all-local-variables and after-change-major-mode-hook is run by run-mode-hooks. So normally, a major mode calls the first function once as the first thing it does and the second function once as the last thing it does. However, org-mode calls the second function halfway, before it sets up its own Font-Lock stuff. As a result Font Lock doesn't work properly for org-mode. Lute. PS. Putting the second function on after-change-major-mode-hook is a recent change, it used to be on find-file-hook. _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel