summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2000-05-03 19:23:28 +0000
committerGerd Moellmann <gerd@gnu.org>2000-05-03 19:23:28 +0000
commit7ce278f3ad9f7796046ed349407336c40d53e560 (patch)
tree15f64c09cb01190621ff2a9ebf63e721d345697c /lisp/replace.el
parent72bd7b7b4604bd1a7d08dd76d42d62d1e4aff095 (diff)
downloademacs-7ce278f3ad9f7796046ed349407336c40d53e560.tar.gz
emacs-7ce278f3ad9f7796046ed349407336c40d53e560.tar.bz2
emacs-7ce278f3ad9f7796046ed349407336c40d53e560.zip
(query-replace-map): Add binding for `E'.
(query-replace-help): Extend help text. (perform-replace): Allow editing the replacement string.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index fcb7ad423b6..539c001dc8a 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -715,7 +715,8 @@ C-r to enter recursive edit (\\[exit-recursive-edit] to get out again),
C-w to delete match and recursive edit,
C-l to clear the screen, redisplay, and offer same replacement again,
! to replace all remaining matches with no more questions,
-^ to move point back to previous match."
+^ to move point back to previous match,
+E to edit the replacement string"
"Help message while in query-replace")
(defvar query-replace-map (make-sparse-keymap)
@@ -733,6 +734,7 @@ The valid answers include `act', `skip', `act-and-show',
(define-key query-replace-map "n" 'skip)
(define-key query-replace-map "Y" 'act)
(define-key query-replace-map "N" 'skip)
+(define-key query-replace-map "E" 'edit-replacement)
(define-key query-replace-map "," 'act-and-show)
(define-key query-replace-map "q" 'exit)
(define-key query-replace-map "\r" 'exit)
@@ -1011,6 +1013,16 @@ which will run faster and probably do exactly what you want."
(if (and regexp-flag nonempty-match)
(setq match-again (and (looking-at search-string)
(match-data)))))
+
+ ;; Edit replacement.
+ ((eq def 'edit-replacement)
+ (setq next-replacement
+ (read-input "Edit replacement string: "
+ next-replacement))
+ (or replaced
+ (replace-match next-replacement nocasify literal))
+ (setq done t))
+
((eq def 'delete-and-edit)
(delete-region (match-beginning 0) (match-end 0))
(set-match-data