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: Miles Bader
Subject: Re: occur-hook changing the current buffer
Date: Wed, 22 Jun 2005 13:16:21 +0900

Juanma Barranquero <address@hidden> writes:
>> Once your code is fixed this is not needed any more.  If the occur-hook is
>> expected to set-buffer in most/many cases, it might make sense, but
>> otherwise it doesn't.
>
> Well, I think it makes sense even if occur-hook is not expected to
> change the current buffer in most/many cases. Just one is enough, if
> it makes the user lose work.

The hook-invoker shouldn't have to protect against every possible
bizarre action that a hook _might_ perform -- it's impossible to do, and
even trying to do it adds unnecessary overhead.

I find it hard to believe that anybody would expect changing the current
buffer in a hook _not_ to cause weird problems.  Returning from a
function with the current buffer changed is a fairly serious thing; you
should never do it without considering the effects on your caller.  This
is not something esoteric, it's elisp programming 101.

-Miles
-- 
Come now, if we were really planning to harm you, would we be waiting here,
 beside the path, in the very darkest part of the forest?




reply via email to

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