Function: event-apply-modifier
event-apply-modifier is a byte-compiled function defined in
simple.el.gz.
Signature
(event-apply-modifier EVENT SYMBOL LSHIFTBY PREFIX)
Documentation
Apply a modifier flag to event EVENT.
SYMBOL is the name of this modifier, as a symbol. LSHIFTBY is the numeric value of this modifier, in keyboard events. PREFIX is the string that represents this modifier in an event type symbol.
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun event-apply-modifier (event symbol lshiftby prefix)
"Apply a modifier flag to event EVENT.
SYMBOL is the name of this modifier, as a symbol.
LSHIFTBY is the numeric value of this modifier, in keyboard events.
PREFIX is the string that represents this modifier in an event type symbol."
(if (numberp event)
(cond ((eq symbol 'control)
(if (<= 64 (upcase event) 95)
(- (upcase event) 64)
(logior (ash 1 lshiftby) event)))
((eq symbol 'shift)
;; FIXME: Should we also apply this "upcase" behavior of shift
;; to non-ascii letters?
(if (and (<= (downcase event) ?z)
(>= (downcase event) ?a))
(upcase event)
(logior (ash 1 lshiftby) event)))
(t
(logior (ash 1 lshiftby) event)))
(if (memq symbol (event-modifiers event))
event
(let ((event-type (if (symbolp event) event (car event))))
(setq event-type (intern (concat prefix (symbol-name event-type))))
(if (symbolp event)
event-type
(cons event-type (cdr event)))))))