unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Derived modes and mode hooks
@ 2013-03-09 14:06 Sebastian Wiesner
  2013-03-09 14:31 ` Xue Fuqiao
  2013-03-09 15:56 ` Stefan Monnier
  0 siblings, 2 replies; 14+ messages in thread
From: Sebastian Wiesner @ 2013-03-09 14:06 UTC (permalink / raw)
  To: emacs-devel

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



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-03-10 15:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-09 14:06 Derived modes and mode hooks Sebastian Wiesner
2013-03-09 14:31 ` Xue Fuqiao
2013-03-09 14:43   ` Sebastian Wiesner
2013-03-09 15:56 ` Stefan Monnier
2013-03-09 16:25   ` Sebastian Wiesner
2013-03-09 16:43     ` Eli Zaretskii
2013-03-09 17:03       ` Sebastian Wiesner
2013-03-09 17:51         ` Eli Zaretskii
2013-03-09 18:58           ` Sebastian Wiesner
2013-03-09 19:31             ` Eli Zaretskii
2013-03-09 19:49               ` Sebastian Wiesner
2013-03-09 20:22                 ` chad
2013-03-10  5:53     ` Stefan Monnier
2013-03-10 15:34       ` Sebastian Wiesner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).