Mi ĵus skribontis leteron, kiam li alvenis hejme.
I was just going to write a letter when he came home.