Commit 4395aaac authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

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'.
parent ab0ebb93
......@@ -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
its first differing character has a smaller numeric value. If
@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
unibyte string and its conversion to multibyte are always regarded as
equal.
......@@ -677,7 +677,8 @@ specified portion) is less.
This function works like @code{assoc}, except that @var{key} must be a
string or symbol, and comparison is done using @code{compare-strings}.
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
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.
......
......@@ -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.
For instance, STR1 is "less than" STR2 if its first differing
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.
The value is t if the strings (or specified portions) match.
......
......@@ -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
symbol KEY, or nil if no match exists. When performing the
comparison, symbols are first converted to strings, and unibyte
strings to multibyte. If the optional arg CASE-FOLD is non-nil, case
is ignored.
strings to multibyte. If the optional arg CASE-FOLD is non-nil, both
KEY and the elements of LIST are upcased for comparison.
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. */)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment