Maintain a completion-set for registered command-plugins

This commit is contained in:
eknauel 2005-05-28 12:06:13 +00:00
parent 59a7a3c9ae
commit 4e5a41db3d
1 changed files with 11 additions and 2 deletions

View File

@ -2,12 +2,18 @@
(define *view-plugins* '())
(define *command-completions*
(make-empty-completion-set))
(define (command-plugin-list)
*command-plugins*)
(define (view-plugin-list)
*view-plugins*)
(define (command-completions)
*command-completions*)
(define-record-type view-plugin :view-plugin
(make-view-plugin fun type-predicate)
view-plugin?
@ -24,7 +30,10 @@
(define (register-plugin! plugin)
(cond
((command-plugin? plugin)
(set! *command-plugins* (cons plugin *command-plugins*)))
(set! *command-plugins* (cons plugin *command-plugins*))
(set! *command-completions*
(adjoin-completion-set *command-completions*
(command-plugin-command plugin))))
((view-plugin? plugin)
(set! *view-plugins* (cons plugin *view-plugins*)))
(error "unknown plugin type" plugin)))
@ -96,7 +105,7 @@
((restore-message? message)
restore-message-result-object)
((selection-message? message)
selection-message-result-object message)
selection-message-result-object)
(else
(error "This message-type has no field for result-objects"
message)))