anchor.diff:    (query-replace-internal before
                             after
                             #'search-forward
  -                          #'search-backward))
  +                          #'search-backward
  +                          t))
   
   (define-command query-replace-regexp (before after)
       ((read-query-replace-args))
     (query-replace-internal before
                             after
                             #'search-forward-regexp
  -                          #'search-backward-regexp))
  +                          #'search-backward-regexp
  +                          t))
   
   (define-command query-replace-symbol (before after)
       ((read-query-replace-args))
     (query-replace-internal before
                             after
                             #'search-forward-symbol
  -                          #'search-backward-symbol))
  +                          #'search-backward-symbol
  +                          t))
  
positive.code:                    (if (point< mark-point (buffer-point buffer))
                         (query-replace-internal-body mark-point
                                                      (buffer-point buffer)
                                                      before after)
                         (query-replace-internal-body (buffer-point buffer)
                                                      mark-point
                                                      before after)))
                   (query-replace-internal-body (buffer-point buffer)
                                                nil
                                                before after))))
        (isearch-reset-overlays buffer))))
  
  (define-key *global-keymap* "M-%" 'query-replace)
  
negative.code:     (setq *replace-after-string* after)
      (list before after)))
  
  (defun query-replace-internal-body (cur-point goal-point before after query)
    (let ((pass-through (not query)))
      (loop
        (when (or (not (funcall *isearch-search-forward-function* cur-point before))
                  (and goal-point (point< goal-point cur-point)))
          (when goal-point
            (move-point (current-point) goal-point))
          (return))
        (with-point ((end cur-point :right-inserting))
          (isearch-update-buffer cur-point before)
          (funcall *isearch-search-backward-function* cur-point before)
          (with-point ((start cur-point :right-inserting))
            (loop :for c := (unless pass-through
                              (prompt-for-character (format nil "Replace ~s with ~s" before after)))
                  :do (cond
                        ((or pass-through (char= c #\y))
                         (delete-between-points start end)
                         (insert-string cur-point after)
                         (return))
                        ((char= c #\n)
                         (move-point cur-point end)
                         (return))
                        ((char= c #\!)
                         (setf pass-through t)))))))))
  
  (defun query-replace-internal (before after search-forward-function search-backward-function query)
    (let ((buffer (current-buffer)))
      (unwind-protect
           (let ((*isearch-search-forward-function* search-forward-function)
  