aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuc Teirlinck2003-12-01 04:09:00 +0000
committerLuc Teirlinck2003-12-01 04:09:00 +0000
commita62f71e4224bf8e631e44656e86be0eb48d66b68 (patch)
tree88ad47fd35a931d7c21e6af4899d673adba9cc0b
parentd4241ae4cb9018ba2ad40a852dba2c0b95dc30ab (diff)
downloademacs-a62f71e4224bf8e631e44656e86be0eb48d66b68.tar.gz
emacs-a62f71e4224bf8e631e44656e86be0eb48d66b68.zip
(Text Comparison): Correctly describe when two strings are `equal'.
Combine and clarify descriptions of `assoc-ignore-case' and `assoc-ignore-representation'.
-rw-r--r--lispref/ChangeLog12
-rw-r--r--lispref/strings.texi39
2 files changed, 37 insertions, 14 deletions
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 69ca664dfb9..85a5f506739 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,15 @@
12003-11-30 Luc Teirlinck <teirllm@auburn.edu>
2
3 * strings.texi (Text Comparison): Correctly describe when two
4 strings are `equal'. Combine and clarify descriptions of
5 `assoc-ignore-case' and `assoc-ignore-representation'.
6
7 * objects.texi (Non-ASCII in Strings): Clarify description of
8 when a string is unibyte or multibyte.
9 (Bool-Vector Type): Update examples.
10 (Equality Predicates): Correctly describe when two strings are
11 `equal'.
12
12003-11-29 Luc Teirlinck <teirllm@auburn.edu> 132003-11-29 Luc Teirlinck <teirllm@auburn.edu>
2 14
3 * lists.texi (Building Lists): `append' no longer accepts integer 15 * lists.texi (Building Lists): `append' no longer accepts integer
diff --git a/lispref/strings.texi b/lispref/strings.texi
index 064e4ba5b30..acab7286d0d 100644
--- a/lispref/strings.texi
+++ b/lispref/strings.texi
@@ -417,8 +417,20 @@ The function @code{string=} ignores the text properties of the two
417strings. When @code{equal} (@pxref{Equality Predicates}) compares two 417strings. When @code{equal} (@pxref{Equality Predicates}) compares two
418strings, it uses @code{string=}. 418strings, it uses @code{string=}.
419 419
420If the strings contain non-@acronym{ASCII} characters, and one is unibyte 420For technical reasons, a unibyte and a multibyte string are
421while the other is multibyte, then they cannot be equal. @xref{Text 421@code{equal} if and only if they contain the same sequence of
422character codes and all these codes are either in the range 0 through
423127 (@acronym{ASCII}) or 160 through 255 (@code{eight-bit-graphic}).
424However, when a unibyte string gets converted to a multibyte string,
425all characters with codes in the range 160 through 255 get converted
426to characters with higher codes, whereas @acronym{ASCII} characters
427remain unchanged. Thus, a unibyte string and its conversion to
428multibyte are only @code{equal} if the string is all @acronym{ASCII}.
429Character codes 160 through 255 are not entirely proper in multibyte
430text, even though they can occur. As a consequence, the situation
431where a unibyte and a multibyte string are @code{equal} without both
432being all @acronym{ASCII} is a technical oddity that very few Emacs
433Lisp programmers ever get confronted with. @xref{Text
422Representations}. 434Representations}.
423@end defun 435@end defun
424 436
@@ -493,9 +505,10 @@ index @var{start2} up to index @var{end2} (@code{nil} means the end of
493the string). 505the string).
494 506
495The strings are both converted to multibyte for the comparison 507The strings are both converted to multibyte for the comparison
496(@pxref{Text Representations}) so that a unibyte string can be equal to 508(@pxref{Text Representations}) so that a unibyte string and its
497a multibyte string. If @var{ignore-case} is non-@code{nil}, then case 509conversion to multibyte are always regarded as equal. If
498is ignored, so that upper case letters can be equal to lower case letters. 510@var{ignore-case} is non-@code{nil}, then case is ignored, so that
511upper case letters can be equal to lower case letters.
499 512
500If the specified portions of the two strings match, the value is 513If the specified portions of the two strings match, the value is
501@code{t}. Otherwise, the value is an integer which indicates how many 514@code{t}. Otherwise, the value is an integer which indicates how many
@@ -506,15 +519,13 @@ portion) is less.
506@end defun 519@end defun
507 520
508@defun assoc-ignore-case key alist 521@defun assoc-ignore-case key alist
509This function works like @code{assoc}, except that @var{key} must be a 522@defunx assoc-ignore-representation key alist
510string, and comparison is done using @code{compare-strings}, ignoring 523These functions work like @code{assoc}, except that @var{key} must be
511case differences. @xref{Association Lists}. 524a string, all elements of @var{alist} must be cons cells whose
512@end defun 525@sc{car} is a string, and comparison is done using
513 526@code{compare-strings}. @code{assoc-ignore-case} ignores case
514@defun assoc-ignore-representation key alist 527differences, whereas @code{assoc-ignore-representation} does not.
515This function works like @code{assoc}, except that @var{key} must be a 528@xref{Association Lists}.
516string, and comparison is done using @code{compare-strings}.
517Case differences are significant.
518@end defun 529@end defun
519 530
520 See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for 531 See also @code{compare-buffer-substrings} in @ref{Comparing Text}, for