On this page:
keymap: aug-keymap<%>
get-chained-keymaps
get-map-function-table
get-map-function-table/ ht
keymap: aug-keymap-mixin
chain-to-keymap
remove-chained-keymap
map-function
keymap: aug-keymap%
keymap: remove-user-keybindings-file
keymap: add-user-keybindings-file
keymap: add-to-right-button-menu
keymap: add-to-right-button-menu/ before
keymap: call/ text-keymap-initializer
keymap: canonicalize-keybinding-string
keymap: get-editor
keymap: get-file
keymap: get-user
keymap: get-global
keymap: get-search
keymap: make-meta-prefix-list
keymap: send-map-function-meta
keymap: setup-editor
keymap: setup-file
keymap: setup-global
keymap: setup-search
keymap: set-chained-keymaps
keymap: remove-chained-keymap
Version: 4.2

17 Keymap

keymap:aug-keymap<%> : interface?
  implements: keymap%

This keymap overrides some of the built in keymap% methods to be able to extract the keybindings from the keymap.

(send a-keymap:aug-keymap get-chained-keymaps)
  (listof (instance keymap%))

Returns the list of keymaps that are chained to this one.

(send a-keymap:aug-keymap get-map-function-table)  hash-table

Returns a hash-table that maps symbols naming key sequences to the names of the keymap functions the are bound to.

(send a-keymap:aug-keymap get-map-function-table/ht ht)
  hash-table
  ht : hash-table

This is a helper function for get-map-function-table that returns the same result, except it accepts a hash-table that it inserts the bindings into. It does not replace any bindings already in ht.

keymap:aug-keymap-mixin : (class? . -> . class?)
  argument extends/implements: keymap%
  result implements: keymap:aug-keymap<%>

(send a-keymap:aug-keymap chain-to-keymap next    
  prefix?)  void
  next : (instance keymap%)
  prefix? : boolean?

Overrides chain-to-keymap in keymap%.

Keeps a list of the keymaps chained to this one.

(send a-keymap:aug-keymap remove-chained-keymap keymap)  void
  keymap : (is-a?/c keymap)

Overrides remove-chained-keymap in keymap%.

Keeps the list of the keymaps chained to this one up to date.

(send a-keymap:aug-keymap map-function key-name    
  function-name)  void
  key-name : string
  function-name : string

Overrides map-function in keymap%.

Keeps a separate record of the key names and functions that they are bound to in this keymap.

keymap:aug-keymap% : class?

  superclass: (keymap:aug-keymap-mixin keymap%)

(keymap:remove-user-keybindings-file user-keybindings-path)
  any
  user-keybindings-path : any/c

Removes the keymap previously added by keymap:add-user-keybindings-file.

(keymap:add-user-keybindings-file user-keybindings-path-or-require-spec)
  any
  user-keybindings-path-or-require-spec : any/c

Chains the keymap defined by user-keybindings-path-or-require-spec to the global keymap, returned by keymap:get-global.

If user-keybindings-path-or-require-spec is a path, the module is loaded directly from that path. Otherwise, user-keybindings-path-or-require-spec is treated like an argument to require.

(keymap:add-to-right-button-menu)  
(-> (is-a?/c popup-menu%)
    (is-a?/c editor<%>)
    (is-a?/c event%)
    void?)
(keymap:add-to-right-button-menu proc)  void?
  proc : 
(-> (is-a?/c popup-menu%)
    (is-a?/c editor<%>)
    (is-a?/c event%)
    void?)

When the keymap that keymap:get-global returns is installed into an editor, this parameter’s value is used for right button clicks.

Before calling this procedure, the function append-editor-operation-menu-items is called.

See also keymap:add-to-right-button-menu/before.

(keymap:add-to-right-button-menu/before)
  (-> (is-a?/c popup-menu%) (is-a?/c editor<%>) (is-a?/c event%) void?)
(keymap:add-to-right-button-menu/before proc)  void?
  proc : (-> (is-a?/c popup-menu%) (is-a?/c editor<%>) (is-a?/c event%) void?)

When the keymap that keymap:get-global returns is installed into an editor, this function is called for right button clicks.

After calling this procedure, the function append-editor-operation-menu-items is called.

See also keymap:add-to-right-button-menu.

(keymap:call/text-keymap-initializer thunk-proc)  any/c
  thunk-proc : (-> any/c)

Thus function parameterizes the call to thunk-proc by setting the keymap-initialization procedure (see current-text-keymap-initializer) to install the framework’s standard text bindings.

(keymap:canonicalize-keybinding-string keybinding-string)
  string?
  keybinding-string : string?

Returns a string that denotes the same keybindings as the input string, except that it is in canonical form; two canonical keybinding strings can be compared with string=?.

(keymap:get-editor)  (is-a?/c keymap%)

This returns a keymap for handling standard editing operations. It binds these keys:

where each key is prefixed with the menu-shortcut key, based on the platform. Under unix, the shortcut is "a:"; under windows the shortcut key is "c:" and under MacOS, the shortcut key is "d:".

(keymap:get-file)  (is-a?/c keymap%)

This returns a keymap for handling file operations.

(keymap:get-user)  (is-a?/c keymap%)

This returns a keymap that contains all of the keybindings in the keymaps loaded via keymap:add-user-keybindings-file

(keymap:get-global)  (is-a?/c keymap%)

This returns a keymap for general operations. See keymap:setup-global for a list of the bindings this keymap contains.

(keymap:get-search)  (is-a?/c keymap%)

This returns a keymap for searching operations.

(keymap:make-meta-prefix-list key)  (listof string?)
  key : string?

This prefixes a key with all of the different meta prefixes and returns a list of the prefixed strings.

takes a keymap, a base key specification, and a function name; it prefixes the base key with all “meta” combination prefixes, and installs the new combinations into the keymap. For example, (keymap:send-map-function-meta keymap "a" func) maps "m:a" and "ESC;a" to func.

(keymap:send-map-function-meta keymap    
  key    
  func)  void?
  keymap : (is-a?/c keymap%)
  key : string?
  func : string?

Most keyboard and mouse mappings are inserted into a keymap by calling the keymap’s map-function method. However, “meta” combinations require special attention. The "m:" prefix recognized by map-function applies only to the Meta key that exists on some keyboards. By convention, however, “meta” combinations can also be accessed by using “ESC” as a prefix.

This procedure binds all of the key-bindings obtained by prefixing key with a meta-prefix to func in keymap.

(keymap:setup-editor keymap)  void?
  keymap : (is-a?/c keymap%)

This sets up the input keymap with the bindings described in keymap:get-editor.

(keymap:setup-file keymap)  void?
  keymap : (is-a?/c keymap%)

This extends a keymap% with the bindings for files.

(keymap:setup-global keymap)  void?
  keymap : (is-a?/c keymap%)

This extends a keymap% with the general bindings.

This function extends a keymap% with the following functions:

These functions are bound to the following keys (C = control, S = shift, A = alt, M = “meta”, D = command):

(keymap:setup-search keymap)  void?
  keymap : (is-a?/c keymap%)

This extends a #<procedure:link> keymap with the bindings for searching.

(keymap:set-chained-keymaps keymap    
  children-keymaps)  void?
  keymap : (is-a?/c keymap:aug-keymap<%>)
  children-keymaps : (listof (is-a?/c keymap%))

Sets keymap’s chained keymaps to children-keymaps, unchaining any keymaps that are currently chained to keymap.

(keymap:remove-chained-keymap editor    
  keymap)  void?
  editor : (is-a?/c editor<%>)
  keymap : (is-a?/c keymap:aug-keymap<%>)

Removes keymap from the keymaps chained to editor. Also (indirectly) removes all keymaps chained to keymap from editor, since they are removed when unchaining keymap itself.

Each of the keymaps chained to editor must be an keymap:aug-keymap% and keymap cannot be the result of (send editor get-keymap) That is, keymap must be chained to some keymap attached to the editor.