summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-11-23 09:10:36 +0000
committerRichard M. Stallman <rms@gnu.org>1994-11-23 09:10:36 +0000
commit5ba4299d2e21897e32e1573eb844c3005c660c00 (patch)
tree4e4739b09bdbf50cdb347a85a44dcb584c94e15d /lisp/replace.el
parent38f80057990257332c98752e8f49b5ee568a0aa7 (diff)
downloademacs-5ba4299d2e21897e32e1573eb844c3005c660c00.tar.gz
(query-replace-map): Define \e and escape as exit-prefix.
(perform-replace): When exiting and rereading, set this-command to mode-exit.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el8
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 9e9e84c8e96..10c41344006 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -446,7 +446,7 @@ C-l to clear the screen, redisplay, and offer same replacement again,
The \"bindings\" in this map are not commands; they are answers.
The valid answers include `act', `skip', `act-and-show',
`exit', `act-and-exit', `edit', `delete-and-edit', `recenter',
-`automatic', `backup', and `help'.")
+`automatic', `backup', `exit-prefix', and `help'.")
(define-key query-replace-map " " 'act)
(define-key query-replace-map "\d" 'skip)
@@ -470,6 +470,8 @@ The valid answers include `act', `skip', `act-and-show',
(define-key query-replace-map "?" 'help)
(define-key query-replace-map "\C-g" 'quit)
(define-key query-replace-map "\C-]" 'quit)
+(define-key query-replace-map "\e" 'exit-prefix)
+(define-key query-replace-map [escape] 'exit-prefix)
(defun perform-replace (from-string replacements
query-flag regexp-flag delimited-flag
@@ -626,7 +628,11 @@ which will run faster and probably do exactly what you want."
(prog1 (match-data)
(save-excursion (recursive-edit))))
(setq replaced t))
+ ;; Note: we do not need to treat `exit-prefix'
+ ;; specially here, since we reread
+ ;; any unrecognized character.
(t
+ (setq this-command 'mode-exited)
(setq keep-going nil)
(setq unread-command-events
(append (listify-key-sequence key)