From 3505e666a8ea9e4e2a2ad1bef012ac68e14d1d2c Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 10 Sep 2022 14:11:54 +0200 Subject: [PATCH] fix: failure to load doom libs on 27.x Emacs 27.x does not collapse consecutive slashes in a file path when trying to load them, and instead discards everything before it and treats the rest as an absolute path, e.g. "~/some//path/foo/" -> "/path/foo". This is not the case in 28.1, but Doom's backport of file-name-concat did not take this into account, so it's been modified to trim trailing slashes. Fix: #6766 Amend: 433c9e344d46 --- lisp/doom-lib.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/doom-lib.el b/lisp/doom-lib.el index 54fc6f966..dec43aa39 100644 --- a/lisp/doom-lib.el +++ b/lisp/doom-lib.el @@ -857,11 +857,12 @@ with a slash -- if they don't end with a slash, a slash will be inserted before contatenating." (mapconcat #'identity - (save-match-data - (cl-loop for str in (cons directory components) - when (and str (/= 0 (length str)) - (string-match "\\(.+\\)/?" str)) - collect (match-string 1 str))) + (cl-loop for str in (cons directory components) + if (and str (/= 0 (length str)) + (if (string-suffix-p "/" str) + (substring str 0 -1) + str)) + collect it) "/")) ;; Introduced in Emacs 28.1