Next: , Previous: , Up: Events   [Contents][Index]

16.1 Event Name Representation

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 event object itself, and vice versa.

Function: lookup-event event-name

Create and return a new input event whose name is event-name.

(lookup-event "C-x")
    ⇒ (120 . 65540) ;; Internally, event is a pair of integers.

(lookup-event "C-M-Button1-Click1")
    ⇒ (1 . 131340)
Function: event-name event

This function returns a string naming the input event event.

(event-name (lookup-event "C-x"))
    ⇒ "C-x"