From: Eli Zaretskii Date: Thu, 23 Jun 2016 15:09:14 +0000 (+0300) Subject: Fix documentation of 'assoc-string' and 'compare-strings' X-Git-Tag: emacs-25.1-rc1~69 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4395aaacd4195d3a5cca9df66cfea13380414a37;p=emacs.git 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'. --- diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index c6563f7e03c..ca700a29a95 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -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. diff --git a/src/fns.c b/src/fns.c index ef6055c17d1..1f1619300de 100644 --- a/src/fns.c +++ b/src/fns.c @@ -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. diff --git a/src/minibuf.c b/src/minibuf.c index d85a7a9b103..3d34635c6c0 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -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. */)