GNU bug report logs - #33466
[PATCH 0/2] Improve guix repl

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Thu, 22 Nov 2018 14:41:02 UTC

Severity: normal

Tags: patch

Done: Oleg Pykhalov <go.wigust <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 33466 in the body.
You can then email your comments to 33466 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Thu, 22 Nov 2018 14:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 22 Nov 2018 14:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 0/2] Improve guix repl
Date: Thu, 22 Nov 2018 17:40:07 +0300
Hello Guix,

This patch series improves ‘guix repl’.

Oleg Pykhalov (2):
  repl: Do not exit repl on SIGINT.
  repl: Add 'colorized' and 'readline' support.

 guix/scripts/repl.scm | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

-- 
2.19.1





Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Thu, 22 Nov 2018 14:43:01 GMT) Full text and rfc822 format available.

Message #8 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 33466 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 1/2] repl: Do not exit repl on SIGINT.
Date: Thu, 22 Nov 2018 17:42:27 +0300
* guix/scripts/repl.scm (guix-repl): Do not exit repl on SIGINT.
---
 guix/scripts/repl.scm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/guix/scripts/repl.scm b/guix/scripts/repl.scm
index b157833a4..1a105f51e 100644
--- a/guix/scripts/repl.scm
+++ b/guix/scripts/repl.scm
@@ -188,7 +188,10 @@ call THUNK."
              (save-module-excursion
               (lambda ()
                 (set-current-module user-module)
-                (start-repl))))
+                ;; Do not exit repl on SIGINT.
+                ((@@ (ice-9 top-repl) call-with-sigint)
+                 (lambda ()
+                   (start-repl))))))
             ((machine)
              (machine-repl))
             (else
-- 
2.19.1





Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Thu, 22 Nov 2018 14:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: 33466 <at> debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
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





Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Sun, 25 Nov 2018 20:40:01 GMT) Full text and rfc822 format available.

Message #14 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 33466 <at> debbugs.gnu.org
Subject: Re: [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT.
Date: Sun, 25 Nov 2018 21:39:16 +0100
Hi Oleg,

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> * guix/scripts/repl.scm (guix-repl): Do not exit repl on SIGINT.

LGTM, thanks!

Ludo'.




Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Sun, 25 Nov 2018 20:41:02 GMT) Full text and rfc822 format available.

Message #17 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 33466 <at> debbugs.gnu.org
Subject: Re: [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline'
 support.
Date: Sun, 25 Nov 2018 21:40:50 +0100
Oleg Pykhalov <go.wigust <at> gmail.com> 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?

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Sat, 01 Dec 2018 20:49:01 GMT) Full text and rfc822 format available.

Message #20 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 33466 <at> debbugs.gnu.org
Subject: Re: [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline'
 support.
Date: Sat, 01 Dec 2018 23:48:02 +0300
[Message part 1 (text/plain, inline)]
Hello Ludovic.

Apologies for a delay.

ludo <at> gnu.org (Ludovic Courtès) writes:

> Oleg Pykhalov <go.wigust <at> gmail.com> 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>
[0001-repl-Load-user-s-initialization-file.patch (text/x-patch, inline)]
From 95b95b24107084baf03e9635280a8c3136b2a356 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <go.wigust <at> gmail.com>
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

[Message part 3 (text/plain, inline)]
Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Sun, 02 Dec 2018 17:39:01 GMT) Full text and rfc822 format available.

Message #23 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 33466 <at> debbugs.gnu.org
Subject: Re: [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline'
 support.
Date: Sun, 02 Dec 2018 18:38:48 +0100
Hi Oleg,

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> From 95b95b24107084baf03e9635280a8c3136b2a356 Mon Sep 17 00:00:00 2001
> From: Oleg Pykhalov <go.wigust <at> gmail.com>
> 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.

[...]

>                  (set-current-module user-module)
> +                (when (file-exists? %guile-initialization-file)
> +                      (load %guile-initialization-file))

Rather:

  (and=> (getenv "HOME")
         (lambda (home)
           (when (file-exists? …)
             …)))

Otherwise if HOME is undefined simply loading (guix scripts repl) will
cause an error.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#33466; Package guix-patches. (Mon, 03 Dec 2018 05:08:01 GMT) Full text and rfc822 format available.

Message #26 received at 33466 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 33466 <at> debbugs.gnu.org, 33466-done <at> debbugs.gnu.org
Subject: Re: [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline'
 support.
Date: Mon, 03 Dec 2018 08:07:07 +0300
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:

> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> From 95b95b24107084baf03e9635280a8c3136b2a356 Mon Sep 17 00:00:00 2001
>> From: Oleg Pykhalov <go.wigust <at> gmail.com>
>> 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.
>
> [...]
>
>>                  (set-current-module user-module)
>> +                (when (file-exists? %guile-initialization-file)
>> +                      (load %guile-initialization-file))
>
> Rather:
>
>   (and=> (getenv "HOME")
>          (lambda (home)
>            (when (file-exists? …)
>              …)))
>
> Otherwise if HOME is undefined simply loading (guix scripts repl) will
> cause an error.

Ah, I see.  Thank you.

Pushed as 37c6f11f8dfa1880db86a3510c9e50990304d76c

Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
You have taken responsibility. (Mon, 03 Dec 2018 05:08:02 GMT) Full text and rfc822 format available.

Notification sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
bug acknowledged by developer. (Mon, 03 Dec 2018 05:08:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 31 Dec 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.