mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 03:30:27 +02:00
(new-input-prompt): Renamed from "prompt".
(continuation-prompt): Renamed from "prompt2". (make-readline-port, readline, set-readline-prompt!): Reflect above renamings. (activate-readline): Rename locals "read-hook" and "prompt" to "repl-read-hook" and "repl-prompt", to disambiguate them from globals. Save and restore the new-input- and continuation- prompts around the REPL read call.
This commit is contained in:
parent
83a5b41b47
commit
3bff1789df
2 changed files with 32 additions and 18 deletions
|
@ -1,3 +1,14 @@
|
|||
2006-10-06 Neil Jerram <neil@ossau.uklinux.net>
|
||||
|
||||
* ice-9/readline.scm (new-input-prompt): Renamed from "prompt".
|
||||
(continuation-prompt): Renamed from "prompt2".
|
||||
(make-readline-port, readline, set-readline-prompt!): Reflect
|
||||
above renamings.
|
||||
(activate-readline): Rename locals "read-hook" and "prompt" to
|
||||
"repl-read-hook" and "repl-prompt", to disambiguate them from
|
||||
globals. Save and restore the new-input- and continuation-
|
||||
prompts around the REPL read call.
|
||||
|
||||
2006-04-17 Kevin Ryde <user42@zip.com.au>
|
||||
|
||||
* ice-9/readline.scm: Bump lib file version to libguilereadline-v-18,
|
||||
|
|
|
@ -68,8 +68,8 @@
|
|||
;;; Dirk:FIXME:: If the-readline-port, input-port or output-port are closed,
|
||||
;;; guile will enter an endless loop or crash.
|
||||
|
||||
(define prompt "")
|
||||
(define prompt2 "")
|
||||
(define new-input-prompt "")
|
||||
(define continuation-prompt "")
|
||||
(define input-port (current-input-port))
|
||||
(define output-port (current-output-port))
|
||||
(define read-hook #f)
|
||||
|
@ -77,8 +77,8 @@
|
|||
(define (make-readline-port)
|
||||
(make-line-buffered-input-port (lambda (continuation?)
|
||||
(let* ((prompt (if continuation?
|
||||
prompt2
|
||||
prompt))
|
||||
continuation-prompt
|
||||
new-input-prompt))
|
||||
(str (%readline (if (string? prompt)
|
||||
prompt
|
||||
(prompt))
|
||||
|
@ -125,7 +125,7 @@
|
|||
;;; %readline is the low-level readline procedure.
|
||||
|
||||
(define-public (readline . args)
|
||||
(let ((prompt prompt)
|
||||
(let ((prompt new-input-prompt)
|
||||
(inp input-port))
|
||||
(cond ((not (null? args))
|
||||
(set! prompt (car args))
|
||||
|
@ -141,9 +141,9 @@
|
|||
args)))
|
||||
|
||||
(define-public (set-readline-prompt! p . rest)
|
||||
(set! prompt p)
|
||||
(set! new-input-prompt p)
|
||||
(if (not (null? rest))
|
||||
(set! prompt2 (car rest))))
|
||||
(set! continuation-prompt (car rest))))
|
||||
|
||||
(define-public (set-readline-input-port! p)
|
||||
(cond ((or (not (file-port? p)) (not (input-port? p)))
|
||||
|
@ -202,19 +202,22 @@
|
|||
(not (let ((guile-user-module (resolve-module '(guile-user))))
|
||||
(and (module-defined? guile-user-module 'use-emacs-interface)
|
||||
(module-ref guile-user-module 'use-emacs-interface)))))
|
||||
(let ((read-hook (lambda () (run-hook before-read-hook))))
|
||||
(let ((repl-read-hook (lambda () (run-hook before-read-hook))))
|
||||
(set-current-input-port (readline-port))
|
||||
(set! repl-reader
|
||||
(lambda (prompt)
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
(set-buffered-input-continuation?! (readline-port) #f)
|
||||
(set-readline-prompt! prompt "... ")
|
||||
(set-readline-read-hook! read-hook))
|
||||
(lambda () (read))
|
||||
(lambda ()
|
||||
(set-readline-prompt! "" "")
|
||||
(set-readline-read-hook! #f)))))
|
||||
(lambda (repl-prompt)
|
||||
(let ((outer-new-input-prompt new-input-prompt)
|
||||
(outer-continuation-prompt continuation-prompt)
|
||||
(outer-read-hook read-hook))
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
(set-buffered-input-continuation?! (readline-port) #f)
|
||||
(set-readline-prompt! repl-prompt "... ")
|
||||
(set-readline-read-hook! repl-read-hook))
|
||||
(lambda () (read))
|
||||
(lambda ()
|
||||
(set-readline-prompt! outer-new-input-prompt outer-continuation-prompt)
|
||||
(set-readline-read-hook! outer-read-hook))))))
|
||||
(set! (using-readline?) #t))))
|
||||
|
||||
(define-public (make-completion-function strings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue