Subject: Guile Ice-9 Readline with-readline-completion-function

From: Matthew Henry <[email-masked]>
Date: Mon, 19 Aug 2019 13:36:26 -0400

Seen in: guile (GNU Guile) 2.2.4

When using the with-readline-completion-function, the passed readline
uses the default (apropos) completion function instead of the one
provided to with-readline-completion-function.

I believe that this is because root/guile-readline/ice-9/readline.scm
has defined with-readline-completion-function as a function instead of
as a macro.  The readline provided in thunk is executed before the
body of with-readline-completion-function executes and overrides
*readline-completion-function*.

As an aside, I think the API would be better if the completion
function could be provided to readline directly.

Attached is a sample program.

Below is sample output of a run of the attached program.  You can see
that it's autocompleting Guile functions and variables (the default
apropos completion) rather than the provided one which should have had
only 3 options with just one starting in "th".

;;;;;;;;;;;;;;;;;;;;;;;;;;;
Prompt:
Display all 1859 possibilities? (y or n)
Prompt: th
the-eof-object   the-scm-module   thread-exited?   thunk?
the-root-module  thread?          throw
Prompt: th