diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-04 13:02:10 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-04 13:02:10 +0100 |
| commit | 9ecaf46e1513e679738bdc65c740b0794cff46b8 (patch) | |
| tree | d145bdfd0602714237bb55f205ed796012e7db81 /compat-26.el | |
| parent | 7737bb9d565c102caeb2bed0c672a98008dc8c9a (diff) | |
Restore explicit versions of string-trim
Diffstat (limited to 'compat-26.el')
| -rw-r--r-- | compat-26.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/compat-26.el b/compat-26.el index 987da44..549710c 100644 --- a/compat-26.el +++ b/compat-26.el @@ -179,6 +179,8 @@ from the absolute start of the buffer, disregarding the narrowing." "Trim STRING of leading string matching REGEXP. REGEXP defaults to \"[ \\t\\n\\r]+\"." + :realname compat--internal-string-trim-left + :explicit t (if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string) (substring string (match-end 0)) string)) @@ -187,6 +189,8 @@ REGEXP defaults to \"[ \\t\\n\\r]+\"." "Trim STRING of trailing string matching REGEXP. REGEXP defaults to \"[ \\t\\n\\r]+\"." + :realname compat--internal-string-trim-right + :explicit t (let ((i (string-match-p (concat "\\(?:" (or regexp "[ \t\n\r]+") "\\)\\'") string))) @@ -196,8 +200,12 @@ REGEXP defaults to \"[ \\t\\n\\r]+\"." "Trim STRING of leading with and trailing matching TRIM-LEFT and TRIM-RIGHT. TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"." - (string-trim-left - (string-trim-right + :explicit t + ;; `string-trim-left' and `string-trim-right' were moved from subr-x + ;; to subr in Emacs 27, so to avoid loading subr-x we use the + ;; compatibility function here: + (compat--internal-string-trim-left + (compat--internal-string-trim-right string trim-right) trim-left)) |
