diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-03-24 09:22:40 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-03-24 09:22:44 +0100 |
commit | a4ececf004e5442fc245ccff910000fe407f7212 (patch) | |
tree | 2e7a3a7e9c290db7382dd5c6093a15db74f47310 /lisp/emacs-lisp/subr-x.el | |
parent | c0d24d5316626a3d5e76f99a0f418463cb355459 (diff) | |
download | emacs-a4ececf004e5442fc245ccff910000fe407f7212.tar.gz emacs-a4ececf004e5442fc245ccff910000fe407f7212.tar.bz2 emacs-a4ececf004e5442fc245ccff910000fe407f7212.zip |
Move string-trim functions to subr.el
* doc/lispref/strings.texi (Creating Strings): Document them.
* lisp/faces.el: Don't require subr-x, because that leads to build
errors.
* lisp/subr.el (string-trim, string-trim-right)
(string-trim-left): Move here from subr-x.el.
* lisp/emacs-lisp/shortdoc.el (string): Adjust.
Diffstat (limited to 'lisp/emacs-lisp/subr-x.el')
-rw-r--r-- | lisp/emacs-lisp/subr-x.el | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index a4514454c0b..9c8c967ee9c 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -215,28 +215,6 @@ The variable list SPEC is the same as in `if-let'." (define-obsolete-function-alias 'string-reverse 'reverse "25.1") -(defsubst string-trim-left (string &optional regexp) - "Trim STRING of leading string matching REGEXP. - -REGEXP defaults to \"[ \\t\\n\\r]+\"." - (if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string) - (substring string (match-end 0)) - string)) - -(defsubst string-trim-right (string &optional regexp) - "Trim STRING of trailing string matching REGEXP. - -REGEXP defaults to \"[ \\t\\n\\r]+\"." - (let ((i (string-match-p (concat "\\(?:" (or regexp "[ \t\n\r]+") "\\)\\'") - string))) - (if i (substring string 0 i) string))) - -(defsubst string-trim (string &optional trim-left trim-right) - "Trim STRING of leading and trailing strings matching TRIM-LEFT and TRIM-RIGHT. - -TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"." - (string-trim-left (string-trim-right string trim-right) trim-left)) - ;;;###autoload (defun string-truncate-left (string length) "Truncate STRING to LENGTH, replacing initial surplus with \"...\"." |