aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-12-12 22:33:28 +0000
committerJuri Linkov2004-12-12 22:33:28 +0000
commit35d59c0f52a589d33670810449a588ecbfc2c3cf (patch)
treebc1bdfa9cdd5db75e0e223f065140bfbcaa80e92
parent15fd7d5da5b7001337c87edd795c747e61894a81 (diff)
downloademacs-35d59c0f52a589d33670810449a588ecbfc2c3cf.tar.gz
emacs-35d59c0f52a589d33670810449a588ecbfc2c3cf.zip
* replace.el (query-replace-highlight): Add new value `isearch'
that allows query replacement to use isearch highlighting. Change type from `boolean' to `choice'. Doc fix. (replace-highlight, replace-dehighlight, perform-replace): Use isearch highlighting if query-replace-highlight eq `isearch'.
-rw-r--r--lisp/ChangeLog33
-rw-r--r--lisp/replace.el54
2 files changed, 72 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e1335731707..d75943f408d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,36 @@
12004-12-12 Juri Linkov <juri@jurta.org>
2
3 * isearch.el (isearch-edit-string): Set 7th arg of
4 `read-from-minibuffer' to `t' to inherit the current input
5 method (whose name is indicated by [IM] in the minibuffer prompt)
6 from the current buffer to the minibuffer.
7 (isearch-lazy-highlight-update): Put body to `with-local-quit'
8 to allow C-g quitting for lazy highlighting looping inside the
9 search with nested repetition operators. Add overlay to the list
10 before setting its face and other properties to avoid the case of
11 code quitting after placing the new overlay but before it's
12 recorded on the list. Select the window where isearch was
13 activated, to highlight matches in the right window when isearch
14 switches the current window to the minibuffer.
15
16 * international/isearch-x.el
17 (isearch-process-search-multibyte-characters):
18 Use `isearch-message' as initial input for `read-string' instead
19 of adding it to the minibuffer prompt. After reading a string
20 remove the initial value of `isearch-message' from the string.
21
22 * replace.el (replace-match-maybe-edit): Doc fix.
23 (perform-replace): Don't call `replace-highlight' when automatic
24 replacement is requested in literal mode, since it is intended
25 only to highlight words during entering a new replacement string
26 for \? in non-literal mode.
27
28 * replace.el (query-replace-highlight): Add new value `isearch'
29 that allows query replacement to use isearch highlighting.
30 Change type from `boolean' to `choice'. Doc fix.
31 (replace-highlight, replace-dehighlight, perform-replace):
32 Use isearch highlighting if query-replace-highlight eq `isearch'.
33
12004-12-11 Stefan Monnier <monnier@iro.umontreal.ca> 342004-12-11 Stefan Monnier <monnier@iro.umontreal.ca>
2 35
3 * emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments) 36 * emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
diff --git a/lisp/replace.el b/lisp/replace.el
index 933a0004ce2..646f693cd7f 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1281,6 +1281,8 @@ make, or the user didn't cancel the call."
1281 ;; (match-data); otherwise it is t if a match is possible at point. 1281 ;; (match-data); otherwise it is t if a match is possible at point.
1282 (match-again t) 1282 (match-again t)
1283 1283
1284 (isearch-string isearch-string)
1285 (isearch-regexp isearch-regexp)
1284 (message 1286 (message
1285 (if query-flag 1287 (if query-flag
1286 (substitute-command-keys 1288 (substitute-command-keys
@@ -1313,6 +1315,10 @@ make, or the user didn't cancel the call."
1313 (if regexp-flag from-string 1315 (if regexp-flag from-string
1314 (regexp-quote from-string)) 1316 (regexp-quote from-string))
1315 "\\b"))) 1317 "\\b")))
1318 (if (eq query-replace-highlight 'isearch)
1319 (setq isearch-string search-string
1320 isearch-regexp regexp-flag))
1321
1316 (push-mark) 1322 (push-mark)
1317 (undo-boundary) 1323 (undo-boundary)
1318 (unwind-protect 1324 (unwind-protect
@@ -1528,7 +1534,14 @@ make, or the user didn't cancel the call."
1528 (setq unread-command-events 1534 (setq unread-command-events
1529 (append (listify-key-sequence key) 1535 (append (listify-key-sequence key)
1530 unread-command-events)) 1536 unread-command-events))
1531 (setq done t)))) 1537 (setq done t)))
1538 (when (eq query-replace-highlight 'isearch)
1539 ;; Force isearch rehighlighting
1540 (if (not (memq def '(skip backup)))
1541 (setq isearch-lazy-highlight-last-string nil))
1542 ;; Restore isearch data in case of isearching during edit
1543 (setq isearch-string search-string
1544 isearch-regexp regexp-flag)))
1532 ;; Record previous position for ^ when we move on. 1545 ;; Record previous position for ^ when we move on.
1533 ;; Change markers to numbers in the match data 1546 ;; Change markers to numbers in the match data
1534 ;; since lots of markers slow down editing. 1547 ;; since lots of markers slow down editing.
@@ -1563,27 +1576,38 @@ make, or the user didn't cancel the call."
1563 (if (= replace-count 1) "" "s"))) 1576 (if (= replace-count 1) "" "s")))
1564 (and keep-going stack))) 1577 (and keep-going stack)))
1565 1578
1566(defcustom query-replace-highlight t 1579(defcustom query-replace-highlight
1567 "*Non-nil means to highlight words during query replacement." 1580 (if (and search-highlight isearch-lazy-highlight) 'isearch t)
1568 :type 'boolean 1581 "*Non-nil means to highlight words during query replacement.
1582If `isearch', use isearch highlighting for query replacement."
1583 :type '(choice (const :tag "Highlight" t)
1584 (const :tag "No highlighting" nil)
1585 (const :tag "Isearch highlighting" 'isearch))
1569 :group 'matching) 1586 :group 'matching)
1570 1587
1571(defvar replace-overlay nil) 1588(defvar replace-overlay nil)
1572 1589
1573(defun replace-dehighlight () 1590(defun replace-dehighlight ()
1574 (and replace-overlay 1591 (cond ((eq query-replace-highlight 'isearch)
1575 (progn 1592 (isearch-dehighlight t)
1576 (delete-overlay replace-overlay) 1593 (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup)
1577 (setq replace-overlay nil)))) 1594 (setq isearch-lazy-highlight-last-string nil))
1595 (query-replace-highlight
1596 (when replace-overlay
1597 (delete-overlay replace-overlay)
1598 (setq replace-overlay nil)))))
1578 1599
1579(defun replace-highlight (start end) 1600(defun replace-highlight (start end)
1580 (and query-replace-highlight 1601 (cond ((eq query-replace-highlight 'isearch)
1581 (if replace-overlay 1602 (isearch-highlight start end)
1582 (move-overlay replace-overlay start end (current-buffer)) 1603 (isearch-lazy-highlight-new-loop))
1583 (setq replace-overlay (make-overlay start end)) 1604 (query-replace-highlight
1584 (overlay-put replace-overlay 'face 1605 (if replace-overlay
1585 (if (facep 'query-replace) 1606 (move-overlay replace-overlay start end (current-buffer))
1586 'query-replace 'region))))) 1607 (setq replace-overlay (make-overlay start end))
1608 (overlay-put replace-overlay 'face
1609 (if (facep 'query-replace)
1610 'query-replace 'region))))))
1587 1611
1588;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4 1612;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
1589;;; replace.el ends here 1613;;; replace.el ends here