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: about readline Date: Sat, 11 Mar 2006 17:03:08 +0000 Message-ID: <871wx8sylv.fsf@ossau.uklinux.net> References: <87d5gt9ghz.fsf@www.williamxu.com> <878xrhrpa1.fsf@ossau.uklinux.net> <878xrh9edv.fsf@www.williamxu.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1142096844 723 80.91.229.2 (11 Mar 2006 17:07:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Mar 2006 17:07:24 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Mar 11 18:07:21 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 1FI7Ye-0006vT-I7 for guile-user@m.gmane.org; Sat, 11 Mar 2006 18:07:12 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FI7Ye-0002Jc-3l for guile-user@m.gmane.org; Sat, 11 Mar 2006 12:07:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FI7Ya-0002JP-Cy for guile-user@gnu.org; Sat, 11 Mar 2006 12:07:08 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FI7YY-0002Iz-QL for guile-user@gnu.org; Sat, 11 Mar 2006 12:07:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FI7YY-0002Iw-NT for guile-user@gnu.org; Sat, 11 Mar 2006 12:07:06 -0500 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FI7c7-0003qh-7P for guile-user@gnu.org; Sat, 11 Mar 2006 12:10:47 -0500 Original-Received: from laruns (host86-129-144-246.range86-129.btcentralplus.com [86.129.144.246]) by mail3.uklinux.net (Postfix) with ESMTP id 9641940A073; Sat, 11 Mar 2006 17:07:05 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 0857A9F8A0; Sat, 11 Mar 2006 17:03:08 +0000 (GMT) Original-To: William Xu In-Reply-To: <878xrh9edv.fsf@www.williamxu.com> (William Xu's message of "Sat, 11 Mar 2006 23:42:36 +0800") 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:5223 Archived-At: William Xu writes: > While this is a function? It seems the very variable is > *readline-completion-function*, but which is not exported from the > module? Yes. I guess the point is to protect the normal value of *readline-completion-function* from being permanently lost. Is this interface a problem in practice for you? > Also, i have no clue how to contruct a proper `completer' for > with-readline-completion-function. The docstring is too simple... It is a bit odd, but basically follows the corresponding C interface. Here's an example which worked some time ago for me. (I haven't tested it recently.) ... (with-readline-completion-function (command-completion-function commands) (lambda () ...)) ... (define (command-completion-function commands) ;; commands is a list of strings representing the possible ;; completions. (letrec ((cmds '()) (regexp #f) (completer (lambda (text continue?) (if continue? (if (null? cmds) #f (let ((cmd (car cmds))) (set! cmds (cdr cmds)) (if (string-match regexp cmd) cmd (completer text #t)))) (begin (set! cmds commands) (set! regexp (string-append "^" (regexp-quote text))) (completer text #t)))))) completer)) Regards, Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user