aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRüdiger Sonderfeld2014-01-10 13:41:19 +0100
committerRüdiger Sonderfeld2014-01-10 13:41:19 +0100
commitf6da761bea5048abd1f6f26c6e144e4ab4e023cb (patch)
treef457a5b0dc1e2d84a997b34191a21206e8237afe
parented6ec139ac9d21dede5800ce9aeb3b90014ad06a (diff)
downloademacs-f6da761bea5048abd1f6f26c6e144e4ab4e023cb.tar.gz
emacs-f6da761bea5048abd1f6f26c6e144e4ab4e023cb.zip
Document `subr-x' functions.
* doc/lispref/hash.texi (Hash Tables): Add cindex entry for `subr-x' functions. * doc/lispref/strings.texi (Creating Strings, Text Comparison): Document functions from `subr-x'.
-rw-r--r--doc/lispref/ChangeLog8
-rw-r--r--doc/lispref/hash.texi1
-rw-r--r--doc/lispref/strings.texi91
-rw-r--r--etc/NEWS4
4 files changed, 101 insertions, 3 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 2963ffc9a60..3a362c7daa5 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,11 @@
12014-01-10 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
2
3 * hash.texi (Hash Tables): Add cindex entry for `subr-x'
4 functions.
5
6 * strings.texi (Creating Strings, Text Comparison): Document
7 functions from `subr-x'.
8
12014-01-09 Rüdiger Sonderfeld <ruediger@c-plusplus.de> 92014-01-09 Rüdiger Sonderfeld <ruediger@c-plusplus.de>
2 10
3 * text.texi (Parsing HTML/XML): Document `shr-insert-document'. 11 * text.texi (Parsing HTML/XML): Document `shr-insert-document'.
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi
index 5d0d6b6c89e..9d6302f4073 100644
--- a/doc/lispref/hash.texi
+++ b/doc/lispref/hash.texi
@@ -354,6 +354,7 @@ This returns the rehash threshold of @var{table}.
354This returns the current nominal size of @var{table}. 354This returns the current nominal size of @var{table}.
355@end defun 355@end defun
356 356
357@cindex Hash table functions in subr-x.
357The following two functions are provided by the @file{subr-x} library. 358The following two functions are provided by the @file{subr-x} library.
358To use them, you need to load this library first. 359To use them, you need to load this library first.
359 360
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 5c814b22b2d..b6972ad9cc5 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -365,6 +365,83 @@ The default value of @var{separators} for @code{split-string}. Its
365usual value is @w{@code{"[ \f\t\n\r\v]+"}}. 365usual value is @w{@code{"[ \f\t\n\r\v]+"}}.
366@end defvar 366@end defvar
367 367
368@cindex String creation functions in subr-x
369 The following functions are provided by the @file{subr-x} library.
370To use them, you need to load this library first.
371
372@defun string-join strings &optional separator
373This joins all strings in @var{strings}. If the optional argument
374@var{separator} is non-@code{nil} then its value is added between each
375string.
376
377@example
378(string-join '("foo" "bar"))
379 @result{} "foobar"
380(string-join '("foo" "bar") ", ")
381 @result{} "foo, bar"
382@end example
383@end defun
384
385@defun string-reverse string
386This function returns the reversed value of @var{string}.
387
388@example
389(string-reverse "ung olleh")
390 @result{} "hello gnu"
391@end example
392@end defun
393
394@defun string-trim-left string
395This function returns a string with all the leading whitespace removed
396from @var{string}. Trailing whitespace are left.
397
398@example
399(string-trim-left "\r\n\t abc ")
400 @result{} "abc "
401@end example
402@end defun
403
404@defun string-trim-right string
405This function returns a string with all the trailing whitespace
406removed from @var{string}. Leading whitespace are left.
407
408@example
409(string-trim-left " abc ")
410 @result{} " abc"
411@end example
412@end defun
413
414@defun string-trim string
415This function returns a string with all leading and trailing
416whitespace from @var{string} removed. This has the same effect as
417calling @code{string-trim-left} and @code{string-trim-right} on
418@var{string}.
419@end defun
420
421@defun string-remove-prefix prefix string
422This removes the string @var{prefix} from the beginning of
423@var{string} if present.
424
425@example
426(string-remove-prefix "foo" "foobar")
427 @result{} "bar"
428(string-remove-prefix "not" "foobar")
429 @result{} "foobar"
430@end example
431@end defun
432
433@defun string-remove-suffix suffix string
434This removes the string @var{suffix} from the end of @var{string} if
435present.
436
437@example
438(string-remove-suffix "bar" "foobar")
439 @result{} "foo"
440(string-remove-suffix "not" "foobar")
441 @result{} "foobar"
442@end example
443@end defun
444
368@node Modifying Strings 445@node Modifying Strings
369@section Modifying Strings 446@section Modifying Strings
370 447
@@ -571,6 +648,20 @@ function @code{string-match}, which matches a regular expression
571against a string, can be used for a kind of string comparison; see 648against a string, can be used for a kind of string comparison; see
572@ref{Regexp Search}. 649@ref{Regexp Search}.
573 650
651@cindex String comparisson functions in subr-x
652 The following functions are provided by the @file{subr-x} library.
653To use them, you need to load this library first.
654
655@defun string-empty-p string
656This function returns non-@code{nil} if @var{string} is an empty
657string.
658@end defun
659
660@defun string-blank-p string
661This function returns non-@code{nil} if @var{string} is either empty
662or only whitespace.
663@end defun
664
574@node String Conversion 665@node String Conversion
575@section Conversion of Characters and Strings 666@section Conversion of Characters and Strings
576@cindex conversion of strings 667@cindex conversion of strings
diff --git a/etc/NEWS b/etc/NEWS
index da1ecbca4d4..26574a11e54 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1099,12 +1099,10 @@ displaying the buffer in a window.
1099+++ 1099+++
1100** New macro with-eval-after-load. Like eval-after-load, but better behaved. 1100** New macro with-eval-after-load. Like eval-after-load, but better behaved.
1101 1101
1102** New library subr-x.el for misc helper functions
1103+++ 1102+++
1103** New library subr-x.el for misc helper functions
1104*** `hash-table-keys' 1104*** `hash-table-keys'
1105+++
1106*** `hash-table-values' 1105*** `hash-table-values'
1107
1108*** `string-blank-p` 1106*** `string-blank-p`
1109*** `string-empty-p` 1107*** `string-empty-p`
1110*** `string-join` 1108*** `string-join`