Fix documentation of 'assoc-string' and 'compare-strings'

* src/minibuf.c (Fassoc_string): Clarify how CASE-FOLD affects the
string comparison.  (Bug#23833)
* src/fns.c (Fcompare_strings): Fix the description of how
IGNORE-CASE affects the comparison.

* doc/lispref/strings.texi (Text Comparison): Clarify how
CASE-FOLD affects the string comparison in 'assoc-string'.  Fix
the description of how IGNORE-CASE affects the comparison in
'compare-strings'.
This commit is contained in:
Eli Zaretskii 2016-06-23 18:09:14 +03:00
parent ab0ebb93a9
commit 4395aaacd4
3 changed files with 6 additions and 5 deletions

View file

@ -660,7 +660,7 @@ The strings are compared by the numeric values of their characters.
For instance, @var{str1} is considered less than @var{str2} if For instance, @var{str1} is considered less than @var{str2} if
its first differing character has a smaller numeric value. If its first differing character has a smaller numeric value. If
@var{ignore-case} is non-@code{nil}, characters are converted to @var{ignore-case} is non-@code{nil}, characters are converted to
lower-case before comparing them. Unibyte strings are converted to upper-case before comparing them. Unibyte strings are converted to
multibyte for comparison (@pxref{Text Representations}), so that a multibyte for comparison (@pxref{Text Representations}), so that a
unibyte string and its conversion to multibyte are always regarded as unibyte string and its conversion to multibyte are always regarded as
equal. equal.
@ -677,7 +677,8 @@ specified portion) is less.
This function works like @code{assoc}, except that @var{key} must be a This function works like @code{assoc}, except that @var{key} must be a
string or symbol, and comparison is done using @code{compare-strings}. string or symbol, and comparison is done using @code{compare-strings}.
Symbols are converted to strings before testing. Symbols are converted to strings before testing.
If @var{case-fold} is non-@code{nil}, it ignores case differences. If @var{case-fold} is non-@code{nil}, @var{key} and the elements of
@var{alist} are converted to upper-case before comparison.
Unlike @code{assoc}, this function can also match elements of the alist Unlike @code{assoc}, this function can also match elements of the alist
that are strings or symbols rather than conses. In particular, @var{alist} can that are strings or symbols rather than conses. In particular, @var{alist} can
be a list of strings or symbols rather than an actual alist. be a list of strings or symbols rather than an actual alist.

View file

@ -224,7 +224,7 @@ Like in `substring', negative values are counted from the end.
The strings are compared by the numeric values of their characters. The strings are compared by the numeric values of their characters.
For instance, STR1 is "less than" STR2 if its first differing For instance, STR1 is "less than" STR2 if its first differing
character has a smaller numeric value. If IGNORE-CASE is non-nil, character has a smaller numeric value. If IGNORE-CASE is non-nil,
characters are converted to lower-case before comparing them. Unibyte characters are converted to upper-case before comparing them. Unibyte
strings are converted to multibyte for comparison. strings are converted to multibyte for comparison.
The value is t if the strings (or specified portions) match. The value is t if the strings (or specified portions) match.

View file

@ -1817,8 +1817,8 @@ DEFUN ("assoc-string", Fassoc_string, Sassoc_string, 2, 3, 0,
This returns the first element of LIST whose car matches the string or This returns the first element of LIST whose car matches the string or
symbol KEY, or nil if no match exists. When performing the symbol KEY, or nil if no match exists. When performing the
comparison, symbols are first converted to strings, and unibyte comparison, symbols are first converted to strings, and unibyte
strings to multibyte. If the optional arg CASE-FOLD is non-nil, case strings to multibyte. If the optional arg CASE-FOLD is non-nil, both
is ignored. KEY and the elements of LIST are upcased for comparison.
Unlike `assoc', KEY can also match an entry in LIST consisting of a Unlike `assoc', KEY can also match an entry in LIST consisting of a
single string, rather than a cons cell whose car is a string. */) single string, rather than a cons cell whose car is a string. */)