On Fri, Aug 8, 2014 at 4:38 PM, Juri Linkov <juri@jurta.org> wrote:
> The question is: how could it be integrated into the current
> query-replace interface, that is how could the user choose
> from a history of defaults (if he does not want to choose the
> latest default which he can access with RET).

Since the default values are displayed in a special format
using an arrow

  Query replace (default from1 -> to1):

a history navigation key should bring the pair into the minibuffer
in the same format like

  Query replace (default from1 -> to1): from2 -> to2

I've often wished for the sort of pair-wise history Tom described
myself, and thought a bit about possible UIs.  So far, the idea I
find most appealing is a history ring whose elements are
single-line yasnippet-style snippets with `from' and `to' fields
that defaulted to the values for that history element.  So after
the first M-p the minibuffer could look something like
  Query replace (TAB for next field, RET to accept): [|from1] -> [to1]
with the point at the start of the from1 field.  Entering any text
would replace from1, while hitting TAB would advance the point
to the to1 field, which would behave similarly.  Entering RET
at any time would commit the current from and to values in
whatever state they were in.  Subsequent M-p's would cycle
through previous pairs as you would expect.  Hitting RET
immediately after any M-p would accept the current default
pair and replacing or editing one or both fields would be
convenient as well. 

I'm afraid I have no clue about how to go about implementing
such behavior though :)

Josh