1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-29 08:20:20 +02:00

* boot-9.scm: Load readline module if readline is present.

* readline.scm (apropos-completion-function): New procedure:
Symbolic completion.  (Thanks to Andrew Archibald!)
This commit is contained in:
Mikael Djurfeldt 1998-05-11 01:15:26 +00:00
parent 95bdd85dc6
commit f246e585bb
3 changed files with 35 additions and 3 deletions

View file

@ -1,3 +1,10 @@
1998-05-11 Mikael Djurfeldt <mdj@kenneth>
* boot-9.scm: Load readline module if readline is present.
* readline.scm (apropos-completion-function): New procedure:
Symbolic completion. (Thanks to Andrew Archibald!)
1998-04-22 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* boot-9.scm (process-define-module): Added keyword use-syntax.

View file

@ -2885,6 +2885,12 @@
(if (%search-load-path "ice-9/session.scm")
(define-module (guile) :use-module (ice-9 session)))
;;; {Use readline if present.}
;;;
(if (memq 'readline *features*)
(define-module (guile) :use-module (ice-9 readline)))
;;; {Load thread code if threads are present.}
;;;

View file

@ -17,8 +17,11 @@
;;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;;;;
;;;; Contributed by Daniel Risacher <risacher@worldnet.att.net>.
;;;; Extensions based upon code by
;;;; Andrew Archibald <aarchiba@undergrad.math.uwaterloo.ca>.
(define-module (ice-9 readline))
(define-module (ice-9 readline)
:use-module (ice-9 session))
(define prompt "")
@ -36,7 +39,9 @@
#\nl))
((= string-index -1)
(begin
(set! read-string (readline prompt))
(set! read-string (readline (if (string? prompt)
prompt
(prompt))))
(set! string-index 0)
(if (not (eof-object? read-string))
(begin
@ -66,6 +71,20 @@
(define-public (set-readline-prompt! p)
(set! prompt p))
(define-public apropos-completion-function
(let ((completions '()))
(lambda (text cont?)
(if (not cont?)
(set! completions
(map symbol->string
(apropos-internal (string-append "^" text)))))
(if (null? completions)
#f
(let ((retval (car completions)))
(begin (set! completions (cdr completions))
retval))))))
(set! *readline-completion-function* apropos-completion-function)
;(define myport (make-readline-port))
;(define (doit)