Fix quoted-insert
This commit is contained in:
parent
1ca7fbc23e
commit
e825073c64
|
@ -55,13 +55,9 @@
|
||||||
buffer-local
|
buffer-local
|
||||||
define-buffer-local
|
define-buffer-local
|
||||||
|
|
||||||
command?
|
(except-out (struct-out command) command)
|
||||||
command-selector
|
copy-command
|
||||||
command-buffer
|
|
||||||
command-window
|
|
||||||
command-editor
|
|
||||||
(rename-out [make-command command])
|
(rename-out [make-command command])
|
||||||
replace-selector
|
|
||||||
invoke
|
invoke
|
||||||
|
|
||||||
define-key
|
define-key
|
||||||
|
@ -410,8 +406,20 @@
|
||||||
[(command? buffer-or-command) (command-buffer buffer-or-command)]))
|
[(command? buffer-or-command) (command-buffer buffer-or-command)]))
|
||||||
(command selector buffer window (or editor (buffer-editor buffer)) keyseq prefix-arg))
|
(command selector buffer window (or editor (buffer-editor buffer)) keyseq prefix-arg))
|
||||||
|
|
||||||
(define (replace-selector cmd selector)
|
(define (copy-command cmd
|
||||||
(struct-copy command cmd [selector selector]))
|
#:selector [selector (command-selector cmd)]
|
||||||
|
#:buffer [buffer (command-buffer cmd)]
|
||||||
|
#:window [window (command-window cmd)]
|
||||||
|
#:editor [editor (command-editor cmd)]
|
||||||
|
#:keyseq [keyseq (command-keyseq cmd)]
|
||||||
|
#:prefix-arg [prefix-arg (command-prefix-arg cmd)])
|
||||||
|
(struct-copy command cmd
|
||||||
|
[selector selector]
|
||||||
|
[buffer buffer]
|
||||||
|
[window window]
|
||||||
|
[editor editor]
|
||||||
|
[keyseq keyseq]
|
||||||
|
[prefix-arg prefix-arg]))
|
||||||
|
|
||||||
(define (invoke cmd)
|
(define (invoke cmd)
|
||||||
(match-define (command selector buf _ _ keyseq _) cmd)
|
(match-define (command selector buf _ _ keyseq _) cmd)
|
||||||
|
|
|
@ -12,12 +12,19 @@
|
||||||
(match keyseq
|
(match keyseq
|
||||||
[(list (key (? char? ch) modifiers)) #:when (set-empty? (set-remove modifiers 'shift))
|
[(list (key (? char? ch) modifiers)) #:when (set-empty? (set-remove modifiers 'shift))
|
||||||
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
||||||
|
[(list (key (? char? ch0) modifiers)) #:when (equal? modifiers (set 'control))
|
||||||
|
(define ch (integer->char (- (char->integer (char-upcase ch0)) (char->integer #\A) -1)))
|
||||||
|
(buffer-insert! buf (window-point win) (string->rope (string ch)))]
|
||||||
[_ #f]))
|
[_ #f]))
|
||||||
|
|
||||||
(define-command fundamental-mode (unbound-key-sequence buf #:command cmd #:keyseq keyseq)
|
(define-command fundamental-mode (unbound-key-sequence buf #:command cmd #:keyseq keyseq)
|
||||||
(invoke (replace-selector cmd 'self-insert-command)))
|
(invoke (copy-command cmd #:selector 'self-insert-command)))
|
||||||
|
|
||||||
(define-key fundamental-mode (list "C-q" '#:default) self-insert-command)
|
(define-command fundamental-mode (quoted-insert buf #:command cmd #:keyseq keyseq)
|
||||||
|
#:bind-key "C-q #:default"
|
||||||
|
(invoke (copy-command cmd
|
||||||
|
#:selector 'self-insert-command
|
||||||
|
#:keyseq (list (cadr keyseq)))))
|
||||||
|
|
||||||
(define-command fundamental-mode (newline buf #:window win)
|
(define-command fundamental-mode (newline buf #:window win)
|
||||||
#:bind-key "C-m"
|
#:bind-key "C-m"
|
||||||
|
|
Loading…
Reference in New Issue