diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2016-02-21 13:25:24 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2016-02-21 13:27:40 -0800 |
commit | 1f7feecaee0ed3fb79758fe60020aefb30d9ff01 (patch) | |
tree | b0476096aabea32658be041242caa74e7a5232cd /doc/lispref/strings.texi | |
parent | 3e67708d7239cde24b0988d4d1288bc75585cfea (diff) | |
download | emacs-1f7feecaee0ed3fb79758fe60020aefb30d9ff01.tar.gz emacs-1f7feecaee0ed3fb79758fe60020aefb30d9ff01.tar.bz2 emacs-1f7feecaee0ed3fb79758fe60020aefb30d9ff01.zip |
Use Gnulib filevercmp for version comparison
* admin/merge-gnulib (GNULIB_MODULES): Add filevercmp.
* doc/lispref/strings.texi (Text Comparison):
* etc/NEWS, src/fns.c:
* test/src/fns-tests.el (fns-tests-string-version-lessp):
Rename newly-introduced function to string-version-lessp, by
analogy with strverscmp.
* lib/filevercmp.c, lib/filevercmp.h: New files, copied from gnulib.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* src/fns.c: Include <filevercmp.h>.
(gather_number_from_string): Remove.
(Fstring_version_lessp): Reimplement via filevercmp.
Diffstat (limited to 'doc/lispref/strings.texi')
-rw-r--r-- | doc/lispref/strings.texi | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 19301de06fa..ce629aa8259 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi @@ -633,20 +633,12 @@ If your system does not support a locale environment, this function behaves like @code{string-lessp}. @end defun -@defun string-numerical-lessp strin1 string2 -This function behaves like @code{string-lessp} for stretches of -consecutive non-numerical characters, but compares sequences of -numerical characters as if they comprised a base-ten number, and then -compares the numbers. So @samp{foo2.png} is ``smaller'' than -@samp{foo12.png} according to this predicate, even if @samp{12} is -lexicographically ``smaller'' than @samp{2}. - -If one string has a number in a position in the string, and the other -doesn't, then lexicograpic comparison is done at that point, so -@samp{foo.png} is ``smaller'' than @samp{foo2.png}. If any of the -numbers in the strings are larger than can be represented as an -integer number, the entire string is compared using -@code{string-less}. +@defun string-version-lessp string1 string2 +This function compares strings lexicographically, except it treats +sequences of numerical characters as if they comprised a base-ten +number, and then compares the numbers. So @samp{foo2.png} is +``smaller'' than @samp{foo12.png} according to this predicate, even if +@samp{12} is lexicographically ``smaller'' than @samp{2}. @end defun @defun string-prefix-p string1 string2 &optional ignore-case |