mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-30 08:50:23 +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:
parent
95bdd85dc6
commit
f246e585bb
3 changed files with 35 additions and 3 deletions
|
@ -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>
|
1998-04-22 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
|
||||||
|
|
||||||
* boot-9.scm (process-define-module): Added keyword use-syntax.
|
* boot-9.scm (process-define-module): Added keyword use-syntax.
|
||||||
|
|
|
@ -2885,6 +2885,12 @@
|
||||||
(if (%search-load-path "ice-9/session.scm")
|
(if (%search-load-path "ice-9/session.scm")
|
||||||
(define-module (guile) :use-module (ice-9 session)))
|
(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.}
|
;;; {Load thread code if threads are present.}
|
||||||
;;;
|
;;;
|
||||||
|
|
|
@ -17,8 +17,11 @@
|
||||||
;;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
;;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
;;;;
|
;;;;
|
||||||
;;;; Contributed by Daniel Risacher <risacher@worldnet.att.net>.
|
;;;; 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 "")
|
(define prompt "")
|
||||||
|
|
||||||
|
@ -36,7 +39,9 @@
|
||||||
#\nl))
|
#\nl))
|
||||||
((= string-index -1)
|
((= string-index -1)
|
||||||
(begin
|
(begin
|
||||||
(set! read-string (readline prompt))
|
(set! read-string (readline (if (string? prompt)
|
||||||
|
prompt
|
||||||
|
(prompt))))
|
||||||
(set! string-index 0)
|
(set! string-index 0)
|
||||||
(if (not (eof-object? read-string))
|
(if (not (eof-object? read-string))
|
||||||
(begin
|
(begin
|
||||||
|
@ -66,7 +71,21 @@
|
||||||
(define-public (set-readline-prompt! p)
|
(define-public (set-readline-prompt! p)
|
||||||
(set! 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 myport (make-readline-port))
|
||||||
;(define (doit)
|
;(define (doit)
|
||||||
; (set-current-input-port myport))
|
; (set-current-input-port myport))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue