[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/man/search.texi [emacs-unicode-2]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/man/search.texi [emacs-unicode-2] |
Date: |
Wed, 28 Jul 2004 03:34:33 -0400 |
Index: emacs/man/search.texi
diff -c emacs/man/search.texi:1.39.2.5 emacs/man/search.texi:1.39.2.6
*** emacs/man/search.texi:1.39.2.5 Fri Jul 23 04:30:39 2004
--- emacs/man/search.texi Wed Jul 28 07:05:51 2004
***************
*** 1038,1057 ****
You can also use Lisp expressions to calculate parts of the
replacement string. To do this, write @samp{\,} followed by the
expression in the replacement string. Each replacement calculates the
! value of the expression, which ought to be a string, and uses it in
the replacement string in place of the expression itself. If the
expression is a symbol, one space in the replacement string after the
! symbol name counts as part of the symbol name, so the value replaces
! them both.
! Inside such an expression, @samp{\&} and @address@hidden used as
! subexpressions refer respectively to the entire match as a string, and
! to a submatch as a string. @var{n} may exceed 9 here, and the value
! of @address@hidden is @code{nil} if subexpression @var{n} did not
! match. You can also use @samp{\#&} and @address@hidden refer to
! those matches converted to numbers (this is valid when the match or
! submatch has the form of a number). @samp{\#} stands for the number
! of already-completed replacements.
Repeating our example to exchange @samp{x} and @samp{y}, we can thus
do it also this way:
--- 1038,1058 ----
You can also use Lisp expressions to calculate parts of the
replacement string. To do this, write @samp{\,} followed by the
expression in the replacement string. Each replacement calculates the
! value of the expression and converts it to text without quoting (if
! it's a string, this means using the string's contents), and uses it in
the replacement string in place of the expression itself. If the
expression is a symbol, one space in the replacement string after the
! symbol name goes with the symbol name, so the value replaces them
! both.
! Inside such an expression, you can use some special sequences.
! @samp{\&} and @address@hidden refer here, as usual, to the entire
! match as a string, and to a submatch as a string. @var{n} may be
! multiple digits, and the value of @address@hidden is @code{nil} if
! subexpression @var{n} did not match. You can also use @samp{\#&} and
! @address@hidden to refer to those matches as numbers (this is valid
! when the match or submatch has the form of a numeral). @samp{\#} here
! too stands for the number of already-completed replacements.
Repeating our example to exchange @samp{x} and @samp{y}, we can thus
do it also this way:
***************
*** 1061,1069 ****
\,(if \1 "y" "x") @key{RET}
@end example
! The @code{format} function (@pxref{Formatting Strings,,,elisp, GNU
! Emacs Lisp Reference Manual}) comes in handy for computing replacement
! strings for @samp{\,}. For example, to add consecutively numbered
strings like @samp{ABC00042} to columns 73 @w{to 80} (unless they are
already occupied), you can use
--- 1062,1070 ----
\,(if \1 "y" "x") @key{RET}
@end example
! For computing replacement strings for @samp{\,}, the @code{format}
! function is often useful (@pxref{Formatting Strings,,,elisp, GNU Emacs
! Lisp Reference Manual}). For example, to add consecutively numbered
strings like @samp{ABC00042} to columns 73 @w{to 80} (unless they are
already occupied), you can use
***************
*** 1074,1081 ****
If you want to enter part of the replacement string by hand each
time, use @samp{\?} in the replacement string. Each replacement will
! enter a recursive edit, with point at the position where the @samp{\?}
! was. For example,
@example
M-x replace-regexp @key{RET} address@hidden @key{RET}
--- 1075,1082 ----
If you want to enter part of the replacement string by hand each
time, use @samp{\?} in the replacement string. Each replacement will
! ask you to edit the replacement string in the minibuffer, putting
! point where the @samp{\?} was. For example,
@example
M-x replace-regexp @key{RET} address@hidden @key{RET}