[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: suggestion in query-replace is messed up after cancelation
From: |
Stefan Monnier |
Subject: |
Re: suggestion in query-replace is messed up after cancelation |
Date: |
Thu, 25 May 2006 15:48:05 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> ! (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))
inhibit-quit should be used with extreme care and I don't think this calls
for it. Actually the same problem could happen because of an error or
a throw rather than a C-g. So I think something based on unwind-protect is
a better option:
(let ((interrupted t))
(unwind-protect
(prog1 (read-from-minibuffer
(format "%s %s with: " prompt (query-replace-descr from))
nil nil nil
query-replace-to-history-variable from t t)
(setq interrupted nil))
;; 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 interrupted query-replace-from-history-variable
(eq query-replace-from-history-variable
query-replace-to-history-variable))
(set query-replace-from-history-variable
(cdr (symbol-value query-replace-from-history-variable))))))
-- Stefan
- Re: suggestion in query-replace is messed up after cancelation, (continued)
- Re: suggestion in query-replace is messed up after cancelation, Juri Linkov, 2006/05/25
- Re: suggestion in query-replace is messed up after cancelation, Richard Stallman, 2006/05/26
- Re: suggestion in query-replace is messed up after cancelation, Chong Yidong, 2006/05/26
- Re: suggestion in query-replace is messed up after cancelation, Kim F. Storm, 2006/05/27
- Re: suggestion in query-replace is messed up after cancelation, Richard Stallman, 2006/05/27
- Re: suggestion in query-replace is messed up after cancelation, Chong Yidong, 2006/05/27
- Re: suggestion in query-replace is messed up after cancelation, Juri Linkov, 2006/05/28
- Re: suggestion in query-replace is messed up after cancelation, Chong Yidong, 2006/05/28
- Re: suggestion in query-replace is messed up after cancelation, Chong Yidong, 2006/05/28
- Re: suggestion in query-replace is messed up after cancelation, Richard Stallman, 2006/05/28
Re: suggestion in query-replace is messed up after cancelation,
Stefan Monnier <=