From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: about readline
Date: Sat, 11 Mar 2006 17:03:08 +0000 [thread overview]
Message-ID: <871wx8sylv.fsf@ossau.uklinux.net> (raw)
In-Reply-To: <878xrh9edv.fsf@www.williamxu.com> (William Xu's message of "Sat, 11 Mar 2006 23:42:36 +0800")
William Xu <william.xwl@gmail.com> 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
next prev parent reply other threads:[~2006-03-11 17:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-11 14:56 about readline William Xu
2006-03-11 15:09 ` Neil Jerram
2006-03-11 15:42 ` William Xu
2006-03-11 17:03 ` Neil Jerram [this message]
2006-03-12 11:19 ` William Xu
2006-03-12 14:38 ` Neil Jerram
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=871wx8sylv.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).