emacs-devel
[Top][All Lists]
Advanced

[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 20:49:13 +0100

2013/3/9 Eli Zaretskii <address@hidden>:
>> Date: Sat, 9 Mar 2013 19:58:11 +0100
>> From: Sebastian Wiesner <address@hidden>
>> Cc: address@hidden, address@hidden
>>
>> 2013/3/9 Eli Zaretskii <address@hidden>:
>> >> In order to completely disable automatic filling I'd add a function
>> >> which simply returns t to this list?
>> >
>> > That's one possibility; I'm sure there are others, less radical ones.
>> >
>> >> That sounds like a nasty hack to me.
>> >
>> > I don't see why.  It is certainly not as nasty as overriding user
>> > customizations.
>>
>> So your proposed solution effectively inhibits auto filling and thus
>> also *effectively overrides* the user's customization, but in a
>> convoluted way, abusing a variable which is obviously intended for a
>> different purpose, and which most likely only few users even know
>> about.
>>
>> Yet you actually *prefer* this crude way of effectively overriding the
>> user's customization over simply disabling the mode, *the* obvious way
>> of inhibiting auto filling, more over clearly indicated to the user by
>> the absence of the corresponding entry in the mode line.
>>
>> Did I get that correctly?
>
> No.  I did say I'm sure there are less radical ways of doing this,
> didn't I?

Truly, you said so, yet the only less radical (or say, less convoluted
way) I see is simply disabling the mode, which I thought you were
opposing.  However, we obviously misunderstood each other, see below.

>> I hitherto thought the main point of derived modes was simply to allow
>> re-use of code
>
> Reuse doesn't make sense if you need to disable most of the inherited
> code.

I don't indent do that.

> In any case, you misunderstand what I meant: I meant not to modify the
> hook itself.  It is okay to make the same effect in other ways.

I never meant to modify the hook itself.  I agree that this is a total no-go.

I merely intend to disable a specific minor mode (i.e. auto-fill-mode)
in a specific major mode derived from text mode, for good reasons.  I
tried to do that in the body of the derived mode, only to discover
that all hooks are run *after* the evaluation of the body, making my
attempt pointless in face of the common way of enabling auto-fill-mode
by adding it to text-mode-hook.  Hence my initial mail.

However, I see that there is no reasonable way to achieve this, so
I'll simply tell my users to do so.  Not as convenient as I had
wished, but apparently the only reasonable way.



reply via email to

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