#| -*-Scheme-*-
-$Id: edwin.pkg,v 1.274 2001/09/21 02:56:15 cph Exp $
+$Id: edwin.pkg,v 1.275 2001/10/30 19:25:15 cph Exp $
Copyright (c) 1989-2001 Massachusetts Institute of Technology
edwin-mode$minibuffer-local-yes-or-no
edwin-variable$enable-recursive-minibuffers
edwin-variable$completion-auto-help
+ lookup-prompt-option
pop-up-completions-list
pop-up-generated-completions
prompt-for-alist-value
prompt-for-variable
prompt-for-yes-or-no?
prompt-history-strings
+ prompt-options-default-string
set-prompt-history-strings!
standard-completion
temporary-typein-message
;;; -*-Scheme-*-
;;;
-;;; $Id: prompt.scm,v 1.197 2001/09/25 12:57:26 cph Exp $
+;;; $Id: prompt.scm,v 1.198 2001/10/30 19:25:08 cph Exp $
;;;
;;; Copyright (c) 1986, 1989-2001 Massachusetts Institute of Technology
;;;
(else
(error "Illegal options tail:" options)))))
+(define (lookup-prompt-option options keyword default)
+ ;; If there are multiple instances of KEYWORD, return the last.
+ (let loop ((options options) (winner #f))
+ (if (pair? options)
+ (begin
+ (if (not (pair? (cdr options)))
+ (error "Options list has odd length:" options))
+ (loop (cddr options)
+ (if (eq? keyword (car options)) options winner)))
+ (begin
+ (if (not (null? options))
+ (error "Illegal options tail:" options))
+ (if winner
+ (cadr winner)
+ default)))))
+
(define prompt-options-table
'())
\f
(and (> length 0)
(< index length))))
(set-options/default-string! options (list-ref (cdr history) index)))))
+
+(define (prompt-options-default-string options)
+ (or (lookup-prompt-option options 'DEFAULT-STRING #f)
+ (let ((index (lookup-prompt-option options 'HISTORY-INDEX #f)))
+ (and index
+ (<= 0 index)
+ (let ((strings
+ (cdr
+ (name->history
+ (lookup-prompt-option options 'HISTORY #f)))))
+ (and (< index (length strings))
+ (list-ref strings index)))))))
\f
;;;; String Prompt Modes