unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* About REPL hook
@ 2012-11-28  9:53 nalaginrut
  2012-11-30 10:49 ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: nalaginrut @ 2012-11-28  9:53 UTC (permalink / raw)
  To: guile-devel

I want to do some magic to let REPL display in color.
But I found there's no content about REPL hook in Guile manual.
And how can I get the result-string which the REPL is going to output?
Anyone point me out?

Thanks!





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

* Re: About REPL hook
  2012-11-28  9:53 About REPL hook nalaginrut
@ 2012-11-30 10:49 ` Ludovic Courtès
  2012-12-01 16:31   ` nalaginrut
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2012-11-30 10:49 UTC (permalink / raw)
  To: nalaginrut; +Cc: guile-devel

Hello!

nalaginrut <nalaginrut@gmail.com> skribis:

> I want to do some magic to let REPL display in color.
> But I found there's no content about REPL hook in Guile manual.
> And how can I get the result-string which the REPL is going to output?

Looking at ‘run-repl’ (system repl repl), there’s ‘before-eval-hook’.
Then, in ‘repl-print’, there’s ‘before-print-hook’.  There are no
‘after’ hooks, though.

Does that answer your question?

Thanks,
Ludo’.



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

* Re: About REPL hook
  2012-11-30 10:49 ` Ludovic Courtès
@ 2012-12-01 16:31   ` nalaginrut
  2012-12-02  2:59     ` Daniel Hartwig
  2012-12-02 16:50     ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: nalaginrut @ 2012-12-01 16:31 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Fri, 2012-11-30 at 11:49 +0100, Ludovic Courtès wrote:
> Hello!
> 
> nalaginrut <nalaginrut@gmail.com> skribis:
> 
> > I want to do some magic to let REPL display in color.
> > But I found there's no content about REPL hook in Guile manual.
> > And how can I get the result-string which the REPL is going to output?
> 
> Looking at ‘run-repl’ (system repl repl), there’s ‘before-eval-hook’.
> Then, in ‘repl-print’, there’s ‘before-print-hook’.  There are no
> ‘after’ hooks, though.
> 
> Does that answer your question?
> 

Thanks ludo!
With your helo, I can easily hack the colorized REPL now!
But I realized that the hook maybe an improper way to go, it'll print
twice:
-----------------example---------------
123 (colorized output)
$1 = 123 (normal output)
-------------------end-----------------

And I checked the code, it'll call 'pp' after 'before-print-hook', so
the add the colorized code into 'pp' will be more pretty.

I think a colorized REPL is useful for our users.
Will you accept a patch to 'pp' for colorized REPL? Or an easy way, a
module with hook to do the same job, but output twice?




> Thanks,
> Ludo’.





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

* Re: About REPL hook
  2012-12-01 16:31   ` nalaginrut
@ 2012-12-02  2:59     ` Daniel Hartwig
  2012-12-02 15:39       ` nalaginrut
  2012-12-02 16:50     ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel Hartwig @ 2012-12-02  2:59 UTC (permalink / raw)
  To: guile-devel

On 2 December 2012 00:31, nalaginrut <nalaginrut@gmail.com> wrote:
> I think a colorized REPL is useful for our users.
> Will you accept a patch to 'pp' for colorized REPL? Or an easy way, a
> module with hook to do the same job, but output twice?

Perhaps rather implement this as a separate, “advanced” interface.
Think: ipython vs. python.  Most of the existing repl module would be
reusable for such a task.

There are benefits to keeping the official package, shell, repl,
interface, whatsit free of unnecessary features.  Such simplicity aids
in debugging, and facilitates a clear definition of language
semantics, compatibility, portability, extension, etc..

Also, are you aware of the multiple existing packages that provide
provide a Guile REPL with syntax highlighting (and *much* more)?.  Try
Geiser [1] or Quack [2], both of which run inside emacs and provide
integration between file and repl buffers (i.e. run expressions
directly from file buffers).

Regards

[1] http://www.nongnu.org/geiser/
[2] http://www.neilvandyke.org/quack/



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

* Re: About REPL hook
  2012-12-02  2:59     ` Daniel Hartwig
@ 2012-12-02 15:39       ` nalaginrut
  0 siblings, 0 replies; 7+ messages in thread
From: nalaginrut @ 2012-12-02 15:39 UTC (permalink / raw)
  To: Daniel Hartwig; +Cc: guile-devel

On Sun, 2012-12-02 at 10:59 +0800, Daniel Hartwig wrote:
> On 2 December 2012 00:31, nalaginrut <nalaginrut@gmail.com> wrote:
> > I think a colorized REPL is useful for our users.
> > Will you accept a patch to 'pp' for colorized REPL? Or an easy way, a
> > module with hook to do the same job, but output twice?
> 
> Perhaps rather implement this as a separate, “advanced” interface.
> Think: ipython vs. python.  Most of the existing repl module would be
> reusable for such a task.
> 
> There are benefits to keeping the official package, shell, repl,
> interface, whatsit free of unnecessary features.  Such simplicity aids
> in debugging, and facilitates a clear definition of language
> semantics, compatibility, portability, extension, etc..
> 
> Also, are you aware of the multiple existing packages that provide
> provide a Guile REPL with syntax highlighting (and *much* more)?.
> Try
> Geiser [1] or Quack [2], both of which run inside emacs and provide
> integration between file and repl buffers (i.e. run expressions
> directly from file buffers).
> 

Not all people use Emacs, although I use it. So neither Geiser nor Quack
is the same case here. 
My effort is to color the result in REPL only, even for a non-Emacs
user, which is a friendly feature for Guilers.

We know Ruby has many IDEs to do the syntax highlight, but it also has a
gem named 'wirble' to color the result in the REPL.

I think such a REPL-plugin is easy to hack for Guile in few hours, so
I'm going to give it a try.  
The only problem is to output twice seems ugly if I write an independent
module without a patch for 'pp'. Or I don't want to modify the current
REPL code personally.

> Regards
> 
> [1] http://www.nongnu.org/geiser/
> [2] http://www.neilvandyke.org/quack/
> 





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

* Re: About REPL hook
  2012-12-01 16:31   ` nalaginrut
  2012-12-02  2:59     ` Daniel Hartwig
@ 2012-12-02 16:50     ` Ludovic Courtès
  2012-12-03  2:18       ` nalaginrut
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2012-12-02 16:50 UTC (permalink / raw)
  To: nalaginrut; +Cc: guile-devel

Hi,

nalaginrut <nalaginrut@gmail.com> skribis:

> I think a colorized REPL is useful for our users.
> Will you accept a patch to 'pp' for colorized REPL? Or an easy way, a
> module with hook to do the same job, but output twice?

If you could come up with an optional mechanism to enable colored
output, that would be great.  The default should remain unchanged.

Note that Geiser does a bit of coloring, and much more.  :-)

Thanks,
Ludo’.



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

* Re: About REPL hook
  2012-12-02 16:50     ` Ludovic Courtès
@ 2012-12-03  2:18       ` nalaginrut
  0 siblings, 0 replies; 7+ messages in thread
From: nalaginrut @ 2012-12-03  2:18 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Sun, 2012-12-02 at 17:50 +0100, Ludovic Courtès wrote:
> Hi,
> 
> nalaginrut <nalaginrut@gmail.com> skribis:
> 
> > I think a colorized REPL is useful for our users.
> > Will you accept a patch to 'pp' for colorized REPL? Or an easy way, a
> > module with hook to do the same job, but output twice?
> 
> If you could come up with an optional mechanism to enable colored
> output, that would be great.  The default should remain unchanged.
> 

OK, I'll give it a try. And default should remain unchanged, it's the
way I like too.

> Note that Geiser does a bit of coloring, and much more.  :-)
> 

Hmm...as I said, not all people use Emacs, and I just want to make our
original REPL a little more friendly. ;-)

Thanks!

> Thanks,
> Ludo’.





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

end of thread, other threads:[~2012-12-03  2:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28  9:53 About REPL hook nalaginrut
2012-11-30 10:49 ` Ludovic Courtès
2012-12-01 16:31   ` nalaginrut
2012-12-02  2:59     ` Daniel Hartwig
2012-12-02 15:39       ` nalaginrut
2012-12-02 16:50     ` Ludovic Courtès
2012-12-03  2:18       ` nalaginrut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).