emacs-devel
[Top][All Lists]
Advanced

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

Derived modes and mode hooks


From: Sebastian Wiesner
Subject: Derived modes and mode hooks
Date: Sat, 9 Mar 2013 15:06:00 +0100

Hello,

if I understand the documentation of derived modes [1] aright, *all*
hooks (including parent mode hooks) are run *after* the body of the
derived mode.  For instance, given "foo-mode" defined as:

(define-derived-mode foo-mode text-mode "Foo"
  "A useless mode for demonstration purposes"
  (body-of-foo-mode))

Then "M-x foo-mode" will

1. Perform some standard setup stuff (e.g. killing local variables,
setting the key map, etc.)
2. Execute "body-of-foo-mode"
3. Execute all hooks in "text-mode-hook"
4. Execute all hooks in "foo-mode-hook"

Is this right?  If so, how can `body-of-foo-mode` forcibly overrule
settings made in `text-mode-hook`?

For instance, assume that the user has "(add-hook 'text-mode-hook
'auto-fill-mode)" in her init file (a very common setting I presume),
how can "foo-mode" "body-of-foo-mode" forcibly disable
"auto-fill-mode"?

Greetings,
Sebastian Wiesner

[1]: http://www.gnu.org/software/emacs/manual/html_node/elisp/Derived-Modes.html



reply via email to

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