summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1993-03-08 00:07:53 +0000
committerRichard M. Stallman <rms@gnu.org>1993-03-08 00:07:53 +0000
commitd63de416be4b4732ff5307ac62c3ff3d057df4d9 (patch)
tree6cc7640bee4b7b7df129b0b7966c81ff13d846e1 /lisp
parent1a7c673b85b6c77d90825c82f4b2e1f35cb5f219 (diff)
downloademacs-d63de416be4b4732ff5307ac62c3ff3d057df4d9.tar.gz
(event-basic-type): New function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/subr.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 5f30e0bd96c..a8533e19b0b 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -244,6 +244,14 @@ See also the function `event-modifier-bits'."
(setq list (cons 'alt list)))
list))))
+(defun event-basic-type (event)
+ "Returns the basic type of the given event (all modifiers removed).
+The value is an ASCII printing character (not upper case) or a symbol."
+ (if (symbolp event)
+ (car (get event 'event-symbol-elements))
+ (let ((base (logand event (1- (lsh 1 18)))))
+ (downcase (if (< base 32) (logior base 64) base)))))
+
(defmacro save-match-data (&rest body)
"Execute the BODY forms, restoring the global value of the match data."
(let ((original (make-symbol "match-data")))