all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#33466] [PATCH 0/2] Improve guix repl
@ 2018-11-22 14:40 Oleg Pykhalov
  2018-11-22 14:42 ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Oleg Pykhalov
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Pykhalov @ 2018-11-22 14:40 UTC (permalink / raw)
  To: 33466

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT.
  2018-11-22 14:40 [bug#33466] [PATCH 0/2] Improve guix repl Oleg Pykhalov
@ 2018-11-22 14:42 ` Oleg Pykhalov
  2018-11-22 14:42   ` [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support Oleg Pykhalov
  2018-11-25 20:39   ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Ludovic Courtès
  0 siblings, 2 replies; 8+ messages in thread
From: Oleg Pykhalov @ 2018-11-22 14:42 UTC (permalink / raw)
  To: 33466

* 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
  2018-11-22 14:42 ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Oleg Pykhalov
@ 2018-11-22 14:42   ` Oleg Pykhalov
  2018-11-25 20:40     ` Ludovic Courtès
  2018-11-25 20:39   ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Oleg Pykhalov @ 2018-11-22 14:42 UTC (permalink / raw)
  To: 33466

* 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT.
  2018-11-22 14:42 ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Oleg Pykhalov
  2018-11-22 14:42   ` [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support Oleg Pykhalov
@ 2018-11-25 20:39   ` Ludovic Courtès
  1 sibling, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2018-11-25 20:39 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 33466

Hi Oleg,

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

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

LGTM, thanks!

Ludo'.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
  2018-11-22 14:42   ` [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support Oleg Pykhalov
@ 2018-11-25 20:40     ` Ludovic Courtès
  2018-12-01 20:48       ` Oleg Pykhalov
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-11-25 20:40 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 33466

Oleg Pykhalov <go.wigust@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’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
  2018-11-25 20:40     ` Ludovic Courtès
@ 2018-12-01 20:48       ` Oleg Pykhalov
  2018-12-02 17:38         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Oleg Pykhalov @ 2018-12-01 20:48 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 33466


[-- Attachment #1.1: Type: text/plain, Size: 1138 bytes --]

Hello Ludovic.

Apologies for a delay.

ludo@gnu.org (Ludovic Courtès) writes:

> Oleg Pykhalov <go.wigust@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>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: [PATCH] repl: Load user's initialization file. --]
[-- Type: text/x-patch, Size: 1269 bytes --]

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


[-- Attachment #1.3: Type: text/plain, Size: 15 bytes --]


Thanks,
Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
  2018-12-01 20:48       ` Oleg Pykhalov
@ 2018-12-02 17:38         ` Ludovic Courtès
  2018-12-03  5:07           ` bug#33466: " Oleg Pykhalov
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2018-12-02 17:38 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 33466

Hi Oleg,

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#33466: [PATCH 2/2] repl: Add 'colorized' and 'readline' support.
  2018-12-02 17:38         ` Ludovic Courtès
@ 2018-12-03  5:07           ` Oleg Pykhalov
  0 siblings, 0 replies; 8+ messages in thread
From: Oleg Pykhalov @ 2018-12-03  5:07 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 33466, 33466-done

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]

ludo@gnu.org (Ludovic Courtès) writes:

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-12-03  5:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-22 14:40 [bug#33466] [PATCH 0/2] Improve guix repl Oleg Pykhalov
2018-11-22 14:42 ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Oleg Pykhalov
2018-11-22 14:42   ` [bug#33466] [PATCH 2/2] repl: Add 'colorized' and 'readline' support Oleg Pykhalov
2018-11-25 20:40     ` Ludovic Courtès
2018-12-01 20:48       ` Oleg Pykhalov
2018-12-02 17:38         ` Ludovic Courtès
2018-12-03  5:07           ` bug#33466: " Oleg Pykhalov
2018-11-25 20:39   ` [bug#33466] [PATCH 1/2] repl: Do not exit repl on SIGINT Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.