2 Customizing Expeditor
(require (submod expeditor configure)) |
When expeditor-configure is called—
For example, the following module as (expeditor-init-file-path) changes the behavior of Ctl-J and changes the color of literals from green to magenta:
#lang racket/base (require (submod expeditor configure)) (expeditor-bind-key! "^J" ee-newline) (expeditor-set-syntax-color! 'literal 'magenta)
2.1 Key-Handling Functions
A key-handling function accepts three values: a representation of the terminal state, a representation of the current editor region, and a character. The result is a representation of the editor region (usually the one passed in) or #f to indicate that the current editor region should be accepted as input.
procedure
(expeditor-bind-key! key handler) → void?
key : string? handler : (eestate? entry? char . -> . (or/c #f entry?))
The key string encodes either a single key or a sequence of keys:
The sequence \e (so, in a literal string as "\\e") is treated as Escape, which at the start of a sequence is normally the way terminals report “Meta-” key combinations.
A ^ prefix on a character implies a “Ctl-” combination, like "^a" for Ctl-A.
The sequence \\ is a backslash (so, in a literal string as "\\\\").
The sequence \^ is the character character.
Anything else stands for itself.
As examples, here are a few bindings from the default set:
(expeditor-bind-key! "^B" ee-backward-char) ; Ctl-B (expeditor-bind-key! "\\ef" ee-forward-word) ; Esc-f (expeditor-bind-key! "\\e[C" ee-forward-char) ; Right (expeditor-bind-key! "\\e[1;5C" ee-forward-word) ; Ctl-Right
The Right and Ctl-Right bindings are derived from a typical sequence that a terminal generates for those key combinations. In your terminal, the od program may be helpful in figuring how key presses turn into program input.
procedure
(ee-insert-self/paren ee entry c) → entry?
ee : eestate? entry : entry? c : char?
Like ee-insert-self, but if c is a “parenthesis” character, flashes its match like ee-flash-matching-delimiter. Furthermore, if c is a closing “parenthesis”, it may be corrected automatically based on its apparently intended match.
procedure
(ee-insert-self ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
((make-ee-insert-string s) ee entry c) → entry?
s : string? ee : eestate? entry : entry? c : char?
procedure
(ee-newline ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-open-line ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-indent-all ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-id-completion/indent ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-id-completion ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-next-id-completion ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-backward-char ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-forward-char ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-next-line ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-previous-line ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-forward-word ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-forward-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-backward-word ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-backward-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-upward-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-downward-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-backward-page ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-forward-page ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-beginning-of-line ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-end-of-line ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-beginning-of-entry ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-end-of-entry ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-goto-matching-delimiter ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-flash-matching-delimiter ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-transpose-char ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-transpose-word ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-transpose-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-set-mark ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-exchange-point-and-mark ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-delete-char ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-backward-delete-char ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-delete-line ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-delete-to-eol ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-delete-between-point-and-mark-or-backward ee entry c) → entry? ee : eestate? entry : entry? c : char?
procedure
(ee-delete-entry ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-reset-entry/break ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-reset-entry ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-delete-word ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-delete-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-backward-delete-exp ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-yank-selection ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-yank-kill-buffer ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-eof/delete-char ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-redisplay ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-history-bwd ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-history-fwd ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-history-bwd-prefix ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-history-bwd-contains ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-history-fwd-prefix ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-history-fwd-contains ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-command-repeat ee entry c) → entry?
ee : eestate? entry : entry? c : char?
procedure
(ee-suspend-process ee entry c) → entry?
ee : eestate? entry : entry? c : char?
2.2 Colors
procedure
(expeditor-set-syntax-color! category color) → void?
category :
(or/c 'error 'paren 'literal 'identifier 'comment)
color :
(or/c 'default 'black 'white 'red 'green 'blue 'yellow 'cyan 'magenta 'dark-gray 'light-gray 'light-red 'light-green 'light-blue 'light-yellow 'light-cyan 'light-magenta)
2.3 History Navigation
parameter
→ (or/c 'start 'top 'bottom 'end) (current-ee-backward-history-point start-at) → void? start-at : (or/c 'start 'top 'bottom 'end)
'start —
at the start of the entry 'top —
at the end of the first line of the entry 'bottom or 'end —
at the end of the last line of the entry
The default is 'top.
parameter
→ (or/c 'start 'top 'bottom 'end) (current-ee-forward-history-point start-at) → void? start-at : (or/c 'start 'top 'bottom 'end)
The default is 'bottom.