This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: libreadline.so.2 not working w/ guile-1.3 and newer


Jim Blandy writes:

 > What's Guile's failure mode?  Does it crash, or just not give you
 > command-line editing?  The latter would be acceptable; Guile requires
 > recent readlines.  The former would be a bug.

If you type "readline" at a guile prompt, it just says unbound variable
and doesn't crash.  If you invoke guile as part of a script (using -s),
and then do (define-module (blah) :use-module (ice-9 readline)), the
unbound variable error causes guile to exit.  I believe the particular
error occurs on line 106, where the code attempts to bind `%readline' to
`readline'.

For thud, I use the following hacky workaround:

(define thud-readline-defined? (defined? 'readline)) ; outside module

(define-module (thud readline-proxy)
  :use-module (thud com))

(if thud-readline-defined?
    (use-modules (ice-9 readline))
    (begin
      (say ";;; WARNING (Not using GNU readline, faking it.)")
      (define fake-readline-prompt #f)
      (define (set-readline-prompt! s) (set! fake-readline-prompt s))
      (define (readline)
	(display fake-readline-prompt)
	(force-output)
	(read-delimited "\n"))
      (define (add-history ignore) #f)))

(export set-readline-prompt!
	readline
	add-history)

Then I use do (define-module (blah) :use-module (thud readline-proxy)),
which guarantees me un-exceptional access to the exported variables that
(ice-9 readline) doesn't.  I think the proper resolution is to move this
kind of safety check into (ice-9 readline) -- but it's still gross.

thi