1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-12 16:23:57 +00:00

Document effect of 'search-upper-case' on replacement commands

* doc/emacs/search.texi (Replacement and Lax Matches): Document
the role of 'search-upper-case' in replacement commands.
(Lax Search): Document the value 'not-yanks' of
'search-upper-case' where the variable itself is documented.

* lisp/replace.el (query-replace-regexp, query-replace): Mention
'search-upper-case' and its effect in doc strings.  (Bug#40940)
This commit is contained in:
Eli Zaretskii 2020-05-02 10:54:01 +03:00
parent 5a5d8a8ec0
commit ed25282b82
2 changed files with 36 additions and 21 deletions

View File

@ -1324,10 +1324,14 @@ case-sensitive. Thus, searching for @samp{Foo} does not find
@samp{foo} or @samp{FOO}. This applies to regular expression search @samp{foo} or @samp{FOO}. This applies to regular expression search
as well as to literal string search. The effect ceases if you delete as well as to literal string search. The effect ceases if you delete
the upper-case letter from the search string. The variable the upper-case letter from the search string. The variable
@code{search-upper-case} controls this: if it is non-@code{nil} (the @code{search-upper-case} controls this: if it is non-@code{nil}, an
default), an upper-case character in the search string makes the upper-case character in the search string makes the search
search case-sensitive; setting it to @code{nil} disables this effect case-sensitive; setting it to @code{nil} disables this effect of
of upper-case characters. upper-case characters. The default value of this variable is
@code{not-yanks}, which makes search case-sensitive if there are
upper-case letters in the search string, and also causes text yanked
into the search string (@pxref{Isearch Yank}) to be down-cased, so
that such searches are case-insensitive by default.
@vindex case-fold-search @vindex case-fold-search
If you set the variable @code{case-fold-search} to @code{nil}, then If you set the variable @code{case-fold-search} to @code{nil}, then
@ -1572,9 +1576,13 @@ searching for patterns.
@cindex case folding in replace commands @cindex case folding in replace commands
If the first argument of a replace command is all lower case, the If the first argument of a replace command is all lower case, the
command ignores case while searching for occurrences to command ignores case while searching for occurrences to
replace---provided @code{case-fold-search} is non-@code{nil}. If replace---provided @code{case-fold-search} is non-@code{nil} and
@code{case-fold-search} is set to @code{nil}, case is always significant @code{search-upper-case} is also non-@code{nil}. If
in all searches. @code{search-upper-case} (@pxref{Lax Search, search-upper-case}) is
@code{nil}, whether searching ignores case is determined by
@code{case-fold-search} alone, regardless of letter-case of the
command's first argument. If @code{case-fold-search} is set to
@code{nil}, case is always significant in all searches.
@vindex case-replace @vindex case-replace
In addition, when the @var{newstring} argument is all or partly lower In addition, when the @var{newstring} argument is all or partly lower

View File

@ -340,13 +340,17 @@ that reads FROM-STRING, or invoke replacements from
incremental search with a key sequence like `C-s C-s M-%' incremental search with a key sequence like `C-s C-s M-%'
to use its current search string as the string to replace. to use its current search string as the string to replace.
Matching is independent of case if `case-fold-search' is non-nil and Matching is independent of case if both `case-fold-search'
FROM-STRING has no uppercase letters. Replacement transfers the case and `search-upper-case' are non-nil and FROM-STRING has no
pattern of the old text to the new text, if `case-replace' and uppercase letters; if `search-upper-case' is nil, then
`case-fold-search' are non-nil and FROM-STRING has no uppercase whether matching ignores case depends on `case-fold-search'
letters. (Transferring the case pattern means that if the old text regardless of whether there are uppercase letters in FROM-STRING.
matched is all caps, or capitalized, then its replacement is upcased Replacement transfers the case pattern of the old text to the
or capitalized.) new text, if both `case-fold-search' and `case-replace' are
non-nil and FROM-STRING has no uppercase letters.
\(Transferring the case pattern means that if the old text
matched is all caps, or capitalized, then its replacement is
respectively upcased or capitalized.)
Ignore read-only matches if `query-replace-skip-read-only' is non-nil, Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
ignore hidden matches if `search-invisible' is nil, and ignore more ignore hidden matches if `search-invisible' is nil, and ignore more
@ -402,13 +406,16 @@ that reads REGEXP, or invoke replacements from
incremental search with a key sequence like `C-M-s C-M-s C-M-%' incremental search with a key sequence like `C-M-s C-M-s C-M-%'
to use its current search regexp as the regexp to replace. to use its current search regexp as the regexp to replace.
Matching is independent of case if `case-fold-search' is non-nil and Matching is independent of case if both `case-fold-search'
REGEXP has no uppercase letters. Replacement transfers the case and `search-upper-case' are non-nil and REGEXP has no uppercase
pattern of the old text to the new text, if `case-replace' and letters; if `search-upper-case' is nil, then whether matching
`case-fold-search' are non-nil and REGEXP has no uppercase letters. ignores case depends on `case-fold-search' regardless of whether
\(Transferring the case pattern means that if the old text matched is there are uppercase letters in REGEXP.
all caps, or capitalized, then its replacement is upcased or Replacement transfers the case pattern of the old text to the new
capitalized.) text, if both `case-fold-search' and `case-replace' are non-nil
and REGEXP has no uppercase letters. (Transferring the case pattern
means that if the old text matched is all caps, or capitalized,
then its replacement is respectively upcased or capitalized.)
Ignore read-only matches if `query-replace-skip-read-only' is non-nil, Ignore read-only matches if `query-replace-skip-read-only' is non-nil,
ignore hidden matches if `search-invisible' is nil, and ignore more ignore hidden matches if `search-invisible' is nil, and ignore more