emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: suggestion in query-replace is messed up after cancelation


From: Chong Yidong
Subject: Re: suggestion in query-replace is messed up after cancelation
Date: Thu, 25 May 2006 13:38:17 -0400

> 1) $ emacs -Q
> 2) type football and C-a
> 3) M-% foo RET bar RET y (this replaces the only occurence of foo)
> 4) M-% (suggests foo -> bar) baz RET C-g
> 5) M-% (suggests bar -> baz, while it should suggest foo -> bar)

I think this can be fixed with the following patch to
query-replace-read-to.  I can install it if people don't object.

*** emacs/lisp/replace.el.~1.239.~      2006-05-25 13:19:07.000000000 -0400
--- emacs/lisp/replace.el       2006-05-25 13:35:40.000000000 -0400
***************
*** 177,186 ****
    "Query and return the `to' argument of a query-replace operation."
    (query-replace-compile-replacement
     (save-excursion
!      (read-from-minibuffer
!       (format "%s %s with: " prompt (query-replace-descr from))
!       nil nil nil
!       query-replace-to-history-variable from t t))
     regexp-flag))
  
  (defun query-replace-read-args (prompt regexp-flag &optional noerror)
--- 177,196 ----
    "Query and return the `to' argument of a query-replace operation."
    (query-replace-compile-replacement
     (save-excursion
!      (let* ((inhibit-quit t)
!           (read
!            (with-local-quit
!              (read-from-minibuffer
!               (format "%s %s with: " prompt (query-replace-descr from))
!               nil nil nil
!               query-replace-to-history-variable from t t))))
!        ;; If the user quits while prompting for the `to' argument,
!        ;; remove the previously-supplied `from' argument from the
!        ;; history to avoid confusing `from'-`to' pairs.
!        (if (and quit-flag query-replace-from-history-variable)
!          (set query-replace-from-history-variable
!               (cdr (symbol-value query-replace-from-history-variable))))
!        read))
     regexp-flag))
  
  (defun query-replace-read-args (prompt regexp-flag &optional noerror)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]