branch: externals/compat
commit 9ecaf46e1513e679738bdc65c740b0794cff46b8
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>

    Restore explicit versions of string-trim
---
 compat-26.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/compat-26.el b/compat-26.el
index 987da44744..549710c0d1 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))

Reply via email to