aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2007-11-10 21:49:19 +0000
committerJuri Linkov2007-11-10 21:49:19 +0000
commit7abe68aa191f9874d41e7d41274ee4fb9a793601 (patch)
tree03baa73b69b4ee618db700f9f0cc985edb4fbd15
parent8c2e721a69fd7d5a517393a83f4ffc189a699638 (diff)
downloademacs-7abe68aa191f9874d41e7d41274ee4fb9a793601.tar.gz
emacs-7abe68aa191f9874d41e7d41274ee4fb9a793601.zip
(query-replace-show-replacement): New defcustom.
(perform-replace): Use `match-substitute-replacement' if `query-replace-show-replacement' is non-nil.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/replace.el17
2 files changed, 25 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7dfea4936d7..ec6c084dd77 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12007-11-10 Paul Pogonyshev <pogonyshev@gmx.net>
2
3 * replace.el (query-replace-show-replacement): New defcustom.
4 (perform-replace): Use `match-substitute-replacement' if
5 `query-replace-show-replacement' is non-nil.
6
72007-11-10 David Kastrup <dak@gnu.org>
8
9 * subr.el (match-substitute-replacement): New function.
10
12007-11-10 Carsten Dominik <dominik@science.uva.nl> 112007-11-10 Carsten Dominik <dominik@science.uva.nl>
2 12
3 * files.el (auto-mode-alist): Select org-mode for files with the 13 * files.el (auto-mode-alist): Select org-mode for files with the
diff --git a/lisp/replace.el b/lisp/replace.el
index 5fe8ad43d22..7876f9bb47c 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -69,6 +69,12 @@ strings or patterns."
69 :group 'matching 69 :group 'matching
70 :version "22.1") 70 :version "22.1")
71 71
72(defcustom query-replace-show-replacement t
73 "*Non-nil means to show what actual replacement text will be."
74 :type 'boolean
75 :group 'matching
76 :version "23.1")
77
72(defcustom query-replace-highlight t 78(defcustom query-replace-highlight t
73 "*Non-nil means to highlight matches during query replacement." 79 "*Non-nil means to highlight matches during query replacement."
74 :type 'boolean 80 :type 'boolean
@@ -1570,10 +1576,17 @@ make, or the user didn't cancel the call."
1570 (or delimited-flag regexp-flag) case-fold-search) 1576 (or delimited-flag regexp-flag) case-fold-search)
1571 ;; Bind message-log-max so we don't fill up the message log 1577 ;; Bind message-log-max so we don't fill up the message log
1572 ;; with a bunch of identical messages. 1578 ;; with a bunch of identical messages.
1573 (let ((message-log-max nil)) 1579 (let ((message-log-max nil)
1580 (replacement-presentation
1581 (if query-replace-show-replacement
1582 (save-match-data
1583 (set-match-data real-match-data)
1584 (match-substitute-replacement next-replacement
1585 nocasify literal))
1586 next-replacement)))
1574 (message message 1587 (message message
1575 (query-replace-descr from-string) 1588 (query-replace-descr from-string)
1576 (query-replace-descr next-replacement))) 1589 (query-replace-descr replacement-presentation)))
1577 (setq key (read-event)) 1590 (setq key (read-event))
1578 ;; Necessary in case something happens during read-event 1591 ;; Necessary in case something happens during read-event
1579 ;; that clobbers the match data. 1592 ;; that clobbers the match data.