Yes, but the point at which the character that's inserted into the buffer is
present is after the Quail input method was invoked by read_char. Again, I'm
finding the stack of things involved in the input method getting invoked
rather difficult to follow, but it feels like Quail doesn't actually look
backwards in the buffer and thus could care less that I inserted
a particular character there. That said, I don't truly get how all this
works yet, there's no documentation and a heap of twisty code involved.
There might be multiple obstacles involved (e.g. multiple places that
assumes the chars are all <127), so it'll be important to test things
bit by bit. E.g. check that with no patch the `input-method-function`
is not called at all when you press F19, then check that with
your patch `input-method-function` *is* called when you press F19.
Once that is done, the rest of the hacking should all be doable at the
Lisp level, but it may involve tracing through the quail code, indeed.