From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: readline eats previous text on line
Date: Fri, 29 Sep 2006 23:33:54 +0100 [thread overview]
Message-ID: <87y7s22tgt.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <878xk3h52l.fsf@zip.com.au> (Kevin Ryde's message of "Fri, 29 Sep 2006 10:47:14 +1000")
Kevin Ryde <user42@zip.com.au> writes:
> Neil Jerram <neil@ossau.uklinux.net> writes:
>>
>> ... instead of by a parameter to `readline',
>
> Is that readline function meant to be used? I assume it's emulating
> the C function of that name. If you use it and no other input it
> works does it?
Yes, it is meant to be used, and I believe it works.
Sorry if I was misleading on this before. I've refreshed my memory
now about how all this fits together. Basically (ice-9 readline)
combines two separable things.
1. One is the Scheme readline function, which basically just wraps the
C function. This allows programs to call `readline' explicitly when
they want to, and on such occasions it makes perfect sense for the
program to specify the prompt, so the readline's first arg is a prompt
string.
2. The other is the idea of using readline automatically whenever
something needs to be read from the current input port. This is what
the `activate-readline' proc does - it could equally well be named
`use-readline-for-current-input-port'. For this feature you wouldn't
expect to see an explicit `readline' call anywhere, except deep down
in the definition of a soft port that replaces the current input port.
Program code continues to use non-readline-specific calls like `read',
`read-char' or `read-line', and the port uses readline to replenish
the port's input buffer when necessary.
My explanation of the thinking behind set-readline-prompt! applies to
(2). In this case the program can't always predict when a readline
will happen, and it doesn't issue the readline call itself directly;
so set-readline-prompt! basically means "use so-and-so prompt if a
readline is needed".
Slightly confusingly, set-readline-prompt! does also set the default
prompt for an explicit `readline' call (1). I think the overall
situation would be clearer if it didn't.
The bug which Jon has noted, about the effect of set-readline-prompt!
not lasting very long, is caused by the fact that Guile's REPL code,
when using readline, does a
(set-readline-prompt! "guile>" "...")
before reading an expression from the REPL, and
(set-readline-prompt! "" "")
after the read, thus losing whatever prompt the user might have
installed for their own (non-REPL) purposes. This code should instead
save the existing prompts and restore them afterwards - I'll post a
patch for that soon.
Regards,
Neil
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next prev parent reply other threads:[~2006-09-29 22:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-27 21:26 readline eats previous text on line Jon Wilson
2006-09-28 1:40 ` Kevin Ryde
2006-09-28 1:50 ` Jon Wilson
2006-09-28 7:49 ` Neil Jerram
2006-09-29 0:47 ` Kevin Ryde
2006-09-29 22:33 ` Neil Jerram [this message]
2006-09-30 12:25 ` Neil Jerram
2006-10-03 0:15 ` Kevin Ryde
2006-10-03 0:52 ` Kevin Ryde
2006-10-04 23:13 ` Kevin Ryde
2006-10-05 23:06 ` Neil Jerram
2006-10-05 23:35 ` Neil Jerram
2006-10-06 0:03 ` Kevin Ryde
2006-12-01 20:24 ` Jon Wilson
2006-10-03 0:22 ` Kevin Ryde
2006-09-28 21:08 ` Jon Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y7s22tgt.fsf@ossau.uklinux.net \
--to=neil@ossau.uklinux.net \
--cc=guile-user@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).