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: Wed, 22 Jun 2005 10:35:30 +0200

> Emacs can't, and shouldn't try to, protect against random crap in hooks,
> except where a particular mistake is very common and easy to make.

I couldn't agree less with you. It is the consequences of the "random
crap" which should dictate whether it makes sense to protect against
it. Easy to make mistakes that cause no harm should perhaps be
avoided, but *if not*, a simple warning on the documentation would
suffice. Not so with not-that-common, but potentially more serious,
problems.

Moreover, in this particular case, the function which causes the
buffer switch was in the hook for a long time. It was a change to
`occur-1' 
(http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/replace.el.diff?r1=1.208&r2=1.209,
if you're wondering) which suddenly made a
yes-I-admit-erroneous-but-not-dangerous-till-now-function to suddenly
become dangerous. I'm not putting the "blame" on the change (which is,
AFAICS, correct), only stressing that when a function runs a hook and
*afterwards* sets the not-modified flag, protecting against the change
of the buffer is not a defense against "random crap". It's helping the
user not to shoot his own foot.

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




reply via email to

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