diff options
| author | Eli Zaretskii | 2015-11-29 19:52:16 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-11-29 19:52:16 +0200 |
| commit | 36255fba58b6c73fcf1c810877cc128091fa2a68 (patch) | |
| tree | 425398ceaa2701c4d010b77dd77b1f7c7f51b687 | |
| parent | f3bd8262a2f5ea104ca0394683098e3c2efe3024 (diff) | |
| download | emacs-36255fba58b6c73fcf1c810877cc128091fa2a68.tar.gz emacs-36255fba58b6c73fcf1c810877cc128091fa2a68.zip | |
Improve documentation of string-collate-* functions
* doc/lispref/strings.texi (Text Comparison): Improve wording and
indexing of 'string-collate-equalp' and 'string-collate-lessp'.
* etc/NEWS: Move the entry of 'string-collate-equalp' and
'string-collate-lessp' to "Lisp Changes" section and mark it as
documented.
| -rw-r--r-- | doc/lispref/strings.texi | 13 | ||||
| -rw-r--r-- | etc/NEWS | 37 |
2 files changed, 28 insertions, 22 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index f8685d9312c..8aa4539bd78 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -465,6 +465,7 @@ Representations}. | |||
| 465 | @code{string-equal} is another name for @code{string=}. | 465 | @code{string-equal} is another name for @code{string=}. |
| 466 | @end defun | 466 | @end defun |
| 467 | 467 | ||
| 468 | @cindex locale-dependent string equivalence | ||
| 468 | @defun string-collate-equalp string1 string2 &optional locale ignore-case | 469 | @defun string-collate-equalp string1 string2 &optional locale ignore-case |
| 469 | This function returns @code{t} if @var{string1} and @var{string2} are | 470 | This function returns @code{t} if @var{string1} and @var{string2} are |
| 470 | equal with respect to collation rules. A collation rule is not only | 471 | equal with respect to collation rules. A collation rule is not only |
| @@ -493,6 +494,7 @@ systems. | |||
| 493 | If @var{ignore-case} is non-@code{nil}, characters are converted to lower-case | 494 | If @var{ignore-case} is non-@code{nil}, characters are converted to lower-case |
| 494 | before comparing them. | 495 | before comparing them. |
| 495 | 496 | ||
| 497 | @vindex w32-collate-ignore-punctuation | ||
| 496 | To emulate Unicode-compliant collation on MS-Windows systems, | 498 | To emulate Unicode-compliant collation on MS-Windows systems, |
| 497 | bind @code{w32-collate-ignore-punctuation} to a non-@code{nil} value, since | 499 | bind @code{w32-collate-ignore-punctuation} to a non-@code{nil} value, since |
| 498 | the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows. | 500 | the codeset part of the locale cannot be @code{"UTF-8"} on MS-Windows. |
| @@ -518,7 +520,7 @@ optional argument @var{ignore-case} is non-@code{nil}, the comparison | |||
| 518 | ignores case differences. | 520 | ignores case differences. |
| 519 | @end defun | 521 | @end defun |
| 520 | 522 | ||
| 521 | @cindex lexical comparison | 523 | @cindex lexical comparison of strings |
| 522 | @defun string< string1 string2 | 524 | @defun string< string1 string2 |
| 523 | @c (findex string< causes problems for permuted index!!) | 525 | @c (findex string< causes problems for permuted index!!) |
| 524 | This function compares two strings a character at a time. It | 526 | This function compares two strings a character at a time. It |
| @@ -576,6 +578,7 @@ are used. | |||
| 576 | @code{string-lessp} is another name for @code{string<}. | 578 | @code{string-lessp} is another name for @code{string<}. |
| 577 | @end defun | 579 | @end defun |
| 578 | 580 | ||
| 581 | @cindex locale-dependent string comparison | ||
| 579 | @defun string-collate-lessp string1 string2 &optional locale ignore-case | 582 | @defun string-collate-lessp string1 string2 &optional locale ignore-case |
| 580 | This function returns @code{t} if @var{string1} is less than | 583 | This function returns @code{t} if @var{string1} is less than |
| 581 | @var{string2} in collation order. A collation order is not only | 584 | @var{string2} in collation order. A collation order is not only |
| @@ -594,15 +597,15 @@ for sorting (@pxref{Sequence Functions}): | |||
| 594 | @end group | 597 | @end group |
| 595 | @end example | 598 | @end example |
| 596 | 599 | ||
| 597 | This behavior is system-dependent; punctuation and whitespace are | 600 | This behavior is system-dependent; e.g., punctuation and whitespace |
| 598 | never ignored on Cygwin, regardless of locale. | 601 | are never ignored on Cygwin, regardless of locale. |
| 599 | 602 | ||
| 600 | The optional argument @var{locale}, a string, overrides the setting of | 603 | The optional argument @var{locale}, a string, overrides the setting of |
| 601 | your current locale identifier for collation. The value is system | 604 | your current locale identifier for collation. The value is system |
| 602 | dependent; a @var{locale} @code{"en_US.UTF-8"} is applicable on POSIX | 605 | dependent; a @var{locale} @code{"en_US.UTF-8"} is applicable on POSIX |
| 603 | systems, while it would be, e.g., @code{"enu_USA.1252"} on MS-Windows | 606 | systems, while it would be, e.g., @code{"enu_USA.1252"} on MS-Windows |
| 604 | systems. The @var{locale} @code{"POSIX"} lets @code{string-collate-lessp} | 607 | systems. The @var{locale} value of @code{"POSIX"} or @code{"C"} lets |
| 605 | behave like @code{string-lessp}: | 608 | @code{string-collate-lessp} behave like @code{string-lessp}: |
| 606 | 609 | ||
| 607 | @example | 610 | @example |
| 608 | @group | 611 | @group |
| @@ -181,23 +181,6 @@ for use in Emacs bug reports. | |||
| 181 | hiding character but the default `.' can be used by let-binding the | 181 | hiding character but the default `.' can be used by let-binding the |
| 182 | variable `read-hide-char'. | 182 | variable `read-hide-char'. |
| 183 | 183 | ||
| 184 | ** The new functions `string-collate-lessp' and `string-collate-equalp' | ||
| 185 | preserve the collation order as defined by the system's locale(1) | ||
| 186 | environment. For the time being this is implemented for modern POSIX | ||
| 187 | systems and for MS-Windows, for other systems they fall back to their | ||
| 188 | counterparts `string-lessp' and `string-equal'. | ||
| 189 | |||
| 190 | *** The ls-lisp package uses `string-collate-lessp' to sort file names. | ||
| 191 | If you want the old, locale-independent sorting, customize the new | ||
| 192 | option `ls-lisp-use-string-collate' to a nil value. | ||
| 193 | |||
| 194 | *** The MS-Windows specific variable `w32-collate-ignore-punctuation', | ||
| 195 | if set to a non-nil value, causes the above 2 functions to ignore | ||
| 196 | symbol and punctuation characters when collating strings. This | ||
| 197 | emulates the behavior of modern Posix platforms when the locale's | ||
| 198 | codeset is "UTF-8" (as in "en_US.UTF-8"). This is needed because | ||
| 199 | MS-Windows doesn't support UTF-8 as codeset in its locales. | ||
| 200 | |||
| 201 | +++ | 184 | +++ |
| 202 | ** The new function `bidi-find-overridden-directionality' allows to | 185 | ** The new function `bidi-find-overridden-directionality' allows to |
| 203 | find characters whose directionality was, perhaps maliciously, | 186 | find characters whose directionality was, perhaps maliciously, |
| @@ -1199,6 +1182,26 @@ evaluated (and should return a string) when the closure is built. | |||
| 1199 | ** New function `string-greaterp', which return the opposite result of | 1182 | ** New function `string-greaterp', which return the opposite result of |
| 1200 | `string-lessp'. | 1183 | `string-lessp'. |
| 1201 | 1184 | ||
| 1185 | +++ | ||
| 1186 | ** The new functions `string-collate-lessp' and `string-collate-equalp' | ||
| 1187 | preserve the collation order as defined by the system's locale(1) | ||
| 1188 | environment. For the time being this is implemented for modern POSIX | ||
| 1189 | systems and for MS-Windows, for other systems they fall back to their | ||
| 1190 | counterparts `string-lessp' and `string-equal'. | ||
| 1191 | |||
| 1192 | --- | ||
| 1193 | *** The ls-lisp package uses `string-collate-lessp' to sort file names. | ||
| 1194 | If you want the old, locale-independent sorting, customize the new | ||
| 1195 | option `ls-lisp-use-string-collate' to a nil value. | ||
| 1196 | |||
| 1197 | +++ | ||
| 1198 | *** The MS-Windows specific variable `w32-collate-ignore-punctuation', | ||
| 1199 | if set to a non-nil value, causes the above 2 functions to ignore | ||
| 1200 | symbol and punctuation characters when collating strings. This | ||
| 1201 | emulates the behavior of modern Posix platforms when the locale's | ||
| 1202 | codeset is "UTF-8" (as in "en_US.UTF-8"). This is needed because | ||
| 1203 | MS-Windows doesn't support UTF-8 as codeset in its locales. | ||
| 1204 | |||
| 1202 | ** New function `alist-get', which is also a valid place (aka lvalue). | 1205 | ** New function `alist-get', which is also a valid place (aka lvalue). |
| 1203 | 1206 | ||
| 1204 | ** New function `funcall-interactively', which works like `funcall' | 1207 | ** New function `funcall-interactively', which works like `funcall' |