emacs-devel
[Top][All Lists]
Advanced

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

Re: occur-hook changing the current buffer


From: Juanma Barranquero
Subject: Re: occur-hook changing the current buffer
Date: Thu, 23 Jun 2005 01:37:24 +0200

> Why setting the not-modified flag comes after running a hook?  AFAIK,
> there is a convention that run-hook should be the last element in the
> function body, so users could override every default settings of the
> function, including in this particular case setting the modification flag.

The Emacs Lisp Reference makes that claim about major-mode hooks and,
less strongly, about minor-mode hooks. Certainly I'm not aware of such
a convention for non-mode hooks, like `occur-hook', and I don't think
it would make sense: hooks are set up at convenient moments, which do
not necessarily coincide with function boundaries.

> So it seems the correct fix is just to move (run-hooks 'occur-hook) down
> to be the last funcall in the `occur-1' function body.

Hey, it's funny: if I had proposed to move the code setting the
read-only and not-modified flags to before run-hooks, instead of
protecting the hook functions from changing the current buffer,
perhaps no one would have complained... :)

-- 
                    /L/e/k/t/u




reply via email to

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