branch: externals/compat commit 79d4778af629a494b30756cedbd10cb2dfa6b996 Author: Philip Kaludercic <phil...@posteo.net> Commit: Philip Kaludercic <phil...@posteo.net>
Use compat--string-trim-left in file-name-with-extension The function was moved from subr-x to subr in Emacs 28, and cannot be used directly in older versions, without requiring subr-x. To avoid this overhead, we use our own implementation. --- compat-28.1.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compat-28.1.el b/compat-28.1.el index 2d45223..50e93bf 100644 --- a/compat-28.1.el +++ b/compat-28.1.el @@ -334,6 +334,8 @@ as the new values of the bound variables in the recursive invocation." ;;;; Defined in files.el +(declare-function compat--string-trim-left "compat-26.1" + (string &optional regexp)) (compat-defun file-name-with-extension (filename extension) "Set the EXTENSION of a FILENAME. The extension (in a file name) is the part that begins with the last \".\". @@ -345,7 +347,7 @@ Errors if the FILENAME or EXTENSION are empty, or if the given FILENAME has the format of a directory. See also `file-name-sans-extension'." - (let ((extn (string-trim-left extension "[.]"))) + (let ((extn (compat--string-trim-left extension "[.]"))) (cond ((string= filename "") (error "Empty filename"))