During today's Austin Group meeting (the folks working on POSIX), we
noticed an inconsistency in GNU ed when compared to other
implementations. It seems that ALL implementations we tested allow
'q' to quit immediately after an 'e' that failed because the buffer
still has unwritten modifications:
[...]
We then tried to figure out what other commands, if any, can be used
in between notification that a buffer was modified and a followup
attempt to quit. On MacOS, 'h' does not count as an intervening
command: