all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Phillip Lord" <phillip.lord@russet.org.uk>
To: "\"Clément Pit-Claudel\"" <cpitclaudel@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>,
	Phillip Lord <phillip.lord@russet.org.uk>
Subject: Re: A programming puzzle with buffer-local hooks
Date: Thu, 18 May 2017 18:46:34 -0000	[thread overview]
Message-ID: <1d597d25a8507a72cc0f3f8d90ad4547.squirrel@cloud103.planethippo.com> (raw)
In-Reply-To: <d1766450-9472-880a-40cf-aa9772a3eb93@gmail.com>

On Thu, May 18, 2017 3:56 pm, Clément Pit-Claudel wrote:
> 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 :)


Why? Perhaps the solution is to work out what you dislike about it, and
the see if we can do something generic to solve the problem. The issue is
not at all specific to your mode.

Phil




  reply	other threads:[~2017-05-18 18:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 15:54 A programming puzzle with buffer-local hooks Phillip Lord
2017-05-18 15:56 ` Clément Pit-Claudel
2017-05-18 18:46   ` Phillip Lord [this message]
2017-05-18 19:03     ` Clément Pit-Claudel
  -- strict thread matches above, loose matches on Subject: below --
2017-05-18 15:10 Clément Pit-Claudel
2017-05-18 15:16 ` Phillip Lord
2017-05-18 15:45   ` Clément Pit-Claudel
2017-05-18 16:51 ` Stefan Monnier
2017-05-18 18:38   ` Clément Pit-Claudel
2017-05-19  6:30 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d597d25a8507a72cc0f3f8d90ad4547.squirrel@cloud103.planethippo.com \
    --to=phillip.lord@russet.org.uk \
    --cc=cpitclaudel@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.