Node: Event Representation, Next: , Previous: Events, Up: Events



Event Representation

Each input event is represented by a cons cell containing two integers, and these integers encode the event. The encoding is opaque; the only way to access an event meaningfully is via the functions provided.

Each event has a string representation, called its "name". Names consist of zero or more modifiers, followed by a key or mouse action indicator. Modifiers are separated from succeeding elements by hyphens -. For example, hitting <x> while holding down the <Control> and <Meta> keys would generate an event named <Control-Meta-x>. This notation is designed to closely match Emacs Lisp's notation.

Functions are available to convert between the name of an event and the actual event itself, and vice versa.

lookup-event event-name Function
Create and return a new input event whose name is event-name.
          (lookup-event "C-x")
              => (120 . 65540)
          
          (lookup-event "C-M-Button1-Click1")
              => (1 . 131340)
          

event-name event Function
This function returns a string naming the input event event.
          (event-name (lookup-event "C-x"))
              => "C-x"