Python 2, 132 122 13870 bytes
Ørjan Johansen points out this didn't support escaped characters, so I've a comment to the end with the string after it.
def f(x='%r'x=''):x='%r'*(x!='%r'+'')+x;s="defs='def f(x=%r):x='%%r'*(x!='%%r'+%r)+x;s=%r;prints=%r;print s%%(x,x[2:],s,x[2:]x)#%s";print#%s';print s%(x,x[2:],s,x[2:]x)#
A weird extension of the usual python quine s="s=%r;print s%%s";print s%s
. This adds twoan extra %%s
s after a comment, one in the check whether x
has changed fromto output the default stringdata, and one to inserta x%r
intoin the default string. The nice thing about this is that the code doesn't extend over multiple iterations. It always preserves its own structure and can return to push the original by passing instring as default instead of an empty string.