Propagate command parameters when delegating to self-insert-command

This commit is contained in:
Tony Garnock-Jones 2014-12-28 00:14:38 -05:00
parent 67949add74
commit 21dae19500
2 changed files with 6 additions and 2 deletions

View File

@ -50,6 +50,7 @@
command-window
command-editor
(rename-out [make-command command])
replace-selector
invoke
define-key
@ -347,6 +348,9 @@
[(command? buffer-or-command) (command-buffer buffer-or-command)]))
(command selector buffer window (or editor (buffer-editor buffer)) keyseq prefix-arg))
(define (replace-selector cmd selector)
(struct-copy command cmd [selector selector]))
(define (invoke cmd)
(match-define (command selector buf _ _ keyseq _) cmd)
(define handler (modeset-lookup-command (buffer-modeset buf) selector))

View File

@ -14,8 +14,8 @@
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
[_ #f]))
(define-command fundamental-mode (unbound-key-sequence buf #:keyseq keyseq)
(invoke (command 'self-insert-command buf #:keyseq keyseq)))
(define-command fundamental-mode (unbound-key-sequence buf #:command cmd #:keyseq keyseq)
(invoke (replace-selector cmd 'self-insert-command)))
(define-key fundamental-mode (list "C-q" '#:default) self-insert-command)