[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A programming puzzle with buffer-local hooks
From: |
Phillip Lord |
Subject: |
Re: A programming puzzle with buffer-local hooks |
Date: |
Thu, 18 May 2017 15:54:04 -0000 |
User-agent: |
SquirrelMail/1.5.2 [SVN] |
On Thu, May 18, 2017 3:45 pm, Clément Pit-Claudel wrote:
> On 2017-05-18 11:16, Phillip Lord wrote:
>
>> Add the hook globally, and then have your hook functions check whether
>> the mode is on or off before they do anything.
>
> I think that's mostly what I meant by "never removing the hook". Am I
> misunderstanding you?
Well, combined with making it global, yes.
I always found developing a minor mode where we add and remove hooks to be
a bit of a pain, because you can easily end up with different buffers have
different state during development. On the other hand, if you have a
single global hook, it's either there or not, just whether it works or not
is dependent only on whether the minor-mode is on or not.
Seems a lot nicer to me.