emacs-devel
[Top][All Lists]
Advanced

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

Re: define-derived-mode runs parent mode hook after evaluating body


From: martin rudalics
Subject: Re: define-derived-mode runs parent mode hook after evaluating body
Date: Sun, 22 Jul 2007 23:22:20 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>>(add-hook
>> 'text-mode-hook
>> '(lambda ()
>>    (unless (and (local-variable-p 'fill-column)
>>                 (not (equal fill-column
>>                             (default-value 'fill-column))))
>>      (setq fill-column 72))))
>
>
> Other than spurious quote in front of the lambda, this looks fine to me.
> More specifically it says in Elisp basically the same as what you said above
> in English, so it seems to be The Right Thing.

It works when the derived mode sets a buffer-local variable.  I wouldn't
know what to do for normal variables though - maybe a non-problem.

>>but this strikes me as inconvenient, ugly, and maybe faulty.
>
>
> The problem is that if what you want to do is "always add 4 to fill-column",
> the current behavior allows you to do that whereas your suggestion to run
> the parent mode early would preclude it.

Hmmm .... the parent mode runs early in any case.  Do we really want its
hooks to add 4 to something defined in the body of the derived mode?
What if a hook of the derived mode wants to add another four?  Do we add
eight?

martin, who never wanted to "suggest" anything in this context.





reply via email to

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