> 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


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to