mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
repl-reader accepts optional "read" argument
* module/ice-9/boot-9.scm (repl-reader): Accept an optional second argument, the reader to use. If it is given, use it instead of dereferencing the current-reader fluid. * guile-readline/ice-9/readline.scm (activate-readline): Make our replacement definition of repl-reader compatible with boot-9.
This commit is contained in:
parent
27c8177fe4
commit
a58b7fbb7e
2 changed files with 10 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
;;;; readline.scm --- support functions for command-line editing
|
||||
;;;;
|
||||
;;;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
|
||||
;;;; Copyright (C) 1997, 1999, 2000, 2001, 2002, 2006, 2009 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
;;;; This program is free software; you can redistribute it and/or modify
|
||||
;;;; it under the terms of the GNU General Public License as published by
|
||||
|
@ -208,7 +208,7 @@
|
|||
(let ((repl-read-hook (lambda () (run-hook before-read-hook))))
|
||||
(set-current-input-port (readline-port))
|
||||
(set! repl-reader
|
||||
(lambda (repl-prompt)
|
||||
(lambda (repl-prompt . reader)
|
||||
(let ((outer-new-input-prompt new-input-prompt)
|
||||
(outer-continuation-prompt continuation-prompt)
|
||||
(outer-read-hook read-hook))
|
||||
|
@ -217,7 +217,9 @@
|
|||
(set-buffered-input-continuation?! (readline-port) #f)
|
||||
(set-readline-prompt! repl-prompt "... ")
|
||||
(set-readline-read-hook! repl-read-hook))
|
||||
(lambda () ((or (fluid-ref current-reader) read)))
|
||||
(lambda () ((or (and (pair? reader) (car reader))
|
||||
(fluid-ref current-reader)
|
||||
read)))
|
||||
(lambda ()
|
||||
(set-readline-prompt! outer-new-input-prompt outer-continuation-prompt)
|
||||
(set-readline-read-hook! outer-read-hook))))))
|
||||
|
|
|
@ -2705,11 +2705,14 @@ module '(ice-9 q) '(make-q q-length))}."
|
|||
;;; The default repl-reader function. We may override this if we've
|
||||
;;; the readline library.
|
||||
(define repl-reader
|
||||
(lambda (prompt)
|
||||
(lambda (prompt . reader)
|
||||
(display (if (string? prompt) prompt (prompt)))
|
||||
(force-output)
|
||||
(run-hook before-read-hook)
|
||||
((or (fluid-ref current-reader) read) (current-input-port))))
|
||||
((or (and (pair? reader) (car reader))
|
||||
(fluid-ref current-reader)
|
||||
read)
|
||||
(current-input-port))))
|
||||
|
||||
(define (scm-style-repl)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue