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: Stefan Monnier
Subject: Re: define-derived-mode runs parent mode hook after evaluating body
Date: Sun, 22 Jul 2007 14:36:40 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux)

> Which would solve this special case.  In general, however, I want to add
> something to a parent-mode hook and pass it on to its derivatives unless
> the derivatives have their own opinion about that.  Well, I could do

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

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


        Stefan




reply via email to

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