[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Derived modes and mode hooks
From: |
Sebastian Wiesner |
Subject: |
Re: Derived modes and mode hooks |
Date: |
Sat, 9 Mar 2013 15:43:47 +0100 |
2013/3/9 Xue Fuqiao <address@hidden>:
> On Sat, 9 Mar 2013 15:06:00 +0100
> Sebastian Wiesner <address@hidden> wrote:
>
>> 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`?
>
> See the function `run-mode-hooks'.
What am I supposed to see there?
I read the documentation of this function, even looked at its source
code, and now I feel confirmed in my analysis of things. But I can't
see anything that would help me to solve the actual problem, that is
forcibly disabling `auto-fill-mode`. I can't even control when and
how this function is invoked, as `define-derived-mode` does that
implicitly.
> I'm no expert on this, but IIRC `after-change-major-mode-hook' helps.
Call me stupid, but I fail to see how it could. It's executed even
earlier than `body-of-foo-mode`, and thus suffers from the same
problem: The later execution of `text-mode-hook` will bring back
`auto-fill-mode`, given `(add-hook 'text-mode-hook
'auto-fill-mode)` in the user's init file.
I need something that runs *after* `text-mode-hook`, but *before*
`foo-mode-hook`.
- Derived modes and mode hooks, Sebastian Wiesner, 2013/03/09
- Re: Derived modes and mode hooks, Xue Fuqiao, 2013/03/09
- Re: Derived modes and mode hooks,
Sebastian Wiesner <=
- Re: Derived modes and mode hooks, Stefan Monnier, 2013/03/09
- Re: Derived modes and mode hooks, Sebastian Wiesner, 2013/03/09
- Re: Derived modes and mode hooks, Eli Zaretskii, 2013/03/09
- Re: Derived modes and mode hooks, Sebastian Wiesner, 2013/03/09
- Re: Derived modes and mode hooks, Eli Zaretskii, 2013/03/09
- Re: Derived modes and mode hooks, Sebastian Wiesner, 2013/03/09
- Re: Derived modes and mode hooks, Eli Zaretskii, 2013/03/09
- Re: Derived modes and mode hooks, Sebastian Wiesner, 2013/03/09
- Re: Derived modes and mode hooks, chad, 2013/03/09
- Re: Derived modes and mode hooks, Stefan Monnier, 2013/03/10