From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jon Wilson Newsgroups: gmane.lisp.guile.user Subject: readline eats previous text on line Date: Wed, 27 Sep 2006 16:26:13 -0500 Message-ID: <451AEC75.90200@fastmail.fm> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7BIT X-Trace: sea.gmane.org 1159392362 15410 80.91.229.2 (27 Sep 2006 21:26:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Sep 2006 21:26:02 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Wed Sep 27 23:25:59 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 1GSgud-0005SB-Lb for guile-user@m.gmane.org; Wed, 27 Sep 2006 23:25:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GSgud-0003L4-2c for guile-user@m.gmane.org; Wed, 27 Sep 2006 17:25:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GSguZ-0003Kz-7U for guile-user@gnu.org; Wed, 27 Sep 2006 17:25:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GSguX-0003Kn-2W for guile-user@gnu.org; Wed, 27 Sep 2006 17:25:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GSguW-0003Kk-U4 for guile-user@gnu.org; Wed, 27 Sep 2006 17:25:44 -0400 Original-Received: from [131.225.111.12] (helo=mailgw2.fnal.gov) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GSgzT-0001Sw-Ac for guile-user@gnu.org; Wed, 27 Sep 2006 17:30:51 -0400 Original-Received: from mailav1.fnal.gov (mailav1.fnal.gov [131.225.111.18]) by mailgw2.fnal.gov (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) with SMTP id <0J6900CAZSUR99@mailgw2.fnal.gov> for guile-user@gnu.org; Wed, 27 Sep 2006 16:25:44 -0500 (CDT) Original-Received: from mailgw2.fnal.gov ([131.225.111.12]) by mailav1.fnal.gov (SAVSMTP 3.1.7.47) with SMTP id M2006092716254417203 for ; Wed, 27 Sep 2006 16:25:44 -0500 Original-Received: from conversion-daemon.mailgw2.fnal.gov by mailgw2.fnal.gov (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) id <0J6900E01SN5KE@mailgw2.fnal.gov> (original mail from j85wilson@fastmail.fm) for guile-user@gnu.org; Wed, 27 Sep 2006 16:25:44 -0500 (CDT) Original-Received: from [192.168.0.2] (cpe-24-162-120-52.hot.res.rr.com [24.162.120.52]) by mailgw2.fnal.gov (iPlanet Messaging Server 5.2 HotFix 2.06 (built Mar 28 2005)) with ESMTPSA id <0J6900C8WSUVB9@mailgw2.fnal.gov> for guile-user@gnu.org; Wed, 27 Sep 2006 16:25:44 -0500 (CDT) Original-To: guile-user X-Accept-Language: en-us, en User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) 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:5553 Archived-At: Hi, I'm trying to read user input (interactive) using guile. I'd like to use (ice-9 readline), so that the user can use backspace and history and such. I'd also like to have a prompt at the beginning of the line. These last two desires seem to be incompatible, at least mod my best efforts. For instance, please consider the following: (use-modules (ice-9 rdelim) (ice-9 format) (ice-9 readline)) (activate-readline) (define (test) (define str #f) (display "prompt: ") (let loop ((n 1000000)) (if (not (zero? n)) (loop (1- n)))) (set! str (read-line)) (newline) (display str)) (test) This prints "prompt: " on a line, and then after a short time, it is erased. The mess with loop in the middle is of course a crufty time delay, without which I can't see "prompt: " at all before it disappears. After it has disappeared, I can type whatever I like, and then press enter. Whatever I have typed is then printed as expected, on a new line. This behavior is unchanged (except for how much text is actually read) when I substitute read-char or read in for read-line. This behavior is gone when I remove (activate-readline). However, without readline, as I said above, the user cannot backspace, which is a great annoyance. Obviously, however, when the normal guile repl uses readline, it has a prompt which is not eaten. How is this accomplished? Regards, Jon _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user