1344 |
;; (match-data); otherwise it is t if a match is possible at point. |
;; (match-data); otherwise it is t if a match is possible at point. |
1345 |
(match-again t) |
(match-again t) |
1346 |
|
|
|
(isearch-string isearch-string) |
|
|
(isearch-regexp isearch-regexp) |
|
|
(isearch-case-fold-search isearch-case-fold-search) |
|
1347 |
(message |
(message |
1348 |
(if query-flag |
(if query-flag |
1349 |
(substitute-command-keys |
(substitute-command-keys |
1377 |
(regexp-quote from-string)) |
(regexp-quote from-string)) |
1378 |
"\\b"))) |
"\\b"))) |
1379 |
(when query-replace-lazy-highlight |
(when query-replace-lazy-highlight |
1380 |
(setq isearch-string search-string |
(setq isearch-lazy-highlight-last-string nil)) |
|
isearch-regexp (or delimited-flag regexp-flag) |
|
|
isearch-case-fold-search case-fold-search |
|
|
isearch-lazy-highlight-last-string nil)) |
|
1381 |
|
|
1382 |
(push-mark) |
(push-mark) |
1383 |
(undo-boundary) |
(undo-boundary) |
1447 |
(let ((inhibit-read-only |
(let ((inhibit-read-only |
1448 |
query-replace-skip-read-only)) |
query-replace-skip-read-only)) |
1449 |
(unless (or literal noedit) |
(unless (or literal noedit) |
1450 |
(replace-highlight (nth 0 real-match-data) |
(replace-highlight |
1451 |
(nth 1 real-match-data) |
(nth 0 real-match-data) (nth 1 real-match-data) |
1452 |
start end)) |
start end search-string |
1453 |
|
(or delimited-flag regexp-flag) case-fold-search)) |
1454 |
(setq noedit |
(setq noedit |
1455 |
(replace-match-maybe-edit |
(replace-match-maybe-edit |
1456 |
next-replacement nocasify literal |
next-replacement nocasify literal |
1466 |
;; `real-match-data'. |
;; `real-match-data'. |
1467 |
(while (not done) |
(while (not done) |
1468 |
(set-match-data real-match-data) |
(set-match-data real-match-data) |
1469 |
(replace-highlight (match-beginning 0) (match-end 0) |
(replace-highlight |
1470 |
start end) |
(match-beginning 0) (match-end 0) |
1471 |
|
start end search-string |
1472 |
|
(or delimited-flag regexp-flag) case-fold-search) |
1473 |
;; Bind message-log-max so we don't fill up the message log |
;; Bind message-log-max so we don't fill up the message log |
1474 |
;; with a bunch of identical messages. |
;; with a bunch of identical messages. |
1475 |
(let ((message-log-max nil)) |
(let ((message-log-max nil)) |
1601 |
unread-command-events)) |
unread-command-events)) |
1602 |
(setq done t))) |
(setq done t))) |
1603 |
(when query-replace-lazy-highlight |
(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) |
|
1604 |
;; Force lazy rehighlighting only after replacements |
;; Force lazy rehighlighting only after replacements |
1605 |
(if (not (memq def '(skip backup))) |
(if (not (memq def '(skip backup))) |
1606 |
(setq isearch-lazy-highlight-last-string nil)))) |
(setq isearch-lazy-highlight-last-string nil)))) |
1640 |
|
|
1641 |
(defvar replace-overlay nil) |
(defvar replace-overlay nil) |
1642 |
|
|
1643 |
(defun replace-highlight (match-beg match-end range-beg range-end) |
(defun replace-highlight (match-beg match-end range-beg range-end |
1644 |
|
string regexp case-fold) |
1645 |
(if query-replace-highlight |
(if query-replace-highlight |
1646 |
(if replace-overlay |
(if replace-overlay |
1647 |
(move-overlay replace-overlay match-beg match-end (current-buffer)) |
(move-overlay replace-overlay match-beg match-end (current-buffer)) |
1648 |
(setq replace-overlay (make-overlay match-beg match-end)) |
(setq replace-overlay (make-overlay match-beg match-end)) |
1649 |
(overlay-put replace-overlay 'priority 1) ;higher than lazy overlays |
(overlay-put replace-overlay 'priority 1) ;higher than lazy overlays |
1650 |
(overlay-put replace-overlay 'face 'query-replace))) |
(overlay-put replace-overlay 'face 'query-replace))) |
1651 |
(when query-replace-lazy-highlight |
(if query-replace-lazy-highlight |
1652 |
(isearch-lazy-highlight-new-loop range-beg range-end))) |
(let ((isearch-string string) |
1653 |
|
(isearch-regexp regexp) |
1654 |
|
(isearch-case-fold-search case-fold)) |
1655 |
|
(isearch-lazy-highlight-new-loop range-beg range-end)))) |
1656 |
|
|
1657 |
(defun replace-dehighlight () |
(defun replace-dehighlight () |
1658 |
(when replace-overlay |
(when replace-overlay |
1659 |
(delete-overlay replace-overlay)) |
(delete-overlay replace-overlay)) |
1660 |
(when query-replace-lazy-highlight |
(when query-replace-lazy-highlight |
1661 |
(isearch-lazy-highlight-cleanup lazy-highlight-cleanup) |
(lazy-highlight-cleanup lazy-highlight-cleanup) |
1662 |
(setq isearch-lazy-highlight-last-string nil))) |
(setq isearch-lazy-highlight-last-string nil))) |
1663 |
|
|
1664 |
;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4 |
;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4 |