guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support.


From: Oleg Pykhalov
Subject: [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
Date: Sat, 01 Dec 2018 23:48:02 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello Ludovic.

Apologies for a delay.

address@hidden (Ludovic Courtès) writes:

> Oleg Pykhalov <address@hidden> skribis:
>
>> * 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))))
>
> What about simply loading ~/.guile when it exists?

Oh, sure.   I should thought about this way.  The patch is attached below.

<#secure method=pgpmime mode=sign>
From 95b95b24107084baf03e9635280a8c3136b2a356 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <address@hidden>
Date: Thu, 22 Nov 2018 17:24:04 +0300
Subject: [PATCH] repl: Load user's initialization file.

* guix/scripts/repl.scm (guix-repl): Load user's initialization file.
---
 guix/scripts/repl.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index 1a105f51ee..b688867b15 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -68,6 +68,9 @@ Start a Guile REPL in the Guix execution environment.\n"))
   (newline)
   (show-bug-report-information))
 
+(define %guile-initialization-file
+  (string-append (getenv "HOME") "/.guile"))
+
 (define (self-quoting? x)
   "Return #t if X is self-quoting."
   (letrec-syntax ((one-of (syntax-rules ()
@@ -188,6 +191,8 @@ call THUNK."
              (save-module-excursion
               (lambda ()
                 (set-current-module user-module)
+                (when (file-exists? %guile-initialization-file)
+                      (load %guile-initialization-file))
                 ;; Do not exit repl on SIGINT.
                 ((@@ (ice-9 top-repl) call-with-sigint)
                  (lambda ()
-- 
2.19.1

Thanks,
Oleg.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]