This is great, thanks. I'm using state() and SafeStateAgain
(adding/removing the autocommand as required)

I've got a WIP PR with the changes up at https://github.com/govim/govim/pull/533

However one issue I'm seeing is that autocommands are not fired when
doing work in response to SafeStateAgain. The scenario looks like
this:

1. govim calls Vim with work to schedule
2. Vim reports that it is not safe and so I add the work to a queue
and a callback to SafeStateAgain
3. when safe, Vim fires the SafeStateAgain autocommand
4. as part of this work, Vim calls back to govim with ch_evalexpr
5. govim receives the message and calls back to Vim with a command to
open a file
6. ... but not autocommands fire (whereas they did previously)
7. the call from govim to Vim (5) returns
8. the ch_evalexpr call from Vim to govim (4) returns

Any ideas what might be going on here?

On Mon, 16 Sep 2019 at 22:20, Bram Moolenaar <b...@moolenaar.net> wrote:
>
>
> > > > I'm not familiar with Vim's internals: please can you explain the
> > > > different loops you're referring to here?
> > >
> > > Most callbacks are invoked from parse_queued_messages().  This is used
> > > when waiting for a key and when sleeping.  Only timer callbacks are
> > > called elsewhere (and differently when using the GUI).
> >
> > <snip>
> >
> > > > Per above, I'd be grateful if you could explain the significance of
> > > > these different loops.
> > >
> > > It's hard to explain, and it differs per system and whether the GUI is
> > > used.  The general idea is "waiting for the user to type a character".
> > > While doing that we trigger timers, read channels and process messages.
> >
> > Thanks. My understanding this fully is probably not significant to us
> > reaching a solution here so if you'll excuse the odd silly question :)
> >
> > Did you see my suggestion about a bare-bones state() function?
>
> I did a first implementation of state().  No tests yet.
>
> --
> In his lifetime van Gogh painted 486 oil paintings. Oddly enough, 8975
> of them are to be found in the United States.
>
>  /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CACoUkn7s%2BZewJsqMVTZnTPan4wT6pi5FxbdP3m8Os8VbO7kvGw%40mail.gmail.com.

Raspunde prin e-mail lui