From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: readline eats previous text on line Date: Fri, 29 Sep 2006 23:33:54 +0100 Message-ID: <87y7s22tgt.fsf@ossau.uklinux.net> References: <451AEC75.90200@fastmail.fm> <87y7s4ahvc.fsf@zip.com.au> <451B2A4C.2040000@fastmail.fm> <87ejtw8m7r.fsf@ossau.uklinux.net> <878xk3h52l.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1159569395 13917 80.91.229.2 (29 Sep 2006 22:36:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 29 Sep 2006 22:36:35 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Sep 30 00:36:33 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GTQy6-00062j-Mx for guile-user@m.gmane.org; Sat, 30 Sep 2006 00:36:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GTQy5-0004gn-OL for guile-user@m.gmane.org; Fri, 29 Sep 2006 18:36:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GTQy1-0004ep-1k for guile-user@gnu.org; Fri, 29 Sep 2006 18:36:25 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GTQy0-0004du-0F for guile-user@gnu.org; Fri, 29 Sep 2006 18:36:24 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GTQxz-0004dr-S0 for guile-user@gnu.org; Fri, 29 Sep 2006 18:36:23 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GTR3O-0007wV-Fy for guile-user@gnu.org; Fri, 29 Sep 2006 18:41:58 -0400 Original-Received: from laruns (host86-145-154-50.range86-145.btcentralplus.com [86.145.154.50]) by mail3.uklinux.net (Postfix) with ESMTP id 6143240A772; Fri, 29 Sep 2006 22:34:02 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 9A19B6F6D4; Fri, 29 Sep 2006 23:33:54 +0100 (BST) Original-To: Kevin Ryde In-Reply-To: <878xk3h52l.fsf@zip.com.au> (Kevin Ryde's message of "Fri, 29 Sep 2006 10:47:14 +1000") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5561 Archived-At: Kevin Ryde writes: > Neil Jerram 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