all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* post-command-hook
@ 2011-04-01 15:58 martin rudalics
  2011-04-01 18:05 ` post-command-hook Antoine Levitt
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: martin rudalics @ 2011-04-01 15:58 UTC (permalink / raw)
  To: emacs-devel

After updating my trunk I'm completely lost with the following issue:
With emacs -Q, switch to the buffer *Messages*, make it empty and
evaluate the following forms in it:

(defun foo ()
   (message "foo"))

(defun bar ()
   (message "bar"))

(add-hook 'post-command-hook 'foo)
(add-hook 'post-command-hook 'bar nil t)

Now move around that buffer.  Here it only runs the local hook function
"bar".  It does _not_ run the global hook function "foo".

All my earlier Emacs versions run both hooks alternately.

GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
  of 2011-04-01 on NESTOR

Help appreciated, martin



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-01 15:58 post-command-hook martin rudalics
@ 2011-04-01 18:05 ` Antoine Levitt
  2011-04-02  7:02   ` post-command-hook martin rudalics
  2011-04-02 14:25 ` post-command-hook Juanma Barranquero
  2011-04-02 21:40 ` post-command-hook Stefan Monnier
  2 siblings, 1 reply; 10+ messages in thread
From: Antoine Levitt @ 2011-04-01 18:05 UTC (permalink / raw)
  To: emacs-devel

01/04/11 17:58, martin rudalics
> After updating my trunk I'm completely lost with the following issue:
> With emacs -Q, switch to the buffer *Messages*, make it empty and
> evaluate the following forms in it:
>
> (defun foo ()
>   (message "foo"))
>
> (defun bar ()
>   (message "bar"))
>
> (add-hook 'post-command-hook 'foo)
> (add-hook 'post-command-hook 'bar nil t)
>
> Now move around that buffer.  Here it only runs the local hook function
> "bar".  It does _not_ run the global hook function "foo".
>
> All my earlier Emacs versions run both hooks alternately.
>
> GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
>  of 2011-04-01 on NESTOR
>
> Help appreciated, martin

Ah, this is probably related to the bug I'm seeing
(http://permalink.gmane.org/gmane.emacs.devel/137894). This setup should
be easier to debug though.

I think buffer-local post-command-hooks are messed up somehow (the other
code that triggers the bug also uses local hooks), but I can't figure
out the part that introduced it in
5e4cb836580a8ef2f9ea9b4b8317005941920027




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-01 18:05 ` post-command-hook Antoine Levitt
@ 2011-04-02  7:02   ` martin rudalics
  2011-04-02  8:36     ` post-command-hook Antoine Levitt
  0 siblings, 1 reply; 10+ messages in thread
From: martin rudalics @ 2011-04-02  7:02 UTC (permalink / raw)
  To: Antoine Levitt; +Cc: emacs-devel

 > Ah, this is probably related to the bug I'm seeing
 > (http://permalink.gmane.org/gmane.emacs.devel/137894). This setup should
 > be easier to debug though.
 >
 > I think buffer-local post-command-hooks are messed up somehow (the other
 > code that triggers the bug also uses local hooks), but I can't figure
 > out the part that introduced it in

Juanma and me suppose it's revno:103769
(revid:monnier@iro.umontreal.ca-20110328202635-2t9ij68etiasfyy2).
Somewhere in run_hook_with_args, I suppose.  Unfortunately, that change
also involves some code cleanup so I was not able so far to track this
down.  Moreover it makes working with the trunk currently impossible for
me :-(

martin



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-02  7:02   ` post-command-hook martin rudalics
@ 2011-04-02  8:36     ` Antoine Levitt
  0 siblings, 0 replies; 10+ messages in thread
From: Antoine Levitt @ 2011-04-02  8:36 UTC (permalink / raw)
  To: emacs-devel

02/04/11 09:02, martin rudalics
>> Ah, this is probably related to the bug I'm seeing
>> (http://permalink.gmane.org/gmane.emacs.devel/137894). This setup should
>> be easier to debug though.
>>
>> I think buffer-local post-command-hooks are messed up somehow (the other
>> code that triggers the bug also uses local hooks), but I can't figure
>> out the part that introduced it in
>
> Juanma and me suppose it's revno:103769
> (revid:monnier@iro.umontreal.ca-20110328202635-2t9ij68etiasfyy2).

Yup, that's what I thought too.

> Somewhere in run_hook_with_args, I suppose.  Unfortunately, that change
> also involves some code cleanup so I was not able so far to track this
> down.  Moreover it makes working with the trunk currently impossible for
> me :-(

Stefan should take a look, but I guess he's busy with the lexbind merge
right now :) I'm simply using an old revision for the time being.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-01 15:58 post-command-hook martin rudalics
  2011-04-01 18:05 ` post-command-hook Antoine Levitt
@ 2011-04-02 14:25 ` Juanma Barranquero
  2011-04-02 21:40 ` post-command-hook Stefan Monnier
  2 siblings, 0 replies; 10+ messages in thread
From: Juanma Barranquero @ 2011-04-02 14:25 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

On Fri, Apr 1, 2011 at 17:58, martin rudalics <rudalics@gmx.at> wrote:

> (defun foo ()
>  (message "foo"))

If you change that to

(defun foo ()
  (message "foo")
  nil)

it works, so it seems like this part of the change is the culprit:


@@ -2543,9 +2577,7 @@
       GCPRO3 (sym, val, global_vals);

       for (;
-	   CONSP (val) && ((cond == to_completion)
-			   || (cond == until_success ? NILP (ret)
-			       : !NILP (ret)));
+	   CONSP (val) && NILP (ret);
 	   val = XCDR (val))
 	{
 	  if (EQ (XCAR (val), Qt))


    Juanma



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-01 15:58 post-command-hook martin rudalics
  2011-04-01 18:05 ` post-command-hook Antoine Levitt
  2011-04-02 14:25 ` post-command-hook Juanma Barranquero
@ 2011-04-02 21:40 ` Stefan Monnier
  2011-04-02 22:00   ` post-command-hook Antoine Levitt
                     ` (2 more replies)
  2 siblings, 3 replies; 10+ messages in thread
From: Stefan Monnier @ 2011-04-02 21:40 UTC (permalink / raw)
  To: martin rudalics; +Cc: emacs-devel

> (defun foo ()
>   (message "foo"))
> (defun bar ()
>   (message "bar"))
> (add-hook 'post-command-hook 'foo)
> (add-hook 'post-command-hook 'bar nil t)

I think the patch below fixes it,


        Stefan


=== modified file 'src/keyboard.c'
--- src/keyboard.c	2011-04-02 18:34:05 +0000
+++ src/keyboard.c	2011-04-02 21:37:19 +0000
@@ -1815,7 +1815,8 @@
 safe_run_hooks_1 (void)
 {
   eassert (CONSP (Vinhibit_quit));
-  return call0 (XCDR (Vinhibit_quit));
+  call0 (XCDR (Vinhibit_quit));
+  return Qnil;
 }
 
 /* Subroutine for safe_run_hooks: handle an error by clearing out the function




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-02 21:40 ` post-command-hook Stefan Monnier
@ 2011-04-02 22:00   ` Antoine Levitt
  2011-04-02 22:38   ` post-command-hook Johan Bockgård
  2011-04-03  7:38   ` post-command-hook martin rudalics
  2 siblings, 0 replies; 10+ messages in thread
From: Antoine Levitt @ 2011-04-02 22:00 UTC (permalink / raw)
  To: emacs-devel

02/04/11 23:40, Stefan Monnier
>> (defun foo ()
>>   (message "foo"))
>> (defun bar ()
>>   (message "bar"))
>> (add-hook 'post-command-hook 'foo)
>> (add-hook 'post-command-hook 'bar nil t)
>
> I think the patch below fixes it,

It fixes my problems, thanks!




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-02 21:40 ` post-command-hook Stefan Monnier
  2011-04-02 22:00   ` post-command-hook Antoine Levitt
@ 2011-04-02 22:38   ` Johan Bockgård
  2011-04-04  1:09     ` post-command-hook Stefan Monnier
  2011-04-03  7:38   ` post-command-hook martin rudalics
  2 siblings, 1 reply; 10+ messages in thread
From: Johan Bockgård @ 2011-04-02 22:38 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (defun foo ()
>>   (message "foo"))
>> (defun bar ()
>>   (message "bar"))
>> (add-hook 'post-command-hook 'foo)
>> (add-hook 'post-command-hook 'bar nil t)
>
> I think the patch below fixes it,
>

>  safe_run_hooks_1 (void)
>  {
>    eassert (CONSP (Vinhibit_quit));
> -  return call0 (XCDR (Vinhibit_quit));
> +  call0 (XCDR (Vinhibit_quit));
> +  return Qnil;
>  }

Shouldn't the "return nil" be in safe_run_hook_funcall instead?



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-02 21:40 ` post-command-hook Stefan Monnier
  2011-04-02 22:00   ` post-command-hook Antoine Levitt
  2011-04-02 22:38   ` post-command-hook Johan Bockgård
@ 2011-04-03  7:38   ` martin rudalics
  2 siblings, 0 replies; 10+ messages in thread
From: martin rudalics @ 2011-04-03  7:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> I think the patch below fixes it,

It fixes my problem.  Thanks.

martin




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: post-command-hook
  2011-04-02 22:38   ` post-command-hook Johan Bockgård
@ 2011-04-04  1:09     ` Stefan Monnier
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2011-04-04  1:09 UTC (permalink / raw)
  To: emacs-devel

> Shouldn't the "return nil" be in safe_run_hook_funcall instead?

Indeed, thanks for caching it before I committed it,


        Stefan



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-04-04  1:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 15:58 post-command-hook martin rudalics
2011-04-01 18:05 ` post-command-hook Antoine Levitt
2011-04-02  7:02   ` post-command-hook martin rudalics
2011-04-02  8:36     ` post-command-hook Antoine Levitt
2011-04-02 14:25 ` post-command-hook Juanma Barranquero
2011-04-02 21:40 ` post-command-hook Stefan Monnier
2011-04-02 22:00   ` post-command-hook Antoine Levitt
2011-04-02 22:38   ` post-command-hook Johan Bockgård
2011-04-04  1:09     ` post-command-hook Stefan Monnier
2011-04-03  7:38   ` post-command-hook martin rudalics

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.