Mercurial > emacs
changeset 60713:77391bae98f1
(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'.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Fri, 18 Mar 2005 09:59:45 +0000 |
parents | d37e83a20683 |
children | 438b974e257c |
files | lisp/replace.el |
diffstat | 1 files changed, 17 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/replace.el Fri Mar 18 09:59:31 2005 +0000 +++ b/lisp/replace.el Fri Mar 18 09:59:45 2005 +0000 @@ -1344,9 +1344,6 @@ ;; (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 @@ (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 @@ (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 @@ ;; `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 @@ 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 @@ (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