summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2020-12-25 05:16:46 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2020-12-25 05:16:46 +0100
commit269cec13a2fc6ac18b675d0dadd07a3d4e074a72 (patch)
tree310349de42c6185770dcd30a5d343d01fd552237
parentd63ccde966a561756675b9c84b39c724662c82a8 (diff)
downloademacs-269cec13a2fc6ac18b675d0dadd07a3d4e074a72.tar.gz
Remove `string-slice' -- it's not very well defined
* doc/lispref/strings.texi (Creating Strings): Ditto. * lisp/emacs-lisp/subr-x.el (string-slice): Remove.
-rw-r--r--doc/lispref/strings.texi11
-rw-r--r--etc/NEWS2
-rw-r--r--lisp/emacs-lisp/shortdoc.el3
-rw-r--r--lisp/emacs-lisp/subr-x.el13
-rw-r--r--test/lisp/emacs-lisp/subr-x-tests.el8
5 files changed, 1 insertions, 36 deletions
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index ef848ac5107..19b91471ed3 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -381,17 +381,6 @@ The default value of @var{separators} for @code{split-string}. Its
usual value is @w{@code{"[ \f\t\n\r\v]+"}}.
@end defvar
-@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
-(string-slice " two words " " +")
- @result{} (" two" " words" " ")
-@end example
-@end defun
-
@defun string-clean-whitespace string
Clean up the whitespace in @var{string} by collapsing stretches of
whitespace to a single space character, as well as removing all
diff --git a/etc/NEWS b/etc/NEWS
index b155ff9d42e..3a0102238ca 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1467,7 +1467,7 @@ This can be set to nil to inhibit hiding passwords in .authinfo files.
+++
*** A number of new string manipulation functions have been added.
'string-clean-whitespace', 'string-fill', 'string-limit',
-'string-lines', 'string-pad', 'string-chop-newline' and 'string-slice'.
+'string-lines', 'string-pad' and 'string-chop-newline'.
+++
*** New variable 'current-minibuffer-command'.
diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 0067495fea0..618465513da 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -154,9 +154,6 @@ 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))
- (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))
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 7e17a3464e6..dc5840a0865 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -310,19 +310,6 @@ than this function."
If OMIT-NULLS, empty lines will be removed from the results."
(split-string string "\n" omit-nulls))
-(defun string-slice (string regexp)
- "Split STRING at REGEXP boundaries and return a list of slices.
-The boundaries that match REGEXP are included in the result.
-
-Also see `split-string'."
- (if (zerop (length string))
- (list "")
- (let ((i (string-match-p regexp string 1)))
- (if i
- (cons (substring string 0 i)
- (string-slice (substring string i) regexp))
- (list string)))))
-
(defun string-pad (string length &optional padding start)
"Pad STRING to LENGTH using PADDING.
If PADDING is nil, the space character is used. If not nil, it
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el b/test/lisp/emacs-lisp/subr-x-tests.el
index 3fc5f1d3ed3..2ae492ecf15 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -604,14 +604,6 @@
(should (equal (string-lines "foo") '("foo")))
(should (equal (string-lines "foo \nbar") '("foo " "bar"))))
-(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")))
- (should (equal (string-slice "foo bar" "\\b") '("foo" " " "bar" "")))
- (should (equal (string-slice "foo bar" "\\b\\|a") '("foo" " " "b" "ar" ""))))
-
(ert-deftest subr-string-pad ()
(should (equal (string-pad "foo" 5) "foo "))
(should (equal (string-pad "foo" 5 ?-) "foo--"))