guile-devel
[Top][All Lists]
Advanced

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

Re: bug#13077: guile: add repl-option for customized print


From: Nala Ginrut
Subject: Re: bug#13077: guile: add repl-option for customized print
Date: Wed, 12 Dec 2012 12:03:25 +0800

hi Daniel!
Custom color-scheme is done now! ;-D
But we have a problem... :-(

It's OK to test this code in the REPL:
--------------------cut-------------------
(use-modules (ice-9 colorized))
(add-color-scheme! 
 `((,(lambda (data) (and (number? data) (> data 10000)))
    MY-LONG-NUM ,color-it (RED))))
(activate-colorized)
--------------------end-------------------


But when I put these lines into our ~/.guile, it throw error:
----------------err msg----------------
In /usr/local/share/guile/2.0/ice-9/colorized.scm:
  31: 0 [activate-colorized]

/usr/local/share/guile/2.0/ice-9/colorized.scm:31:20: In procedure
activate-colorized:
/usr/local/share/guile/2.0/ice-9/colorized.scm:31:20: In procedure car:
Wrong type argument in position 1 (expecting pair): ()
------------------end------------------

Seems (fluid-ref *repl-stack*) is not a pair/list when REPL is just
started?
Please checkout here:
https://github.com/NalaGinrut/guile-colorized/blob/upstream/ice-9/colorized.scm#L31


Thanks!

On Tue, 2012-12-04 at 13:34 +0800, Daniel Hartwig wrote:
> On 4 December 2012 13:19, nalaginrut <address@hidden> wrote:
> > Hi Daniel!
> > I believe this patch simplified my work, and 'colorized' module has been
> > finished, I'm testing and debugging.
> > I'll post it when it's all done.
> 
> Glad to hear it.
> 
> Attached is an alternate patch that handles before-print-hook and
> *unspecified* outside of the custom print procedure, to avoid the need
> for boilerplate there.
> 
> --
> scheme@(guile-user)> (define (repl-print* repl val)
>                        (format #t "address@hidden" val)
>                        (newline))
> scheme@(guile-user)> (use-modules (system repl common))
> scheme@(guile-user)> (repl-option-set! (car (fluid-ref *repl-stack*))
> 'print repl-print*)
> scheme@(guile-user)> (use-modules (srfi srfi-1))
> scheme@(guile-user)> (iota 20)
> $1 = (0 1 2 3 4 5 6 7 …)





reply via email to

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