[Top][All Lists]

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

Re: Differencing a major mode from its derived modes

From: Kai Grossjohann
Subject: Re: Differencing a major mode from its derived modes
Date: Sat, 12 Jun 2004 15:36:32 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

chem <address@hidden> 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

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?).


> 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.


reply via email to

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