readline-activator.scm 549 B

123456789101112131415161718
  1. (define-module (readline-activator))
  2. (define-public (activate-readline)
  3. (if (not (provided? 'readline))
  4. (scm-error 'misc-error
  5. 'activate-readline
  6. "readline is not provided in this Guile installation"
  7. '()
  8. '()))
  9. (save-module-excursion
  10. (lambda ()
  11. (define-module (guile))
  12. (dynamic-call "scm_init_readline" (dynamic-link "libguilereadline.so"))
  13. (if (isatty? (current-input-port))
  14. (begin
  15. (define-module (guile) :use-module (ice-9 readline))
  16. (define-module (guile-user) :use-module (ice-9 readline)))))))