summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2005-03-18 09:59:45 +0000
committerJuri Linkov <juri@jurta.org>2005-03-18 09:59:45 +0000
commit444697a17ac69ec1d0b7805f448de3c15c9d5467 (patch)
tree054c304727a091dadcce463519a9864864b0b9d1 /lisp/replace.el
parentd9dd1f33b666997b4ae4f7376b927e55a300b131 (diff)
downloademacs-444697a17ac69ec1d0b7805f448de3c15c9d5467.tar.gz
(perform-replace): Remove bindings of global
variables isearch-string, isearch-regexp, isearch-case-fold-search. Add three new arguments to `replace-highlight'. (replace-highlight): Add arguments string, regexp, case-fold. Let-bind isearch-string, isearch-regexp, isearch-case-fold-search to allow isearch-lazy-highlight-new-loop to use these values to set corresponding isearch-lazy-highlight-... internal variables whose values lazy highlighting will use regardless of changes to global variables isearch-string, isearch-regexp, isearch-case-fold-search during lazy highlighting loop. (replace-dehighlight): Rename `isearch-lazy-highlight-cleanup' to `lazy-highlight-cleanup'.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el38
1 files changed, 17 insertions, 21 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index d2a0370f93e..dc8eb131b72 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1344,9 +1344,6 @@ make, or the user didn't cancel the call."
;; (match-data); otherwise it is t if a match is possible at point.
(match-again t)
- (isearch-string isearch-string)
- (isearch-regexp isearch-regexp)
- (isearch-case-fold-search isearch-case-fold-search)
(message
(if query-flag
(substitute-command-keys
@@ -1380,10 +1377,7 @@ make, or the user didn't cancel the call."
(regexp-quote from-string))
"\\b")))
(when query-replace-lazy-highlight
- (setq isearch-string search-string
- isearch-regexp (or delimited-flag regexp-flag)
- isearch-case-fold-search case-fold-search
- isearch-lazy-highlight-last-string nil))
+ (setq isearch-lazy-highlight-last-string nil))
(push-mark)
(undo-boundary)
@@ -1453,9 +1447,10 @@ make, or the user didn't cancel the call."
(let ((inhibit-read-only
query-replace-skip-read-only))
(unless (or literal noedit)
- (replace-highlight (nth 0 real-match-data)
- (nth 1 real-match-data)
- start end))
+ (replace-highlight
+ (nth 0 real-match-data) (nth 1 real-match-data)
+ start end search-string
+ (or delimited-flag regexp-flag) case-fold-search))
(setq noedit
(replace-match-maybe-edit
next-replacement nocasify literal
@@ -1471,8 +1466,10 @@ make, or the user didn't cancel the call."
;; `real-match-data'.
(while (not done)
(set-match-data real-match-data)
- (replace-highlight (match-beginning 0) (match-end 0)
- start end)
+ (replace-highlight
+ (match-beginning 0) (match-end 0)
+ start end search-string
+ (or delimited-flag regexp-flag) case-fold-search)
;; Bind message-log-max so we don't fill up the message log
;; with a bunch of identical messages.
(let ((message-log-max nil))
@@ -1604,11 +1601,6 @@ make, or the user didn't cancel the call."
unread-command-events))
(setq done t)))
(when query-replace-lazy-highlight
- ;; Restore isearch data for lazy highlighting
- ;; in case of isearching during recursive edit
- (setq isearch-string search-string
- isearch-regexp (or delimited-flag regexp-flag)
- isearch-case-fold-search case-fold-search)
;; Force lazy rehighlighting only after replacements
(if (not (memq def '(skip backup)))
(setq isearch-lazy-highlight-last-string nil))))
@@ -1648,21 +1640,25 @@ make, or the user didn't cancel the call."
(defvar replace-overlay nil)
-(defun replace-highlight (match-beg match-end range-beg range-end)
+(defun replace-highlight (match-beg match-end range-beg range-end
+ string regexp case-fold)
(if query-replace-highlight
(if replace-overlay
(move-overlay replace-overlay match-beg match-end (current-buffer))
(setq replace-overlay (make-overlay match-beg match-end))
(overlay-put replace-overlay 'priority 1) ;higher than lazy overlays
(overlay-put replace-overlay 'face 'query-replace)))
- (when query-replace-lazy-highlight
- (isearch-lazy-highlight-new-loop range-beg range-end)))
+ (if query-replace-lazy-highlight
+ (let ((isearch-string string)
+ (isearch-regexp regexp)
+ (isearch-case-fold-search case-fold))
+ (isearch-lazy-highlight-new-loop range-beg range-end))))
(defun replace-dehighlight ()
(when replace-overlay
(delete-overlay replace-overlay))
(when query-replace-lazy-highlight
- (isearch-lazy-highlight-cleanup lazy-highlight-cleanup)
+ (lazy-highlight-cleanup lazy-highlight-cleanup)
(setq isearch-lazy-highlight-last-string nil)))
;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4