[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hook for "buffer switched"
From: |
Elena |
Subject: |
Re: Hook for "buffer switched" |
Date: |
Wed, 15 Dec 2010 01:02:40 -0800 (PST) |
User-agent: |
G2/1.0 |
On Dec 15, 5:07 am, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> > Is there any hook that is run when a buffer is switched?
>
> I think generally the answer is "no", tho this question is ill-formed:
> it's not clear what you mean by switching buffer: do you mean "change
> the currently active buffer" (i.e. what is done by `set-buffer'), or
> "change the buffer displayed in the current window", or "select
> a different window showing a different buffer", or ...
I would like to be able to handle the "change
the currently active buffer" case.
> > If not, why not?
>
> Maybe because to a large extent it's an ill-defined problem and once
> they try to define it better, people seem to end up deciding they don't
> really need to solve it any more?
Or maybe because they are not able to solve it reliably. For
instance, I'd like Viper state to be global instead of buffer-local.
For this to work, I would have to know whenever the current active
buffer changes and switch Viper state when needed. Or I could just
prefer always switching to Normal state whenever I switch buffer.