anchor.diff:                     #'(lambda ()
                          (let ((pos (search str (take-string))))
                            (when pos (+ pos (length str)))))
  -                   #'search-forward-step
  +                   #'next-line
                      #'goto-column
                      (search-forward-endp-function limit)))))
  +
  +(defun search-backward-endp-function (limit)
  +  (if limit
  +      #'(lambda ()
  +          (point< (point) limit))
  +      #'bobp))
   
   (defun search-backward (str &optional limit)
     (let ((length (1+ (count #\newline str))))
  
positive.code:         (point-set start-point)
          (do ()
              ((null
                (search-forward search-string
                                end-point)))
            (let ((point2 (point))
                  (point1 (save-excursion
                           (prev-char (length search-string))
                           (point))))
              (push (make-overlay point1 point2
                                  :attr (if (and (point<= point1 save-point)
  
negative.code:     (setq *replace-after-string* after)
      (values before after)))
  
  ;(define-key *global-keymap* (kbd "M-C-r") 'query-replace)
  (define-command query-replace () ()
    (multiple-value-bind (before after)
        (query-replace-before-after)
  