]> git.eshelyaron.com Git - emacs.git/commitdiff
Rename slice-string to string-slice
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 21 Dec 2020 19:18:57 +0000 (20:18 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 21 Dec 2020 19:18:57 +0000 (20:18 +0100)
* lisp/emacs-lisp/subr-x.el (string-slice): Rename from slice-string.
* doc/lispref/strings.texi (Creating Strings): Ditto.

doc/lispref/strings.texi
etc/NEWS
lisp/emacs-lisp/shortdoc.el
lisp/emacs-lisp/subr-x.el
test/lisp/emacs-lisp/subr-x-tests.el

index 958ae4c0a159611895e6396119e34010598f09d3..c65d839a028431f13ccc5fc167b4bb38bc482e2f 100644 (file)
@@ -381,13 +381,13 @@ The default value of @var{separators} for @code{split-string}.  Its
 usual value is @w{@code{"[ \f\t\n\r\v]+"}}.
 @end defvar
 
-@defun slice-string string regexp
+@defun string-slice string regexp
 Split @var{string} into a list of strings on @var{regexp} boundaries.
 As opposed to @code{split-string}, the boundaries are included in the
 result set:
 
 @example
-(slice-string "  two words " " +")
+(string-slice "  two words " " +")
      @result{} ("  two" " words" " ")
 @end example
 @end defun
index 9b4fcd92fc12479672f12a8179f1dc2dffcd5cc7..1d50555c8e1f7ac345b53694449b0861c29915a9 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1443,7 +1443,7 @@ that makes it a valid button.
 +++
 *** A number of new string manipulation functions have been added.
 'string-clean-whitespace', 'string-fill', 'string-limit',
-'string-limit', 'string-pad' and 'slice-string'.
+'string-limit', 'string-pad' and 'string-slice'.
 
 +++
 *** New variable 'current-minibuffer-command'.
index 3e1476adfc1e04810f121e51a7fce56936cedfeb..df31b0aaf1fc9fcb4f16ca4df5d76eff66831dd7 100644 (file)
@@ -151,9 +151,9 @@ There can be any number of :example/:result elements."
    :eval (split-string "foo bar")
    :eval (split-string "|foo|bar|" "|")
    :eval (split-string "|foo|bar|" "|" t))
-  (slice-string
-   :eval (slice-string "foo-bar" "-")
-   :eval (slice-string "foo-bar--zot-" "-+"))
+  (string-slice
+   :eval (string-slice "foo-bar" "-")
+   :eval (string-slice "foo-bar--zot-" "-+"))
   (string-lines
    :eval (string-lines "foo\n\nbar")
    :eval (string-lines "foo\n\nbar" t))
index 250ba6e6fa2ba9a80d3261ac580087ad305985bd..db7e75dfd2be8618e74708a797bef56b5578637e 100644 (file)
@@ -301,7 +301,7 @@ a substring consisitng of thelast LENGTH characters of STRING."
 If OMIT-NULLS, empty lines will be removed from the results."
   (split-string string "\n" omit-nulls))
 
-(defun slice-string (string regexp)
+(defun string-slice (string regexp)
   "Split STRING at REGEXP boundaries and return a list of slices.
 The boundaries that match REGEXP are not omitted from the results."
   (let ((start-substring 0)
index 94ff459869c0b2f97a844fd5b431cedcd33dea62..6ed06d4ce4f3a86663729a3a2938795eaed231c1 100644 (file)
   (should (equal (string-lines "foo") '("foo")))
   (should (equal (string-lines "foo \nbar") '("foo " "bar"))))
 
-(ert-deftest subr-slice-string ()
-  (should (equal (slice-string "foo-bar" "-") '("foo" "-bar")))
-  (should (equal (slice-string "foo-bar-" "-") '("foo" "-bar" "-")))
-  (should (equal (slice-string "-foo-bar-" "-") '("-foo" "-bar" "-")))
-  (should (equal (slice-string "ooo" "lala") '("ooo"))))
+(ert-deftest subr-string-slice ()
+  (should (equal (string-slice "foo-bar" "-") '("foo" "-bar")))
+  (should (equal (string-slice "foo-bar-" "-") '("foo" "-bar" "-")))
+  (should (equal (string-slice "-foo-bar-" "-") '("-foo" "-bar" "-")))
+  (should (equal (string-slice "ooo" "lala") '("ooo"))))
 
 (ert-deftest subr-string-pad ()
   (should (equal (string-pad "foo" 5) "foo  "))