emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A programming puzzle with buffer-local hooks


From: Clément Pit-Claudel
Subject: Re: A programming puzzle with buffer-local hooks
Date: Thu, 18 May 2017 11:56:17 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 2017-05-18 11:54, Phillip Lord wrote:
> 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.

I entirely agree.  But as a user I dislike these zombie hooks :)



reply via email to

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