How can I do a backwards query-replace in emacs

1

From the documentation of query-replace:

[...] In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer.

What is the way to do it backwards? That is, if nothing is marked, from point to the beginning of the buffer? Have in mind the behavior of isearch-forward vs. isearch-backward. It might be that this kind of functionality is not available out of the box for a reason - if this is the case I would like to know what is the reason.

Dror

Posted 2013-12-28T11:21:19.923

Reputation: 1 510

Answers

1

There is not such a function out of the box. Unfortunately I cannot give a reason why.

As you may already know you could do the following:

  1. C-SPC
  2. M-<
  3. M-%

To get the behavior you are looking for. This could be recorded into a macro and bound to a key (cf. http://www.gnu.org/software/emacs/manual/html_node/emacs/Save-Keyboard-Macro.html)

verdammelt

Posted 2013-12-28T11:21:19.923

Reputation: 369