Subject: [PATCH 2/2] repl: Add 'colorized' and 'readline' support.

From: Oleg Pykhalov <[email-masked]>
Date: Thu, 22 Nov 2018 17:42:28 +0300

* guix/scripts/repl.scm (guix-repl): Add 'colorized' and 'readline' support.
---
 guix/scripts/repl.scm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 1a105f51e..eeaf4acc4 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -188,6 +188,23 @@ call THUNK."
              (save-module-excursion
               (lambda ()
                 (set-current-module user-module)
+                (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")))
+                (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"))))
                 ;; Do not exit repl on SIGINT.
                 ((@@ (ice-9 top-repl) call-with-sigint)
                  (lambda ()
-- 
2.19.1