diff options
| author | Luc Teirlinck | 2003-12-01 04:09:00 +0000 |
|---|---|---|
| committer | Luc Teirlinck | 2003-12-01 04:09:00 +0000 |
| commit | a62f71e4224bf8e631e44656e86be0eb48d66b68 (patch) | |
| tree | 88ad47fd35a931d7c21e6af4899d673adba9cc0b | |
| parent | d4241ae4cb9018ba2ad40a852dba2c0b95dc30ab (diff) | |
| download | emacs-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/ChangeLog | 12 | ||||
| -rw-r--r-- | lispref/strings.texi | 39 |
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 @@ | |||
| 1 | 2003-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 | |||
| 1 | 2003-11-29 Luc Teirlinck <teirllm@auburn.edu> | 13 | 2003-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 | |||
| 417 | strings. When @code{equal} (@pxref{Equality Predicates}) compares two | 417 | strings. When @code{equal} (@pxref{Equality Predicates}) compares two |
| 418 | strings, it uses @code{string=}. | 418 | strings, it uses @code{string=}. |
| 419 | 419 | ||
| 420 | If the strings contain non-@acronym{ASCII} characters, and one is unibyte | 420 | For technical reasons, a unibyte and a multibyte string are |
| 421 | while the other is multibyte, then they cannot be equal. @xref{Text | 421 | @code{equal} if and only if they contain the same sequence of |
| 422 | character codes and all these codes are either in the range 0 through | ||
| 423 | 127 (@acronym{ASCII}) or 160 through 255 (@code{eight-bit-graphic}). | ||
| 424 | However, when a unibyte string gets converted to a multibyte string, | ||
| 425 | all characters with codes in the range 160 through 255 get converted | ||
| 426 | to characters with higher codes, whereas @acronym{ASCII} characters | ||
| 427 | remain unchanged. Thus, a unibyte string and its conversion to | ||
| 428 | multibyte are only @code{equal} if the string is all @acronym{ASCII}. | ||
| 429 | Character codes 160 through 255 are not entirely proper in multibyte | ||
| 430 | text, even though they can occur. As a consequence, the situation | ||
| 431 | where a unibyte and a multibyte string are @code{equal} without both | ||
| 432 | being all @acronym{ASCII} is a technical oddity that very few Emacs | ||
| 433 | Lisp programmers ever get confronted with. @xref{Text | ||
| 422 | Representations}. | 434 | Representations}. |
| 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 | |||
| 493 | the string). | 505 | the string). |
| 494 | 506 | ||
| 495 | The strings are both converted to multibyte for the comparison | 507 | The 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 |
| 497 | a multibyte string. If @var{ignore-case} is non-@code{nil}, then case | 509 | conversion to multibyte are always regarded as equal. If |
| 498 | is 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 |
| 511 | upper case letters can be equal to lower case letters. | ||
| 499 | 512 | ||
| 500 | If the specified portions of the two strings match, the value is | 513 | If 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 |
| 509 | This function works like @code{assoc}, except that @var{key} must be a | 522 | @defunx assoc-ignore-representation key alist |
| 510 | string, and comparison is done using @code{compare-strings}, ignoring | 523 | These functions work like @code{assoc}, except that @var{key} must be |
| 511 | case differences. @xref{Association Lists}. | 524 | a 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 | 527 | differences, whereas @code{assoc-ignore-representation} does not. |
| 515 | This function works like @code{assoc}, except that @var{key} must be a | 528 | @xref{Association Lists}. |
| 516 | string, and comparison is done using @code{compare-strings}. | ||
| 517 | Case 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 |