* Differencing a major mode from its derived modes
@ 2004-06-07 22:46 chem
2004-06-08 6:36 ` Kai Grossjohann
0 siblings, 1 reply; 6+ messages in thread
From: chem @ 2004-06-07 22:46 UTC (permalink / raw)
Hi,
I would like to add allout mode only to text-mode. That is, I don't
want allout mode to propagate to all the derived modes, like message
mode, etc.
I tried, using a:
- if test on the major-mode, and it's not working
- (if (get major-mode 'derived-mode-parent)..., not working neither.
It seems that the major-mode on which the derived mode is based is
actually loaded. Thus, all the hooks are made. Only then, the
customization of the derived mode are done. Then, I really don't know
how to isolated the parent from its children. If someone has a
solution, it would be nice.
Thanks
--
Chemtov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Differencing a major mode from its derived modes
2004-06-07 22:46 Differencing a major mode from its derived modes chem
@ 2004-06-08 6:36 ` Kai Grossjohann
2004-06-08 9:36 ` chem
0 siblings, 1 reply; 6+ messages in thread
From: Kai Grossjohann @ 2004-06-08 6:36 UTC (permalink / raw)
chem <chemtov@ifrance.com> writes:
> I would like to add allout mode only to text-mode. That is, I don't
> want allout mode to propagate to all the derived modes, like message
> mode, etc.
message-mode runs message-mode-hook and then text-mode-hook.
text-mode runs text-mode-hook only.
So you could toggle allout mode from both hooks. This would turn it
on, then off again, in message-mode, which is what you want.
Kai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Differencing a major mode from its derived modes
2004-06-08 6:36 ` Kai Grossjohann
@ 2004-06-08 9:36 ` chem
2004-06-11 13:00 ` Kai Grossjohann
0 siblings, 1 reply; 6+ messages in thread
From: chem @ 2004-06-08 9:36 UTC (permalink / raw)
Cc: help-gnu-emacs
> message-mode runs message-mode-hook and then text-mode-hook.
> text-mode runs text-mode-hook only.
>
> So you could toggle allout mode from both hooks. This would turn it
> on, then off again, in message-mode, which is what you want.
Thanks,
I did it already, but there are a lot of modes deriving from text mode,
and I don't want to modify them all. That's why I wanted a general
way to specify that a particular hook should only apply to the parent
mode, and not to its children.
PS: I try hard to make gnus and message use the MFT header (I post
from the mailing list), I hope I achieve it. If not, I'm sorry, and
will try harder. A typo in my emacs.el hinders me from replying
sooner.
--
Chemtov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Differencing a major mode from its derived modes
2004-06-08 9:36 ` chem
@ 2004-06-11 13:00 ` Kai Grossjohann
2004-06-11 17:34 ` chem
0 siblings, 1 reply; 6+ messages in thread
From: Kai Grossjohann @ 2004-06-11 13:00 UTC (permalink / raw)
chem <chemtov@ifrance.com> writes:
> I did it already, but there are a lot of modes deriving from text mode,
> and I don't want to modify them all. That's why I wanted a general
> way to specify that a particular hook should only apply to the parent
> mode, and not to its children.
I forget whether testing the variable major-mode was already
mentioned. You could write a function that checks (eq major-mode
'text-mode), and only if this is true, then activate allout mode.
Kai
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Differencing a major mode from its derived modes
2004-06-11 13:00 ` Kai Grossjohann
@ 2004-06-11 17:34 ` chem
2004-06-12 13:36 ` Kai Grossjohann
0 siblings, 1 reply; 6+ messages in thread
From: chem @ 2004-06-11 17:34 UTC (permalink / raw)
Cc: help-gnu-emacs
> I forget whether testing the variable major-mode was already
> mentioned. You could write a function that checks (eq major-mode
> 'text-mode), and only if this is true, then activate allout mode.
yes, i tried that, but it only work if the mode is not derived from
text-mode (eg. LaTeX - from aucTeX), but not if it is (eg. message).
In the latter, code like this one :
(add-hook 'text-mode-hook
'(lambda ()
(if (eq major-mode 'text-mode)
(flyspell-mode 1)
(turn-on-auto-fill))))
will run the THEN _and_ the ELSE part of the IF expression, while in
the former, only then ELSE part is evaluated.
Furthermore, something like :
(derived-mode-p 'text-mode)
will return true even in text-mode (while it's hardly derived from
text-mode, isn't it?).
So, I found no easy way to discriminate between parent from derived
children mode.
Thanks again for the support.
PS: Could you tell me if receive my reply twice : on the mailing list
(or the newsgroup) and in your mailbox. I'm curious to know if all
(of my gnus and message configurations) is working as intended.
--
Chemtov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Differencing a major mode from its derived modes
2004-06-11 17:34 ` chem
@ 2004-06-12 13:36 ` Kai Grossjohann
0 siblings, 0 replies; 6+ messages in thread
From: Kai Grossjohann @ 2004-06-12 13:36 UTC (permalink / raw)
chem <chemtov@ifrance.com> writes:
>> I forget whether testing the variable major-mode was already
>> mentioned. You could write a function that checks (eq major-mode
>> 'text-mode), and only if this is true, then activate allout mode.
>
> yes, i tried that, but it only work if the mode is not derived from
> text-mode (eg. LaTeX - from aucTeX), but not if it is (eg. message).
> In the latter, code like this one :
>
> (add-hook 'text-mode-hook
> '(lambda ()
> (if (eq major-mode 'text-mode)
> (flyspell-mode 1)
> (turn-on-auto-fill))))
>
> will run the THEN _and_ the ELSE part of the IF expression, while in
> the former, only then ELSE part is evaluated.
I think that's because text-mode-hook is run twice: once as part of
message-mode, and once more because message-mode is derived from
text-mode.
IMHO this should not happen: text-mode-hook should be run only once
in this case.
I wonder if this is really a bug, and if so, how to fix it.
> Furthermore, something like :
>
> (derived-mode-p 'text-mode)
>
> will return true even in text-mode (while it's hardly derived from
> text-mode, isn't it?).
Hm.
> So, I found no easy way to discriminate between parent from derived
> children mode.
>
> Thanks again for the support.
>
> PS: Could you tell me if receive my reply twice : on the mailing list
> (or the newsgroup) and in your mailbox. I'm curious to know if all
> (of my gnus and message configurations) is working as intended.
I got it twice. I deleted the mail.
But note that the mail reply was addressed to help-gnu-emacs, not to
a newsgroup. Not sure if that is relevant.
Kai
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-06-12 13:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-07 22:46 Differencing a major mode from its derived modes chem
2004-06-08 6:36 ` Kai Grossjohann
2004-06-08 9:36 ` chem
2004-06-11 13:00 ` Kai Grossjohann
2004-06-11 17:34 ` chem
2004-06-12 13:36 ` Kai Grossjohann
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).