chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Procedures in the `read' series shadowed by GNU read


From: Mario Domenech Goulart
Subject: Re: [Chicken-users] Procedures in the `read' series shadowed by GNU readline
Date: Mon, 25 Oct 2010 15:58:40 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux)

Hi

On Mon, 25 Oct 2010 21:46:28 +0200 Yi DAI <address@hidden> wrote:

> I just found that procedures in the `read' series, like `read', `read-line',
> etc do not work in the interactive repl if I make use of the GNU readline egg.
> When I try to `(read)', it does not wait for my input any more instead 
> directly
> jump to a new prompt as if I enter nothing.  Below is my .csirc
>
> (use readline regex datatype matchable)
>
> (current-input-port (make-gnu-readline-port))
>
> (gnu-history-install-file-manager
>   (string-append (or (getenv "HOME") ".") "/.csi.history"))
>
> But if I do not use readline (also comment the last two line of gnu-stuff), it
> works fine. I am currently using 4.6.0 on Archlinux.

You can use a dirty trick: in your .csirc, save your default stdin
before setting it to `(make-gnu-readline-port)'. When you want the old
`(current-input-port)', just parameterize it using the value you saved.

So, your .csirc would be:

    (use readline regex datatype matchable)
    
    (define old-stdin (current-input-port))
    
    (current-input-port (make-gnu-readline-port))
    
    (gnu-history-install-file-manager
      (string-append (or (getenv "HOME") ".") "/.csi.history"))


When you want to use, say, `read' without the readline port, do:

  (parameterize ((current-input-port old-stdin)) (read))

Best wishes.
Mario
-- 
http://parenteses.org/mario



reply via email to

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