Because the write action is executed inside the ingo#actions#ExecuteOrFunc(), an ugly multi-line exception will be printed. We shouldn't use :echoerr here, because then Vim will prepend a line about the failing :autocmd, which is an implementation detail here. So use plain :echomsg.
Failing tests (WriteBackup/writebackupVewDiffDaysChanges001.vim) alerted me that the implementation is stil incomplete.
ingo#buffer#generate#Create() needs to take an additional a:NextFilenameFuncref argument instead of invoking non-existent ingo#buffer#generate#NextFilename().
ingo#buffer#scratch#NextFilename() needs to invoke ingo#buffer#generate#NextBracketedFilename(), not the eponymous function in its own module.
The previous split of ingo#buffer#generate#Create() subtly changed the behavior with empty scratch contents. We must not :setlocal readonly if the scratch buffer is still empty.
Add a:isInitialized argument to ingo#buffer#scratch#SetLocal().
This allows reuse for non-scratch buffer creation; i.e. where the buftype / readonly stuff isn't needed. Also, the code is easier to understand now that the two concepts are separated.
Use new a:isFile flag to ingo#escape#file#bufnameescape() and set a:isFullMatch to 1 instead of emulating the full-match for non-existing scratch buffers.
Keep current cursor position when ingo#buffer#scratch#Create() removes the first empty line in the scratch buffer.
Use new a:isFile flag to ingo#escape#file#bufnameescape() and set a:isFullMatch to 1 instead of emulating the full-match for non-existing scratch buffers.