Subject: [PATCH] * src/lread.c (get-load-suffixes): Avoid module suffix with compressed suffix
From: Lin Sun <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Wed, 14 May 2025 06:21:09 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

The Emacs (with module) will try load module with compressed suffix ".gz", for example, (require 'X) will trigger emacs try load file X.dll, X.dll.gz... on windows, but the "X.dll.gz" does not loadable, it affects performance especially on windows.

This patch make the (get-load-suffixes) function return result contains the ".dll" but avoid the ".dll.gz". 

Please help review the patch. Thank you.

From 25e18bb0722c822201a2cdd1a6eb9b54e66de838 Mon Sep 17 00:00:00 2001
From: Lin Sun <[email-masked]>
Date: Wed, 14 May 2025 06:30:34 +0000
Subject: [PATCH] * src/lread.c (get-load-suffixes): Avoid module suffix with
 compressed suffix

---
 src/lread.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/lread.c b/src/lread.c
index 95c9e711130..f4dbae6bab0 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1204,6 +1204,14 @@ DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
     {
       Lisp_Object exts = Vload_file_rep_suffixes;
       Lisp_Object suffix = XCAR (suffixes);
+#ifdef HAVE_MODULES
+      if (suffix_p(suffix, MODULES_SUFFIX))
+	continue;
+#ifdef MODULES_SECONDARY_SUFFIX
+      else if (suffix_p (suffix, MODULES_SECONDARY_SUFFIX))
+	continue;
+#endif
+#endif
       FOR_EACH_TAIL (exts)
 	lst = Fcons (concat2 (suffix, XCAR (exts)), lst);
     }
-- 
2.34.1