Function: event-basic-type

event-basic-type is a byte-compiled function defined in subr.el.gz.

Signature

(event-basic-type EVENT)

Documentation

Return the basic type of the given event (all modifiers removed).

The value is a printing character (not upper case) or a symbol. EVENT may be an event or an event type. If EVENT is a symbol that has never been used in an event that has been read as input in the current Emacs session, then this function may return nil.

View in manual

Aliases

mwheel-event-button (obsolete since 30.1)

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun event-basic-type (event)
  "Return the basic type of the given event (all modifiers removed).
The value is a printing character (not upper case) or a symbol.
EVENT may be an event or an event type.  If EVENT is a symbol
that has never been used in an event that has been read as input
in the current Emacs session, then this function may return nil."
  (declare (side-effect-free t))
  (unless (stringp event)
    (if (consp event)
        (setq event (car event)))
    (if (symbolp event)
        (car (get event 'event-symbol-elements))
      (let* ((base (logand event (1- ?\A-\0)))
	     (uncontrolled (if (< base 32) (logior base 64) base)))
        ;; There are some numbers that are invalid characters and
        ;; cause `downcase' to get an error.
        (condition-case ()
	    (downcase uncontrolled)
	  (error uncontrolled))))))