[Top][All Lists]

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

Re: occur-mode-hook run too early to be useful

From: Juanma Barranquero
Subject: Re: occur-mode-hook run too early to be useful
Date: Wed, 28 Aug 2002 17:06:20 +0200

On Wed, 28 Aug 2002 10:30:05 -0400, "Stefan Monnier" 
<monnier+gnu/address@hidden> wrote:

> That would be wrong.  The hook should be run at the end of the major mode's
> function.

Yes, sure. That's the normal way and that's why I asked.

But in this case things aren't that clear, as the distinction between
code in occur-mode and code in occur-1 seems rather arbitrary:

 1. occur-mode is only called from occur-1
 2. occur-mode is called unconditionally
 3. occur-1 is the engine to all the interactive occur functions
 4. M-x occur-mode in a non-occur buffer is meaningless
 5. occur-mode-hook now serves almost no practical purpose

> Another way would be to call `occur-mode' later (which would
> require the occur-revert-arguments variable to be made permanent-local)

That just does credence to my idea that occur-mode is but an ugly

> or to provide another hook (like `occur-hook').

Yeah, of course. But it feels a bit silly to have two hooks for almost
nothing. In fact, if I add an `occur-hook' I could move the call to
`turn-on-font-lock' to it and `occur-mode-hook' would be useless... Not
to mention that its docstring just says "Hooks run when `occur' is called.",
so it's difficult, from a user's POV, to see what purpose it serves that
occur-hook does not.

So I think that's what I'm going to do: changing occur-mode-hook to just
occur-hook and executing it at the end of occur-1.

Thanks for your comments,


reply via email to

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