Subject: bug#69686: Geiser is slow when running with geiser-guile-load-init-file set to t

From: Tomas Volf <[email-masked]>
Date: Sun, 10 Mar 2024 02:13:04 +0100

Hello,

I discovered that when I run Geiser with geiser-guile-load-init-file set to t,
it results in horrible experience, when the REPL seems to technically work, but
anything takes a long time (completion is on order of seconds).

I found out that it is caused by the readline activation.  I am unsure how to
solve this properly.  For me the workaround was to move the readline check
inside the (unless (getenv "INSIDE_EMACS") ...), since I do not need it there.
I was contemplating sending a patch doing just so, but I realized that also
disables readline in any shell mode.  I personally do not care about that (I
only interact with guile from Emacs using Geiser, at least for now), but someone
else might care.

Ignoring the fact that disabling the colors for ansi-term (and other modes?)
might not be necessary neither, I am not sure how to write more robust check.

The patch I was considering is at the end of the email, feel free to use it if
the trade-off would be acceptable.

diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index d9f13271d8..fcd1d76c18 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -215,24 +215,26 @@ (define %default-nanorc

 (define %default-dotguile
   (plain-file "dot-guile"
-              "(cond ((false-if-exception (resolve-interface '(ice-9 readline)))
-       =>
-       (lambda (module)
-         ;; Enable completion and input history at the REPL.
-         ((module-ref module 'activate-readline))))
-      (else
-       (display \"Consider installing the 'guile-readline' package for
-convenient interactive line editing and input history.\\n\\n\")))
+              ";;; -*- mode: scheme -*-

-      (unless (getenv \"INSIDE_EMACS\")
-        (cond ((false-if-exception (resolve-interface '(ice-9 colorized)))
-               =>
-               (lambda (module)
-                 ;; Enable completion and input history at the REPL.
-                 ((module-ref module 'activate-colorized))))
-              (else
-               (display \"Consider installing the 'guile-colorized' package
-for a colorful Guile experience.\\n\\n\"))))\n"))
+(unless (getenv \"INSIDE_EMACS\")
+  (cond ((false-if-exception (resolve-interface '(ice-9 readline)))
+         =>
+         (lambda (module)
+           ;; Enable completion and input history at the REPL.
+           ((module-ref module 'activate-readline))))
+        (else
+         (display \"Consider installing the 'guile-readline' package for
+convenient interactive line editing and input history.\n\n\")))
+
+  (cond ((false-if-exception (resolve-interface '(ice-9 colorized)))
+         =>
+         (lambda (module)
+           ;; Enable completion and input history at the REPL.
+           ((module-ref module 'activate-colorized))))
+        (else
+         (display \"Consider installing the 'guile-colorized' package
+for a colorful Guile experience.\n\n\"))))\n"))

 (define %default-skeleton-home-config
   (plain-file "default-home-config" "\

Have a nice day,
Tomas Volf

--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.