aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorChong Yidong2008-06-06 20:32:11 +0000
committerChong Yidong2008-06-06 20:32:11 +0000
commitc35a09fc44c3ed4e401f6f05aaca7763c3990659 (patch)
tree77e48590b8344b9e571677feb10f5ee1d8b51b8c /lisp/replace.el
parente87085e6d5606b545ac0ee6039fe15f32ac7ee1c (diff)
downloademacs-c35a09fc44c3ed4e401f6f05aaca7763c3990659.tar.gz
emacs-c35a09fc44c3ed4e401f6f05aaca7763c3990659.zip
(replace-search-function, replace-re-search-function): New vars.
(perform-replace): Use them.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 1da1253641c..9b42834d7cb 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1486,6 +1486,17 @@ passed in. If LITERAL is set, no checking is done, anyway."
1486 (replace-match newtext fixedcase literal) 1486 (replace-match newtext fixedcase literal)
1487 noedit) 1487 noedit)
1488 1488
1489(defvar replace-search-function 'search-forward
1490 "Function to use when searching for strings to replace.
1491It is used by `query-replace' and `replace-string', and is called
1492with three arguments, as if it were `search-forward'.")
1493
1494(defvar replace-re-search-function 're-search-forward
1495 "Function to use when searching for regexps to replace.
1496It is used by `query-replace-regexp', `replace-regexp',
1497`query-replace-regexp-eval', and `map-query-replace-regexp'. It
1498is called with three arguments, as if it were `search-forward'.")
1499
1489(defun perform-replace (from-string replacements 1500(defun perform-replace (from-string replacements
1490 query-flag regexp-flag delimited-flag 1501 query-flag regexp-flag delimited-flag
1491 &optional repeat-count map start end) 1502 &optional repeat-count map start end)
@@ -1511,7 +1522,10 @@ make, or the user didn't cancel the call."
1511 case-fold-search)) 1522 case-fold-search))
1512 (nocasify (not (and case-replace case-fold-search))) 1523 (nocasify (not (and case-replace case-fold-search)))
1513 (literal (or (not regexp-flag) (eq regexp-flag 'literal))) 1524 (literal (or (not regexp-flag) (eq regexp-flag 'literal)))
1514 (search-function (if regexp-flag 're-search-forward 'search-forward)) 1525 (search-function
1526 (if regexp-flag
1527 replace-re-search-function
1528 replace-search-function))
1515 (search-string from-string) 1529 (search-string from-string)
1516 (real-match-data nil) ; The match data for the current match. 1530 (real-match-data nil) ; The match data for the current match.
1517 (next-replacement nil) 1531 (next-replacement nil)