This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Reading more than one expression on the same line
- To: Neil Jerram <neil at ossau dot uklinux dot net>
- Subject: Re: Reading more than one expression on the same line
- From: mstachow at alum dot mit dot edu
- Date: Mon, 29 May 2000 01:50:10 -0400
- CC: guile at sourceware dot cygnus dot com
- References: <200005281905.UAA02172@ossau>
Neil Jerram wrote:
>
> I sent this patch in April, but didn't get any response. So here it
> is again...
Hi neil, first of all, if you have GNU diff, please send patches generated
with diff -u (if you don't, a context diff like you sent is OK).
> When readline is *not* activated, this is what you see if you type two
> expressions on the same line and press enter:
>
> guile> 'a 'b
> a
> guile> b
> guile>
>
> Whereas I think it would be more natural, and less confusing, to see:
>
> guile> 'a 'b
> a
> b
> guile>
>
> If the consensus agrees with me, the fix is to modify repl-reader in
> boot-9.scm so that it only displays its prompt when there is no input
> already available, as in the following patch.
I think this would indeed be an improvement, but see below.
> Regards,
>
> Neil
>
> 2000-04-09 Neil Jerram <neil@ossau.uklinux.net>
>
> * boot-9.scm (repl-reader): Only display prompt if there isn't
> input already available.
>
> Index: boot-9.scm
> ===================================================================
> RCS file: /cvs/guile/guile/guile-core/ice-9/boot-9.scm,v
> retrieving revision 1.200
> diff -c -r1.200 boot-9.scm
> *** boot-9.scm 2000/03/02 20:44:19 1.200
> --- boot-9.scm 2000/04/09 22:00:54
> ***************
> *** 2460,2467 ****
> ;;; the readline library.
> (define repl-reader
> (lambda (prompt)
> ! (display prompt)
> ! (force-output)
> (run-hook before-read-hook)
> (read (current-input-port))))
>
> --- 2460,2469 ----
> ;;; the readline library.
> (define repl-reader
> (lambda (prompt)
> ! (if (not (char-ready?))
> ! (begin
> ! (display prompt)
> ! (force-output)))
> (run-hook before-read-hook)
> (read (current-input-port))))
>
It's interesting to note that this patch changes more than the case you
mentioned. In particular, if you type a full expression and a partial expression on the same line, e.g.
guile> 'foo '(bar
foo will be displayed right away but you won't get another prompt.
This may be better than the current behavior, but it's something to
be aware of.
- Maciej