I have been an Emac user for 20 plus years, and I often look at mg to replace it. The functionality of mg is getting close.
To get some degree of programmability, I suggest that you could implement Emac's "name-last-kbd-macro" then allow one to bind that named-kbd-macro to a key. To be really useful it be necessary to allow the definition of keyboard macros to be in the startup file and also to implement Emac's register commands.