Mercurial > emacs
comparison lisp/replace.el @ 45529:45014630aeb2
(perform-replace): Document return value. Use `pop'.
author | Colin Walters <walters@gnu.org> |
---|---|
date | Sun, 26 May 2002 20:42:51 +0000 |
parents | 177f92e9f497 |
children | 01fbc1331841 |
comparison
equal
deleted
inserted
replaced
45528:bc8cc9c5d979 | 45529:45014630aeb2 |
---|---|
965 (while (re-search-forward \"foo[ \\t]+bar\" nil t) | 965 (while (re-search-forward \"foo[ \\t]+bar\" nil t) |
966 (replace-match \"foobar\" nil nil)) | 966 (replace-match \"foobar\" nil nil)) |
967 | 967 |
968 which will run faster and probably do exactly what you want. Please | 968 which will run faster and probably do exactly what you want. Please |
969 see the documentation of `replace-match' to find out how to simulate | 969 see the documentation of `replace-match' to find out how to simulate |
970 `case-replace'." | 970 `case-replace'. |
971 | |
972 This function returns nil if and only if there were no matches to | |
973 make, or the user didn't cancel the call." | |
971 (or map (setq map query-replace-map)) | 974 (or map (setq map query-replace-map)) |
972 (and query-flag minibuffer-auto-raise | 975 (and query-flag minibuffer-auto-raise |
973 (raise-frame (window-frame (minibuffer-window)))) | 976 (raise-frame (window-frame (minibuffer-window)))) |
974 (let ((nocasify (not (and case-fold-search case-replace | 977 (let ((nocasify (not (and case-fold-search case-replace |
975 (string-equal from-string | 978 (string-equal from-string |
1121 ((eq def 'exit) | 1124 ((eq def 'exit) |
1122 (setq keep-going nil) | 1125 (setq keep-going nil) |
1123 (setq done t)) | 1126 (setq done t)) |
1124 ((eq def 'backup) | 1127 ((eq def 'backup) |
1125 (if stack | 1128 (if stack |
1126 (let ((elt (car stack))) | 1129 (let ((elt (pop stack))) |
1127 (goto-char (car elt)) | 1130 (goto-char (car elt)) |
1128 (setq replaced (eq t (cdr elt))) | 1131 (setq replaced (eq t (cdr elt))) |
1129 (or replaced | 1132 (or replaced |
1130 (set-match-data (cdr elt))) | 1133 (set-match-data (cdr elt)))) |
1131 (setq stack (cdr stack))) | |
1132 (message "No previous match") | 1134 (message "No previous match") |
1133 (ding 'no-terminate) | 1135 (ding 'no-terminate) |
1134 (sit-for 1))) | 1136 (sit-for 1))) |
1135 ((eq def 'act) | 1137 ((eq def 'act) |
1136 (or replaced | 1138 (or replaced |