aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2004-07-01 10:01:32 +0000
committerJuri Linkov2004-07-01 10:01:32 +0000
commit0ec4febda2d72e79bd90ab25bada4f8b34f4ab54 (patch)
tree1a946ca27eba29a6a9e095011067a6ce82007495 /lisp
parent74820eb5215e5e21f084c70e7770e0a04c1f6033 (diff)
downloademacs-0ec4febda2d72e79bd90ab25bada4f8b34f4ab54.tar.gz
emacs-0ec4febda2d72e79bd90ab25bada4f8b34f4ab54.zip
(query-replace-interactive): Change type from boolean
to choice. Add value `initial'. (query-replace-read-args): Handle value `initial' of query-replace-interactive.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/replace.el31
2 files changed, 39 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 90b17f7a14f..fc5217a1991 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12004-07-01 Juri Linkov <juri@jurta.org>
2
3 * isearch.el (isearch-mode-map): Bind C-M-w to isearch-del-char,
4 C-M-y to isearch-yank-char. Bind M-% to isearch-query-replace,
5 C-M-% to isearch-query-replace-regexp.
6 (minibuffer-local-isearch-map): Add arrow key bindings.
7 Bind C-f to isearch-yank-char-in-minibuffer.
8 (isearch-forward): Doc fix.
9 (isearch-edit-string): Doc fix.
10 (isearch-query-replace, isearch-query-replace-regexp): New funs.
11 (isearch-del-char): Add optional arg. Set isearch-yank-flag to t.
12 (isearch-yank-char): Add optional arg.
13 (isearch-yank-char-in-minibuffer): New fun.
14
15 * replace.el (query-replace-interactive): Change type from boolean
16 to choice. Add value `initial'.
17 (query-replace-read-args): Handle value `initial' of
18 query-replace-interactive.
19
12004-06-29 Kim F. Storm <storm@cua.dk> 202004-06-29 Kim F. Storm <storm@cua.dk>
2 21
3 * progmodes/gdb-ui.el (breakpoint-enabled-bitmap-face) 22 * progmodes/gdb-ui.el (breakpoint-enabled-bitmap-face)
diff --git a/lisp/replace.el b/lisp/replace.el
index c2305cdecc6..cac4470c9cd 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -38,8 +38,12 @@
38 38
39(defcustom query-replace-interactive nil 39(defcustom query-replace-interactive nil
40 "Non-nil means `query-replace' uses the last search string. 40 "Non-nil means `query-replace' uses the last search string.
41That becomes the \"string to replace\"." 41That becomes the \"string to replace\".
42 :type 'boolean 42If value is `initial', the last search string is inserted into
43the minibuffer as an initial value for \"string to replace\"."
44 :type '(choice (const :tag "Off" nil)
45 (const :tag "Initial content" initial)
46 (other :tag "Use default value" t))
43 :group 'matching) 47 :group 'matching)
44 48
45(defcustom query-replace-from-history-variable 'query-replace-history 49(defcustom query-replace-from-history-variable 'query-replace-history
@@ -70,16 +74,20 @@ strings or patterns."
70 (unless noerror 74 (unless noerror
71 (barf-if-buffer-read-only)) 75 (barf-if-buffer-read-only))
72 (let (from to) 76 (let (from to)
73 (if query-replace-interactive 77 (if (and query-replace-interactive
74 (setq from (car (if regexp-flag regexp-search-ring search-ring))) 78 (not (eq query-replace-interactive 'initial)))
79 (setq from (car (if regexp-flag regexp-search-ring search-ring)))
75 ;; The save-excursion here is in case the user marks and copies 80 ;; The save-excursion here is in case the user marks and copies
76 ;; a region in order to specify the minibuffer input. 81 ;; a region in order to specify the minibuffer input.
77 ;; That should not clobber the region for the query-replace itself. 82 ;; That should not clobber the region for the query-replace itself.
78 (save-excursion 83 (save-excursion
79 (setq from (read-from-minibuffer (format "%s: " string) 84 (setq from (read-from-minibuffer
80 nil nil nil 85 (format "%s: " string)
81 query-replace-from-history-variable 86 (if (eq query-replace-interactive 'initial)
82 nil t))) 87 (car (if regexp-flag regexp-search-ring search-ring)))
88 nil nil
89 query-replace-from-history-variable
90 nil t)))
83 ;; Warn if user types \n or \t, but don't reject the input. 91 ;; Warn if user types \n or \t, but don't reject the input.
84 (and regexp-flag 92 (and regexp-flag
85 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) 93 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
@@ -92,9 +100,10 @@ strings or patterns."
92 (sit-for 2)))) 100 (sit-for 2))))
93 101
94 (save-excursion 102 (save-excursion
95 (setq to (read-from-minibuffer (format "%s %s with: " string from) 103 (setq to (read-from-minibuffer
96 nil nil nil 104 (format "%s %s with: " string from)
97 query-replace-to-history-variable from t))) 105 nil nil nil
106 query-replace-to-history-variable from t)))
98 (when (and regexp-flag 107 (when (and regexp-flag
99 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)) 108 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))
100 (let (pos list char) 109 (let (pos list char)