diff --git a/rmacs/buffer.rkt b/rmacs/buffer.rkt index 6938bbe..33ea204 100644 --- a/rmacs/buffer.rkt +++ b/rmacs/buffer.rkt @@ -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)) diff --git a/rmacs/mode/fundamental.rkt b/rmacs/mode/fundamental.rkt index 21ae5e0..f87cbe6 100644 --- a/rmacs/mode/fundamental.rkt +++ b/rmacs/mode/fundamental.rkt @@ -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)