comparison lisp/replace.el @ 83256:389421e988c2

Merged from miles@gnu.org--gnu-2005 (patch 17-26, 107-116) Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-107 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-108 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-109 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-110 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-111 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-112 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-113 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-114 <no summary provided> * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-115 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-116 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-17 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-18 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-19 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-20 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-21 More work on moving images to etc/images * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-22 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-23 Fix errors with image-file installation * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-24 etc/Makefile.in (install): Put gnus-tut.txt in the right place. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-25 etc/Makefile.in (install, uninstall): Fix installed image dirs. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-26 etc/Makefile.in (install): Create $(etcdir)/images/gnus dir. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-296
author Karoly Lorentey <lorentey@elte.hu>
date Sun, 20 Feb 2005 18:47:54 +0000
parents 85f04f438e03
children 4d79094ee455 bf0d492ea2d5
comparison
equal deleted inserted replaced
83255:9684495d72bc 83256:389421e988c2
113 (format "%s: " string)) 113 (format "%s: " string))
114 nil nil nil 114 nil nil nil
115 query-replace-from-history-variable 115 query-replace-from-history-variable
116 nil t t)))) 116 nil t t))))
117 (if (and (zerop (length from)) lastto lastfrom) 117 (if (and (zerop (length from)) lastto lastfrom)
118 (cons lastfrom 118 (progn
119 (query-replace-compile-replacement lastto regexp-flag)) 119 (cons lastfrom
120 (query-replace-compile-replacement lastto regexp-flag))
121 (set query-replace-from-history-variable
122 (cdr (symbol-value query-replace-from-history-variable))))
120 ;; Warn if user types \n or \t, but don't reject the input. 123 ;; Warn if user types \n or \t, but don't reject the input.
121 (and regexp-flag 124 (and regexp-flag
122 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from) 125 (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" from)
123 (let ((match (match-string 3 from))) 126 (let ((match (match-string 3 from)))
124 (cond 127 (cond
212 only matches surrounded by word boundaries. 215 only matches surrounded by word boundaries.
213 Fourth and fifth arg START and END specify the region to operate on. 216 Fourth and fifth arg START and END specify the region to operate on.
214 217
215 To customize possible responses, change the \"bindings\" in `query-replace-map'." 218 To customize possible responses, change the \"bindings\" in `query-replace-map'."
216 (interactive (let ((common 219 (interactive (let ((common
217 (query-replace-read-args "Query replace" nil))) 220 (query-replace-read-args
221 (if (and transient-mark-mode mark-active)
222 "Query replace in region"
223 "Query replace")
224 nil)))
218 (list (nth 0 common) (nth 1 common) (nth 2 common) 225 (list (nth 0 common) (nth 1 common) (nth 2 common)
219 ;; These are done separately here 226 ;; These are done separately here
220 ;; so that command-history will record these expressions 227 ;; so that command-history will record these expressions
221 ;; rather than the values they had this time. 228 ;; rather than the values they had this time.
222 (if (and transient-mark-mode mark-active) 229 (if (and transient-mark-mode mark-active)
272 When using those Lisp features interactively in the replacement 279 When using those Lisp features interactively in the replacement
273 text, TO-STRING is actually made a list instead of a string. 280 text, TO-STRING is actually made a list instead of a string.
274 Use \\[repeat-complex-command] after this command for details." 281 Use \\[repeat-complex-command] after this command for details."
275 (interactive 282 (interactive
276 (let ((common 283 (let ((common
277 (query-replace-read-args "Query replace regexp" t))) 284 (query-replace-read-args
285 (if (and transient-mark-mode mark-active)
286 "Query replace regexp in region"
287 "Query replace regexp")
288 t)))
278 (list (nth 0 common) (nth 1 common) (nth 2 common) 289 (list (nth 0 common) (nth 1 common) (nth 2 common)
279 ;; These are done separately here 290 ;; These are done separately here
280 ;; so that command-history will record these expressions 291 ;; so that command-history will record these expressions
281 ;; rather than the values they had this time. 292 ;; rather than the values they had this time.
282 (if (and transient-mark-mode mark-active) 293 (if (and transient-mark-mode mark-active)
418 which will run faster and will not set the mark or print anything. 429 which will run faster and will not set the mark or print anything.
419 \(You may need a more complex loop if FROM-STRING can match the null string 430 \(You may need a more complex loop if FROM-STRING can match the null string
420 and TO-STRING is also null.)" 431 and TO-STRING is also null.)"
421 (interactive 432 (interactive
422 (let ((common 433 (let ((common
423 (query-replace-read-args "Replace string" nil))) 434 (query-replace-read-args
435 (if (and transient-mark-mode mark-active)
436 "Replace string in region"
437 "Replace string")
438 nil)))
424 (list (nth 0 common) (nth 1 common) (nth 2 common) 439 (list (nth 0 common) (nth 1 common) (nth 2 common)
425 (if (and transient-mark-mode mark-active) 440 (if (and transient-mark-mode mark-active)
426 (region-beginning)) 441 (region-beginning))
427 (if (and transient-mark-mode mark-active) 442 (if (and transient-mark-mode mark-active)
428 (region-end))))) 443 (region-end)))))
472 (while (re-search-forward REGEXP nil t) 487 (while (re-search-forward REGEXP nil t)
473 (replace-match TO-STRING nil nil)) 488 (replace-match TO-STRING nil nil))
474 which will run faster and will not set the mark or print anything." 489 which will run faster and will not set the mark or print anything."
475 (interactive 490 (interactive
476 (let ((common 491 (let ((common
477 (query-replace-read-args "Replace regexp" t))) 492 (query-replace-read-args
493 (if (and transient-mark-mode mark-active)
494 "Replace regexp in region"
495 "Replace regexp")
496 t)))
478 (list (nth 0 common) (nth 1 common) (nth 2 common) 497 (list (nth 0 common) (nth 1 common) (nth 2 common)
479 (if (and transient-mark-mode mark-active) 498 (if (and transient-mark-mode mark-active)
480 (region-beginning)) 499 (region-beginning))
481 (if (and transient-mark-mode mark-active) 500 (if (and transient-mark-mode mark-active)
482 (region-end))))) 501 (region-end)))))