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: Yi DAI
Subject: Re: [Chicken-users] Procedures in the `read' series shadowed by GNU readline
Date: Tue, 26 Oct 2010 19:17:53 +0200



On Mon, Oct 25, 2010 at 9:58 PM, Mario Domenech Goulart <address@hidden> wrote:
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))

OK. Thanks for the suggestion. But that's annoying to type such a long line to use the `read' series, isn't it? Guile also uses readline to achieve the same effect in its repl but without this trouble (No offence to Chicken, in particular its Eggs as in breakfast and scheming ;). Should I mark this as a bug and report it? Though I am not sure I should mark it the bug of the readline Egg or Chicken core.


Best regards,


 

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



--
DAI Yi
(代 毅)

reply via email to

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