Subject: Re: bug#22287: 25.1.50; Sudden jumping point in buffer

From: "Stefan-W. Hahn" <[email-masked]>
Date: Sun, 3 Jan 2016 14:07:42 +0100

Mail von David Engster, Sun, 03 Jan 2016 at 12:26:37 +0100:

Hello,

> Stefan-W. Hahn writes:
> > - the point at the end of semanticdb-save-all-db-idle has changed!!
> 
> Thank you for investigating this so thoroughly. This is indeed some

Thanks.

> weird behavior and I'm no longer sure this is the same bug as 15045. I
> will try to reproduce this on my system.

I tried to get deeper yesterday and tried to check if a timer is called at
the end of semanticdb-save-all-db-idle.

For this I instrumented the code as follows:

,----
| diff --git a/src/alloc.c b/src/alloc.c
| index bee7cd1..4adb3d6 100644
| --- a/src/alloc.c
| +++ b/src/alloc.c
| @@ -7146,6 +7146,10 @@ do hash-consing of the objects allocated to pure space.  */);
|  	       doc: /* Non-nil means display messages at start and end of garbage collection.  */);
|    garbage_collection_messages = 0;
|  
| +  DEFVAR_BOOL ("my-safe-run-hooks", my_safe_run_hooks,
| +	       doc: /* Non-nil means display messages at start and end of garbage collection.  */);
| +  my_safe_run_hooks = 0;
| +
|    DEFVAR_LISP ("post-gc-hook", Vpost_gc_hook,
|  	       doc: /* Hook run after garbage collection has finished.  */);
|    Vpost_gc_hook = Qnil;
| diff --git a/src/fileio.c b/src/fileio.c
| index 6cda1e3..fb094df 100644
| --- a/src/fileio.c
| +++ b/src/fileio.c
| @@ -5499,7 +5499,9 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
|    Vquit_flag = Qnil;
|  
|    hook = intern ("auto-save-hook");
| +  my_safe_run_hooks = Qt;
|    safe_run_hooks (hook);
| +  my_safe_run_hooks = Qnil;
|  
|    if (STRINGP (Vauto_save_list_file_name))
|      {
| diff --git a/src/keyboard.c b/src/keyboard.c
| index 2449abb..00696cf 100644
| --- a/src/keyboard.c
| +++ b/src/keyboard.c
| @@ -7039,6 +7039,8 @@ process_pending_signals (void)
|  {
|    pending_signals = false;
|    handle_async_input ();
| +  if (garbage_collection_messages && my_safe_run_hooks)
| +    message1("*** handle atimers");
|    do_pending_atimers ();
|  }
|  
`----

and semanticdb-save-all-db-idle as described in the initial post.

With this I got (after starting and setting garbage-collection-messages t,
and doing stuff as described in the bug-report):

,----
| *** handle atimers [540 times]
| *** sem start: buffer intervals.c 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** sem: buffer intervals.c 49722
| *** input: rc=nil 49722 49722
| *** out: rc=nil 49722 49722
| *** handle atimers [10 times]
| *** sem end: buffer intervals.c 49392
| Auto-saving...done
| *** handle atimers [32 times]
`----

So a running timer is moving point!

Now I will try to find the desperado.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.