Is the run_command Synchronous? From what I can tell it is.
Also, It would be nice if there was a note in the API documentation. The only mention of asynchronous is in open_file. Are there any more to watch out for?
All API functions are synchronous. The only things to watch out for are:
When running in a separate thread, while the API is still synchronous, the buffer can be changing underneath you. It's a similar situation to a normal application working with the file system: other applications can be modifying files as the same times as yours is running.
When opening a file, the file contents may not be available immediately, but only at some future point when the file has finished loading.