Maintain a completion-set for registered command-plugins
This commit is contained in:
parent
59a7a3c9ae
commit
4e5a41db3d
|
@ -2,12 +2,18 @@
|
||||||
|
|
||||||
(define *view-plugins* '())
|
(define *view-plugins* '())
|
||||||
|
|
||||||
|
(define *command-completions*
|
||||||
|
(make-empty-completion-set))
|
||||||
|
|
||||||
(define (command-plugin-list)
|
(define (command-plugin-list)
|
||||||
*command-plugins*)
|
*command-plugins*)
|
||||||
|
|
||||||
(define (view-plugin-list)
|
(define (view-plugin-list)
|
||||||
*view-plugins*)
|
*view-plugins*)
|
||||||
|
|
||||||
|
(define (command-completions)
|
||||||
|
*command-completions*)
|
||||||
|
|
||||||
(define-record-type view-plugin :view-plugin
|
(define-record-type view-plugin :view-plugin
|
||||||
(make-view-plugin fun type-predicate)
|
(make-view-plugin fun type-predicate)
|
||||||
view-plugin?
|
view-plugin?
|
||||||
|
@ -24,7 +30,10 @@
|
||||||
(define (register-plugin! plugin)
|
(define (register-plugin! plugin)
|
||||||
(cond
|
(cond
|
||||||
((command-plugin? plugin)
|
((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)
|
((view-plugin? plugin)
|
||||||
(set! *view-plugins* (cons plugin *view-plugins*)))
|
(set! *view-plugins* (cons plugin *view-plugins*)))
|
||||||
(error "unknown plugin type" plugin)))
|
(error "unknown plugin type" plugin)))
|
||||||
|
@ -96,7 +105,7 @@
|
||||||
((restore-message? message)
|
((restore-message? message)
|
||||||
restore-message-result-object)
|
restore-message-result-object)
|
||||||
((selection-message? message)
|
((selection-message? message)
|
||||||
selection-message-result-object message)
|
selection-message-result-object)
|
||||||
(else
|
(else
|
||||||
(error "This message-type has no field for result-objects"
|
(error "This message-type has no field for result-objects"
|
||||||
message)))
|
message)))
|
||||||
|
|
Loading…
Reference in New Issue