* post-self-insert-hook being reset?
@ 2015-06-17 16:02 Sam Halliday
2015-06-17 16:31 ` Phillip Lord
[not found] ` <mailman.5172.1434558699.904.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 8+ messages in thread
From: Sam Halliday @ 2015-06-17 16:02 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
I am using smartparens and it adds a really useful post-self-insert-hook called sp--post-self-insert-hook-handler.
However, after a while of just general editing, the hook disappears!
I've grepped my entire config, all my packages from MELPA etc, to see if anything is resetting the post-self-insert-hook list, but everything looks well behaved.
Is there any standard emacs package, or error handling, that would remove a hook for some reason?
FYI, my .emacs https://github.com/fommil/dotfiles/blob/master/.emacs.d/init.el
Best regards,
Sam
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: post-self-insert-hook being reset?
2015-06-17 16:02 post-self-insert-hook being reset? Sam Halliday
@ 2015-06-17 16:31 ` Phillip Lord
[not found] ` <mailman.5172.1434558699.904.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 8+ messages in thread
From: Phillip Lord @ 2015-06-17 16:31 UTC (permalink / raw)
To: Sam Halliday, help-gnu-emacs@gnu.org
There are a class of hooks (post-command-hook, after-change-functions) that nil themselves on error.
This normally happens at the C layer, and is there to prevent Emacs from getting hung. I guess post-self-insert-hook
is one of these.
It's a PITA to debug from lisp I am afraid.
________________________________________
From: help-gnu-emacs-bounces+phillip.lord=newcastle.ac.uk@gnu.org [help-gnu-emacs-bounces+phillip.lord=newcastle.ac.uk@gnu.org] on behalf of Sam Halliday [sam.halliday@gmail.com]
Sent: 17 June 2015 17:02
To: help-gnu-emacs@gnu.org
Subject: post-self-insert-hook being reset?
Hi all,
I am using smartparens and it adds a really useful post-self-insert-hook called sp--post-self-insert-hook-handler.
However, after a while of just general editing, the hook disappears!
I've grepped my entire config, all my packages from MELPA etc, to see if anything is resetting the post-self-insert-hook list, but everything looks well behaved.
Is there any standard emacs package, or error handling, that would remove a hook for some reason?
FYI, my .emacs https://github.com/fommil/dotfiles/blob/master/.emacs.d/init.el
Best regards,
Sam
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <mailman.5172.1434558699.904.help-gnu-emacs@gnu.org>]
* Re: post-self-insert-hook being reset?
[not found] ` <mailman.5172.1434558699.904.help-gnu-emacs@gnu.org>
@ 2015-06-17 17:14 ` Sam Halliday
2015-06-17 17:15 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Sam Halliday @ 2015-06-17 17:14 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 17 June 2015 17:31:41 UTC+1, Phil Lord wrote:
> There are a class of hooks (post-command-hook, after-change-functions) that nil themselves on error.
>
> This normally happens at the C layer, and is there to prevent Emacs from getting hung. I guess post-self-insert-hook
> is one of these.
>
> It's a PITA to debug from lisp I am afraid.
Thanks. The weird thing is it looks like just this one hook is being removed... does that sound right? If that's the case I can start to look at putting some error handling into the hook and find the bug.
> ________________________________________
> Sent: 17 June 2015 17:02
>
> Hi all,
>
> I am using smartparens and it adds a really useful post-self-insert-hook called sp--post-self-insert-hook-handler.
>
> However, after a while of just general editing, the hook disappears!
>
> I've grepped my entire config, all my packages from MELPA etc, to see if anything is resetting the post-self-insert-hook list, but everything looks well behaved.
>
> Is there any standard emacs package, or error handling, that would remove a hook for some reason?
>
> FYI, my .emacs https://github.com/fommil/dotfiles/blob/master/.emacs.d/init.el
>
> Best regards,
> Sam
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: post-self-insert-hook being reset?
[not found] ` <mailman.5172.1434558699.904.help-gnu-emacs@gnu.org>
2015-06-17 17:14 ` Sam Halliday
@ 2015-06-17 17:15 ` Stefan Monnier
2015-06-17 20:46 ` Sam Halliday
2015-06-18 15:51 ` Phillip Lord
1 sibling, 2 replies; 8+ messages in thread
From: Stefan Monnier @ 2015-06-17 17:15 UTC (permalink / raw)
To: help-gnu-emacs
> There are a class of hooks (post-command-hook, after-change-functions)
> that nil themselves on error.
Actually, these have been refined since to only remove the offending
function rather than set themselves straight to nil.
And they emit a warning when that happens.
> I guess post-self-insert-hook is one of these.
That was a good guess, but:
src/cmds.c: run_hook (Qpost_self_insert_hook);
so, no, it's run "in the normal way". 'Must be something else.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: post-self-insert-hook being reset?
2015-06-17 17:15 ` Stefan Monnier
@ 2015-06-17 20:46 ` Sam Halliday
2015-06-18 1:43 ` Stefan Monnier
2015-06-18 1:44 ` Stefan Monnier
2015-06-18 15:51 ` Phillip Lord
1 sibling, 2 replies; 8+ messages in thread
From: Sam Halliday @ 2015-06-17 20:46 UTC (permalink / raw)
To: help-gnu-emacs
On Wednesday, 17 June 2015 18:15:21 UTC+1, Stefan Monnier wrote:
> > There are a class of hooks (post-command-hook, after-change-functions)
> > that nil themselves on error.
>
> Actually, these have been refined since to only remove the offending
> function rather than set themselves straight to nil.
> And they emit a warning when that happens.
>
> > I guess post-self-insert-hook is one of these.
>
> That was a good guess, but:
>
> src/cmds.c: run_hook (Qpost_self_insert_hook);
>
> so, no, it's run "in the normal way". 'Must be something else.
Thanks Stefan.
Is there anything else that could be removing the member? The only place I can see where the list is wiped is the lisp/subr.el function when reading a password and I don't think that's relevant. And I can't see anywhere where a single hook is removed.
I noticed that scala-mode is setting post-self-insert-hook to be a local variable, but that doesn't explain why this specific post-self-insert-hook is being wiped from all major modes. https://github.com/hvesalai/scala-mode2/blob/master/scala-mode2.el#L92
I'm not seeing any errors in the *Messages* buffer.
Best regards,
Sam
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: post-self-insert-hook being reset?
2015-06-17 20:46 ` Sam Halliday
@ 2015-06-18 1:43 ` Stefan Monnier
2015-06-18 1:44 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2015-06-18 1:43 UTC (permalink / raw)
To: help-gnu-emacs
> I noticed that scala-mode is setting post-self-insert-hook to be a local
> variable,
Sounds like a bug. You normally use the `local' arg of add-hook for that.
Worse: they make it buffer-local and then they don't actually change it,
it seems: "only pain, no gain".
> but that doesn't explain why this specific post-self-insert-hook
> is being wiped from all major
> modes. https://github.com/hvesalai/scala-mode2/blob/master/scala-mode2.el#L92
One more thing: is the hook set to nil, or is your hook function being
removed (i.e. do other hook functions stay on that hook, or not)? Also,
does this affect the global value of the hook, or also the buffer-local value?
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: post-self-insert-hook being reset?
2015-06-17 20:46 ` Sam Halliday
2015-06-18 1:43 ` Stefan Monnier
@ 2015-06-18 1:44 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2015-06-18 1:44 UTC (permalink / raw)
To: help-gnu-emacs
> Is there anything else that could be removing the member?
Can't think of anything offhand. I suggest you make a bug report,
trying to give as much as info as possible (the ideal being a recipe
that starts from "emacs -Q").
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: post-self-insert-hook being reset?
2015-06-17 17:15 ` Stefan Monnier
2015-06-17 20:46 ` Sam Halliday
@ 2015-06-18 15:51 ` Phillip Lord
1 sibling, 0 replies; 8+ messages in thread
From: Phillip Lord @ 2015-06-18 15:51 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> There are a class of hooks (post-command-hook, after-change-functions)
>> that nil themselves on error.
>
> Actually, these have been refined since to only remove the offending
> function rather than set themselves straight to nil.
> And they emit a warning when that happens.
Oh, that's interesting. I've been so used to dealing with this in my
packages, that I hadn't seen that change.
>> I guess post-self-insert-hook is one of these.
>
> That was a good guess, but:
>
> src/cmds.c: run_hook (Qpost_self_insert_hook);
>
> so, no, it's run "in the normal way". 'Must be something else.
Ah, my fantastic guess bought to the grounds by cruel reality.
Phil
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-06-18 15:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 16:02 post-self-insert-hook being reset? Sam Halliday
2015-06-17 16:31 ` Phillip Lord
[not found] ` <mailman.5172.1434558699.904.help-gnu-emacs@gnu.org>
2015-06-17 17:14 ` Sam Halliday
2015-06-17 17:15 ` Stefan Monnier
2015-06-17 20:46 ` Sam Halliday
2015-06-18 1:43 ` Stefan Monnier
2015-06-18 1:44 ` Stefan Monnier
2015-06-18 15:51 ` Phillip Lord
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).